/*
 * maxwellhandler.com shared base: everything both pages use.
 * Loads after tokens.css and before the page's own file (home.css or build-log.css).
 * Every value comes from tokens.css; one-off component dimensions stay literal with a
 * comment saying why.
 */

/* Fonts (self-hosted, OFL; licenses in assets/fonts/) */
@font-face { font-family: 'Geist'; src: url('../assets/fonts/Geist-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('../assets/fonts/Geist-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('../assets/fonts/Geist-SemiBold.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('../assets/fonts/GeistMono-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('../assets/fonts/GeistMono-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Caveat'; src: url('../assets/fonts/Caveat-Medium-latin.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }

/* Reset and globals */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }
code { font-family: var(--font-mono); }
button { font: inherit; cursor: pointer; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--ink); }
::selection { background: rgba(255, 221, 64, 0.55); color: var(--ink); }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--space-4); top: var(--space-2); z-index: 10;
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--space-4);
  background: var(--paper); border: 1px solid var(--ink); border-radius: var(--radius-m);
  color: var(--ink); font-size: var(--text-15); text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

.wrap { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gutter); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--button-h); padding: 0 var(--space-5); border-radius: var(--radius-m);
  font-size: var(--text-15); font-weight: 500; text-decoration: none;
  transition: background-color 150ms ease, transform 100ms ease; }
.btn--primary { background: var(--ink); color: var(--paper); border: 1px solid var(--ink); }
.btn--primary:hover { background: var(--ink-hover); color: var(--paper); }
.btn--secondary { background: var(--paper); color: var(--ink); border: 1px solid var(--ink); min-width: 150px; }
.btn--secondary:hover { background: var(--paper-alt); color: var(--ink); }
.btn:active { transform: translateY(1px); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-s); }

/* Shared text patterns */
.mono { font-family: var(--font-mono); }
.label {
  font-family: var(--font-mono); font-size: var(--text-12); font-weight: 400;
  letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--muted);
}
.link-sm {
  display: inline-flex; align-items: center; min-height: var(--tap);
  font-family: var(--font-mono); font-size: var(--text-13);
}

/* Pending link: muted text + "Soon" tag. Not a link. */
.pending { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap); }
.pending__text { font-family: var(--font-mono); font-size: var(--text-13); color: var(--muted); }
.pending__tag {
  font-family: var(--font-mono); font-size: var(--text-12); letter-spacing: var(--tracking-label);
  text-transform: uppercase; padding: var(--space-1) var(--space-2);
  border: 1px solid var(--rule); border-radius: var(--radius-s); color: var(--muted);
}

/* Top bar (not sticky) and phone menu. js/site.js opens and closes the menu. */
.topbar { position: relative; background: var(--paper); border-bottom: 1px solid var(--rule); }
.topbar__nav {
  min-height: 60px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--space-2) var(--space-5);
}
.topbar__name {
  display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap);
  color: var(--ink); text-decoration: none; font-size: var(--text-15); font-weight: 600; letter-spacing: var(--tracking-1);
}
.topbar__mark { display: block; flex: none; width: var(--mark-size); height: var(--mark-size); }
.topbar__mark-letter { fill: var(--ink); }
.topbar__mark-line { stroke: var(--pencil); }
.topbar__right { display: flex; align-items: center; gap: var(--space-2) var(--space-5); font-size: var(--text-15); }
.nav-sections { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-5); }
.nav-sections a, .topbar__resume {
  display: inline-flex; align-items: center; min-height: var(--tap); text-decoration: none;
}
.nav-sections a { color: var(--ink); }
.nav-sections a:hover { color: var(--accent); }
.topbar__resume { font-weight: 500; }
.menu-btn.btn {
  min-height: var(--tap); min-width: 0; padding: 0 var(--space-4); gap: var(--space-2);
}
.menu-panel {
  flex-direction: column; padding: var(--space-1) var(--gutter) var(--space-4);
  border-top: 1px solid var(--rule);
}
.menu-panel a {
  display: flex; align-items: center; min-height: var(--tap); padding: 0 var(--space-1);
  border-top: 1px solid var(--rule); color: var(--ink); text-decoration: none; font-size: var(--text-16);
}
/* Menu visibility: section links above 640px, the Menu button at 640px and under */
.menu-btn, .menu-panel { display: none; }
@media (max-width: 640px) {
  .nav-sections { display: none; }
  .menu-btn { display: inline-flex; }
  .menu-panel.is-open { display: flex; }
  /* Mark, name, Resume and Menu share one row at 375px: smaller name and minimum gaps;
     space-between still spreads any leftover width. */
  .topbar__nav { column-gap: var(--space-2); }
  .topbar__right { gap: var(--space-3); }
  .topbar__name { font-size: var(--text-14); }
}

