/* ============================================================
   joshwillis.com — dark cinematic
   ============================================================ */

:root {
  --bg: #0a0b0d;
  --bg-2: #0f1114;
  --ink: #e9e6df;
  --muted: #969ba3;
  --line: rgba(233, 230, 223, 0.12);
  --accent: #7fb0e8;
  --accent-bright: #a9ccf4;
  --max: 1200px;
  --pad: clamp(1.25rem, 4vw, 4rem);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: var(--bg); }

.mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

em {
  font-style: normal;
  color: var(--accent);
}

a { color: inherit; text-decoration: none; }

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

/* ---------- scroll progress ---------- */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 0;
  z-index: 200;
  pointer-events: none;
}

/* ---------- cursor glow (pointer: fine only, added by script.js) ---------- */
.cursor-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background: radial-gradient(
    34rem circle at var(--mx, 50%) var(--my, 30%),
    rgba(127, 176, 232, 0.06),
    transparent 70%
  );
}

/* ---------- magnetic hover targets ---------- */
.contact-link, .nav-cta {
  will-change: transform;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.35s ease, background 0.35s ease;
}

/* ---------- film grain ---------- */
.grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 9s steps(10) infinite;
}

@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -2%); }
  80% { transform: translate(3%, 3%); }
}

/* ---------- nav ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem var(--pad);
  transition: background 0.4s ease, border-color 0.4s ease;
  border-bottom: 1px solid transparent;
}

.nav.scrolled {
  background: rgba(10, 11, 13, 0.82);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--line);
}

.nav-mark .mono {
  font-size: 0.9rem;
  color: var(--accent);
  border: 1px solid var(--line);
  padding: 0.35rem 0.55rem;
  transition: border-color 0.3s ease;
}

.nav-mark:hover .mono { border-color: var(--accent); }

.nav-links {
  display: flex;
  gap: clamp(1rem, 3vw, 2.5rem);
}

.nav-links a,
.nav-cta {
  color: var(--muted);
  transition: color 0.3s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible { color: var(--ink); }

.nav-cta {
  color: var(--accent);
  border-bottom: 1px solid transparent;
}

.nav-cta:hover { color: var(--accent-bright); border-bottom-color: var(--accent-bright); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 6rem var(--pad) 2rem;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 45% at 50% 115%, rgba(127, 176, 232, 0.13), transparent 65%),
    radial-gradient(ellipse 55% 40% at 18% -8%, rgba(58, 74, 96, 0.28), transparent 70%),
    radial-gradient(ellipse 50% 35% at 88% 8%, rgba(42, 48, 56, 0.45), transparent 70%);
  animation: drift 16s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translate3d(-1.5%, 0, 0) scale(1); }
  to   { transform: translate3d(1.5%, -2%, 0) scale(1.06); }
}

.hero-eyebrow {
  color: var(--muted);
  margin-bottom: clamp(1.5rem, 4vh, 3rem);
}

.hero-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 300;
  font-size: clamp(4rem, 16vw, 12.5rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
}

.hero-name .line {
  display: block;
  overflow: hidden;
}

/* per-letter intro animation (spans injected by script.js) */
.hero-name .ch {
  display: inline-block;
  transform: translateY(115%);
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-name.in .ch { transform: none; }

.hero-name .line-2 {
  margin-left: clamp(1rem, 8vw, 9rem);
  color: var(--accent);
}

.hero-tag {
  margin-top: clamp(1.75rem, 4vh, 3rem);
  font-size: clamp(1rem, 2vw, 1.35rem);
  color: var(--muted);
  letter-spacing: 0.01em;
}

.hero-foot {
  position: absolute;
  bottom: 2rem;
  left: var(--pad);
  right: var(--pad);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  color: var(--muted);
}

.hero-foot .mono { color: var(--muted); }

.scroll-cue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  color: var(--accent);
}

.cue-line {
  width: 1px;
  height: 3rem;
  background: linear-gradient(var(--accent), transparent);
  animation: cue 2.2s ease-in-out infinite;
  transform-origin: top;
}

