/* Cassie May. A letter on paper, a map underneath.
   Paper and ink carry it. Lake draws the contours. Copper marks the one thing to click. */


:root {
  --paper: #f4f2ed;
  --paper-deep: #e9e5da;
  --chip: #e4e0d5;
  --chip-hover: #d9d4c6;
  --ink: #171710;
  --soft: #3a3932;
  --rule: rgba(23, 23, 16, 0.34);
  --lake: #1d4b59;
  --band-bg: #171710;
  --band-ink: #f4f2ed;
  --band-lake: #8fc0cc;
  --band-soft: #cfcabd;
  --copper: #a35a30;
  --on-copper: #fbf8f2;
  --term: #171710;
  --on-term: #f4f2ed;
  --ink-filter: none;
  --serif: Archivo, "Helvetica Neue", Arial, sans-serif;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --pad: clamp(1rem, 5vw, 4.5rem);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #12130f;
  --paper-deep: #1b1c17;
  --chip: #26271f;
  --chip-hover: #313228;
  --ink: #ece8de;
  --soft: #cdc9bd;
  --rule: rgba(236, 232, 222, 0.3);
  --lake: #8fc0cc;
  --band-bg: #23241d;
  --band-ink: #f4f2ed;
  --band-lake: #8fc0cc;
  --band-soft: #cfcabd;
  --copper: #c8703a;
  --on-copper: #12130f;
  --term: #ece8de;
  --on-term: #12130f;
  --ink-filter: invert(1) brightness(.9);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: 112.5%; background: var(--paper); scroll-behavior: smooth; scrollbar-color: var(--rule) var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); font-size: 1rem; line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: .22em; text-decoration-thickness: 1px; }
::selection { background: var(--lake); color: var(--paper); }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; text-wrap: balance; }
p { text-wrap: pretty; }
.ink { filter: var(--ink-filter); }
.skip-link { position: fixed; top: .5rem; left: .5rem; z-index: 50; padding: .6rem .9rem; background: var(--ink); color: var(--paper); transform: translateY(-160%); }
.skip-link:focus { transform: none; }

