/* AI Workflow Builders Live. The "departure board" look (Connor picked it on 1 Dec 2026).
   Colours: pattern_engine brand/tokens.css. Rust is for "live" only.
   The login mail (src/views/mail.ts) holds a copy of these colours; a test keeps the two the same.
   Type:
   - Big Shoulders Display: the board, headings and labels. It is sign lettering, so labels are in capitals.
   - IBM Plex Sans: text and controls.
   - DM Mono: numbers.
   Spacing: one scale (--s0 to --s7). The page sets the space between sections (--gap-section);
   a section sets the space between its own parts. No part adds outside margin of its own. */

@font-face { font-family: "Big Shoulders Display"; src: url("/fonts/BigShouldersDisplay.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/IBMPlexSans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/IBMPlexSans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "DM Mono"; src: url("/fonts/DMMono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "DM Mono"; src: url("/fonts/DMMono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --pe-paper: #F5F2EA;
  --pe-charcoal: #252923;
  --pe-olive: #484C45;
  --pe-stone: #BCC2AA;
  --pe-tint: #ECE5D6;
  --pe-rust: #BD7048;

  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --s0: 4px; --s1: 8px; --s15: 12px; --s2: 16px; --s3: 24px; --s4: 32px; --s5: 48px; --s6: 64px; --s7: 96px;
  --pad: clamp(16px, 4vw, 40px);
  --gap-section: clamp(32px, 5vw, 56px);
  --radius: 8px;
  --radius-panel: 12px;
  --control: 48px;

  /* Dark is the start value: the room is a dark room. */
  color-scheme: dark;
  --ink: var(--pe-paper);
  --ink-soft: var(--pe-stone);
  --ground: var(--pe-charcoal);
  --panel: #2E332B;
  --well: var(--pe-charcoal);
  --rule: var(--pe-olive);
  --edge: #7C8372; /* the edge of a control: 3:1 or more on the ground and on a panel */
  --live: var(--pe-rust);
  --button-ground: var(--pe-paper);
  --button-ink: var(--pe-charcoal);
}
:root[data-theme="light"] {
  color-scheme: light;
  --ink: var(--pe-charcoal);
  --ink-soft: var(--pe-olive);
  --ground: var(--pe-paper);
  --panel: var(--pe-tint);
  --well: var(--pe-paper);
  --rule: var(--pe-stone);
  --edge: #71786A;
  /* Rust on cream is too light for small text. This darker rust passes for text. */
  --live: #9A4F2B;
  --button-ground: var(--pe-charcoal);
  --button-ink: var(--pe-paper);
}

/* Pictures that have one file for each theme. Only the file for the theme in use is loaded. */
.flask { display: block; flex: none; width: 34px; height: 34px; background: url("/logo/flask-on-charcoal.png") center / contain no-repeat; }
.spark-rule { display: block; width: 100%; aspect-ratio: 18 / 1; background: url("/logo/spark-rule.svg") right center / contain no-repeat; }
:root[data-theme="light"] .flask { background-image: url("/logo/flask-on-paper.png"); }
:root[data-theme="light"] .spark-rule { background-image: url("/logo/spark-rule-light.svg"); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--ground);
  /* The same soft light as the dark sections of patternengine.ai. */
  background-image: radial-gradient(at 88% 12%, rgba(141, 164, 126, 0.10), rgba(0, 0, 0, 0) 60%);
  background-attachment: fixed;
}
:root[data-theme="light"] body { background-image: none; }

h1, h2, h3, p, ul, ol, fieldset, legend { margin: 0; padding: 0; }
fieldset { border: 0; min-width: 0; }
ul, ol { list-style: none; }
img { max-width: 100%; }
a { color: var(--ink); text-underline-offset: 3px; }
h1, h2, .panel-title, .board-label {
  font-family: var(--display);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
h1 { font-size: clamp(34px, 6vw, 56px); }
h2 { font-size: clamp(22px, 3vw, 28px); }

/* ---------- Frame ---------- */

.masthead, .screen, .footer { width: 100%; max-width: 1120px; margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }
.masthead { padding-top: var(--s2); padding-bottom: var(--s2); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s1) var(--s3); }
.brand { display: inline-flex; align-items: center; gap: var(--s15); color: var(--ink); text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 22px; line-height: 1; letter-spacing: 0.03em; text-transform: uppercase; }
.brand-live { color: var(--live); }

.icon { flex: none; display: block; }
/* The door's one other road. Only the words carry the line, so the icon and the arrow do not break it. */
.door-link { display: inline-flex; align-items: flex-start; gap: var(--s1); padding: 12px 0; font: 500 13px/1.5 var(--mono); color: var(--ink-soft); text-decoration: none; }
.door-link .icon { margin-top: -1px; }
/* The arrow sits in the same line of text as the last word, so it stays next to it when the words wrap. */
.door-link-text { min-width: 0; }
.door-link-words { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.door-link-arrow { display: inline-block; transition: transform 120ms ease; }
.door-link:hover { color: var(--ink); }
.door-link:hover .door-link-arrow { transform: translateX(3px); }
@media (prefers-reduced-motion: reduce) { .door-link-arrow { transition: none; } }
.code-input { font: 500 22px/1 var(--mono); letter-spacing: 0.3em; }

.menu { display: flex; align-items: center; gap: var(--s0); }
.menu a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 var(--s15);
  border-radius: var(--radius);
  font: 600 15px/1 var(--sans);
  color: var(--ink-soft);
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
}
.menu a:hover { color: var(--ink); }
.menu a[aria-current="page"] { color: var(--ink); background: var(--panel); }

.screen { flex: 1; padding-top: clamp(20px, 4vw, 48px); padding-bottom: var(--s6); display: flex; flex-direction: column; gap: var(--gap-section); }
:where(.screen > section) { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.narrow { max-width: 640px; }
/* A page of text: About, Privacy, Terms. */
.prose { max-width: 680px; gap: var(--s2); }
.prose h2 { margin-top: var(--s1); }
.plain { list-style: disc; padding-left: var(--s3); display: flex; flex-direction: column; gap: var(--s1); }
.small { font-size: 13px; }
table.wrap th, table.wrap td { white-space: normal; vertical-align: top; min-width: 150px; }
.screen-door, .screen-none { justify-content: center; padding-bottom: clamp(48px, 16vh, 160px); }
.note, .way-in { max-width: 560px; }
.way-in { gap: var(--s2); }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 var(--s3); }
.footer { padding-top: var(--s2); padding-bottom: var(--s4); font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s1) var(--s3); }
/* The theme marker: one icon at the bottom right. A press opens the three choices above it. */
.theme { position: relative; margin-left: auto; }
.theme-toggle { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; color: var(--ink-soft); background: none; border: 1px solid var(--edge); border-radius: 50%; cursor: pointer; }
.theme-toggle:hover, .theme-toggle[aria-expanded="true"] { color: var(--ink); }
.theme-now { display: none; }
:root:not([data-theme-pick]) .theme-now-system,
:root[data-theme-pick="system"] .theme-now-system,
:root[data-theme-pick="dark"] .theme-now-dark,
:root[data-theme-pick="light"] .theme-now-light { display: block; }
.theme-menu { position: absolute; right: 0; bottom: calc(100% + var(--s1)); z-index: 10; display: flex; flex-direction: column; gap: 2px; min-width: 150px; padding: 4px; background: var(--panel); border: 1px solid var(--edge); border-radius: var(--radius); }
.theme-menu[hidden] { display: none; }
.theme-menu button { display: flex; align-items: center; gap: var(--s15); min-height: 44px; padding: 0 var(--s15); font: 600 14px/1 var(--sans); color: var(--ink-soft); background: none; border: 0; border-radius: 6px; text-align: left; cursor: pointer; }
.theme-menu button:hover { color: var(--ink); }
.theme-menu button[aria-pressed="true"] { color: var(--ground); background: var(--ink); }
.footer a { color: var(--ink-soft); display: inline-flex; align-items: center; min-height: 40px; }

