:root {
  --bg: #f7f4ee;
  --ink: #1a1a1a;
  --muted: #8a8579;
  --hairline: #e4dfd4;
  --accent: #c9962c;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
}

/* Click-through palettes — the hero cue cycles og -> paper -> carbon -> og.
   :root above is "og" and is always what a first-time visitor loads into. */

:root[data-theme="paper"] {
  --bg: #ffffff;
  --ink: #000000;
  --muted: #767676;
  --hairline: #e3e3e3;
  --accent: #000000;
}

:root[data-theme="carbon"] {
  --bg: #000000;
  --ink: #ffffff;
  --muted: #8c8c8c;
  --hairline: #262626;
  --accent: #ffffff;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

html {
  background: var(--bg);
  transition: background-color 0.75s ease;
}

body {
  background: var(--bg);
  color: var(--ink);
  transition: background-color 0.75s ease, color 0.75s ease;
  font-family: var(--font-sans);
  font-weight: 300;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  color: var(--accent);
}

/* Everything tinted by the palette eases over on a click, so the swap reads
   as one slow cross-fade instead of a hard cut. */
.timeline-list li,
.site-footer,
.monogram,
.about-photo-frame {
  transition: border-color 0.75s ease, color 0.75s ease;
}

.topbar-nav,
.timeline-list time,
.timeline-heading,
.icon-link,
.about h1,
.site-footer {
  transition: color 0.75s ease;
}

@media (prefers-reduced-motion: reduce) {
  body,
  .timeline-list li,
  .site-footer,
  .monogram,
  .about-photo-frame,
  .topbar-nav,
  .timeline-list time,
  .timeline-heading,
  .icon-link,
  .about h1 {
    transition: none;
  }
}

/* Drifting star field behind the whole page */

#stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* every piece of page chrome rides above the star layer */
.topbar,
.hero-row,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

/* Top bar — name + page nav + social icons */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.75rem clamp(1.25rem, 4vw, 3rem) 0;
}

.topbar .wordmark {
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.85rem;
  font-weight: 300;
  color: var(--muted);
}

.topbar-icons {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.icon-link svg {
  width: 100%;
  height: 100%;
}

.icon-link:hover {
  color: var(--accent);
}

/* Hero row — Log sidebar + rotating wireframe sphere/cube */

.hero-row {
  display: grid;
  grid-template-columns: 300px 1fr 300px;
  align-items: center;
  gap: 3rem;
  padding: 2.25rem clamp(1.25rem, 4vw, 3rem) 0;
}

/* middle column: CLICK stacked directly above the shape */
.stage {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.hero-row .timeline {
  grid-column: 1;
  max-width: 300px;
  margin: 0;
}

.hero {
  position: relative;
  width: 100%;
  height: clamp(240px, 34vw, 400px);
  overflow: hidden;
  cursor: pointer;
}

#hero-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Click cue — big breathing CLICK across the top of the page */

.click-cue {
  background: none;
  border: none;
  padding: 0.25em 0 0.15em;
  margin: 0;
  cursor: pointer;
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(1.3rem, 3vw, 2.3rem);
  font-weight: 300;
  line-height: 1;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  text-transform: uppercase;
  color: var(--accent);
  transition: color 0.75s ease;
  -webkit-tap-highlight-color: transparent;
}

.click-cue span {
  display: block;
  animation: cue-breathe 3.4s ease-in-out infinite;
}

/* slow fade up and back down — never fully gone, never fully solid */
@keyframes cue-breathe {
  0%, 100% { opacity: 0.14; }
  50% { opacity: 0.95; }
}

/* the moment of the click: the word blooms wide, then settles back */
.click-cue.is-firing span {
  animation: cue-fire 0.8s ease-out;
}

@keyframes cue-fire {
  0% { opacity: 1; letter-spacing: 0.4em; }
  40% { opacity: 1; letter-spacing: 0.72em; }
  100% { opacity: 0.14; letter-spacing: 0.4em; }
}

.click-cue:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 0.2em;
}

@media (prefers-reduced-motion: reduce) {
  .click-cue span,
  .click-cue.is-firing span {
    animation: none;
    opacity: 0.8;
  }

  .click-cue {
    transition: none;
  }
}

/* Main */

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem clamp(1.25rem, 4vw, 3rem) 6rem;
}