/* Header */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 1.1rem var(--pad); }
.site-header nav { display: flex; align-items: center; gap: clamp(.9rem, 2.4vw, 1.75rem); }
.mark { font-family: var(--serif); font-size: 1.25rem; text-decoration: none; letter-spacing: -.01em; white-space: nowrap; }
.nav-link { font-size: .875rem; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; color: var(--soft); }
.nav-link:hover, .nav-link[aria-current="page"] { color: var(--ink); }
.nav-link[aria-current="page"] { text-decoration: underline; }
.header-right { display: flex; align-items: center; gap: 1rem; }
.theme-toggle { display: grid; place-items: center; width: 2.3rem; height: 2.3rem; padding: 0; border: 1px solid var(--rule); background: transparent; color: var(--ink); cursor: pointer; }
.theme-toggle:hover { border-color: var(--ink); }
.theme-toggle svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }
.theme-toggle .flame { fill: var(--copper); stroke: none; }
.theme-toggle .glow { fill: var(--copper); opacity: .2; stroke: none; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

/* The letter */
.letter { width: min(40rem, calc(100% - 2 * var(--pad))); margin: clamp(2.5rem, 7vw, 5.5rem) auto 0; font-family: var(--serif); font-size: clamp(1.3rem, 2.2vw, 1.6rem); line-height: 1.75; }
.letter p { margin: 0 0 1.4em; }
.letter .hello { font-style: italic; }
.chip {
  display: inline; padding: 0 0 .04em; margin: 0;
  background: none; color: inherit; cursor: pointer;
  border-bottom: 2.5px dotted var(--lake);
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
  transition: color 150ms ease, border-color 150ms ease;
}
.chip .lead, .chip.no-lead { white-space: nowrap; }
.chip::before { content: none; }
.chip .lead::before, .chip.no-lead::before {
  content: ""; display: inline-block; width: .38em; height: .38em; margin: 0 .32em .12em .05em;
  background: var(--copper); transform: rotate(45deg); vertical-align: middle;
}
.chip:hover, .chip[aria-expanded="true"] { color: var(--lake); border-bottom-style: solid; }
.nw { white-space: nowrap; }
.face { display: inline-block; width: 1.5em; height: 1.5em; vertical-align: -.35em; margin: 0 .1em; border-radius: .3em; object-fit: cover; filter: grayscale(1); transform: rotate(-4deg); }
.flap { display: inline-flex; gap: 2px; vertical-align: .05em; }
.flap span { display: inline-grid; place-items: center; width: .82em; height: 1.2em; background: var(--term); color: var(--on-term); font-family: var(--mono); font-size: .7em; border-radius: 2px; position: relative; overflow: hidden; }
.flap span::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: color-mix(in srgb, var(--paper) 30%, transparent); }
.term { display: inline-block; padding: .1em .55em; border-radius: .3em; background: var(--term); color: var(--on-term); font-family: var(--mono); font-size: .66em; vertical-align: .2em; white-space: nowrap; }
.term b { color: var(--copper); font-weight: 400; }
.note {
  display: block; margin: -.6em 0 1.4em; padding: .9rem 1.1rem;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  font-family: var(--sans); font-size: 1rem; line-height: 1.55; color: var(--soft);
  animation: unfold 380ms var(--ease) both;
}
.note strong { color: var(--ink); font-weight: 600; }
@keyframes unfold { from { opacity: 0; clip-path: inset(0 0 100% 0); } to { opacity: 1; clip-path: inset(0 0 0 0); } }
.sign { display: flex; align-items: center; gap: 1rem; margin-top: 2.25rem; font-style: italic; }
.sign .rule { flex: 0 0 3rem; height: 1px; background: var(--ink); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin: 2.5rem 0 0; font-family: var(--sans); font-size: 1rem; }
.button { display: inline-flex; align-items: center; gap: .55rem; padding: .85rem 1.3rem; background: var(--copper); color: var(--on-copper); text-decoration: none; font-weight: 600; line-height: 1.1; }
.button:hover { filter: brightness(1.08); }
.button svg { width: .95rem; height: .95rem; fill: none; stroke: currentColor; stroke-width: 2; }
.text-link { color: var(--lake); font-weight: 600; }

/* Name and the live map */
.namefield { margin-top: clamp(4rem, 9vw, 7rem); }
.namefield .wrap { display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.bigname { font-size: clamp(3.5rem, 11vw, 9rem); line-height: .9; letter-spacing: -.035em; }
.map-caption { font-family: var(--mono); font-size: .875rem; color: var(--soft); text-align: right; max-width: 18ch; padding-bottom: .6rem; }
.topo { display: block; width: 100%; height: clamp(16rem, 34vw, 28rem); margin-top: 1.25rem; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); cursor: crosshair; touch-action: pan-y; }
.wrap { width: 100%; max-width: 78rem; margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }

/* Range engraving */
.range { margin-top: clamp(3rem, 7vw, 5rem); }
.range img { width: 100%; max-width: 78rem; margin: 0 auto; }
.range-top { margin-top: clamp(.5rem, 2vw, 1.5rem); }
.range-top + .letter { margin-top: clamp(1.5rem, 4vw, 3rem); }


