/* ==========================================================================
   schuller.dev — quiet, typographic, amber.
   Layout: one generous column for the hero; label-left / content-right
   for sections. Inter Tight does the talking; Plex Mono only for small labels.
   ========================================================================== */

/* Self-hosted fonts (latin subset) — no third-party requests */
@font-face {
  font-family: "Inter Tight"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../assets/fonts/inter-tight-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter Tight"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../assets/fonts/inter-tight-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../assets/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
}

:root {
  /* Surfaces */
  --bg:          #11100e;   /* warm near-black */
  --paper:       #ede8de;   /* warm off-white */
  --subtle:      #c6bfb2;
  --muted:       #9c9486;
  --dim:         #6f685d;   /* large / decorative text only */
  --line:        #29251f;
  --line-strong: #3d372e;

  /* Accent — phosphor amber, used sparingly */
  --accent:      #e3a659;
  --accent-soft: rgba(227, 166, 89, 0.45);
  --grid-dot:    rgba(237, 232, 222, 0.16);

  /* Fonts */
  --f-sans: "Inter Tight", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;

  /* Rhythm */
  --header-h: 64px;
  --gutter:   clamp(20px, 5vw, 72px);
  --col-gap:  clamp(16px, 2.5vw, 40px);
  --ease:     cubic-bezier(.2, .7, .1, 1);

  color-scheme: dark;
}

/* ---------- Base ---------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--paper);
  font-family: var(--f-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }

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

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

.wrap {
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding-left:  max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute;
  left: max(var(--gutter), env(safe-area-inset-left, 0px));
  top: -100px;
  z-index: 200;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--bg);
  font: 500 0.8125rem/1 var(--f-mono);
  text-decoration: none;
}
.skip:focus { top: 12px; }

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

section[id] { scroll-margin-top: var(--header-h); }

/* Small mono labels — the only place the monospace face appears */
.eyebrow, .status, .section-id, .overline, .label,
.nav a, .textlink, .copy, .ext,
.foot-id, .foot-msg, .foot-top {
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: 0.75rem;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ---------- Masthead ------------------------------------------------------ */

.masthead {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease;
}
.masthead.is-scrolled { border-bottom-color: var(--line); }

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

.mark {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font: 500 0.875rem/1 var(--f-mono);
  text-decoration: none;
  white-space: nowrap;
}
.mark-rs   { color: var(--accent); margin-right: 6px; }
.mark-site { color: var(--paper); }
.cursor    { color: var(--accent); animation: blink 1.1s steps(1, end) infinite; }

.nav { display: flex; gap: clamp(16px, 2.6vw, 36px); }
.nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  color: var(--muted);
  text-decoration: none;
  transition: color .2s ease;
}
.nav-n { color: var(--dim); transition: color .2s ease; }
.nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 10px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s var(--ease);
}
.nav a:hover, .nav a.is-active { color: var(--paper); }
.nav a:hover .nav-n, .nav a.is-active .nav-n { color: var(--accent); }
.nav a:hover::after, .nav a.is-active::after { transform: scaleX(1); }

/* ---------- Hero ---------------------------------------------------------- */

.hero {
  padding-block: clamp(72px, 10vw, 144px) clamp(64px, 7vw, 104px);
  animation: rise .9s var(--ease) both;
}

.eyebrow { color: var(--muted); margin-bottom: clamp(20px, 2.6vw, 32px); }
.eyebrow .dash { color: var(--accent); }

.headline {
  font-weight: 500;
  font-size: clamp(2.75rem, 1.3rem + 5.2vw, 6rem);
  line-height: 1;
  letter-spacing: -0.04em;
}
.headline .line { display: block; }
.headline .hl {
  color: var(--accent);
  display: inline-block;      /* width is locked by JS while scrambling */
  white-space: nowrap;
}
.headline .hl.is-scrambling .sc { color: var(--accent-soft); }

