/* ============================================================
   Timothy Ivey, personal site
   Dark-first design system with a tuned light theme.
   ============================================================ */

:root {
  color-scheme: dark;
  /* palette: dark (default) */
  --bg:           #0A0B0D;
  --bg-2:         #0D0F13;
  --surface:      #121419;
  --surface-2:    #171A21;
  --border:       #242832;
  --border-soft:  #1A1D24;
  --text:         #ECEEF1;
  --text-2:       #A7AEBA;
  --text-3:       #757D8A;
  --accent:       #FF9A55;
  --accent-ink:   #0A0B0D;
  --accent-soft:  rgba(255, 154, 85, 0.13);
  --accent-line:  rgba(255, 154, 85, 0.34);
  --glow-1:       rgba(255, 128, 48, 0.17);
  --glow-2:       rgba(255, 196, 120, 0.09);
  --shadow:       0 24px 60px -30px rgba(0, 0, 0, 0.9);
  --nav-bg:       rgba(10, 11, 13, 0.82);

  /* type */
  --font-display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-sans:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* metrics */
  --container: 1140px;
  --gutter: 28px;
  --radius: 16px;
  --radius-sm: 10px;
  --section-y: clamp(72px, 9vw, 120px);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light palette. Applied when the visitor's device asks for light and they have
   not explicitly picked dark, or when they explicitly pick light with the
   toggle. The two selectors carry the same values on purpose: CSS has no way to
   share one block between them. Edit both if you change a color. */

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg:           #FCFBFA;
    --bg-2:         #F5F4F1;
    --surface:      #FFFFFF;
    --surface-2:    #F7F6F3;
    --border:       #E4E2DD;
    --border-soft:  #EDEBE6;
    --text:         #14161A;
    --text-2:       #555C67;
    --text-3:       #686F7A;
    --accent:       #C2410C;
    --accent-ink:   #FFFFFF;
    --accent-soft:  rgba(194, 65, 12, 0.07);
    --accent-line:  rgba(194, 65, 12, 0.24);
    --glow-1:       rgba(194, 65, 12, 0.09);
    --glow-2:       rgba(230, 150, 60, 0.07);
    --shadow:       0 24px 50px -32px rgba(20, 22, 26, 0.28);
    --nav-bg:       rgba(252, 251, 250, 0.86);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg:           #FCFBFA;
  --bg-2:         #F5F4F1;
  --surface:      #FFFFFF;
  --surface-2:    #F7F6F3;
  --border:       #E4E2DD;
  --border-soft:  #EDEBE6;
  --text:         #14161A;
  --text-2:       #555C67;
  --text-3:       #686F7A;
  --accent:       #C2410C;
  --accent-ink:   #FFFFFF;
  --accent-soft:  rgba(194, 65, 12, 0.07);
  --accent-line:  rgba(194, 65, 12, 0.24);
  --glow-1:       rgba(194, 65, 12, 0.09);
  --glow-2:       rgba(230, 150, 60, 0.07);
  --shadow:       0 24px 50px -32px rgba(20, 22, 26, 0.28);
  --nav-bg:       rgba(252, 251, 250, 0.86);
}

/* ── base ─────────────────────────────────────────────────── */

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

html {
  /* Phones stay at the browser default. Larger screens scale the whole rem
     system up to roughly 125%, which is where the body copy reads comfortably
     on a desktop display. Everything sized in rem follows automatically. */
  font-size: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
  -webkit-text-size-adjust: 100%;
}

@media (min-width: 880px) {
  html { font-size: 118.75%; }
}

@media (min-width: 1200px) {
  html { font-size: 125%; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.2; }
p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 0 0 8px 8px;
  font-size: 0.875rem;
  font-weight: 500;
}
.skip-link:focus { top: 0; text-decoration: none; }

.mono-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ── buttons ──────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease),
              color 0.2s var(--ease), transform 0.2s var(--ease);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }

.btn-sm { padding: 9px 18px; font-size: 0.875rem; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost {
  border-color: var(--border);
  color: var(--text);
  background: transparent;
}
.btn-ghost:hover { border-color: var(--accent-line); color: var(--accent); }

/* ── resume download: two buttons on phones, a dropdown above 640px ── */

.resume-toggle { display: none; }
.resume-dl { display: contents; }

.icon-dl, .icon-caret { flex: none; }
.icon-caret { opacity: 0.6; transition: transform 0.2s var(--ease); }

@media (min-width: 641px) {
  .resume-dl {
    display: inline-flex;
    position: relative;
  }
  .resume-toggle { display: inline-flex; }
  .resume-dl.is-open .icon-caret { transform: rotate(180deg); }

  .resume-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 70;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 100%;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.18s var(--ease), transform 0.18s var(--ease), visibility 0.18s;
  }
  .resume-dl.is-open .resume-menu {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  /* flatten the button styling into menu rows */
  .resume-menu .resume-opt {
    justify-content: flex-start;
    white-space: nowrap;
    border: 0;
    border-radius: 9px;
    padding: 10px 16px;
    background: transparent;
    font-weight: 500;
  }
  .resume-menu .resume-opt:hover {
    background: var(--surface-2);
    color: var(--accent);
    transform: none;
  }
}

/* ── navigation ───────────────────────────────────────────── */

.nav-wrap {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease),
              backdrop-filter 0.3s var(--ease);
}
.nav-wrap.is-menu-open {
  background: var(--bg);
  border-bottom-color: var(--border-soft);
}
.nav-wrap.is-scrolled {
  background: var(--nav-bg);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border-bottom-color: var(--border-soft);
}

.nav {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 72px;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent-line); }
.theme-toggle .icon-moon { display: none; }
.theme-toggle.is-light .icon-moon { display: block; }
.theme-toggle.is-light .icon-sun { display: none; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}
.brand:hover { text-decoration: none; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.brand-name { font-size: 0.9375rem; font-weight: 500; letter-spacing: -0.01em; }
.brand { margin-right: auto; }

.nav-menu {
  display: flex;
  align-items: center;
  gap: 30px;
}
.nav-menu a {
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s var(--ease);
}
.nav-menu a:hover { color: var(--text); text-decoration: none; }
.nav-menu a.is-active { color: var(--text); }
.nav-menu a.is-active::after {
  content: "";
  display: block;
  height: 1px;
  margin-top: 4px;
  background: var(--accent);
}
.nav-menu-cta { margin-left: 4px; }
.nav-menu-cta a.is-active::after { display: none; }
.nav-menu-cta a { color: var(--accent-ink); }
.nav-menu-cta a:hover { color: var(--accent-ink); }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px; height: 42px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
.nav-toggle-bar {
  display: block;
  width: 16px; height: 1.5px;
  margin-inline: auto;
  background: var(--text);
  transition: transform 0.25s var(--ease), opacity 0.2s var(--ease);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:first-child { transform: translateY(3.25px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:last-child  { transform: translateY(-3.25px) rotate(-45deg); }

/* ── hero ─────────────────────────────────────────────────── */

.hero {
  position: relative;
  padding-top: clamp(126px, 16vh, 184px);
  padding-bottom: clamp(56px, 7vw, 88px);
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 130%;
  pointer-events: none;
  background:
    radial-gradient(48% 40% at 22% 12%, var(--glow-1), transparent 70%),
    radial-gradient(38% 34% at 82% 26%, var(--glow-2), transparent 72%);
}
.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--border-soft) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border-soft) 1px, transparent 1px);
  background-size: 78px 78px;
  -webkit-mask-image: radial-gradient(70% 55% at 50% 30%, #000 0%, transparent 75%);
  mask-image: radial-gradient(70% 55% at 50% 30%, #000 0%, transparent 75%);
  opacity: 0.65;
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: clamp(36px, 5vw, 72px);
  align-items: center;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 26px;
  padding: 7px 15px 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #3FCF8E;
  box-shadow: 0 0 0 0 rgba(63, 207, 142, 0.55);
  animation: pulse 2.6s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(63, 207, 142, 0.5); }
  70%  { box-shadow: 0 0 0 7px rgba(63, 207, 142, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 207, 142, 0); }
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.9rem, 6.6vw, 4.6rem);
  line-height: 0.96;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.hero-role {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  font-size: clamp(1.05rem, 1.7vw, 1.25rem);
  font-weight: 500;
  color: var(--accent);
  letter-spacing: -0.01em;
}
.hero-role::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--accent-line), transparent);
}