/* ---------- The board ---------- */

.hero { gap: var(--s15); align-self: flex-start; max-width: 100%; }
.board {
  --flap: clamp(30px, 10.4vw, 104px);
  display: flex;
  align-items: flex-end;
  gap: calc(var(--flap) * 0.08);
  font-family: var(--display);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.board[data-size="medium"] { --flap: clamp(22px, 7.2vw, 78px); }
.board[data-size="small"] { --flap: clamp(16px, 5.4vw, 56px); }
/* Before the script runs, or with no script: the plain number, large. */
.board:not([data-shown]) { font-size: clamp(56px, 14vw, 150px); min-height: calc(var(--flap) * 1.42); align-items: center; }
.flap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--flap);
  height: calc(var(--flap) * 1.42);
  font-size: calc(var(--flap) * 1.3);
  color: var(--pe-paper);
  /* Two flat halves, as on a real flap. The tiles stay dark in the light theme, like a real board on a wall. */
  background: linear-gradient(#3B4136 0 50%, #2F342A 50% 100%);
  border-radius: calc(var(--flap) * 0.08);
}
.flap::after { content: ""; position: absolute; left: 0; right: 0; top: calc(50% - 1px); height: 2px; background: var(--pe-charcoal); }
.flap-gap { width: calc(var(--flap) * 0.14); font-size: 0; }
.flap-turn { animation: flap-turn 420ms cubic-bezier(0.2, 0.7, 0.2, 1); transform-origin: center; }
@keyframes flap-turn {
  from { transform: perspective(600px) rotateX(-88deg); filter: brightness(1.6); }
  to { transform: perspective(600px) rotateX(0); filter: brightness(1); }
}

