/* Per-experience palettes: the active nav tab retints the whole site
   (bg, text, borders, accents). Work is Platinum (#D9D9D9), About is
   Strawberry (#FA5053). */
:root {
  --font-sans: 'Inter', system-ui, sans-serif;
  --ease-out: cubic-bezier(.19, 1, .22, 1);
  --ease-in-out: cubic-bezier(.45, 0, .4, 1);
}
/* Registered so palette changes blend instead of snapping: every
   element using var(--text) etc. retints together with the page. */
@property --bg { syntax: '<color>'; inherits: true; initial-value: #D9D9D9; }
@property --bg-elevated { syntax: '<color>'; inherits: true; initial-value: #E8E8E8; }
@property --text { syntax: '<color>'; inherits: true; initial-value: #171719; }
@property --text-muted { syntax: '<color>'; inherits: true; initial-value: #171719; }
@property --border { syntax: '<color>'; inherits: true; initial-value: transparent; }
@property --accent { syntax: '<color>'; inherits: true; initial-value: #171719; }
@property --accent-soft { syntax: '<color>'; inherits: true; initial-value: transparent; }
html {
  transition: --bg .6s ease, --bg-elevated .6s ease, --text .6s ease, --text-muted .6s ease,
    --border .6s ease, --accent .6s ease, --accent-soft .6s ease;
}
html[data-experience='work'] {
  --bg: #D9D9D9;
  --bg-elevated: #E8E8E8;
  --text: #171719;
  --text-muted: rgba(23, 23, 25, .55);
  --border: rgba(23, 23, 25, .16);
  --accent: rgba(23, 23, 25, .5);
  --accent-soft: rgba(23, 23, 25, .08);
  --nav-active: #000000;
}
html[data-experience='about'] {
  --bg: #F9D2D4;
  --bg-elevated: #FFF1F1;
  --text: #2A0407;
  --text-muted: rgba(42, 4, 7, .6);
  --border: rgba(42, 4, 7, .16);
  --accent: #FF3B3F;
  --accent-soft: rgba(255, 59, 63, .22);
  --nav-active: #000000;
}
/* Wide-gamut layer: same palettes authored in display-p3. */
@supports (color: color(display-p3 1 0 0)) {
  html[data-experience='work'] {
    --bg: color(display-p3 0.851 0.851 0.851);
    --bg-elevated: color(display-p3 0.91 0.91 0.91);
    --text: color(display-p3 0.09 0.09 0.098);
    --text-muted: color(display-p3 0.09 0.09 0.098 / .55);
    --border: color(display-p3 0.09 0.09 0.098 / .16);
    --accent: color(display-p3 0.09 0.09 0.098 / .5);
    --accent-soft: color(display-p3 0.09 0.09 0.098 / .08);
  }
  html[data-experience='about'] {
    --bg: color(display-p3 0.976 0.824 0.831);
    --bg-elevated: color(display-p3 1 0.945 0.945);
    --text: color(display-p3 0.165 0.016 0.027);
    --text-muted: color(display-p3 0.165 0.016 0.027 / .6);
    --border: color(display-p3 0.165 0.016 0.027 / .16);
    --accent: color(display-p3 1 0.231 0.247);
    --accent-soft: color(display-p3 1 0.231 0.247 / .22);
  }
}

/* Base */
* {
  box-sizing: border-box;
}
html {
  font-size: 16px;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
  text-decoration: none;
}
:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-radius: 0.25rem;
}
::selection {
  background: var(--accent-soft);
  color: var(--accent);
}
@media (prefers-reduced-motion: reduce) {
  *,
  html {
    transition: none !important;
    animation: none !important;
  }
}
/* Soft crossfade between index.html and 404.html where supported. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

/* Page grid: rail + content, a third column for the About socials
   from 80rem. */
.wrap {
  max-width: 36.25rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}
@media (min-width: 64rem) {
  .wrap {
    max-width: 64rem;
    display: grid;
    grid-template-columns: minmax(0, 13rem) minmax(0, 36.25rem);
    column-gap: 4.5rem;
    justify-content: center;
  }
  .rail {
    position: sticky;
    top: 0;
    align-self: start;
  }
  .content {
    /* panels have their own 1.25rem top padding; offset so panel
       content lines up with the name in the rail */
    padding-top: 3.25rem;
  }
}
/* The About panel spans the content and socials columns and lays
   itself out in two tracks (see .about-panel) so its socials sit at
   the right edge. */
@media (min-width: 80rem) {
  .wrap {
    max-width: 84rem;
    grid-template-columns: minmax(0, 13rem) minmax(0, 36.25rem) minmax(0, 1fr);
  }
  .content {
    grid-column: 2 / 4;
  }
  .content > .tab-panel:not(.about-panel),
  .content > footer {
    max-width: 36.25rem;
  }
}

/* Identity */
.identity {
  padding-top: 3rem;
}
@media (min-width: 64rem) {
  .identity {
    padding-top: 4.5rem;
  }
}
.name {
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 2rem;
  letter-spacing: -0.04em;
  margin: 0 0 0.375rem;
}
.tagline {
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.2em;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text);
}
.tagline-sub {
  color: color-mix(in srgb, var(--text) 55%, transparent);
  margin-bottom: 1.75rem;
}
.tagline-sub a:hover {
  text-decoration: underline;
}

/* Nav */
nav.site {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 0 0 1.5rem;
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 2rem;
  letter-spacing: -0.01em;
}
nav.site a {
  color: var(--accent);
  transition: opacity .15s ease, color .5s ease;
}
nav.site a:hover {
  opacity: 0.75;
}
nav.site a.active {
  /* Black or white, whichever has the stronger WCAG contrast
     against the current experience background. */
  color: var(--nav-active, var(--text));
  opacity: 1;
}

/* Tab panels */
.tab-panel {
  padding: 1.25rem 0 3.5rem;
}
.tab-panel.hidden-panel {
  display: none;
}
/* Tab transitions. The nav is a vertical list, so motion follows it:
   moving down the list (Work → About) the old panel drifts up and the
   new one rises from below; moving back up reverses that. --shift is
   flipped by script.js via data-direction. */
html {
  --shift: 0.5rem;
}
html[data-direction='up'] {
  --shift: -0.5rem;
}
.tab-panel.focus-out {
  animation: panelOut .26s var(--ease-in-out) forwards;
}
@keyframes panelOut {
  to {
    opacity: 0;
    filter: blur(4px);
    transform: translateY(calc(var(--shift) * -1)) scale(0.99);
  }
}
/* The incoming panel's content arrives line by line. script.js sets
   --i on each child of a [data-stagger] container (counting from the
   attribute's value, if any); the delay is capped
   so long panels don't drag. */
:is(.tab-panel.focus-in[data-stagger], .tab-panel.focus-in [data-stagger]) > :not(.hover-highlight),
.rail [data-stagger] > * {
  /* backwards, not both: once finished the rows go back to their own
     transitions (hover highlight, link hovers) untouched. */
  animation: rise .7s var(--ease-out) backwards;
  animation-delay: calc(min(var(--i, 0), 10) * 45ms + var(--stagger-base, 0ms));
}
@keyframes rise {
  from {
    opacity: 0;
    filter: blur(4px);
    transform: translateY(var(--shift));
  }
}
/* First load only: the rail settles in just ahead of the content. */
.rail [data-stagger] > * {
  animation-duration: .9s;
}
html.is-loading :is(.tab-panel.focus-in[data-stagger], .tab-panel.focus-in [data-stagger]) > * {
  --stagger-base: 180ms;
}
html:not(.is-loading) .rail [data-stagger] > * {
  animation: none;
}
.panel-title {
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0 0 0.25rem;
  color: var(--text-muted);
}

/* Work list */
.hover-list {
  position: relative;
}
.hover-list .hover-highlight {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  background: color-mix(in srgb, var(--accent-soft), var(--bg-elevated));
  border-radius: 0.875rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .10), 0 1px 3px rgba(0, 0, 0, .08);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition: transform .55s cubic-bezier(.34, 1.56, .64, 1), width .55s cubic-bezier(.34, 1.56, .64, 1), height .55s cubic-bezier(.34, 1.56, .64, 1), opacity .2s ease;
}
.hover-list .row {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1875rem;
  width: max-content;
  max-width: 100%;
  padding: 0.5rem 0.75rem;
  margin: 0.125rem -0.75rem;
}
.hover-list .row .title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  transition: color .15s ease;
}
.hover-list a.row .title {
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.hover-list .row .year {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* About */
.about-socials {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 2rem;
  letter-spacing: .01em;
  padding-bottom: 1.5rem;
  margin-bottom: 2.25rem;
  border-bottom: 1px solid var(--border);
}
.about-socials a {
  color: var(--text);
}
.about-socials a:hover {
  text-decoration: underline;
}
.about-socials a.about-cv {
  margin-top: 0.75rem;
}
.about-body > p {
  max-width: 54ch;
  margin: 0 0 0.875rem;
}
.about-body > p:last-child {
  margin-bottom: 0;
}
.about-body > p a {
  color: color-mix(in srgb, var(--text) 73%, transparent);
  position: relative;
  z-index: 1;
  transition: color .15s ease;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--text) 25%, transparent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}
.about-body > p a::before {
  content: '';
  position: absolute;
  inset: -0.125rem -0.25rem;
  background: var(--bg-elevated);
  border-radius: 0.375rem;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .10), 0 1px 3px rgba(0, 0, 0, .08);
  opacity: 0;
  z-index: -1;
  transition: opacity .2s ease;
  pointer-events: none;
}
.about-body > p a:hover {
  color: var(--accent);
  text-decoration: none;
}
.about-body > p a:hover::before {
  opacity: 1;
}
/* At 80rem+ the page grid adds a third column and .content lets this
   panel span columns two and three, so the socials move from the top
   of the panel to its right-hand side. The track sizes here mirror
   the .wrap grid. */
@media (min-width: 80rem) {
  .about-panel {
    display: grid;
    grid-template-columns: 36.25rem minmax(0, 1fr);
    column-gap: 4.5rem;
    align-items: start;
  }
  .about-body {
    grid-column: 1;
    grid-row: 1;
  }
  .about-socials {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: 0;
  }
}
.about-sub {
  margin-top: 2.25rem;
}
.about-sub .row {
  padding: 0.25rem 0;
}
.about-sub .title {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text);
}
.about-sub .meta,
.about-sub .school {
  font-size: 0.875rem;
  color: var(--text-muted);
}
.about-sub .school {
  margin-top: 0.125rem;
}
.about-sub .year {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.about-sub .summary {
  font-size: 0.875rem;
  color: var(--text-muted);
  letter-spacing: -.02em;
  max-width: 46ch;
}
.lang-line {
  font-size: 1rem;
  margin: 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.375rem;
}
.lang-level {
  color: var(--text-muted);
  font-size: 0.875rem;
}
.lang-dot {
  color: var(--text-muted);
}
.skills-list {
  color: var(--text-muted);
  line-height: 1.9;
  text-wrap: pretty;
}
.skill-key {
  color: var(--text);
}

/* 404: the message sits above the homepage's Work list (pulled in by
   script.js), so the panel gap is tighter than between tabs. */
.tab-panel.not-found {
  padding-bottom: 1.25rem;
}
.not-found-line {
  font: inherit;
  max-width: 54ch;
  margin: 0 0 0.875rem;
}

/* Footer */
footer {
  padding: 1.5rem 0 3rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}
#local-time {
  font-variant-numeric: tabular-nums;
}
.p3-note {
  display: none;
  max-width: 46ch;
  margin: 0.75rem 0 0;
  line-height: 1.55;
}
.p3-note code {
  font-family: inherit;
  color: var(--text);
}
@supports (color: color(display-p3 1 0 0)) {
  .p3-note {
    display: block;
  }
}