.hero-copy {
  max-width: 54ch;
  margin-bottom: 32px;
  font-size: 1.0625rem;
  color: var(--text-2);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 36px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  padding-top: 26px;
  border-top: 1px solid var(--border-soft);
  font-size: 0.9rem;
  color: var(--text-2);
}
.hero-meta a { color: var(--text-2); }
.hero-meta a:hover { color: var(--accent); }
.hero-meta .mono-label { margin-right: 8px; }

/* snapshot card */

.snapshot {
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow);
}

.snapshot-kicker { display: none; }

.snapshot-photo {
  position: relative;
  margin: -26px -26px 6px;
  overflow: hidden;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  background: var(--surface-2);
  line-height: 0;
}
.snapshot-photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 4;
  object-fit: cover;
  object-position: center 18%;
}
.snapshot-photo::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 42%;
  background: linear-gradient(to top, var(--surface), transparent);
  pointer-events: none;
}

.snapshot-list { margin: 0; }
.snapshot-row {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 14px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-soft);
}
.snapshot-row dt { margin: 0; padding-top: 2px; line-height: 1.55; }
.snapshot-row dd {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.5;
}

.snapshot-foot {
  margin: 16px 0 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-3);
}

/* ── sections ─────────────────────────────────────────────── */

.section { padding-block: var(--section-y); }
.section-alt { background: var(--bg-2); border-block: 1px solid var(--border-soft); }

.section-head {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: clamp(36px, 5vw, 56px);
}
.section-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}
.section-index { color: var(--accent); }
.section-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 2.75rem);
  letter-spacing: -0.015em;
}

/* ── about ────────────────────────────────────────────────── */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
  gap: clamp(36px, 5vw, 72px);
  align-items: start;
}
.about-body p { color: var(--text-2); }
.about-body .lead {
  font-size: 1.125rem;
  color: var(--text);
  line-height: 1.6;
}

.pull-quote {
  margin: 0 0 28px;
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}
.pull-quote p {
  margin: 0;
  font-family: var(--font-display);
  /* sized for a short paragraph rather than a one-line pull quote */
  font-size: 1.0625rem;
  line-height: 1.52;
  color: var(--text);
}

.about-list li {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.9375rem;
  color: var(--text-2);
}
.about-list li:last-child { border-bottom: 0; }

/* ── timeline ─────────────────────────────────────────────── */

.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(36px, 4.5vw, 56px);
  padding-left: 34px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: linear-gradient(to bottom, var(--accent-line) 0%, var(--border) 18%, var(--border-soft) 100%);
}

.tl-item { position: relative; }

.tl-marker {
  position: absolute;
  left: -34px;
  top: 8px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--accent-line);
  box-shadow: 0 0 0 4px var(--bg);
}
.tl-item:first-child .tl-marker { background: var(--accent); border-color: var(--accent); }
.section-alt .tl-marker { background: var(--bg-2); box-shadow: 0 0 0 4px var(--bg-2); }
.section-alt .tl-item:first-child .tl-marker { background: var(--accent); }

.tl-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
}
.tl-company {
  font-size: 1.25rem;
  letter-spacing: -0.015em;
}
.tl-company-alt { color: var(--text-3); font-weight: 400; }
.tl-date { white-space: nowrap; }

.tl-sub {
  margin: 6px 0 0;
  font-size: 0.9375rem;
  color: var(--accent);
  font-weight: 500;
}
.tl-context {
  margin: 10px 0 0;
  font-size: 0.9375rem;
  color: var(--text-3);
}

.tl-body > .bullets { margin-top: 16px; }

.role {
  margin-top: 26px;
  padding-left: 22px;
  border-left: 1px solid var(--border);
}
.role-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-bottom: 12px;
}
.role-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.bullets { display: flex; flex-direction: column; gap: 11px; }
.bullets li {
  position: relative;
  padding-left: 22px;
  font-size: 0.9375rem;
  color: var(--text-2);
  line-height: 1.62;
}
.bullets li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.72em;
  width: 8px;
  height: 1px;
  background: var(--accent-line);
}