.board-line { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 var(--s3); }
.board-label { font-weight: 600; font-size: clamp(18px, 2.6vw, 26px); letter-spacing: 0.08em; color: var(--ink-soft); }
.board-title { margin-left: var(--s15); color: var(--ink); }
.board-aside { font-family: var(--mono); font-size: 13px; color: var(--ink-soft); }
.board-aside a { color: var(--ink-soft); display: inline-block; padding: var(--s15) 0; }

/* ---------- Panels ---------- */

.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: var(--s3); align-items: start; }
.panel { background: var(--panel); border-radius: var(--radius-panel); padding: var(--s3); display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s1) var(--s2); min-height: 36px; }
.panel-title { font-size: 20px; letter-spacing: 0.08em; }
.panel-note { font-size: 13px; color: var(--ink-soft); }

.live-dot { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--live); animation: live-dot 1.6s ease-in-out infinite; }
@keyframes live-dot { 50% { opacity: 0.35; } }

/* The switch: one panel, two views. It works with no script. */
.switch { display: inline-flex; padding: 3px; border-radius: var(--radius); background: var(--well); border: 1px solid var(--edge); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch label { padding: 6px var(--s15); border-radius: 6px; font-size: 14px; font-weight: 600; color: var(--ink-soft); cursor: pointer; }
.switch input:checked + label { background: var(--ink); color: var(--ground); }
.switch input:focus-visible + label { outline: 3px solid var(--ink); outline-offset: 2px; }
.switch-panel .view-projects { display: none; }
.switch-panel:has(#view-projects:checked) .view-projects { display: block; }
.switch-panel:has(#view-projects:checked) .view-builders { display: none; }

.rank li { display: grid; grid-template-columns: 1fr auto; gap: var(--s0) var(--s2); padding: var(--s1) 0; align-items: baseline; }
.rank-name { font-weight: 600; overflow-wrap: break-word; min-width: 0; }
.rank-detail { font-weight: 400; color: var(--ink-soft); }
.rank-value { font-family: var(--mono); font-size: 14px; font-variant-numeric: tabular-nums; }
.share { grid-column: 1 / -1; display: block; width: 100%; height: 4px; border-radius: 2px; background: var(--well); fill: var(--ink-soft); }

.feed li { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s15); align-items: baseline; padding: var(--s1) 0; border-top: 1px solid var(--rule); font-size: 14px; }
.feed li:first-child { border-top: 0; }
.feed-time, .feed-add { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.feed-time { color: var(--ink-soft); }
.feed-what { overflow-wrap: anywhere; }
.feed-new { animation: feed-new 900ms ease-out; }
@keyframes feed-new { from { opacity: 0; transform: translateY(-6px); } }

.empty, .quiet { color: var(--ink-soft); }
.mono { font-family: var(--mono); font-size: 0.9em; font-variant-numeric: tabular-nums; }

/* The ledger (Shipped screen): name, a dotted leader, the value. */
.ledger li { display: flex; align-items: baseline; gap: var(--s1); padding: var(--s1) 0; }
.ledger-name { font-weight: 600; overflow-wrap: break-word; min-width: 0; }
.ledger-detail { font-weight: 400; color: var(--ink-soft); }
.ledger-leader { flex: 1; min-width: var(--s2); border-bottom: 2px dotted var(--rule); transform: translateY(-4px); }
.ledger-value { font-family: var(--mono); font-size: 14px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
@media (max-width: 480px) { .ledger li { flex-wrap: wrap; } .ledger-leader { display: none; } .ledger-value { flex-basis: 100%; text-align: left; color: var(--ink-soft); } }

.rows li { display: grid; grid-template-columns: 1fr auto auto; gap: var(--s1) var(--s3); align-items: baseline; padding: var(--s15) 0; border-bottom: 1px solid var(--rule); }
.rows form { margin: 0; }
@media (max-width: 520px) { .rows li { grid-template-columns: 1fr auto; } .rows li > :first-child { grid-column: 1 / -1; } }

/* The shelf: shipped things with details. */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: var(--s3); align-items: start; }
.shelf-item { background: var(--panel); border-radius: var(--radius-panel); overflow: hidden; display: flex; flex-direction: column; }
.shelf-picture { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; }
.shelf-text { padding: var(--s3); display: flex; flex-direction: column; gap: var(--s1); }
.shelf-name, .card-title { font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1.05; letter-spacing: 0.03em; text-transform: uppercase; overflow-wrap: anywhere; }
.shelf-builder { color: var(--ink-soft); font-size: 14px; }
.shelf-blurb { overflow-wrap: anywhere; }

/* ---------- Forms ---------- */

label { display: block; font-weight: 600; font-size: 14px; }
.field { display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), textarea {
  width: 100%;
  min-height: var(--control);
  font: inherit;
  color: var(--ink);
  background: var(--well);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: var(--s15) var(--s2);
}
textarea { resize: vertical; }
input::placeholder { color: var(--ink-soft); opacity: 0.8; }
/* Text fields show focus with a heavier edge. Tick boxes and radio buttons keep the ring from :focus-visible below. */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus-visible, textarea:focus-visible { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); flex: none; }
input[type="file"] { font: inherit; font-size: 14px; color: var(--ink-soft); max-width: 100%; }
input[type="file"]::file-selector-button { min-height: 40px; margin-right: var(--s15); padding: 0 var(--s2); font: 600 14px/1 var(--sans); color: var(--ink); background: transparent; border: 1px solid var(--edge); border-radius: var(--radius); cursor: pointer; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control);
  padding: 0 var(--s3);
  font: 600 16px/1 var(--sans);
  color: var(--button-ink);
  background: var(--button-ground);
  border: 2px solid var(--button-ground);
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.button-quiet { min-height: 40px; padding: 0 var(--s2); font-size: 14px; color: var(--ink); background: transparent; border: 1px solid var(--edge); }
.link-button { min-height: 40px; padding: 0; color: var(--ink); background: none; border: 0; font-weight: 400; text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.stack { display: flex; flex-direction: column; gap: var(--s2); }
.check { display: flex; align-items: center; gap: var(--s15); min-height: 40px; font-weight: 400; font-size: 16px; }
legend { margin-bottom: var(--s1); }
.one-line { display: grid; grid-template-columns: 1fr auto; gap: var(--s1); }
.one-line .cf-turnstile { grid-column: 1 / -1; }
@media (max-width: 440px) { .one-line { grid-template-columns: 1fr; } }

.sprint-form { display: grid; grid-template-columns: 2fr 1fr; gap: var(--s2); align-items: end; }
.sprint-form .wide { grid-column: 1 / -1; }
.sprint-form button { justify-self: start; }
@media (max-width: 520px) { .sprint-form { grid-template-columns: 1fr; } }
.key-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: var(--s2); align-items: end; }
@media (max-width: 640px) { .key-form { grid-template-columns: 1fr; } }
.add { padding-top: var(--s4); border-top: 1px solid var(--rule); }
.add-form { display: grid; grid-template-columns: 2fr 1fr auto; gap: var(--s2); align-items: end; }
@media (max-width: 640px) { .add-form { grid-template-columns: 1fr; } }

.problem, .notice { border-left: 4px solid var(--ink); background: var(--panel); padding: var(--s2); font-weight: 600; border-radius: 0 var(--radius) var(--radius) 0; }

/* ---------- Me: project cards, connect ---------- */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: var(--s3); }
.card { background: var(--panel); border-radius: var(--radius-panel); padding: var(--s3); display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s1) var(--s2); }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); padding-top: var(--s3); border-top: 1px solid var(--rule); }
.card-foot form { margin: 0; }
.file-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); min-width: 0; }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: var(--radius); }
.danger { margin-left: auto; display: inline-flex; align-items: center; min-height: 40px; font-size: 14px; color: var(--ink-soft); }

