/* scottwhitson.com — the same building after hours
   ================================================================
   Consumes shared/tokens.css exclusively: no color literal, no
   third-party font request. Six tokens, one palette — every rule
   resolves to one of them.

   Default theme: after-hours (tonal ground, the personal register).
   Offers: after-hours, light (for reading and printing).

   The reference is the corridor thesis — vast negative space, a single
   hairline, and the one lit door. But this is the building at night:
   no animation, no daylight, no institutional cold. The serif is the
   reading voice the other sites don't have.
   ================================================================ */

/* ---------- shell ---------- */

.frame {
 max-width: 68rem;
 margin: 0 auto;
 padding: clamp(2rem, 5vw, 4.5rem) var(--gutter) 4rem;
 min-height: 100vh;
 display: flex;
 flex-direction: column;
}

/* ---------- masthead ---------- */

.masthead {
 display: flex;
 justify-content: space-between;
 align-items: center;
 gap: 1.5rem;
 flex-wrap: wrap;
 padding-bottom: 1.1rem;
 border-bottom: var(--rail) solid var(--rule);
}

.masthead__right {
 display: flex;
 align-items: center;
 gap: 1.5rem;
}

/* byte display — 8 cells representing one byte, cycling ASCII */
.byte-display {
 display: grid;
 grid-template-columns: repeat(4, 1fr);
 gap: 2.5px;
}

.byte-cell {
 width: 7px;
 height: 7px;
 border-radius: 1.5px;
 background: var(--signal);
 opacity: 0.06;
 transition: opacity 400ms ease-in-out;
}

.byte-cell.on {
 opacity: 0.85;
}

.wordmark {
 font-family: var(--font-inst);
 font-size: clamp(0.78rem, 1.6vw, 0.95rem);
 font-weight: 700;
 letter-spacing: 0.42em;
 text-transform: uppercase;
 color: var(--ink);
 text-decoration: none;
 white-space: nowrap;
}

.wordmark:hover {
 color: var(--ink-mute);
}

.masthead__nav {
 display: flex;
 gap: 1.5rem;
}

.masthead__nav a {
 font-family: var(--font-inst);
 font-size: var(--step--1);
 letter-spacing: 0.22em;
 text-transform: uppercase;
 color: var(--ink-mute);
 text-decoration: none;
 transition: color 180ms ease;
}

.masthead__nav a:hover {
 color: var(--ink);
}

/* ---------- the corridor ----------
   A single hairline runs the height of the page. Doors branch off it.
   No animation — this is the building at night. */

.corridor {
 position: relative;
 flex: 1;
 padding-left: clamp(1.75rem, 4vw, 3.25rem);
 padding-top: clamp(0.5rem, 4vh, 3rem);
 padding-bottom: 4rem;
}

.corridor::before {
 content: "";
 position: absolute;
 left: 0;
 top: 0;
 bottom: 0;
 width: var(--rail);
 background: var(--rule);
}

/* ---------- thesis ---------- */

.thesis {
 max-width: 46ch;
}

.thesis p {
 font-size: clamp(1.1rem, 2.6vw, 1.8rem);
 line-height: 1.32;
 font-weight: 300;
 letter-spacing: -0.01em;
 margin: 0 0 0.2rem;
 text-wrap: balance;
}

/* ---------- the door ---------- */

.doors {
 margin-top: clamp(3rem, 10vh, 7rem);
 display: flex;
 flex-direction: column;
 gap: 1px;
}

.door {
 position: relative;
 display: grid;
 grid-template-columns: 1fr auto;
 align-items: center;
 gap: 1rem 2rem;
 padding: 1.4rem 1.6rem 1.4rem 0;
 text-decoration: none;
 color: inherit;
 border-top: var(--rail) solid var(--rule);
 transition:
  background 260ms ease,
  padding-left 260ms ease;
}

.doors > .door:last-child {
 border-bottom: var(--rail) solid var(--rule);
}

