/* Shared styles for DylanHarootunian.com */

:root {
  --bg: #f6f5f9;
  --surface: #ffffff;
  --surface-2: #f0edf7;
  --text: #17141f;
  --muted: #514c5c;
  --accent: #4b2e83;        /* UW purple */
  --accent-soft: #e9e3f5;
  --link: #4b2e83;
  --border: #dcd7e6;
  --focus: #b7791f;
  --shadow: 0 1px 2px rgba(20, 10, 40, 0.06), 0 8px 24px rgba(20, 10, 40, 0.06);
  --radius: 14px;
  --maxw: 960px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121018;
    --surface: #1b1824;
    --surface-2: #24202f;
    --text: #ece9f3;
    --muted: #b3adc2;
    --accent: #c4b3ec;
    --accent-soft: #2e2840;
    --link: #c9b8f2;
    --border: #353046;
    --focus: #f0b75a;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #121018;
  --surface: #1b1824;
  --surface-2: #24202f;
  --text: #ece9f3;
  --muted: #b3adc2;
  --accent: #c4b3ec;
  --accent-soft: #2e2840;
  --link: #c9b8f2;
  --border: #353046;
  --focus: #f0b75a;
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img, video { max-width: 100%; height: auto; display: block; }

a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: 16px; top: -100px;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 100;
  font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* Header / nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
  align-items: center;
}

.nav ul a {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}
.nav ul a:hover, .nav ul a[aria-current="page"] { color: var(--text); background: var(--surface-2); }

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.theme-toggle:hover { background: var(--surface-2); }

/* Layout */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px 20px 64px;
}

section { margin-top: 56px; }
section:first-child { margin-top: 0; }

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.015em; }
h1 { font-size: clamp(2rem, 5vw, 2.75rem); margin: 0 0 8px; }
h2 { font-size: 1.5rem; margin: 0 0 16px; }
h3 { font-size: 1.125rem; margin: 0 0 6px; }
p { margin: 0 0 12px; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 8px;
}

.lead { font-size: 1.2rem; color: var(--muted); max-width: 62ch; }
.muted { color: var(--muted); }
.small { font-size: 0.92rem; }

/* Hero */
.hero { padding: 28px 0 8px; }
.hero .role { font-size: 1.15rem; color: var(--muted); margin: 0 0 18px; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn.primary:hover { filter: brightness(1.1); background: var(--accent); }

/* Tags */
.tags { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  background: var(--accent-soft);
  color: var(--text);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.card > :last-child { margin-bottom: 0; }

.card.featured { border-left: 4px solid var(--accent); }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, 1fr); }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

.project-card { display: flex; flex-direction: column; }
.project-card p:not(.meta) { flex: 1; }
.project-card .meta { font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
.project-card h3 a { color: var(--text); text-decoration: none; }
.project-card h3 a:hover { text-decoration: underline; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 20px 22px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -7px; top: 8px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
}
.timeline li.current::before { background: var(--accent); }
.timeline .when { font-size: 0.85rem; color: var(--muted); display: block; }

/* News */
.news { list-style: none; margin: 0; padding: 0; }
.news li { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.news li:first-child { border-top: 0; }
.news time { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .news li { grid-template-columns: 1fr; gap: 0; } }

/* Lists of files/links */
.file-list { list-style: none; padding: 0; margin: 0; }
.file-list li { padding: 10px 0; border-top: 1px solid var(--border); }
.file-list li:first-child { border-top: 0; padding-top: 0; }
.file-type {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--muted);
  margin-left: 6px;
  vertical-align: 2px;
}

/* Project pages */
.breadcrumb { font-size: 0.9rem; margin-bottom: 20px; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.breadcrumb li + li::before { content: "/"; margin-right: 6px; color: var(--muted); }

.stack > * + * { margin-top: 16px; }

figure { margin: 0; }
figure video { border-radius: 10px; background: #000; width: 100%; }
figcaption { font-size: 0.9rem; color: var(--muted); margin-top: 8px; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.facts dt { font-weight: 600; }
dl.facts dd { margin: 0; color: var(--muted); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 20px 40px;
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer .inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}
.site-footer ul { list-style: none; display: flex; gap: 16px; padding: 0; margin: 0; flex-wrap: wrap; }

@media (max-width: 600px) {
  main { padding: 20px 16px 48px; }
  .nav { padding: 8px 16px; }
  .site-header { position: static; }
  html { scroll-padding-top: 0; }
  section { margin-top: 44px; }
}

@media print {
  .site-header, .skip-link, .theme-toggle, .site-footer ul { display: none; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; }
}

/* Sub-group headings within a section */
.group-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 12px;
}
.group-label ~ .group-label { margin-top: 32px; }
h4 { font-size: 1.075rem; line-height: 1.3; margin: 0 0 6px; }
.project-card h4 a { color: var(--text); text-decoration: none; }
.project-card h4 a:hover { text-decoration: underline; }

.stack > section { margin-top: 0; }
.stack > section + section { margin-top: 16px; }
.card h2 { font-size: 1.2rem; margin-bottom: 10px; }

.uw-projects { margin-top: 16px; }
.uw-projects > :only-child { grid-column: 1 / -1; }

.card ul:not(.tags):not(.file-list):not(.timeline) { padding-left: 20px; margin: 0 0 12px; }
.card ul:not(.tags):not(.file-list) li + li { margin-top: 6px; }