/* Footer */
.site-footer { border-top: 1px solid var(--ink); padding: 2rem 0 2.5rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2rem; font-size: .9rem; color: var(--soft); }
.footer-inner p { margin: 0; }
.footer-inner .sign-off { font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--ink); }
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* Info */
.page-head { padding-top: clamp(2.5rem, 7vw, 5rem); }
.page-head h1 { font-size: clamp(2.2rem, 4.6vw, 3.6rem); line-height: 1.12; letter-spacing: -.02em; max-width: 22ch; }
.paper-strip { margin-top: clamp(2.5rem, 5vw, 3.5rem); display: grid; grid-template-columns: 10rem minmax(0, 1fr); gap: 1rem; align-items: end; }
.paper-strip img { width: 100%; height: 10rem; object-fit: cover; }
.paper-strip .portrait { width: 10rem; aspect-ratio: 1; }
.paper-strip .portrait { filter: grayscale(1); }
.section { padding-top: clamp(3.5rem, 8vw, 6rem); }
.section-title { font-family: var(--serif); font-size: clamp(1.7rem, 3vw, 2.3rem); line-height: 1.15; padding-bottom: 1rem; border-bottom: 1px solid var(--ink); margin-bottom: 2rem; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem clamp(2rem, 6vw, 5rem); }
.prose p { margin: 0 0 1.1em; font-family: var(--serif); font-size: clamp(1.15rem, 1.7vw, 1.3rem); line-height: 1.6; }
.ledger { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 clamp(2rem, 6vw, 5rem); }
.ledger div { padding: 1.25rem 0 1.5rem; border-bottom: 1px solid var(--rule); }
.ledger h3 { font-family: var(--sans); font-size: .95rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-bottom: .5rem; }
.ledger p { margin: 0; color: var(--soft); max-width: 44ch; }
.ledger a { color: var(--lake); font-weight: 600; }
.closing { padding-top: clamp(3.5rem, 8vw, 6rem); }
.closing p { font-family: var(--serif); font-size: clamp(1.4rem, 2.6vw, 2rem); line-height: 1.35; max-width: 30ch; margin: 0 0 1.75rem; }

/* Writing */
.empty { margin-top: 2.5rem; padding: 2rem 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); }
.empty p { margin: 0; max-width: 46ch; font-family: var(--serif); font-size: clamp(1.2rem, 2vw, 1.45rem); line-height: 1.55; }
.empty .small { margin-top: 1rem; font-family: var(--sans); font-size: 1rem; color: var(--soft); }

@media (max-width: 820px) {
    .two-col, .ledger { grid-template-columns: minmax(0, 1fr); }
  .paper-strip { grid-template-columns: 7rem minmax(0, 1fr); }
  .paper-strip img { height: 7rem; }
  .paper-strip .portrait { width: 7rem; }
  .namefield .wrap { flex-direction: column; align-items: flex-start; }
  .map-caption { text-align: left; }
}
@media (max-width: 520px) {
  .site-header nav { gap: .85rem; }
  .site-header nav .nav-link[href="/"] { display: none; }
  .mark { font-size: 1.1rem; }
  .site-header nav .anvil-link span { display: none; }
  .nav-link { font-size: .85rem; letter-spacing: .05em; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .note { animation: none; }
}

/* Trail register */
.register { margin: 0 0 2.5rem; border: 1px solid var(--ink); font-family: var(--sans); }
.register-head { display: flex; justify-content: space-between; padding: .55rem .9rem; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: .875rem; letter-spacing: .1em; text-transform: uppercase; }
.register-rows { margin: 0; }
.register-rows div { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); align-items: baseline; border-top: 1px dotted var(--rule); }
.register-rows div:first-child { border-top: 0; }
.register-rows dt { padding: .6rem .9rem; font-family: var(--mono); font-size: .875rem; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); border-right: 1px solid var(--rule); }
.register-rows dd { margin: 0; padding: .45rem .9rem; font-family: var(--serif); font-style: italic; font-size: clamp(1.15rem, 2vw, 1.35rem); }
.out-there { font-style: italic; }

/* Notes sit in the margin like a map legend on wide screens */
@media (min-width: 1180px) {
  .letter { position: relative; }
  .letter .note {
    position: absolute; left: calc(100% + 2.5rem); width: 15rem; margin: 0;
    padding: .7rem 0 0; border: 0; border-top: 2px dotted var(--lake);
    font-size: .95rem;
  }
}

/* Anvil tab */
.anvil-link { display: inline-flex; align-items: center; gap: .35rem; color: var(--soft); text-decoration: none; font-family: var(--serif); font-style: italic; font-size: 1rem; }
.anvil-link svg { width: 1.6rem; height: 1.2rem; fill: currentColor; }
.anvil-link span { display: none; }
.anvil-link:hover, .anvil-link[aria-current="page"] { color: var(--ink); }
.anvil-link[aria-current="page"] span, .anvil-link:hover span { display: inline; }