.door::before {
 content: "";
 position: absolute;
 left: calc(-1 * clamp(1.75rem, 4vw, 3.25rem));
 top: -1px;
 width: clamp(1.75rem, 4vw, 3.25rem);
 height: var(--rail);
 background: var(--rule);
 transition: background 260ms ease;
}

.door__name {
 font-size: clamp(1.25rem, 2.8vw, 1.9rem);
 font-weight: 700;
 letter-spacing: 0.12em;
 text-transform: uppercase;
 line-height: 1.1;
}

.door__mark {
 grid-row: 1;
 grid-column: 2;
 font-family: var(--font-data);
 font-size: var(--step--1);
 letter-spacing: 0.18em;
 color: var(--ink-mute);
 transition:
  color 260ms ease,
  transform 260ms ease;
}

.door:hover,
.door:focus-visible {
 background: linear-gradient(
  to right,
  color-mix(in srgb, var(--signal) 16%, transparent),
  transparent 72%
 );
 padding-left: 1.1rem;
 outline: none;
}

.door:hover .door__mark,
.door:focus-visible .door__mark {
 color: var(--signal);
 transform: translateX(0.35rem);
}

.door:focus-visible {
 box-shadow: inset 0 0 0 2px var(--signal);
}

/* ---------- focus — the popular links held inside a door ----------
   One door carries a sub-block: a label and the short list of links most
   worth reaching. The wrapper is not decoration. A door is an <a>, and an
   anchor cannot contain another anchor, so the sub-block has to be a
   sibling — the group is what keeps the row reading as a single unit, and
   what carries the row's rule and its tick back to the rail. */

.door-group {
 position: relative;
 display: flex;
 flex-direction: column;
 border-top: var(--rail) solid var(--rule);
}

.door-group > .door {
 border-top: none;
}

/* The group draws the tick; the door inside it would draw a second one at the
   same pixel. Suppressed rather than left as a coincidentally-identical
   overlap — one owner for the rail connection. */
.door-group > .door::before {
 display: none;
}

.door-group::before {
 content: "";
 position: absolute;
 left: calc(-1 * clamp(1.75rem, 4vw, 3.25rem));
 top: -1px;
 width: clamp(1.75rem, 4vw, 3.25rem);
 height: var(--rail);
 background: var(--rule);
 transition: background 260ms ease;
}

.focus {
 display: flex;
 flex-direction: column;
 gap: 0.55rem;
 padding: 0 1.6rem 1.4rem clamp(1.25rem, 3vw, 2.25rem);
}

.focus__label {
 font-family: var(--font-data);
 font-size: var(--step--1);
 letter-spacing: 0.2em;
 text-transform: uppercase;
 color: var(--ink-mute);
}

.focus__links {
 display: flex;
 flex-wrap: wrap;
 gap: 0.5rem 1.5rem;
 margin: 0;
}

.focus__links a {
 display: inline-flex;
 align-items: baseline;
 gap: 0.5rem;
 font-family: var(--font-inst);
 font-size: var(--step-0);
 font-weight: 600;
 letter-spacing: 0.14em;
 text-transform: uppercase;
 color: var(--ink);
 text-decoration: none;
 border-bottom: var(--rail) solid transparent;
 transition:
  color 260ms ease,
  border-color 260ms ease;
}

.focus__mark {
 font-family: var(--font-data);
 font-size: var(--step--1);
 color: var(--ink-mute);
 transition:
  color 260ms ease,
  transform 260ms ease;
}

.focus__links a:hover,
.focus__links a:focus-visible {
 color: var(--signal);
 border-bottom-color: var(--signal);
 outline: none;
}

.focus__links a:focus-visible {
 border-bottom-color: transparent;
 box-shadow: inset 0 0 0 2px var(--signal);
}

.focus__links a:hover .focus__mark,
.focus__links a:focus-visible .focus__mark {
 color: var(--signal);
 transform: translateX(0.3rem);
}

/* ---------- prose (interior pages) ---------- */