/* Faint dot grid behind the hero; fades out as you scroll (opacity set in JS) */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(circle at center, var(--grid-dot) 1px, transparent 1.4px);
  background-size: 28px 28px;
  background-position: calc(50% + 14px) 0;
  -webkit-mask-image: radial-gradient(ellipse 85% 70% at 65% 30%, #000 20%, transparent 75%);
          mask-image: radial-gradient(ellipse 85% 70% at 65% 30%, #000 20%, transparent 75%);
  opacity: var(--grid-o, 1);
}
main, .footer { position: relative; z-index: 1; }

.hero-foot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
  margin-top: clamp(36px, 4.5vw, 56px);
}
.lede {
  max-width: 32ch;
  font-size: clamp(1.0625rem, 0.95rem + 0.45vw, 1.3125rem);
  line-height: 1.5;
  color: var(--subtle);
  text-wrap: pretty;
}

.textlink {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--paper);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px solid var(--accent-soft);
  transition: border-color .2s ease;
}
.textlink .arrow { color: var(--accent); display: inline-block; transition: transform .3s var(--ease); }
.textlink:hover { border-color: var(--accent); }
.textlink:hover .arrow { transform: translate(3px, 3px); }
/* Spec line + CTA share one status bar on wide screens */
.hero-base {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 48px;
  margin-top: clamp(56px, 6vw, 88px);
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.hero-cta { flex: none; }
.hero-cta:hover .arrow { transform: translateY(4px); }

/* Spec line — real numbers about this page */
.spec {
  display: flex;
  flex-wrap: wrap;
  gap: 18px clamp(28px, 4vw, 56px);
  margin: 0;
}
.spec > div { display: flex; flex-direction: column; gap: 6px; }
.spec dt {
  font: 400 0.625rem/1 var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--dim);
}
.spec dd {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 400 0.8125rem/1.2 var(--f-mono);
  color: var(--subtle);
  font-variant-numeric: tabular-nums;
}
.led {
  flex: none;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 3.2s ease-in-out infinite;
}

/* ---------- Sections ------------------------------------------------------ */

.section {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--col-gap);
  row-gap: 36px;
  padding-block: clamp(64px, 9vw, 128px);
  border-top: 1px solid var(--line);
}
/* keep the rule inside the gutters */
.section, .contact { border-top: 0; position: relative; }
.section::before, .contact::before, .footer::before {
  content: "";
  position: absolute;
  top: 0;
  left:  max(var(--gutter), env(safe-area-inset-left, 0px));
  right: max(var(--gutter), env(safe-area-inset-right, 0px));
  height: 1px;
  background: var(--line);
}

.section-head { grid-column: 1 / span 4; align-self: start; }
.section-body { grid-column: 5 / -1; min-width: 0; }

.section-id { color: var(--muted); margin-bottom: 18px; }
.section-id span { color: var(--accent); margin-right: 8px; }

