/* Nathaniel Melisso — nash.melisso.net */

:root {
  --bg:            #fbfaf8;
  --bg-raised:     #ffffff;
  --bg-sunken:     #f4f2ed;
  --text:          #14181f;
  --text-muted:    #5b6472;
  --text-faint:    #8b93a1;
  --rule:          #e4e2dd;
  --rule-strong:   #d2cfc8;
  --accent:        #9c5321;
  --accent-on:     #ffffff;
  --accent-soft:   #f3e7dc;
  --tag-bg:        #f1efea;
  --shadow:        0 1px 2px rgba(20, 24, 31, .04), 0 8px 24px rgba(20, 24, 31, .05);

  /* One hue per kind of work; used by the timeline rail, cards, and legend. */
  --cat-research:  #9c5321;
  --cat-industry:  #1a6a73;
  --cat-education: #574a99;

  /* Thin-film interference palette — the top band, and the hero grain tints. */
  --grain-line:    rgba(20, 24, 31, .16);
  --grain-1:       rgba(43, 63, 143, .11);
  --grain-2:       rgba(77, 111, 208, .10);
  --grain-3:       rgba(69, 176, 201, .12);
  --grain-4:       rgba(127, 201, 138, .12);
  --grain-5:       rgba(216, 194, 90, .14);
  --grain-6:       rgba(217, 139, 69, .13);
  --sweep:         rgba(217, 139, 69, .55);

  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --font-serif: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;

  --font-sans-ja: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Yu Gothic", YuGothic, "Noto Sans JP", Meiryo, sans-serif;
  --font-serif-ja: "Hiragino Mincho ProN", "Yu Mincho", YuMincho, "Noto Serif JP",
    "Times New Roman", serif;

  --wrap: 62rem;
  --header-h: 3.5rem;
  --rail-gutter: 8rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #101319;
    --bg-raised:   #171b23;
    --bg-sunken:   #0c0f14;
    --text:        #e9ecf2;
    --text-muted:  #a3abbb;
    --text-faint:  #757e8f;
    --rule:        #262b35;
    --rule-strong: #333945;
    --accent:      #e0965f;
    --accent-on:   #14181f;
    --accent-soft: #2a2019;
    --tag-bg:      #1e232c;
    --shadow:      0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);

    --cat-research:  #e0965f;
    --cat-industry:  #5fc0cf;
    --cat-education: #a99cf0;

    --grain-line: rgba(233, 236, 242, .13);
    --grain-1:    rgba(77, 111, 208, .15);
    --grain-2:    rgba(101, 141, 231, .12);
    --grain-3:    rgba(69, 176, 201, .13);
    --grain-4:    rgba(127, 201, 138, .12);
    --grain-5:    rgba(216, 194, 90, .12);
    --grain-6:    rgba(224, 150, 95, .14);
    --sweep:      rgba(224, 175, 120, .42);
  }
}

:root[data-theme="dark"] {
  --bg:          #101319;
  --bg-raised:   #171b23;
  --bg-sunken:   #0c0f14;
  --text:        #e9ecf2;
  --text-muted:  #a3abbb;
  --text-faint:  #757e8f;
  --rule:        #262b35;
  --rule-strong: #333945;
  --accent:      #e0965f;
  --accent-on:   #14181f;
  --accent-soft: #2a2019;
  --tag-bg:      #1e232c;
  --shadow:      0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);

  --cat-research:  #e0965f;
  --cat-industry:  #5fc0cf;
  --cat-education: #a99cf0;

  --grain-line: rgba(233, 236, 242, .13);
  --grain-1:    rgba(77, 111, 208, .15);
  --grain-2:    rgba(101, 141, 231, .12);
  --grain-3:    rgba(69, 176, 201, .13);
  --grain-4:    rgba(127, 201, 138, .12);
  --grain-5:    rgba(216, 194, 90, .12);
  --grain-6:    rgba(224, 150, 95, .14);
  --sweep:      rgba(224, 175, 120, .42);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

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

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

/* Anything the sticky header would otherwise cover when jumped to. */
:target { scroll-margin-top: calc(var(--header-h) + 1.25rem); }
.section, .card, .anchor { scroll-margin-top: calc(var(--header-h) + 1.25rem); }