@keyframes cue {
  0%, 100% { transform: scaleY(0.4); opacity: 0.4; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* ---------- sections ---------- */
.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(5rem, 12vh, 9rem) var(--pad);
}

.section-label {
  color: var(--accent);
  margin-bottom: clamp(2rem, 5vh, 3.5rem);
  display: block;
}

.section-title {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 300;
  font-size: clamp(2.1rem, 5vw, 4rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  max-width: 18ch;
  margin-bottom: clamp(2.5rem, 6vh, 4.5rem);
}

/* ---------- story ---------- */
.story-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: center;
}

.lede {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 300;
  font-size: clamp(1.7rem, 3.4vw, 2.8rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 2rem;
}

.body-text {
  color: var(--muted);
  max-width: 56ch;
}

.body-text + .body-text { margin-top: 1.25rem; }

.portrait {
  position: relative;
  border: 1px solid var(--line);
  padding: clamp(0.75rem, 1.5vw, 1.25rem);
  background: var(--bg-2);
}

.portrait img {
  display: block;
  width: 100%;
  height: auto;
  filter: grayscale(1) contrast(1.06) brightness(0.92);
  transition: filter 0.8s ease;
}

.portrait:hover img { filter: grayscale(0.15) contrast(1.02) brightness(1); }

.portrait figcaption {
  margin-top: 0.9rem;
  color: var(--muted);
}

/* ---------- stats ---------- */
.stats {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.stat {
  padding: clamp(2rem, 5vh, 3.5rem) clamp(1.25rem, 3vw, 2.5rem);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stat + .stat { border-left: 1px solid var(--line); }

.stat-num {
  font-size: clamp(1.8rem, 3.5vw, 2.7rem);
  letter-spacing: 0;
  text-transform: none;
  color: var(--accent);
  font-weight: 400;
  white-space: nowrap;
}

.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
  max-width: 24ch;
}

/* ---------- pillars ---------- */
.pillars {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.pillar {
  background: var(--bg);
  padding: clamp(1.75rem, 4vw, 2.75rem);
  transition: background 0.4s ease;
}

.pillar:hover { background: var(--bg-2); }

.pillar-num {
  color: var(--accent);
  display: block;
  margin-bottom: 2.5rem;
}

.pillar h3 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 400;
  font-size: 1.45rem;
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.pillar p { color: var(--muted); font-size: 0.95rem; }

/* ---------- timeline ---------- */
.tl { list-style: none; border-top: 1px solid var(--line); }

.tl-row {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: clamp(1.5rem, 4vw, 4rem);
  padding: clamp(1.75rem, 4vh, 2.75rem) 0;
  border-bottom: 1px solid var(--line);
  transition: padding-left 0.4s ease;
}

.tl-row:hover { padding-left: 0.75rem; }

.tl-year {
  color: var(--accent);
  font-size: 1.05rem;
  padding-top: 0.3rem;
}

.tl-body h3 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 400;
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 1rem;
}

.tl-loc { color: var(--muted); }

.tl-body p { color: var(--muted); max-width: 62ch; }

.tl-badge {
  color: var(--bg);
  background: var(--accent);
  padding: 0.15rem 0.5rem;
  margin-left: 0.5rem;
  white-space: nowrap;
}

/* ---------- roots ---------- */
#roots { position: relative; }

.roots-grid { max-width: 60ch; }

.roots-path {
  color: var(--accent);
  display: block;
  margin-bottom: 2rem;
}

/* ---------- contact ---------- */
.contact { text-align: center; }

.contact .section-label { text-align: center; }

.contact-title {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 300;
  font-size: clamp(3.5rem, 12vw, 9rem);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

.contact-sub { margin: 0 auto 3.5rem; }

.contact-links {
  display: flex;
  justify-content: center;
  gap: clamp(1.5rem, 5vw, 4rem);
  flex-wrap: wrap;
}

.contact-link {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem 2rem;
  border: 1px solid var(--line);
  transition: border-color 0.35s ease, background 0.35s ease;
  min-width: min(20rem, 80vw);
}

.contact-link:hover {
  border-color: var(--accent);
  background: var(--bg-2);
}

.contact-kind { color: var(--accent); }

.contact-val { font-size: clamp(1rem, 2.2vw, 1.25rem); }

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 2.5rem var(--pad);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
}

.footer .mono { color: var(--muted); }

.footer > span.mono { color: var(--accent); }

/* ---------- reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1), transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.in {
  opacity: 1;
  transform: none;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .story-grid { grid-template-columns: 1fr; }
  .portrait { max-width: 26rem; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(odd) { border-left: none; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .pillars { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .nav-links { display: none; }
  .hero-foot .mono:last-of-type { display: none; }
  .tl-row { grid-template-columns: 1fr; gap: 0.5rem; }
  .stats { grid-template-columns: 1fr; }
  .stat + .stat { border-left: none; border-top: 1px solid var(--line); }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .grain, .hero-glow, .cue-line { animation: none; }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