.about-main {
  padding-top: 4rem;
}

section {
  margin-bottom: 4.5rem;
}

.about h1 {
  font-size: 1rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.about-layout {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
}

.about-photo-frame {
  flex: 0 0 170px;
  width: 170px;
  height: 370px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--hairline);
}

.about-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 65%;
  transform: scale(3.65);
  transform-origin: 54% 76%;
}

.about-body {
  flex: 1 1 auto;
  min-width: 0;
}

.about-body p {
  font-size: 1.05rem;
  font-weight: 300;
  line-height: 1.7;
  max-width: 60ch;
}

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

@media (max-width: 560px) {
  .about-layout {
    flex-direction: column;
  }

  .about-photo-frame {
    width: 135px;
    height: 290px;
  }
}

/* Timeline — smaller, left-aligned, not centered with the rest of main */

.timeline {
  max-width: 340px;
  margin-left: 0;
  margin-right: auto;
}

.timeline-heading {
  font-size: 0.85rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 1.75rem;
}

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

.timeline-list li {
  display: flex;
  gap: 1.25rem;
  padding: 0.9rem 0.25rem;
  border-bottom: 1px solid var(--hairline);
  font-size: 0.8rem;
  font-weight: 300;
}

.timeline-list li:first-child {
  padding-top: 0;
}

.timeline-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.timeline-list time {
  flex: 0 0 auto;
  width: 4.4rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 300;
  color: var(--muted);
  padding-top: 0.15rem;
}

.timeline-list span {
  color: var(--ink);
  line-height: 1.6;
}

/* Pending "what's next" entry at the top of the Log */

.timeline-next time {
  display: inline-flex;
  gap: 0.12em;
  color: var(--accent);
}

/* Three question marks flashing on and off in sequence */
.timeline-next time i {
  font-style: normal;
  animation: next-flash 1.5s steps(1, end) infinite;
}

.timeline-next time i:nth-child(2) { animation-delay: 0.25s; }
.timeline-next time i:nth-child(3) { animation-delay: 0.5s; }

@keyframes next-flash {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .timeline-next time i {
    animation: none;
  }
}

/* Footer */

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem clamp(1.25rem, 4vw, 3rem) 2rem;
  border-top: 1px solid var(--hairline);
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--muted);
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.monogram {
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}

.copyright a {
  color: var(--muted);
}

.copyright a:hover {
  color: var(--accent);
}

.ethan-time {
  font-family: var(--font-mono);
  font-weight: 300;
}

@media (max-width: 700px) {
  .hero-row {
    grid-template-columns: 1fr;
  }

  .hero-row .timeline {
    grid-column: 1;
    max-width: none;
  }

  .stage {
    grid-column: 1;
  }
}

@media (max-width: 480px) {
  .topbar {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .topbar-right {
    gap: 1.25rem;
  }

  .timeline-list li {
    gap: 0.75rem;
  }

  .timeline-list time {
    width: 3.8rem;
  }
}

/* ===================================================================
   Stat line — same hairline-and-mono language as the Log: labels in
   mono caps, numbers set light and tabular so the columns line up.
   =================================================================== */

.statline {
  position: relative;
  z-index: 1;
  margin: clamp(2.5rem, 6vw, 5rem) 0 4.5rem;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
}

.statline-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.statline-heading {
  font-size: 0.85rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0;
  transition: color 0.75s ease;
}

.statline-note {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 300;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.75s ease;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  margin: 0;
  border-top: 1px solid var(--hairline);
  transition: border-color 0.75s ease;
}

.stat {
  padding: 1.35rem 1.25rem 1.5rem 0;
  border-bottom: 1px solid var(--hairline);
  transition: border-color 0.75s ease;
}

.stat dt {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 300;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.85rem;
  transition: color 0.75s ease;
}

.stat dd {
  margin: 0;
}

.stat-num {
  display: block;
  font-size: clamp(2rem, 4.2vw, 3rem);
  font-weight: 200;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: color 0.75s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-sub {
  display: block;
  margin-top: 0.7rem;
  font-size: 0.73rem;
  font-weight: 300;
  line-height: 1.55;
  color: var(--muted);
  max-width: 24ch;
  transition: color 0.75s ease;
}

/* The reach number carries the accent — it's the one a stranger reads
   first, and it landed on only his second video. */
.stat.is-standout .stat-num {
  color: var(--accent);
}

.stat:hover .stat-num {
  color: var(--accent);
  transform: translateY(-2px);
}

/* What's next — borrows the Log's flashing question marks, because it's
   the same idea: a slot that isn't filled in yet. */
.stat.is-next .stat-num {
  display: inline-flex;
  gap: 0.12em;
  color: var(--accent);
}

.stat.is-next .stat-num i {
  font-style: normal;
  animation: next-flash 1.5s steps(1, end) infinite;
}

.stat.is-next .stat-num i:nth-child(2) { animation-delay: 0.25s; }
.stat.is-next .stat-num i:nth-child(3) { animation-delay: 0.5s; }

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat {
    padding-right: 0.9rem;
  }

  .stat-sub {
    max-width: none;
  }
}

/* Scroll reveal — one soft rise, staggered across the cells.
   Scoped to html.js so the stats stay visible if JS never runs. */

html.js [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--reveal-delay, 0s);
}