.anchor { display: block; height: 0; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--bg-raised);
  border: 1px solid var(--rule-strong);
  border-radius: 0 0 8px 0;
  padding: .625rem 1rem;
  font-size: .875rem;
}

.skip:focus { left: 0; }

/* --- thin-film interference band ------------------------------------- */

.film-band {
  height: 3px;
  background: linear-gradient(90deg,
    #2b3f8f 0%, #4d6fd0 14%, #45b0c9 28%, #7fc98a 42%,
    #d8c25a 56%, #d98b45 70%, #b8547a 84%, #6a4a9c 100%);
}

/* --- header ----------------------------------------------------------- */

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

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  min-height: var(--header-h);
  flex-wrap: wrap;
}

.wordmark {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  gap: 1.125rem;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: .875rem;
  letter-spacing: .01em;
  padding-block: .25rem;
  border-bottom: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}

.site-nav a:hover,
.site-nav a[aria-current] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* Language toggle sits at the end of the nav, set off by a hairline rule. */
.site-nav .lang-switch {
  padding-left: 1.125rem;
  border-left: 1px solid var(--rule-strong);
  color: var(--accent);
}

.site-nav .lang-switch:hover {
  border-bottom-color: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --- hero ------------------------------------------------------------- */

.hero {
  padding-block: clamp(2.5rem, 6vw, 4.25rem) clamp(2rem, 5vw, 3.25rem);
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
}

.eyebrow {
  margin: 0 0 .875rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -.02em;
  margin: 0 0 1.125rem;
}

.lede {
  margin: 0;
  max-width: 32rem;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.lede strong { color: var(--text); font-weight: 600; }
.lede + .lede { margin-top: 1rem; }

/* The 404 page is a hero on its own — no rule beneath it. */
.hero.no-rule { border-bottom: 0; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1.5rem;
}

.btn {
  display: inline-block;
  padding: .625rem 1.125rem;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--bg-raised);
  color: var(--text);
  font-size: .9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color .15s ease, transform .15s ease, background-color .15s ease;
}

.btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}

.btn-primary:hover { filter: brightness(1.06); }

/* --- hero artwork: a polycrystalline grain field ---------------------- */

.hero-art {
  margin: 0;
  min-width: 0;
  max-width: 21rem;
  margin-left: auto;
}

.grain-field {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--bg-raised);
  box-shadow: var(--shadow);
}

.gr {
  stroke: var(--grain-line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.gr.t1 { fill: var(--grain-1); }
.gr.t2 { fill: var(--grain-2); }
.gr.t3 { fill: var(--grain-3); }
.gr.t4 { fill: var(--grain-4); }
.gr.t5 { fill: var(--grain-5); }
.gr.t6 { fill: var(--grain-6); }

/* A slow melt front travelling across the field. The gradient stops are styled
   here rather than as SVG attributes so they can read the theme variable. */
.s-edge { stop-color: var(--sweep); stop-opacity: 0; }
.s-mid  { stop-color: var(--sweep); stop-opacity: 1; }

.sweep {
  animation: sweep 11s linear infinite;
}

@keyframes sweep {
  from { transform: translateX(-160px); }
  to   { transform: translateX(560px); }
}

.hero-art figcaption {
  margin-top: .625rem;
  font-size: .75rem;
  line-height: 1.5;
  color: var(--text-faint);
}

/* --- sections --------------------------------------------------------- */

.section { padding-block: clamp(2.25rem, 4.5vw, 3.25rem); }

.section + .section { border-top: 1px solid var(--rule); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.section-title {
  margin: 0;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: .75rem;
}

/* Hairline drawn from the interference palette, echoing the top band. */
.section-title::after {
  content: "";
  width: 2.5rem;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #45b0c9, #d8c25a, #d98b45);
  opacity: .8;
}

.prose p { margin: 0 0 1rem; color: var(--text-muted); }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--text); font-weight: 600; }

.aside {
  font-size: .875rem;
  line-height: 1.55;
  color: var(--text-faint);
}

/* --- at-a-glance strip ------------------------------------------------ */

.facts-strip {
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--rule);
}