.notes { display: flex; flex-direction: column; gap: var(--s2); }
.notes li { border-bottom: 1px solid var(--rule); padding-bottom: var(--s1); }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.small-head { font: 600 13px/1 var(--sans); color: var(--ink-soft); margin: 0; }
.ships { display: flex; flex-direction: column; gap: var(--s2); }
.ship { background: var(--well); border-radius: var(--radius); padding: var(--s2); display: flex; flex-direction: column; gap: var(--s2); }
.grow { flex: 1; }
.push { margin-left: auto; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); margin: 0; }
select { min-height: 40px; max-width: 100%; font: inherit; font-size: 14px; color: var(--ink); background: var(--well); border: 1px solid var(--edge); border-radius: var(--radius); padding: 0 var(--s15); }
.shelf-project { font: 600 13px/1.2 var(--sans); color: var(--ink-soft); }
.status { display: flex; align-items: center; gap: var(--s15); font-weight: 600; }
.status .live-dot { background: var(--ink-soft); animation: none; }
.status-on .live-dot { background: var(--live); animation: live-dot 1.6s ease-in-out infinite; }
.copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); min-width: 0; }
.copy-row code { flex: 1; min-width: 0; padding: var(--s15) var(--s2); border-radius: var(--radius); background: var(--panel); font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.steps { list-style: decimal; padding-left: var(--s3); display: flex; flex-direction: column; gap: var(--s2); }
.steps .copy-row { margin-top: var(--s1); }

.foot { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.foot form { margin: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: var(--s15) var(--s1); border-bottom: 1px solid var(--rule); white-space: nowrap; }
th { font-weight: 600; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .flap-turn, .feed-new, .live-dot, .status-on .live-dot { animation: none; }
}