.section-title {
  font-weight: 500;
  font-size: clamp(1.875rem, 1.35rem + 1.9vw, 2.875rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

/* About */
.prose {
  display: flex;
  flex-direction: column;
  gap: 1.2em;
  max-width: 62ch;
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.72;
  color: var(--subtle);
}
.prose p { text-wrap: pretty; }
.prose .lead {
  max-width: 30ch;
  margin-bottom: 0.3em;
  font-size: clamp(1.375rem, 1.1rem + 1vw, 1.875rem);
  line-height: 1.32;
  letter-spacing: -0.018em;
  color: var(--paper);
}

.lately { margin-top: 1.6em; }
.label { color: var(--muted); margin-bottom: 12px; }
.lately ul { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.lately li {
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  color: var(--paper);
  font-size: 0.9375rem;
  line-height: 1.4;
}

/* Expertise */
.discipline {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.25fr);
  gap: 8px 32px;
  align-items: baseline;
  padding-block: clamp(22px, 2.4vw, 30px);
  border-top: 1px solid var(--line);
}
.discipline:first-child { border-top: 0; padding-top: 4px; }
.discipline::before {
  content: "";
  position: absolute;
  left: 0; top: -1px;
  height: 1px; width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .6s var(--ease);
}
.discipline:first-child::before { display: none; }
.d-title {
  font-weight: 500;
  font-size: clamp(1.2rem, 1.05rem + 0.5vw, 1.45rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  transition: color .3s ease;
}
.d-desc { color: var(--muted); line-height: 1.6; transition: color .3s ease; text-wrap: pretty; }
@media (hover: hover) {
  .discipline:hover::before { transform: scaleX(1); }
  .discipline:hover .d-title { color: var(--accent); }
  .discipline:hover .d-desc { color: var(--subtle); }
}

/* ---------- Contact ------------------------------------------------------- */

.contact { padding-block: clamp(72px, 10vw, 144px) clamp(64px, 8vw, 112px); }

.overline { margin-top: clamp(32px, 4vw, 52px); color: var(--muted); }
.contact-title {
  margin-top: 12px;
  font-weight: 500;
  font-size: clamp(3rem, 1.5rem + 6.5vw, 7rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
}
.contact-body {
  max-width: 40ch;
  margin-top: clamp(24px, 3vw, 36px);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--subtle);
}

.email {
  display: inline-block;
  max-width: 100%;
  margin-top: clamp(32px, 4vw, 48px);
  padding-bottom: 6px;
  font-weight: 500;
  font-size: clamp(1.5rem, 0.9rem + 3vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--paper);
  text-decoration: none;
  overflow-wrap: anywhere;
  background:
    linear-gradient(var(--accent), var(--accent)) no-repeat left bottom / 0% 2px,
    linear-gradient(var(--line-strong), var(--line-strong)) no-repeat left bottom / 100% 2px;
  transition: background-size .6s var(--ease), color .3s ease;
}
.email:hover { color: var(--accent); background-size: 100% 2px, 100% 2px; }

.contact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 28px;
  margin-top: 24px;
}
.copy, .ext {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--subtle);
  text-decoration: none;
  transition: color .2s ease, border-color .2s ease;
}
.copy {
  padding: 0 14px;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  cursor: pointer;
}
.copy:hover { border-color: var(--accent); color: var(--paper); }
.copy.is-done { border-color: var(--accent); color: var(--accent); }
.ext span[aria-hidden] { color: var(--accent); }
.ext:hover { color: var(--paper); }

/* ---------- Footer -------------------------------------------------------- */

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 32px;
  padding-block: 20px calc(20px + env(safe-area-inset-bottom, 0px));
}
.footer { position: relative; }
.foot-id, .foot-msg, .foot-top { font-size: 0.6875rem; color: var(--dim); }
.foot-id .mark-rs { text-transform: none; margin-right: 4px; }
.foot-msg { color: var(--muted); }
#foot-msg { transition: opacity .45s ease; }
.foot-msg .prompt { color: var(--accent); }
.foot-top { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--muted); text-decoration: none; }
.foot-top span { color: var(--accent); }
.foot-top:hover { color: var(--paper); }

/* Footer line doubles as the terminal trigger */
button.foot-msg {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  min-height: 44px;
  text-align: left;
  cursor: pointer;
}
button.foot-msg:hover { color: var(--paper); }
button.foot-msg:hover .prompt { animation: blink 1.1s steps(1, end) infinite; }

/* ---------- Hidden terminal ----------------------------------------------- */

.term {
  position: fixed;
  z-index: 100;
  right: max(var(--gutter), env(safe-area-inset-right, 0px));
  bottom: 24px;
  width: min(560px, calc(100vw - 2 * var(--gutter)));
  height: min(380px, 60vh);
  display: flex;
  flex-direction: column;
  background: rgba(17, 16, 14, 0.97);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  font: 400 0.8125rem/1.6 var(--f-mono);
  color: var(--subtle);
  animation: rise .25s var(--ease) both;
}
.term[hidden] { display: none; }

.term-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 0 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
}
.term-close {
  min-height: 36px;
  padding: 0 10px;
  background: none;
  border: 0;
  color: var(--dim);
  font: inherit;
  text-transform: uppercase;
  cursor: pointer;
}
.term-close:hover { color: var(--accent); }

