/* Site shell for the homepage: slim top bar extras (progress + percentage),
   the numbered side rail, smooth-scroll (Lenis) housekeeping and the
   fade-and-lift reveal. Colors come only from the tokens in css/theme.css, so
   both themes follow automatically. js/site.js drives all of it. */

/* ---- Lenis (smooth scrolling) ---- */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }
html.motion { scroll-behavior: auto; }

/* ---- Reveal: sections simply fade and lift in. No blur, no flicker. ---- */
.reveal { animation: none; filter: none; }
html.motion .reveal { opacity: 0; transform: translateY(24px); will-change: transform, opacity; }
html.motion .reveal.is-visible { opacity: 1; transform: none; }

/* ---- Top bar: progress bar + percentage ---- */
.top-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.top-progress-track {
  position: relative;
  width: clamp(48px, 7vw, 96px);
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--rule);
}
.top-progress-bar {
  will-change: transform;
  position: absolute;
  inset: 0;
  background: var(--coral);
  transform: scaleX(0);
  transform-origin: 0 50%;
}
.top-progress-pct { min-width: 3.2ch; text-align: right; font-variant-numeric: tabular-nums; }
/* The homepage has its own progress bar in the top bar; hide the shared
   window-top one here (case pages keep it). */
body.has-site-shell .scroll-progress { display: none; }

/* ---- Side rail (desktop only) ---- */
.rail {
  position: fixed;
  z-index: 9;
  top: 50%;
  left: 14px;
  display: none;
  transform: translateY(-50%);
}
.rail ol { position: relative; display: grid; gap: 22px; margin: 0; padding: 0; list-style: none; }
.rail-line {
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 11px;
  width: 1px;
  background: var(--rule);
}
.rail-fill {
  will-change: transform;
  position: absolute;
  inset: 0;
  background: var(--coral);
  transform: scaleY(0);
  transform-origin: 50% 0;
}
.rail a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 22px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-decoration: none;
}
.rail-num {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--paper);
  transition: color 200ms ease, border-color 200ms ease, background 200ms ease;
}
.rail-label {
  position: absolute;
  left: 32px;
  padding: 3px 8px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  opacity: 0;
  white-space: nowrap;
  text-transform: uppercase;
  pointer-events: none;
  transform: translateX(-4px);
  transition: opacity 180ms ease, transform 180ms ease;
}
.rail a:hover .rail-label,
.rail a:focus-visible .rail-label { opacity: 1; transform: none; }
.rail a.is-reached .rail-num { border-color: var(--coral); color: var(--coral); }
.rail a.is-current .rail-num { border-color: var(--coral); background: var(--coral); color: var(--section-dark); font-weight: 700; }
.rail a:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; border-radius: 12px; }

@media (min-width: 1200px) { .rail { display: block; } }

@media (max-width: 920px) {
  .site-header .top-progress { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html.motion .reveal { opacity: 1; transform: none; }
  .rail-num, .rail-label { transition: none; }
}

/* ---- Load curve placeholder (built in a later stage) ---- */
.loadcurve .section-intro { color: var(--muted); }

/* ---- Relationship lines on the globe (made in -> studied) ---- */
:root { --relation: #1f8a5e; }
:root[data-theme="dark"] { --relation: #6fd3a8; }

/* ---- Phones: the profile's intro + stats, moved to the top of About ---- */
.about-intro { margin-bottom: 28px; padding: 20px; border-radius: 14px; background: var(--section-dark); color: var(--on-dark); }
.about-intro .hero-copy { margin: 0; max-width: none; }
.about-intro .hero-meta { margin-top: 20px; grid-template-columns: minmax(0, 1fr); gap: 14px; }

/* ---- About: two columns, as in the mockup (text left, experience right) ---- */
.about-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; max-width: var(--max); margin: 0 auto; }
.about-main { display: flex; flex-direction: column; gap: 14px; }
.about-main .section-label { margin: 0; font: 500 12px var(--mono); letter-spacing: 0.18em; text-transform: uppercase; color: var(--coral); }
.about-main .section-title { margin: 0; font-size: 36px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.about-text { margin: 0; font-size: 16px; line-height: 1.65; color: var(--ink-soft); }
.about-exp-label { margin: 0; padding-bottom: 10px; font: 500 12px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.about-roles { margin: 0; padding: 0; list-style: none; border-bottom: 1px solid var(--rule); }
.about-roles li { display: flex; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid var(--rule); }
.about-roles strong { display: block; font-weight: 700; }
.about-roles em { display: block; margin-top: 2px; font-style: normal; font-size: 14px; color: var(--muted); }
.about-role-side { display: flex; flex: 0 0 auto; align-items: center; gap: 14px; }
.about-role-side time { white-space: nowrap; }
.about-roles .as-logo { display: block; width: 84px; height: 36px; padding: 4px 8px; box-sizing: border-box; border-radius: 6px; background: #fff; object-fit: contain; }
.about-roles .as-logo-crop { width: 46px; object-fit: cover; object-position: 6px center; }
@media (max-width: 899px) { .about-role-side { gap: 10px; } .about-roles .as-logo { width: 68px; height: 32px; } .about-roles .as-logo-crop { width: 40px; } }
.about-roles time { flex: 0 0 auto; font: 500 12px var(--mono); color: var(--muted); }
@media (max-width: 899px) { .about-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; } .about-main .section-title { font-size: 24px; } .about-text { font-size: 14px; line-height: 1.6; } }

/* ---- Phones: section nav moves to a bottom tab bar (the top bar has no room) ---- */
/* Icons only exist for the phone tab bar. */
.nav-ico { display: none; }

@media (max-width: 680px) {
  body.has-site-shell { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .site-header .top-progress { display: none; }
  .site-header .header-contact { display: inline-flex; margin-left: auto; }
  .site-header .nav {
    position: fixed; z-index: 11; right: 0; bottom: 0; left: 0; margin: 0; gap: 0;
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--rule);
    background: color-mix(in srgb, var(--paper) 96%, transparent);
    backdrop-filter: blur(18px);
  }
  .site-header .nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 60px; padding: 0 2px; font-size: 12px; letter-spacing: 0; text-align: center; text-transform: none; }
  .nav-ico { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .site-header .nav a::after { top: 0; bottom: auto; height: 2px; }
}

/* ---- Touch: every control gets a 44px hit area ---- */
@media (pointer: coarse) {
  .resource-link, .tool, .rail a, .header-contact, .theme-toggle, .pc-cred, .contact-link, .wordmark { min-height: 44px; }
  .theme-toggle { min-width: 44px; }
  .tool { padding: 0 12px; }
}