/* ── skills ───────────────────────────────────────────────── */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(288px, 1fr));
  gap: 18px;
}
.skill-card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.skill-card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.skill-card h3 {
  margin-bottom: 16px;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips li {
  padding: 6px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-2);
  line-height: 1.4;
}

/* ── work ─────────────────────────────────────────────────── */

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

/* With an odd number of cards the last one would sit alone at half width.
   Let it span the row instead, so the grid never looks unfinished. Self
   correcting if cards are added or removed later. */
.work-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.work-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease),
              box-shadow 0.25s var(--ease);
}
.work-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.work-index { color: var(--accent); }
.work-card h3 {
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.work-card p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-2);
}
.work-tag {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}

/* ── portfolio ────────────────────────────────────────────── */

.portfolio { display: grid; gap: 40px; }
.portfolio-heading {
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.portfolio-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.portfolio-item {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 24px;
  transition: background 0.25s var(--ease);
}
.portfolio-item[hidden] { display: none; }
.portfolio-item + .portfolio-item { border-top: 1px solid var(--border-soft); }
.portfolio-item:hover { background: var(--accent-soft); }
.portfolio-main h4 {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.portfolio-main p {
  margin: 4px 0 0;
  font-size: 0.9375rem;
  color: var(--text-2);
}
.portfolio-tag { flex-shrink: 0; }

/* the project name is a button whose ::after stretches over the whole row,
   so the entire row is clickable while the accessible name stays short */
.portfolio-open {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.portfolio-open::after {
  content: "";
  position: absolute;
  inset: 0;
}
.portfolio-open:hover { color: var(--accent); }
.portfolio-open:focus-visible { outline: none; }
.portfolio-open:focus-visible::after {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: var(--radius);
}

.portfolio-more {
  margin-top: 14px;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent);
  cursor: pointer;
}
.portfolio-more:hover { text-decoration: underline; }
.portfolio-more:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

/* ── project modal ────────────────────────────────────────── */

html.modal-open { overflow: hidden; }

.project-modal {
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: auto;
}
.project-modal::backdrop { background: rgba(0, 0, 0, 0.6); }

.project-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 1;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.project-modal-close:hover { color: var(--accent); }

.project-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 32px;
  padding: 32px;
}

.project-modal-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-right: 36px;
}
.project-modal-head h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.7rem, 3.5vw, 2.2rem);
  line-height: 1.1;
}

.project-logo {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--accent);
}
.project-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.project-shot {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-3);
}
.project-shot:has(img) { aspect-ratio: auto; border-style: solid; }
.project-shot img { display: block; width: 100%; height: auto; }

.project-desc p {
  margin: 0 0 12px;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text-2);
}

.project-facts { display: grid; gap: 18px; margin: 0 0 28px; }
.project-facts dt { margin-bottom: 4px; color: var(--accent); }
.project-facts dd {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text-2);
}
.project-facts .is-empty { opacity: 0.6; }
.project-facts a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
}
.project-facts a:hover { color: var(--accent); }

.project-tech-title { margin-bottom: 10px; color: var(--accent); font-weight: 500; }

/* ── video lightbox ───────────────────────────────────────── */

.video-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s var(--ease);
}
.video-play:hover,
.video-play:focus-visible { background: rgba(0, 0, 0, 0.45); }
.video-play-icon {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
}
/* CSS triangle for the play glyph, nudged right to look optically centered */
.video-play-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 11px 0 11px 18px;
  border-color: transparent transparent transparent #111;
}
.video-play-label { color: #fff; }

.video-modal {
  width: min(1200px, 94vw);
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: #000;
  overflow: visible;
}
.video-modal::backdrop { background: rgba(0, 0, 0, 0.85); }
.video-modal-frame { width: 100%; aspect-ratio: 16 / 9; }
.video-modal-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: var(--radius-sm);
}
.video-modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  border: 0;
  background: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}
.video-modal-close:hover { color: var(--accent); }

/* ── contact ──────────────────────────────────────────────── */

.contact { padding-bottom: clamp(88px, 11vw, 140px); }