.term-out {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 14px 4px;
}
.term-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.term-line a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-soft); }
.term-line a:hover { border-bottom-color: var(--accent); }
.term-cmd { color: var(--paper); margin-top: 6px; }
.term-dim { color: var(--muted); }
.term-err { color: #d98a6a; }

.term-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 12px;
}
.term-ps { color: var(--accent); }
.term-input {
  flex: 1;
  min-width: 0;
  padding: 4px 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--paper);
  caret-color: var(--accent);
  font: inherit;
  font-size: 16px; /* prevents iOS zoom on focus */
}

/* ---------- Motion -------------------------------------------------------- */

@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes rise  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
}

/* ---------- Responsive ---------------------------------------------------- */

@media (max-width: 900px) {
  .section-head, .section-body { grid-column: 1 / -1; }
  .discipline { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Phone layout: designed for thumbs, not just shrunk ------------------ */
@media (max-width: 640px) {
  :root { --header-h: 56px; --nav-h: 60px; }

  html { -webkit-tap-highlight-color: transparent; }
  body { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); }

  /* Header: just the wordmark. Navigation moves to a bottom tab bar. */
  .mark-rs { margin-right: 6px; }
  .mark-site { display: inline; }

  .nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(17, 16, 14, 0.94);
    -webkit-backdrop-filter: blur(10px);
            backdrop-filter: blur(10px);
    border-top: 1px solid var(--line-strong);
  }
  .nav a {
    justify-content: center;
    min-height: var(--nav-h);
    gap: 8px;
    font-size: 0.75rem;
  }
  .nav-n { display: inline; }
  .nav a::after { top: -1px; bottom: auto; height: 2px; }
  .nav a:active { background: rgba(237, 232, 222, 0.05); }

  /* Hero: headline fills the width, content sits higher */
  .hero { padding-block: clamp(40px, 12vw, 64px) 36px; }
  .hero-base { display: block; margin-top: 44px; padding-top: 20px; }
  .hero-cta { margin-top: 36px; }
  .eyebrow { margin-bottom: 20px; font-size: 0.6875rem; letter-spacing: 0.1em; }
  .headline { font-size: min(14.2vw, 4.25rem); letter-spacing: -0.045em; }
  .hero-foot { margin-top: 28px; gap: 20px; }
  .lede { max-width: 30ch; font-size: 1.125rem; }

  .textlink { min-height: 48px; }
  .textlink:active { border-color: var(--accent); color: var(--accent); }

  /* Spec line: tidy 2-up grid instead of a ragged wrap */
  .spec {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 16px;
  }
  .spec > div:last-child { grid-column: 1 / -1; }

  /* Sections: tighter rhythm, single column */
  .section { padding-block: 56px; row-gap: 24px; }
  .section-id { margin-bottom: 14px; }
  .prose { font-size: 1.0625rem; line-height: 1.7; }
  .lately { margin-top: 1.2em; }
  .lately li { padding: 9px 14px; }

  .discipline { padding-block: 22px; gap: 6px; }

  /* Contact: big tap targets, stacked actions */
  .contact { padding-block: 64px 48px; }
  .contact-title { font-size: min(21vw, 5.5rem); }
  .email {
    display: block;
    width: 100%;
    margin-top: 28px;
    font-size: min(6.4vw, 1.75rem);
    padding-bottom: 10px;
  }
  .contact-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
  }
  .copy, .ext {
    justify-content: center;
    min-height: 52px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: 2px;
  }
  .copy { grid-column: 1 / -1; color: var(--bg); background: var(--accent); border-color: var(--accent); font-weight: 500; }
  .copy:hover { color: var(--bg); }
  .copy.is-done { background: transparent; color: var(--accent); }
  .copy:active, .ext:active { opacity: .8; }

  /* Footer: compact, centered stack; "back to top" is redundant next to the tab bar */
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 6px; padding-block: 24px 28px; }
  .foot-top { display: none; }

  .term {
    left: 12px; right: 12px; width: auto;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
    height: min(340px, 55vh);
  }
}

@media (max-width: 360px) {
  .nav a { font-size: 0.6875rem; letter-spacing: 0.08em; }
  .nav-n { display: none; }
}

/* ---------- 404 ----------------------------------------------------------- */
.headline.is-nf { font-size: clamp(2.25rem, 1rem + 4.6vw, 5rem); }
.headline.is-nf .hl { white-space: normal; }