.prose {
 max-width: var(--measure);
 font-family: var(--font-read);
 font-size: var(--step-0);
 flex: 1;
 padding-top: clamp(2rem, 6vh, 4rem);
 padding-bottom: 3rem;
}

/* Headings switch back to the institutional face */
.prose h1,
.prose h2,
.prose h3,
.prose h4 {
 font-family: var(--font-inst);
}

.prose h1 {
 font-size: clamp(1.9rem, 5vw, 3.1rem);
 font-weight: 700;
 letter-spacing: 0.06em;
 text-transform: uppercase;
 line-height: 1.08;
 margin: 0 0 1.5rem;
 text-wrap: balance;
 border-bottom: var(--rail) solid var(--rule);
 padding-bottom: 0.4rem;
}

.prose h2 {
 font-size: clamp(1.05rem, 2vw, 1.3rem);
 font-weight: 700;
 letter-spacing: 0.16em;
 text-transform: uppercase;
 margin: 2.8rem 0 0.8rem;
 padding-top: 0.8rem;
 border-top: var(--rail) solid var(--rule);
}

.prose h3 {
 font-size: var(--step-0);
 font-weight: 700;
 letter-spacing: 0.06em;
 margin: 2rem 0 0.5rem;
}

.prose h4 {
 font-size: 0.9rem;
 font-weight: 600;
 letter-spacing: 0.04em;
 margin: 1.5rem 0 0.4rem;
}

/* ---------- heading markers ----------
   The org headline bullets, as far as the type allows. Plex carries U+2192
   (the door mark) but no circle and no triangle, so the ring is drawn and
   both arrows are that one glyph, separated by weight and tone rather than
   by shape. Level 1 is a circle, level 2 a light arrow, level 3 a solid one
   — the same order the org docs use. Signal is never used here: headings
   are ink. */

.prose h2::before {
 content: "";
 display: inline-block;
 inline-size: 0.5em;
 block-size: 0.5em;
 border: 1.5px solid var(--ink-mute);
 border-radius: 50%;
 margin-inline-end: 0.55em;
}

.prose h3::before {
 content: "\2192";
 color: var(--ink-mute);
 font-weight: 400;
 margin-inline-end: 0.5em;
}

.prose h4::before {
 content: "\2192";
 color: var(--ink);
 font-weight: 700;
 margin-inline-end: 0.5em;
}

.prose p {
 margin: 0 0 1.15rem;
 line-height: 1.72;
}

/* body links are ink + hairline. Signal is NOT the link affordance. */
.prose a {
 color: var(--ink);
 text-decoration: none;
 border-bottom: 1px solid var(--ink-mute);
 transition:
  border-color 200ms ease,
  color 200ms ease;
}

.prose a:hover {
 border-bottom-color: var(--signal);
}

.prose ul,
.prose ol {
 padding-left: 1.1rem;
 margin: 0 0 1.15rem;
}

.prose li {
 margin-bottom: 0.35rem;
}

.prose li::marker {
 color: var(--ink-mute);
}

.prose code {
 font-family: var(--font-data);
 font-size: 0.86em;
 background: var(--ground-raise);
 padding: 0.12em 0.36em;
}

/* Org src/example blocks. Only one page has one, but without this a <pre>
   takes browser defaults: no padding, no background, and long lines run off
   the column instead of scrolling. */
.prose pre {
 font-family: var(--font-data);
 font-size: var(--step--1);
 line-height: 1.55;
 background: var(--ground-raise);
 padding: 1rem 1.1rem;
 margin: 0 0 1.5rem;
 overflow-x: auto;
}

/* Copy button for code blocks. It lives in a wrapper rather than inside the
   <pre>: the <pre> scrolls horizontally, and an absolutely positioned child
   would scroll out of the corner with the code. Styled off .theme-toggle, so
   it reads as the same kind of object. */
.code-wrap {
 position: relative;
}