/* Page header and title */
.page-head { padding-top: var(--space-9); padding-bottom: var(--space-8); display: flex; flex-direction: column; gap: var(--space-5); }
.page-title {
  font-size: var(--text-72); font-weight: 500; letter-spacing: var(--tracking-3); line-height: var(--leading-tight);
}
.page-lede { max-width: 720px; font-size: var(--text-22); line-height: var(--leading-lede); }
/* A row of buttons or links under a page's lede (404, resume); keeps them content-width */
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5); }

/* Sections: 1px ink rule, 64px, content, 64px */
.section__inner { padding: var(--space-8) 0; border-top: 1px solid var(--ink); }
.section-title {
  margin-bottom: var(--space-section); display: flex; align-items: baseline; gap: var(--space-4);
  font-size: var(--text-44); font-weight: 600; letter-spacing: var(--tracking-3); line-height: var(--leading-tight);
}
.section-title__num {
  font-family: var(--font-mono); font-size: var(--text-19); font-weight: 500; letter-spacing: 0; color: var(--accent);
}

/* Step row. The homepage's #steps animates it (js/home.js); elsewhere it is static. */
.steps {
  list-style: none; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-5);
}
.step {
  display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4);
  border-top: 2px solid var(--ink); border-radius: 0 0 var(--radius-m) var(--radius-m);
  background: transparent;
  transition: background-color var(--fade), border-color var(--fade);
}
.step.is-active { border-top-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.step__num { font-family: var(--font-mono); font-size: var(--text-12); color: var(--accent); }
.step__title { font-size: var(--text-19); font-weight: 600; }
.step__text { font-size: var(--text-15); line-height: var(--leading-body); color: var(--ink-soft); }
@media (prefers-reduced-motion: reduce) { .step { transition: none; } }

/* Card */
.card {
  display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5);
  border: 1px solid var(--rule); border-radius: var(--radius-m);
}
.card__text { font-size: var(--text-15); line-height: var(--leading-body); color: var(--ink-soft); }

/* Highlighter on a key phrase */
mark {
  color: inherit; background: var(--highlighter); padding: 1px var(--space-1); margin: 0 -2px;
  border-radius: 3px 6px 2px 5px; -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* Worked / Didn't */
.outcomes {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: var(--space-5); margin-top: var(--space-2);
}
.outcomes__label {
  margin-bottom: var(--space-2); font-family: var(--font-mono); font-size: var(--text-12); font-weight: 400;
  letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--ink);
}
.outcomes__label--didnt { color: var(--pencil); }
.outcomes ul { padding-left: 18px; display: flex; flex-direction: column; gap: var(--space-2); }
.outcomes li { font-size: var(--text-15); line-height: var(--leading-body); }

/* Labeled list (project-kickoff changes, doc-tailor versions, build-log steps) */
.labeled { list-style: none; padding: 0; }
/* 80px key column: fits short keys like "Commands" or "v2.1"; a one-off component width, so literal */
.labeled__row {
  display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: var(--space-4);
  padding: var(--space-4) 0; border-top: 1px solid var(--rule);
}
.labeled__key { font-family: var(--font-mono); font-size: var(--text-12); color: var(--muted); }
.labeled__key--version { font-size: var(--text-13); font-weight: 500; color: var(--ink); }
.labeled__key--current { color: var(--accent); }
.labeled__val { font-size: var(--text-15); line-height: var(--leading-body); }
.labeled__body { display: flex; flex-direction: column; gap: var(--space-1); }
.labeled__name { font-family: var(--font-mono); font-size: var(--text-12); color: var(--muted); }
.labeled__gain { font-family: var(--font-mono); font-size: var(--text-13); line-height: var(--leading-body); }
.labeled__gain span { color: var(--muted); }