.facts-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding-block: 1.125rem;
}

.fact { padding-inline: 1.25rem; }
.fact:first-child { padding-left: 0; }
.fact:last-child { padding-right: 0; }
.fact + .fact { border-left: 1px solid var(--rule); }

.fact dt {
  margin-bottom: .3125rem;
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}

.fact dd {
  margin: 0;
  font-size: .875rem;
  line-height: 1.45;
  color: var(--text-muted);
}

/* Two-column body copy: fills the wider measure without a long ragged edge. */
.prose-cols {
  columns: 2;
  column-gap: 2.75rem;
}

.prose-cols p { break-inside: avoid-column; }

/* --- timeline: legend ------------------------------------------------- */

.legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1rem;
  margin: 0;
  padding: 0;
  font-size: .75rem;
  color: var(--text-muted);
}

.legend li {
  display: flex;
  align-items: center;
  gap: .4375rem;
}

.legend li::before {
  content: "";
  width: .5rem;
  height: .5rem;
  border-radius: 999px;
  background: var(--cat);
}

/* --- timeline: the rail ---------------------------------------------- */

.rail {
  position: relative;
  margin-bottom: 1.75rem;
}

.rail-axis {
  position: relative;
  height: 1.125rem;
  margin-left: var(--rail-gutter);
  font-size: .6875rem;
  letter-spacing: .06em;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.rail-axis span {
  position: absolute;
  top: 0;
  padding-left: .375rem;
}

.rail-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rail-link {
  display: grid;
  grid-template-columns: var(--rail-gutter) minmax(0, 1fr);
  align-items: center;
  gap: 0;
  text-decoration: none;
  color: inherit;
  border-radius: 6px;
}

.rail-label {
  padding-right: .75rem;
  font-size: .75rem;
  line-height: 1.3;
  color: var(--text-muted);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color .15s ease;
}

.rail-track {
  position: relative;
  display: block;
  height: 1.5rem;
  /* Year gridlines: one every 1/7 of the 2020–2027 domain. */
  background-image: repeating-linear-gradient(
    90deg, var(--rule) 0 1px, transparent 1px 14.2857%);
  background-color: transparent;
  transition: background-color .15s ease;
}

/* Faint banding so the eye can follow a row across to its bar. */
.rail-rows li:nth-child(odd) .rail-track {
  background-color: color-mix(in srgb, var(--text) 3%, transparent);
}

.rail-rows li:first-child .rail-track { border-top: 1px solid var(--rule); }
.rail-rows li:last-child .rail-track { border-bottom: 1px solid var(--rule); }

.rail-link:hover .rail-track,
.rail-row.is-hot .rail-track {
  background-color: color-mix(in srgb, var(--cat) 9%, transparent);
}

/* Where "present" falls on the axis — August 2026. */
.rail-now {
  position: absolute;
  top: 1.125rem;
  bottom: 0;
  left: calc(var(--rail-gutter) + (100% - var(--rail-gutter)) * .94048);
  border-left: 1px dashed color-mix(in srgb, var(--text) 32%, transparent);
  pointer-events: none;
}

.rail-now i {
  position: absolute;
  top: -1.125rem;
  left: .375rem;
  font-style: normal;
  font-size: .625rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
}

.bar {
  position: absolute;
  top: calc(50% - 5px);
  height: 10px;
  min-width: 9px;
  border-radius: 999px;
  background: var(--cat);
  transform-origin: left center;
  transition: filter .15s ease, opacity .15s ease;
}

/* Ongoing work runs off the right edge instead of stopping at a date. */
.bar.is-now {
  -webkit-mask-image: linear-gradient(90deg, #000 0 72%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 0 72%, transparent 100%);
}

/* Bar geometry. Domain is Jan 2020 → Jan 2027 (84 months) mapped to 0–100%. */
.b-bs   { left:  9.524%; width: 54.762%; }
.b-dv   { left: 34.524%; width: 32.143%; }
.b-hea  { left: 48.810%; width:  3.571%; }
.b-tff  { left: 52.381%; width: 10.714%; }
.b-ms   { left: 66.667%; width: 33.333%; }
.b-imb  { left: 77.381%; width:  3.571%; }
.b-film { left: 80.952%; width: 19.048%; }

/* Year tick positions, same domain. */
.y0 { left:  0%; }
.y1 { left: 14.2857%; }
.y2 { left: 28.5714%; }
.y3 { left: 42.8571%; }
.y4 { left: 57.1429%; }
.y5 { left: 71.4286%; }
.y6 { left: 85.7143%; }

/* Hover/focus on a rail row or its card highlights the pair. */
.rail-link:hover .rail-label,
.rail-row.is-hot .rail-label { color: var(--text); }

.rail-link:hover .bar,
.rail-row.is-hot .bar { filter: brightness(1.12) saturate(1.2); }

.rail.is-muted .rail-row:not(.is-hot) .bar { opacity: .35; }
.rail.is-muted .rail-row:not(.is-hot) .rail-label { color: var(--text-faint); }

/* --- timeline: cards -------------------------------------------------- */

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 1.25rem;
}

.card {
  break-inside: avoid;
  margin: 0 0 1.25rem;
  padding: 1rem 1.125rem 1.125rem;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--cat);
  border-radius: 10px;
  box-shadow: var(--shadow);
  transition: border-color .15s ease, transform .15s ease;
}