.copy-btn {
 position: absolute;
 top: 0.5rem;
 right: 0.5rem;
 background: var(--ground);
 border: var(--rail) solid var(--rule);
 padding: 0.3rem 0.5rem;
 font-family: var(--font-data);
 font-size: var(--step--1);
 letter-spacing: 0.1em;
 text-transform: uppercase;
 cursor: pointer;
 color: var(--ink-mute);
}

.copy-btn:hover,
.copy-btn:focus-visible {
 color: var(--ink);
 border-color: var(--signal);
}

.copy-btn[data-copied] {
 color: var(--signal);
 border-color: var(--signal);
}

.prose blockquote {
 margin: 1.5rem 0;
 padding-left: 1.2rem;
 border-left: 2px solid var(--signal);
}

.prose table {
 width: 100%;
 border-collapse: collapse;
 font-size: var(--step-0);
 margin: 0 0 1.5rem;
}

.prose th,
.prose td {
 text-align: left;
 padding: 0.55rem 0.9rem 0.55rem 0;
 border-bottom: var(--rail) solid var(--rule);
 vertical-align: top;
}

.prose th {
 font-family: var(--font-data);
 font-size: var(--step--1);
 letter-spacing: 0.18em;
 text-transform: uppercase;
 color: var(--ink-mute);
 font-weight: 400;
}

/* ---------- plate ---------- */

.plate {
 margin-top: auto;
 padding-top: 1.1rem;
 border-top: var(--rail) solid var(--rule);
 display: flex;
 justify-content: space-between;
 gap: 1rem 2rem;
 flex-wrap: wrap;
 font-family: var(--font-data);
 font-size: var(--step--1);
 letter-spacing: 0.2em;
 text-transform: uppercase;
 color: var(--ink-mute);
}

.plate a {
 color: var(--ink-mute);
 text-decoration: none;
}

.plate a:hover {
 color: var(--ink);
}

/* ---------- theme toggle ---------- */

.theme-toggle {
 position: fixed;
 bottom: 1.5rem;
 right: 1.5rem;
 background: var(--ground-raise);
 border: var(--rail) solid var(--rule);
 padding: 0.45rem 0.7rem;
 font-family: var(--font-data);
 font-size: var(--step--1);
 letter-spacing: 0.1em;
 text-transform: uppercase;
 cursor: pointer;
 color: var(--ink-mute);
 transition:
  background 180ms ease,
  color 180ms ease;
}

.theme-toggle:hover {
 background: var(--ink);
 color: var(--ground);
}

/* ---------- gallery ---------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0 0;
}

.gallery__item {
  margin: 0;
  display: flex;
  flex-direction: column;
}

.gallery__item a {
  display: block;
  line-height: 0;
  border-bottom: none;
  text-decoration: none;
}

.gallery__item img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--rule);
  transition: border-color 260ms ease, opacity 260ms ease;
}

.gallery__item a:hover img,
.gallery__item a:focus-visible img {
  border-color: var(--signal);
  opacity: 0.92;
}

/* ---------- inline screenshots and the lightbox ----------
   A figure in the run of the text. The link points at the image itself, so
   with no script a click still opens it full size; with script it opens in
   the lightbox instead. */

.shot {
  margin: 1.6rem 0 2rem;
}

.prose .shot a {
  display: block;
  line-height: 0;
  border-bottom: none;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  transition: border-color 260ms ease;
}

.shot a:hover img,
.shot a:focus-visible img {
  border-color: var(--signal);
}

a.zoom,
.gallery__item a {
  cursor: zoom-in;
}

/* A native <dialog>: Escape closes it, focus is trapped while it is open and
   returned to the link when it closes, with no code for any of that. */
.lightbox {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 96vw;
  max-height: 96vh;
  overflow: visible;
  cursor: zoom-out;
}

.lightbox::backdrop {
  background: color-mix(in srgb, var(--ground) 94%, transparent);
}

.lightbox img {
  display: block;
  width: auto;
  height: auto;
  max-width: 96vw;
  max-height: 92vh;
  border: 1px solid var(--rule);
}