.contact-card {
  position: relative;
  padding: clamp(40px, 6vw, 76px) clamp(28px, 5vw, 64px);
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  text-align: center;
}
.contact-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(44% 50% at 50% -25%, var(--glow-1), transparent);
}
.contact-card > * { position: relative; }
.contact-card.is-pulse { animation: contact-pulse 1.4s var(--ease); }
@keyframes contact-pulse {
  0%   { border-color: var(--accent); box-shadow: 0 0 0 0 var(--accent-line); }
  35%  { border-color: var(--accent); box-shadow: 0 0 0 8px var(--accent-line); }
  100% { border-color: var(--border); box-shadow: 0 0 0 0 transparent; }
}

.contact-card .section-index { display: block; margin-bottom: 14px; }
.contact-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}
.contact-copy {
  max-width: 52ch;
  margin: 0 auto 32px;
  color: var(--text-2);
  font-size: 1.0625rem;
}
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

/* ── footer ───────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--border-soft);
  padding-block: 28px;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ── 404 page ─────────────────────────────────────────────── */

.not-found {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 100dvh;
  padding-block: 120px 72px;
  overflow: hidden;
}
.not-found-inner { position: relative; }
.not-found .section-index { display: block; margin-bottom: 18px; }
.not-found-title {
  max-width: 16ch;
  margin-bottom: 20px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  line-height: 1;
  letter-spacing: -0.02em;
}
.not-found-copy {
  max-width: 46ch;
  margin-bottom: 32px;
  font-size: 1.0625rem;
  color: var(--text-2);
}
.not-found-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ── reveal on scroll (progressive enhancement) ───────────── */

[data-reveal="on"] .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
[data-reveal="on"] .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ── responsive ───────────────────────────────────────────── */

@media (max-width: 1000px) {
  .hero-grid { grid-template-columns: 1fr; gap: 44px; }

  /* stacked: the card fills the column and the portrait shrinks to an
     avatar, so a 5:4 headshot does not take over the screen */
  .snapshot-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 4px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-soft);
  }
  .snapshot-photo {
    flex: none;
    width: 68px;
    height: 68px;
    margin: 0;
    border-radius: 50%;
    border: 1px solid var(--border-soft);
  }
  .snapshot-photo img {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    object-position: center 22%;
  }
  .snapshot-photo::after { display: none; }
  .snapshot-kicker { display: block; }
  .about-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .work-grid { grid-template-columns: 1fr; }
}

@media (max-width: 840px) {
  :root { --gutter: 20px; }

  .nav-toggle { display: flex; }

  .nav-menu {
    position: absolute;
    top: calc(100% + 1px);
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gutter) 18px;
    background: var(--bg);
    border-bottom: 1px solid var(--border-soft);
    display: none;
  }
  .nav-menu.is-open { display: flex; }
  .nav-menu li { border-bottom: 1px solid var(--border-soft); }
  .nav-menu li:last-child { border-bottom: 0; }
  .nav-menu a {
    display: block;
    padding: 14px 2px;
    font-size: 1rem;
  }
  .nav-menu a.is-active::after { display: none; }
  .nav-menu a.is-active { color: var(--accent); }
  .nav-menu-cta { margin: 14px 0 0; }
  .nav-menu-cta a { display: inline-flex; padding: 12px 22px; }

  .hero { padding-top: 120px; }
  .hero-meta { gap: 8px 22px; }
  .timeline { padding-left: 26px; }
  .tl-marker { left: -26px; }
  .role { padding-left: 16px; }
  .work-card, .skill-card { padding: 22px; }
}

@media (max-width: 760px) {
  .project-modal-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding: 24px 20px;
  }
}

@media (max-width: 560px) {
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }
  .contact-actions .btn { width: 100%; justify-content: center; }
  .tl-top, .role-top { flex-direction: column; gap: 4px; }
  .portfolio-item { flex-direction: column; gap: 8px; padding: 18px; }

  /* the 116px label column leaves too little room for the value on a phone */
  .snapshot-row { grid-template-columns: 1fr; gap: 5px; }
}

/* ── motion preferences ───────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  [data-reveal="on"] .reveal { opacity: 1; transform: none; }
}