.card.is-hot {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--cat) 45%, var(--rule));
  border-left-color: var(--cat);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  margin: 0 0 .375rem;
}

.card-cat {
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--cat);
}

.card-when {
  font-size: .75rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.card h3 {
  margin: 0 0 .25rem;
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.01em;
}

.card-org {
  margin: 0 0 .625rem;
  font-size: .875rem;
  color: var(--text-muted);
}

.bullets {
  margin: 0;
  padding-left: 1.05rem;
  color: var(--text-muted);
  font-size: .9063rem;
  line-height: 1.5;
}

.bullets li { margin-bottom: .3125rem; }
.bullets li:last-child { margin-bottom: 0; }
.bullets li::marker { color: var(--cat); }

/* Category hues, shared by rail rows, legend dots, and cards. */
.cat-research  { --cat: var(--cat-research); }
.cat-industry  { --cat: var(--cat-industry); }
.cat-education { --cat: var(--cat-education); }

/* --- tags ------------------------------------------------------------- */

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .3125rem;
  margin: .75rem 0 0;
  padding: 0;
}

.tags li {
  font-size: .6875rem;
  letter-spacing: .01em;
  color: var(--text-muted);
  background: var(--tag-bg);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .1875rem .5625rem;
}

/* --- skills ----------------------------------------------------------- */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.skill-card {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 1.125rem 1.25rem;
  box-shadow: var(--shadow);
}

.skill-card h3,
.instr-title {
  margin: 0 0 .5rem;
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.skill-card p {
  margin: 0;
  font-size: .9063rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.instruments {
  background: var(--bg-sunken);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 1.125rem 1.25rem 1.25rem;
}

.instr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem 1.5rem;
}

.instr-group h4 {
  margin: 0;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text);
}

.instr-group .tags { margin-top: .5rem; }
.instr-group .tags li { background: var(--bg-raised); }

/* --- contact ---------------------------------------------------------- */

.cta {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: center;
  padding: clamp(1.25rem, 3vw, 1.75rem) clamp(1.25rem, 3vw, 1.875rem);
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.cta::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg,
    #2b3f8f 0%, #4d6fd0 14%, #45b0c9 28%, #7fc98a 42%,
    #d8c25a 56%, #d98b45 70%, #b8547a 84%, #6a4a9c 100%);
}

.cta h3 {
  margin: 0 0 .5rem;
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.01em;
}

.cta p { margin: 0; color: var(--text-muted); font-size: .9375rem; }
.cta .aside { margin-top: .75rem; }

.cta-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .75rem;
}

/* --- footer ----------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--rule);
  padding-block: 1.5rem 2.5rem;
}

.footer-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-footer p {
  margin: 0;
  font-size: .8125rem;
  color: var(--text-faint);
}

.site-footer a { color: var(--text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }

/* --- reveal-on-scroll ------------------------------------------------- */
/* main.js only arms this for content that is still below the fold, so there
   is never a flash of hidden content for anything already on screen. */