html.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html.js [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .statline-heading,
  .statline-note,
  .stat-grid,
  .stat,
  .stat dt,
  .stat-num,
  .stat-sub {
    transition: none;
  }

  .stat.is-next .stat-num i {
    animation: none;
  }

  .stat:hover .stat-num {
    transform: none;
  }
}

/* ===================================================================
   Lede — who he is, stated plainly above the hero. Same mono-caps
   label language as the Log and the Stat line.
   =================================================================== */

.lede {
  position: relative;
  z-index: 1;
  padding: clamp(1.75rem, 5vw, 3.25rem) clamp(1.25rem, 4vw, 3rem) 0;
  max-width: 44rem;
}

.lede h1 {
  margin: 0;
  font-size: clamp(1.9rem, 5vw, 2.9rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--ink);
  transition: color 0.75s ease;
}

.lede-role {
  margin: 0.5rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  transition: color 0.75s ease;
}

.lede-line {
  margin: 1rem 0 0;
  font-size: 0.95rem;
  font-weight: 300;
  line-height: 1.65;
  color: var(--muted);
  transition: color 0.75s ease;
}

.lede-mail {
  display: inline-block;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 300;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 0.15rem;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.lede-mail:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ===================================================================
   Work — selected past work, one hairline row per kind of work.
   =================================================================== */

.work {
  position: relative;
  z-index: 1;
  margin: 0 0 4.5rem;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
}

.work-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.work-heading {
  font-size: 0.85rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0;
  transition: color 0.75s ease;
}

.work-note {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 300;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.75s ease;
}

.work-list {
  margin: 0;
  border-top: 1px solid var(--hairline);
  transition: border-color 0.75s ease;
}

.work-item {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--hairline);
  transition: border-color 0.75s ease;
}

.work-item dt {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 0.2rem;
  transition: color 0.75s ease;
}

.work-item dd {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.work-title {
  font-size: 1rem;
  font-weight: 300;
  color: var(--ink);
  transition: color 0.75s ease;
}

.work-sub {
  font-size: 0.82rem;
  font-weight: 300;
  line-height: 1.55;
  color: var(--muted);
  transition: color 0.75s ease;
}

.work-item.is-next .work-title {
  color: var(--accent);
  transition: color 0.75s ease;
}

.work-contact {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.75rem;
}

.work-contact-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 300;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.75s ease;
}

.work-contact a {
  font-size: 1rem;
  font-weight: 300;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 0.15rem;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.work-contact a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

@media (max-width: 560px) {
  .work-item {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
}

/* Footer email sits beside the clock */

.footer-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.footer-mail {
  font-family: var(--font-mono);
  font-weight: 300;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-mail:hover {
  color: var(--accent);
}

@media (max-width: 560px) {
  .footer-mail {
    display: none;
  }
}

/* The about page's inline mailto */

.about-mail {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  transition: color 0.3s ease, border-color 0.3s ease;
}

.about-mail:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Copy button beside the contact email */

.copy-mail {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 300;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.copy-mail:hover {
  color: var(--ink);
  border-color: var(--muted);
}

.copy-mail.is-copied {
  color: var(--accent);
  border-color: var(--accent);
  text-transform: none;
  letter-spacing: 0.04em;
}

.copy-mail:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}
