/* DevOpser Videos. One stylesheet, no framework, strict-CSP friendly.
   The interface is drawn as the thing it sells: a turnaround sheet on cool
   bond paper, blue-black ink, and one red marking pencil for the hero pick. */

@font-face {
  font-family: "Archivo";
  src: url("/static/css/fonts/archivo-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Courier Prime";
  src: url("/static/css/fonts/courier-prime-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bond: #F4F5F1;      /* page: animation bond paper */
  --sheet: #FFFFFF;     /* the drawn sheet, inputs, paste blocks */
  --ink: #243247;       /* text, rules, frames, primary button */
  --graphite: #5B6470;  /* secondary text, hints, captions */
  --red: #BE2F28;       /* marking pencil: the hero pick, errors */
  --guide: #A9D3E6;     /* non-photo blue: guide lines inside empty frames only */
  --rule: #D6D9DE;      /* light separators (never the only boundary of a control) */
  --font-ui: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "Courier Prime", "Courier New", Courier, monospace;
  --wrap: 1120px;
  --radius: 3px;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--bond);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .14em; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { margin: 0 0 .5rem; font-weight: 600; line-height: 1.15; letter-spacing: -0.005em; }
h1 { font-size: 2rem; overflow-wrap: anywhere; }
h2 { font-size: 1.375rem; line-height: 1.25; margin-top: 2.5rem; }
h3 { font-size: 1.0625rem; line-height: 1.35; }
p { margin: 0 0 1rem; max-width: 62ch; }
ul, ol { margin: 0 0 1rem; padding-left: 1.2rem; }
li { margin-bottom: .35rem; }
.display { font-size: clamp(2.25rem, 1.6rem + 2.6vw, 3.25rem); line-height: 1.05; letter-spacing: -0.015em; max-width: 22ch; margin-bottom: 1rem; }
.lead { color: var(--graphite); }
.meta, .fineprint, .hint { color: var(--graphite); font-size: .875rem; line-height: 1.45; }
.lettering { font-size: .8125rem; font-weight: 500; letter-spacing: .02em; line-height: 1.3; }
code { font-family: var(--font-mono); font-size: .95em; background: var(--sheet); padding: 0 .3em; border: 1px solid var(--rule); border-radius: var(--radius); }
pre.prompt { font-family: var(--font-mono); font-size: .9375rem; line-height: 1.5; background: var(--sheet); border: 1px solid var(--ink); padding: 1rem 1.1rem; margin: 0 0 .75rem; white-space: pre-wrap; word-break: break-word; }
pre.prompt.small { font-size: .875rem; color: var(--graphite); }
pre.stack { background: var(--sheet); border: 1px solid var(--rule); padding: 1rem; overflow: auto; font-size: .8rem; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 760px; }
.site-main { padding: 1.5rem 0 4rem; min-height: 60vh; }
.site-main > section.wrap + section.wrap { margin-top: 1rem; }

/* Header and footer: quiet paperwork around the sheet. */
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; padding-top: 1.1rem; padding-bottom: 1.1rem; }
.brand { font-weight: 600; font-size: 1.125rem; text-decoration: none; white-space: nowrap; }
.site-nav { display: flex; align-items: center; gap: .25rem 1.25rem; flex-wrap: wrap; }
.site-nav a { text-decoration: none; font-size: .9375rem; padding: .2rem 0; border-bottom: 2px solid transparent; }
.site-nav a:hover { border-bottom-color: var(--rule); }
.site-nav a.active { border-bottom-color: var(--ink); }
.site-nav a.nav-cta { border: 1px solid var(--ink); border-radius: var(--radius); padding: .4rem .8rem; font-weight: 600; }
.site-nav a.nav-cta:hover { background: var(--sheet); }
.site-footer { border-top: 1px solid var(--rule); padding: 1.5rem 0 2rem; color: var(--graphite); font-size: .875rem; }
.footer-links { list-style: none; padding: 0; margin: 0; display: flex; gap: 1.25rem; flex-wrap: wrap; }

/* Buttons: pressed objects get a 3px radius; everything drawn stays square. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .6rem 1rem; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--sheet); color: var(--ink); font: inherit; font-size: .9375rem; font-weight: 600; line-height: 1.25; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--bond); text-decoration: none; }
.btn-primary { background: var(--ink); color: var(--bond); }
.btn-primary:hover { background: #1B2636; }
.btn-ghost { background: transparent; }
.btn-lg { padding: .8rem 1.25rem; font-size: 1.0625rem; }
.btn-sm { padding: .3rem .65rem; font-size: .8125rem; }
.btn-text { border: 0; background: none; padding: 0; font-weight: 500; text-decoration: underline; text-underline-offset: .14em; }
.btn-text:hover { background: none; text-decoration-thickness: 2px; }
.btn-danger { color: var(--red); }
.btn.disabled, .btn[disabled], .btn[aria-disabled="true"] { background: var(--bond); color: var(--graphite); border-color: var(--rule); pointer-events: none; cursor: default; }
.cta-row { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; margin: 1.25rem 0 .5rem; max-width: none; }
.hero { padding-top: 1.5rem; }
.hero .fineprint { margin-bottom: 0; }

/* Notes and errors. */
.notice { border-left: 3px solid var(--ink); background: var(--sheet); padding: .6rem .9rem; margin: 1rem 0; max-width: none; }
.alert { border-left: 3px solid var(--red); background: var(--sheet); color: var(--red); padding: .6rem .9rem; margin: 0 0 1rem; }
.alert ul { margin: 0; }
.alert a { color: inherit; }
.empty { color: var(--graphite); }

/* The sheet: the one drawn object on the site. */
.sheet { background: var(--sheet); border: 1px solid var(--ink); padding: clamp(14px, 2.2vw, 28px); margin: 2rem 0 1rem; }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem 2rem; flex-wrap: wrap; border-bottom: 1px solid var(--ink); padding-bottom: .6rem; margin-bottom: clamp(14px, 2vw, 24px); }
.sheet-head .lettering { margin: 0; max-width: none; }
.sheet-fields { display: flex; gap: .5rem 1.5rem; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.sheet-fields li { margin: 0; color: var(--graphite); }
.sheet-fields b { font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.blank { display: inline-block; min-width: 7ch; border-bottom: 1px solid var(--ink); vertical-align: baseline; height: .9em; }
.frames { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(10px, 1.6vw, 20px); list-style: none; margin: 0; padding: 0; align-items: start; }
.frame { margin: 0; }
.frame-box { position: relative; border: 1px solid var(--ink); background: var(--sheet); aspect-ratio: 2 / 3; overflow: hidden;
  background-image:
    repeating-linear-gradient(to bottom, transparent 0, transparent calc(25% - 1px), var(--guide) calc(25% - 1px), var(--guide) 25%),
    linear-gradient(to right, transparent calc(50% - .5px), var(--guide) calc(50% - .5px), var(--guide) calc(50% + .5px), transparent calc(50% + .5px)); }
.frame[data-aspect="1:1"] .frame-box { aspect-ratio: 1 / 1; }
.frame-box img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; background: #8C8C8C; }
.frame-note { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: .3rem .5rem; background: rgba(255, 255, 255, .92); color: var(--graphite); font-size: .8125rem; line-height: 1.3; max-width: none; max-height: calc(100% - .5rem); overflow-y: auto; }
.frame[data-state="failed"] .frame-note, .frame[data-state="refused"] .frame-note { color: var(--red); }
.frame[data-state="generating"] .frame-box::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 40%; background: var(--ink); animation: sweep 1.4s linear infinite; }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.frame-cap { text-align: center; margin: .5rem 0 0; max-width: none; }
.frame-cap small { display: block; color: var(--graphite); font-weight: 400; letter-spacing: 0; }
.frame-actions { text-align: center; margin-top: .4rem; min-height: 1.6rem; }
.sheet--reveal .frame-box img { animation: fade 240ms ease-out both; }
.sheet--reveal .frame:nth-child(2) .frame-box img { animation-delay: 90ms; }
.sheet--reveal .frame:nth-child(3) .frame-box img { animation-delay: 180ms; }
.sheet--reveal .frame:nth-child(4) .frame-box img { animation-delay: 270ms; }
.sheet--reveal .frame:nth-child(5) .frame-box img { animation-delay: 360ms; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet-foot { margin: .9rem 0 0; color: var(--graphite); font-size: .875rem; max-width: none; }

/* Plain text structures: no cards, no chrome. */
.index { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.25rem 2rem; }
.index li { margin: 0; }
.index a { font-weight: 600; text-decoration: none; }
.index a:hover { text-decoration: underline; }
.index p { margin: .15rem 0 0; }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem 2.5rem; }
.columns p { margin: 0; }
.ruled { list-style: none; padding: 0; margin: 0 0 1rem; border-top: 1px solid var(--ink); }
.ruled li { margin: 0; padding: .7rem 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: minmax(140px, 1fr) 3fr; gap: .25rem 1.5rem; align-items: baseline; }
.ruled li > a { font-weight: 600; }
.ruled li > span { color: var(--graphite); font-size: .9375rem; }
.strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1.25rem 1rem; list-style: none; padding: 0; margin: 0 0 1rem; }
.strip li { margin: 0; }
.strip a { text-decoration: none; display: block; }
.strip img, .strip .placeholder { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border: 1px solid var(--ink); background: #8C8C8C; }
.strip .placeholder { background: var(--sheet); color: var(--graphite); display: grid; place-items: center; font-size: .8125rem; }
.strip p { margin: .4rem 0 0; max-width: none; }
.strip p b { font-weight: 500; }
.strip .meta { display: block; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.table th { text-align: left; border-bottom: 1px solid var(--ink); padding: .4rem .5rem .5rem; font-size: .8125rem; font-weight: 500; letter-spacing: .02em; white-space: nowrap; }
.table td { border-bottom: 1px solid var(--rule); padding: .6rem .5rem; vertical-align: top; }
.table td.yes { font-weight: 500; }
.table td.no { color: var(--graphite); }
.table td:first-child { padding-left: 0; } .table th:first-child { padding-left: 0; }

/* Create: the sheet's title block being filled in. */
.create-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2rem 3rem; align-items: start; }
.form fieldset { border: 0; border-top: 1px solid var(--ink); padding: .9rem 0 .4rem; margin: 0 0 .75rem; min-width: 0; }
.form legend { padding: 0 .6rem 0 0; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip span { display: inline-block; padding: .4rem .8rem; border: 1px solid var(--graphite); border-radius: 999px; background: var(--sheet); cursor: pointer; font-size: .9375rem; line-height: 1.25; }
.chip input:checked + span { background: var(--ink); color: var(--bond); border-color: var(--ink); font-weight: 500; }
.chip input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 3px; }
.chip.disabled span { opacity: .4; cursor: not-allowed; }
.field { margin-bottom: .9rem; }
.field label { display: block; font-weight: 500; margin-bottom: .25rem; font-size: .9375rem; }
.field input[type=text], .field select, .field textarea { width: 100%; padding: .55rem .7rem; border: 1px solid var(--graphite); border-radius: var(--radius); background: var(--sheet); color: var(--ink); font: inherit; font-size: 1rem; line-height: 1.4; }
.field input:focus-visible, .field select:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.field .hint { margin: .25rem 0 0; }
.submit-row { display: flex; align-items: center; gap: 1rem 1.5rem; flex-wrap: wrap; margin-top: 1.25rem; }
.submit-row .meta { margin: 0; }
.spec { position: sticky; top: 1rem; border: 1px solid var(--ink); background: var(--sheet); padding: 1rem 1.1rem 1.1rem; }
.spec .lettering { margin: 0 0 .6rem; border-bottom: 1px solid var(--ink); padding-bottom: .4rem; }
.spec dl { margin: 0 0 .9rem; display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; font-size: .9375rem; }
.spec dt { color: var(--graphite); }
.spec dd { margin: 0; font-weight: 500; }
.spec-sentence { font-family: var(--font-mono); font-size: .875rem; line-height: 1.5; margin: 0 0 .5rem; }
.spec .meta { margin: 0; }
.spec-inline { display: none; }

/* Character page: the finished sheet. */
.title-block { border: 1px solid var(--ink); background: var(--sheet); padding: 1rem 1.25rem; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem 2rem; align-items: start; margin: 1rem 0; }
.title-block h1 { margin-bottom: .2rem; }
.title-block p { margin: 0; max-width: none; }
.title-block .status { display: flex; align-items: center; gap: .5rem; margin-top: .5rem; }
.title-block .actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.title-block[data-state="failed"] .status { color: var(--red); }
.spinner { width: 14px; height: 14px; border: 2px solid var(--rule); border-top-color: var(--ink); border-radius: 50%; animation: spin .9s linear infinite; flex: none; }
.title-block[data-state="ready"] .spinner, .title-block[data-state="failed"] .spinner, .title-block[data-state="awaiting_pick"] .spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.candidates-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr); gap: 1rem 2.5rem; align-items: start; }
.candidates { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; max-width: 560px; list-style: none; padding: 0; margin: 0; }
.candidate { display: block; width: 100%; padding: 0; margin: 0; border: 1px solid var(--ink); background: var(--sheet); color: var(--ink); font: inherit; cursor: pointer; text-align: center; }
.candidate .frame-box { border: 0; display: block; }
.candidate .frame-note { display: block; }
.candidate[aria-pressed="true"] { outline: 2px solid var(--red); outline-offset: 2px; }
.candidate:focus-visible { outline: 2px solid var(--ink); outline-offset: 5px; }
.candidate[disabled] { cursor: default; }
.candidate .stamp { position: absolute; top: .5rem; left: .5rem; background: var(--red); color: #fff; font-size: .75rem; font-weight: 600; letter-spacing: .02em; padding: .15rem .45rem; }
.candidate .cap { display: block; padding: .4rem .5rem; font-size: .8125rem; font-weight: 500; letter-spacing: .02em; }
.candidates-aside { padding-top: 3.1rem; }
.candidates-aside p { margin-bottom: .75rem; }
.bible-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 2rem 3rem; align-items: start; margin-top: 2.5rem; }
.bible-grid h2 { margin-top: 0; }
.copy-row { display: flex; gap: .75rem; flex-wrap: wrap; margin: 0 0 1.25rem; }
.pack { border: 1px solid var(--ink); background: var(--sheet); padding: 1rem 1.1rem 1.1rem; }
.pack img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border: 1px solid var(--ink); background: #8C8C8C; margin-bottom: .75rem; }
.pack .files { font-family: var(--font-mono); font-size: .8125rem; line-height: 1.5; color: var(--graphite); margin: 0 0 .9rem; }
.pack .btn { width: 100%; }
.next-row { margin-top: 2.5rem; }
.danger-row { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.hidden { display: none !important; }
.card { border: 1px solid var(--ink); background: var(--sheet); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.card h2 { margin-top: 0; }
.skip { position: absolute; left: 16px; top: -3rem; padding: .5rem .8rem; background: var(--ink); color: var(--bond); z-index: 50; }
.skip:focus { top: 8px; }

@media (max-width: 960px) {
  .create-grid { grid-template-columns: minmax(0, 1fr); }
  .spec { position: static; }
  .bible-grid, .candidates-row { grid-template-columns: minmax(0, 1fr); }
  .candidates-aside { padding-top: 0; }
  .title-block { grid-template-columns: minmax(0, 1fr); }
  .title-block .actions { justify-content: flex-start; }
}
@media (max-width: 720px) {
  .frames { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .frame { grid-column: span 2; }
  .frame:nth-child(4) { grid-column: 2 / span 2; }
  .frame:nth-child(5) { grid-column: 4 / span 2; }
  .ruled li { grid-template-columns: minmax(0, 1fr); }
  .spec { display: none; }
  .spec-inline { display: block; width: 100%; font-family: var(--font-mono); font-size: .875rem; line-height: 1.5; border-top: 1px solid var(--rule); padding-top: .75rem; margin: 0 0 .5rem; max-width: none; }
  .site-header .wrap { padding-top: .9rem; padding-bottom: .6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; border-top-color: var(--graphite); }
  .frame[data-state="generating"] .frame-box::after { animation: none; width: 50%; }
  .sheet--reveal .frame-box img { animation: none; }
}