.will-reveal { opacity: 0; transform: translateY(10px); }

.will-reveal.is-revealed {
  opacity: 1;
  transform: none;
  transition: opacity .5s ease, transform .5s ease;
}

.will-grow .bar { transform: scaleX(0); }

.will-grow.is-revealed .bar {
  transform: scaleX(1);
  transition: transform .7s cubic-bezier(.22, .8, .3, 1);
}

.will-grow.is-revealed .rail-row:nth-child(2) .bar { transition-delay: .06s; }
.will-grow.is-revealed .rail-row:nth-child(3) .bar { transition-delay: .12s; }
.will-grow.is-revealed .rail-row:nth-child(4) .bar { transition-delay: .18s; }
.will-grow.is-revealed .rail-row:nth-child(5) .bar { transition-delay: .24s; }
.will-grow.is-revealed .rail-row:nth-child(6) .bar { transition-delay: .30s; }
.will-grow.is-revealed .rail-row:nth-child(7) .bar { transition-delay: .36s; }

/* --- Japanese typography ---------------------------------------------- */
/* CJK text needs a taller line box, no negative tracking, and gothic/mincho
   families rather than the Latin stacks above. */

[lang="ja"] {
  font-family: var(--font-sans-ja);
  line-height: 1.85;
  letter-spacing: 0;
  line-break: strict;
  overflow-wrap: break-word;
  --rail-gutter: 8.5rem;
}

[lang="ja"] .wordmark,
[lang="ja"] .hero h1,
[lang="ja"] .card h3,
[lang="ja"] .cta h3 {
  font-family: var(--font-serif-ja);
  letter-spacing: .01em;
}

[lang="ja"] .hero h1 {
  font-size: clamp(1.875rem, 5vw, 2.875rem);
  line-height: 1.25;
}

[lang="ja"] .lede {
  line-height: 1.85;
  max-width: 34rem;
}

[lang="ja"] .eyebrow,
[lang="ja"] .section-title,
[lang="ja"] .card-cat,
[lang="ja"] .fact dt {
  letter-spacing: .08em;
}

[lang="ja"] .bullets,
[lang="ja"] .fact dd,
[lang="ja"] .skill-card p { line-height: 1.75; }

[lang="ja"] .card-when,
[lang="ja"] .rail-axis { font-feature-settings: "palt"; }

/* --- responsive ------------------------------------------------------- */

@media (max-width: 62rem) {
  .cta { grid-template-columns: 1fr; }
  .cta-action { align-items: stretch; }
}

@media (max-width: 52rem) {
  .hero-inner { grid-template-columns: 1fr; }

  .hero-art {
    order: -1;
    max-width: 24rem;
  }

  .grain-field { aspect-ratio: 16 / 9; }

  .facts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 0; }
  .fact:nth-child(odd) { padding-left: 0; }
  .fact:nth-child(even) { padding-right: 0; }
  .fact:nth-child(odd) { border-left: 0; }

  .prose-cols { columns: 1; }

  .cards { columns: 1; }
}

@media (max-width: 40rem) {
  body { font-size: 16px; }

  :root, [lang="ja"] { --rail-gutter: 6.25rem; }

  .header-inner { padding-block: .5rem; }
  .site-nav { gap: .875rem; }
  .site-nav a { font-size: .8125rem; }

  .facts-grid { grid-template-columns: 1fr; }
  .fact { padding-inline: 0; border-left: 0; }

  .rail-label { font-size: .6875rem; padding-right: .5rem; }
  .rail-track { height: 1.375rem; }
  .rail-axis { font-size: .625rem; }
  /* Half the year labels, so they stop colliding on narrow screens. */
  .rail-axis .y1, .rail-axis .y3, .rail-axis .y5 { display: none; }
  .rail-now i { display: none; }

  .card-head { gap: .25rem .75rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .sweep { animation: none; }

  .will-reveal, .will-grow .bar { opacity: 1; transform: none; }
  .will-reveal.is-revealed, .will-grow.is-revealed .bar { transition: none; }

  .btn:hover, .card.is-hot { transform: none; }
}