/* Pencil marks (decorative; the markup keeps them aria-hidden) */

/* Highlighter swipe behind handwritten words */
.hl { padding: 0 var(--space-1); background: var(--highlighter) no-repeat 0 65% / 100% 75%; }

/* Graphite strike: one hand-drawn line through a word or phrase that stays on one line.
 * The line is a CSS mask of the drawn path, so the markup needs no SVG. The mask is an
 * image, so it can't read tokens: its stroke-width 1.8 is --stroke-main and must change
 * with it. .strike--drawn swaps in an inline SVG line (.strike__line) for the homepage
 * intro edit, whose stroke animates. */
.strike { position: relative; display: inline-block; color: var(--muted); }
.strike::after, .strike__line {
  position: absolute; left: -3px; top: 50%; width: calc(100% + 6px); height: 10px; margin-top: -4px;
}
.strike::after {
  content: ""; background: var(--graphite);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M1 6 C 28 3.8, 62 6.6, 99 4.2' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M1 6 C 28 3.8, 62 6.6, 99 4.2' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
}
.strike--drawn::after { content: none; }
.strike__line { overflow: visible; }
.strike__line path { fill: none; stroke: var(--graphite); stroke-width: var(--stroke-main); stroke-linecap: round; }

/* Handwritten pencil note ("try it!", "this one!"). Each use sets its own position. */
.hand-note {
  position: absolute; white-space: nowrap;
  font-family: var(--font-hand); font-size: var(--text-26); font-weight: 500; line-height: var(--leading-tight);
  color: var(--pencil); transform: rotate(-6deg);
}

/* Pencil arrow pointing up at what's above, with a handwritten note beside it
   ("More to come!" in Journey, "Still learning…" on the build log) */
.arrow-note { position: relative; min-height: 96px; padding: 6px 0 var(--space-3) var(--space-6); }
/* 40px is the arrow drawing's box, centered on its left edge (left: -20px); a drawing size, not the section gap */
.arrow-note__arrow {
  position: absolute; left: -20px; top: 0; width: 40px; height: 100%; overflow: visible; color: var(--pencil);
}
.arrow-note__text {
  display: flex; flex-direction: column; gap: var(--space-1);
  transform: rotate(-2deg); transform-origin: left top;
  font-family: var(--font-hand); font-weight: 500; color: var(--pencil);
}
.arrow-note__title { font-size: var(--text-34); line-height: var(--leading-tight); }
.arrow-note__sub { font-size: var(--text-24); line-height: var(--leading-heading); }

/* Footer */
.footer { border-top: 1px solid var(--ink); background: var(--paper-alt); }
.footer__inner {
  padding-top: var(--space-8); padding-bottom: var(--space-6);
  display: flex; flex-direction: column; align-items: center; gap: var(--space-6); text-align: center;
}
.footer__head { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); }
.footer__title { font-size: var(--text-44); font-weight: 600; letter-spacing: var(--tracking-3); line-height: var(--leading-tight); }
.footer__sub { font-size: var(--text-19); line-height: var(--leading-lede); color: var(--ink-soft); }
.footer__buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); }
.footer__buttons .btn { gap: var(--space-3); min-width: 150px; }
.footer__line {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 var(--space-5);
  font-family: var(--font-mono); font-size: var(--text-15); color: var(--muted);
}
.footer__line a { display: inline-flex; align-items: center; min-height: var(--tap); }
@media (max-width: 500px) {
  .footer__line { flex-direction: column; }
  .footer__sep { display: none; }
}
.footer__bottom {
  align-self: stretch; display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-4);
  margin-top: var(--space-section); padding-top: var(--space-5); border-top: 1px solid var(--rule);
  font-family: var(--font-mono); font-size: var(--text-13); color: var(--muted);
}