.gallery__copyright {
  font-family: var(--font-data);
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  color: var(--ink-mute);
  margin: 2rem 0 0;
}

.gallery__caption {
  font-family: var(--font-data);
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  color: var(--ink-mute);
  padding-top: 0.5rem;
  line-height: 1.4;
}

/* ---------- responsive ---------- */

@media (max-width: 34rem) {
 body {
  font-size: 16px;
 }
 .masthead {
  gap: 0.5rem;
 }
 .masthead__right {
  gap: 0.75rem;
 }
 .byte-display {
  display: none;
 }
 .door {
  padding-right: 0;
 }
 .focus {
  padding-right: 0;
 }
 /* A wide table scrolls inside itself on a phone rather than pushing the
    whole page sideways. */
 .prose table {
  display: block;
  overflow-x: auto;
 }
 .theme-toggle {
  bottom: 0.75rem;
  right: 0.75rem;
 }
}

/* ---------- now ---------- */

/* A photograph at the head of a Now entry. Capped at a column width rather than
   the measure: a portrait at full measure runs longer than a screen. */
/* The photo is a lightbox link; it must not pick up the body-link hairline. */
.now-photo a,
.prose .now-photo a {
 display: block;
 width: fit-content;
 line-height: 0;
 border-bottom: none;
}

.now-photo a:hover img,
.now-photo a:focus-visible img {
 border-color: var(--signal);
}

.now-photo img {
 display: block;
 width: 100%;
 max-width: 26rem;
 height: auto;
 border: 1px solid var(--rule);
 margin: 1.2rem 0 1.6rem;
}

/* The newest Now entry, repeated under the Now door on the landing page. It is
   the same export the Now page gets, so it cannot fall out of step -- which is
   why the heading is styled here rather than rewritten for the teaser. */
.now-teaser {
 max-width: 46ch;
 padding: 0 1.6rem 1.5rem clamp(1.25rem, 3vw, 2.25rem);
}

.now-teaser h2 {
 font-family: var(--font-data);
 font-size: var(--step--1);
 letter-spacing: 0.2em;
 text-transform: uppercase;
 color: var(--ink-mute);
 margin: 0 0 0.6rem;
}

.now-teaser p {
 font-family: var(--font-read);
 font-size: var(--step-0);
 line-height: 1.5;
 margin: 0 0 0.7rem;
}

.now-teaser p:last-child {
 margin-bottom: 0;
}

/* Smaller than on the Now page: on the landing page it is a taste of the
   entry, not the entry. */
.now-teaser .now-photo img {
 max-width: 15rem;
 margin: 0 0 1rem;
}

/* ---------- selection ---------- */

::selection {
 background: var(--ink);
 color: var(--ground);
}

/* ---------- photo grids ---------- */

/* A set of photographs, each on the hairline rule. Equal columns and natural
   heights: no cropping, because cutting a person out of a family photograph is
   worse than a ragged bottom edge. Used by the memorial page and About. */
.photo-grid {
 display: grid;
 grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
 gap: 1rem 1.25rem;
 align-items: start;
 margin: 0 0 2rem;
}

.photo-grid img {
 display: block;
 width: 100%;
 height: auto;
 border: 1px solid var(--rule);
}

/* Equal-height variant: a row sits level without losing any of the frame.
   Both photographs are scaled to one height and keep their own width, so the
   tall portrait stays tall and narrow beside the wide one. Fitting them to a
   common ratio is the other way to level a row, and it takes the top of a
   head with it -- which is not a trade worth making for a tidy edge. */
.photo-grid--even {
 display: flex;
 flex-wrap: wrap;
 gap: 1rem 1.25rem;
 align-items: flex-start;
 margin: 0 0 2rem;
}

.photo-grid--even img {
 width: auto;
 /* Sized to fit two frames across the prose measure, because a row that wraps
    is not a row. The measure, not the window, is the limit here. */
 height: clamp(11rem, 22vw, 16rem);
 max-width: 100%;
}