/* On the anvil */
.anvil-intro { max-width: 46ch; margin: 1.25rem 0 0; font-family: var(--serif); font-size: clamp(1.2rem, 2vw, 1.45rem); line-height: 1.5; color: var(--soft); }
.forge { margin-top: clamp(2.5rem, 6vw, 4rem); }
.forge-stage { display: flex; align-items: center; gap: .7rem; font-family: var(--mono); font-size: .9rem; letter-spacing: .1em; text-transform: uppercase; padding-bottom: .8rem; border-bottom: 1px solid var(--ink); }
.heat { width: .8rem; height: .8rem; border-radius: 50%; }
.heat-fire { background: #d9622b; }
.heat-anvil { background: #c0692f; }
.heat-quenched { background: #7d8a90; }
.forge-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) auto; gap: .5rem 2rem; padding: 1.3rem 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.forge-item h3 { font-size: 1.4rem; line-height: 1.25; }
.forge-item p { margin: 0; color: var(--soft); max-width: 52ch; }
.forge-meta { font-family: var(--mono); font-size: .875rem; white-space: nowrap; }
@media (max-width: 820px) {
  .forge-item { grid-template-columns: minmax(0, 1fr); }
}

/* Sign the register (Substack signup) */
.signup { margin-top: clamp(3.5rem, 8vw, 6rem); }
.signup-card { max-width: 40rem; margin: 0 auto; border: 1px solid var(--ink); }
.signup-body { padding: 1.25rem 1.25rem 1.4rem; }
.signup-body p { margin: 0 0 1rem; font-family: var(--serif); font-size: clamp(1.15rem, 2vw, 1.3rem); line-height: 1.5; }
.signup-frame { display: block; width: 100%; height: 160px; border: 1px solid var(--rule); background: #fff; }
.signup-soon { display: none; color: var(--soft); font-style: italic; }
.signup[data-live="false"] .signup-frame { display: none; }
.signup[data-live="false"] .signup-soon { display: block; }
.page-head .signup-card { margin-left: 0; }

/* Contrast bands: the map and the footer print in reverse, like a trail map */
.namefield { background: var(--band-bg); color: var(--band-ink); padding-top: clamp(2.5rem, 6vw, 4rem); --ink: var(--band-ink); --lake: var(--band-lake); --paper: var(--band-bg); --soft: var(--band-soft); }
.namefield .topo { border-color: var(--band-ink); border-bottom: 0; }
.site-footer { background: var(--band-bg); color: var(--band-soft); border-top: 0; }
.site-footer .sign-off, .site-footer a { color: var(--band-ink); }
.footer-inner { color: var(--band-soft); }
.range + .site-footer, .range ~ .site-footer { margin-top: 0; }
.letter p, .prose p { color: var(--ink); }
.site-footer { border-top: 1px solid rgba(244, 242, 237, 0.18); }
.letter .why { padding: 1.1rem 0 1.1rem 1.25rem; border-left: 1px solid var(--ink); }
.note-img { display: inline-block; width: 3.6rem; height: auto; vertical-align: middle; margin-right: .6rem; }
.info-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2rem; align-items: end; }
.info-head .portrait { width: clamp(6.5rem, 12vw, 9.5rem); aspect-ratio: 1; object-fit: cover; filter: grayscale(1); border: 1px solid var(--ink); }
.note-img { width: 5rem !important; }
.register .face { cursor: zoom-in; transition: width 380ms cubic-bezier(.16,1,.3,1), height 380ms cubic-bezier(.16,1,.3,1), transform 380ms cubic-bezier(.16,1,.3,1); }
.register .face.open { width: 7em; height: 7em; transform: rotate(-2deg); vertical-align: middle; margin: .4rem .2rem; cursor: zoom-out; border: 1px solid var(--ink); }
@media (prefers-reduced-motion: reduce) { .register .face { transition: none; } }
