/* Layout: a workbench — the generator is the hero, reading content follows in a 68ch column. */
:root {
  --bg: #eceee9;
  --surface: #f7f8f5;
  --fg: #17201b;
  --muted: #56625b;
  --line: #d1d7cf;
  --accent: #1f4a3a;
  --accent-ink: #f3f6f2;
  --ad: #e3e6e0;
  --shadow: 0 1px 2px rgba(20,30,25,.06), 0 10px 30px rgba(20,30,25,.09);
  --f-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1411; --surface: #161c18; --fg: #e3e8e4; --muted: #94a099; --line: #28312c;
    --accent: #93c9ab; --accent-ink: #0f1411; --ad: #1b221e;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 32px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1411; --surface: #161c18; --fg: #e3e8e4; --muted: #94a099; --line: #28312c;
  --accent: #93c9ab; --accent-ink: #0f1411; --ad: #1b221e;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 32px rgba(0,0,0,.4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 16px; line-height: 1.6; }
a { color: inherit; text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.page { max-width: 1320px; margin: 0 auto; padding-inline: 20px; }
.site-head { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; margin-inline: -20px; padding-inline: 20px; padding-top: calc(12px + env(safe-area-inset-top, 0px)); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); }
:root { --head-h: 64px; }
html { scroll-padding-top: calc(var(--head-h) + 12px); }

.logo { font-family: var(--f-display); font-weight: 800; font-stretch: 120%; font-size: 1.35rem; letter-spacing: -.01em; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.logo svg { width: 26px; height: 18px; }
.site-head nav { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; font-size: .95rem; }
.page { overflow-x: clip; }
.site-head nav a { text-decoration: none; color: var(--muted); }
.site-head nav a:hover, .site-head nav a[aria-current="page"] { color: var(--fg); }
.lang { font-family: var(--f-mono); font-size: .8rem; border: 1px solid var(--line); border-radius: 4px; padding: 2px 8px; }

.hero { padding-block: 36px 20px; display: flex; flex-direction: column; gap: 10px; }
.eyebrow { font-family: var(--f-mono); font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0; }
h1 { font-family: var(--f-display); font-weight: 800; font-stretch: 112%; font-size: clamp(2rem, 4.6vw, 3.4rem); line-height: 1.04; letter-spacing: -.02em; margin: 0; max-width: 22ch; text-wrap: balance; }
.lede { margin: 0; color: var(--muted); font-size: 1.12rem; max-width: 62ch; }

/* Generator */
.gen { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; padding-block: 12px 28px; }
@media (max-width: 920px) { .gen { grid-template-columns: minmax(0, 1fr); } }
.stage { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tpl-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl-tabs button { font: 500 .92rem var(--f-body); border: 1px solid var(--line); background: var(--surface); color: var(--fg); padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.tpl-tabs button[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.stage-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { font: 500 .88rem var(--f-body); border: 0; background: transparent; color: var(--muted); padding: 6px 14px; border-radius: 6px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.res { font-family: var(--f-mono); font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.screen { position: relative; width: 100%; max-width: 100%; aspect-ratio: 3456 / 2234; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); background: #222; }
.screen canvas.main { display: block; width: 100%; height: 100%; }
.menubar { position: absolute; left: 0; right: 0; top: 0; background: rgba(255,255,255,.3); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: space-between; padding-inline: 1.4%; font: 500 clamp(6px, .85vw, 12px) -apple-system, "Helvetica Neue", sans-serif; color: rgba(0,0,0,.75); pointer-events: none; }
.menubar.dark { background: rgba(0,0,0,.34); color: rgba(255,255,255,.86); }
.menubar .notch { position: absolute; left: 50%; top: 0; transform: translateX(-50%); width: 11.5%; height: 100%; background: #000; border-radius: 0 0 9px 9px; }
.menubar span { white-space: nowrap; }
.thumb { position: absolute; right: 2%; bottom: 3%; width: 22%; border-radius: 6px; overflow: hidden; box-shadow: 0 4px 18px rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.3); cursor: pointer; padding: 0; background: none; }
.thumb canvas { display: block; width: 100%; height: auto; }
.thumb small { position: absolute; left: 6px; top: 4px; font: 500 10px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6); }

.rail { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; min-width: 0; }
.group { padding: 15px 18px; display: flex; flex-direction: column; gap: 9px; border-top: 1px solid var(--line); }
.group:first-child { border-top: 0; }
.label { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.rail select, .rail input[type="text"] { width: 100%; font: 400 .95rem var(--f-body); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sw { width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--line); cursor: pointer; padding: 0; position: relative; }
.sw[aria-pressed="true"]::after { content: ""; position: absolute; inset: -4px; border: 2px solid var(--accent); border-radius: 8px; }
.pick { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.pick label { display: flex; align-items: center; gap: 6px; }
.pick input[type="color"] { width: 30px; height: 26px; border: 1px solid var(--line); border-radius: 4px; padding: 0; background: none; cursor: pointer; }
.toggle { display: flex; gap: 8px; align-items: center; font-size: .9rem; cursor: pointer; }
.toggle input { accent-color: var(--accent); }
.count { font-variant-numeric: tabular-nums; }
.dl { padding: 18px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.btn { font: 600 1rem var(--f-body); background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 12px 14px; cursor: pointer; text-align: center; }
.btn:hover { filter: brightness(1.08); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); font-weight: 500; font-size: .9rem; padding: 9px 10px; }
.msg { font-size: .85rem; color: var(--muted); margin: 0; }

/* Ads: fixed reserved height keeps layout stable (CLS) */
.ad { background: var(--ad); border-radius: 8px; min-height: 250px; display: flex; align-items: center; justify-content: center; position: relative; margin-block: 8px 28px; }
.ad > span { position: absolute; top: 6px; left: 10px; font: 500 .68rem var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Reading content */
.content { display: flex; flex-direction: column; gap: 44px; padding-block: 12px 56px; }
.prose { max-width: 68ch; }
.prose h2, .section-h { font-family: var(--f-display); font-weight: 750; font-stretch: 108%; font-size: clamp(1.45rem, 2.6vw, 1.9rem); line-height: 1.15; letter-spacing: -.01em; margin: 0 0 12px; text-wrap: balance; }
.prose h3 { font-size: 1.1rem; margin: 22px 0 6px; }
.prose p, .prose li { color: color-mix(in srgb, var(--fg) 88%, var(--muted)); }
.prose ol, .prose ul { padding-left: 1.3em; display: flex; flex-direction: column; gap: 6px; }
.steps { counter-reset: s; list-style: none; padding: 0 !important; display: grid !important; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px !important; max-width: none; }
.steps li { counter-increment: s; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.steps li::before { content: counter(s, decimal-leading-zero); display: block; font: 500 .8rem var(--f-mono); color: var(--accent); margin-bottom: 6px; }
.steps strong { display: block; margin-bottom: 4px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card { text-decoration: none; display: flex; flex-direction: column; gap: 10px; }
.card .pair { position: relative; border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); aspect-ratio: 3456 / 2234; }
.card .pair img { width: 100%; height: 100%; object-fit: cover; }
.card .pair img + img { position: absolute; inset: 0; clip-path: polygon(55% 0, 100% 0, 100% 100%, 45% 100%); }
.card h3 { margin: 0; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); font-size: .92rem; }

.table-wrap { overflow-x: auto; max-width: 68ch; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); }
th { font: 500 .74rem var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
td.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

details { border-bottom: 1px solid var(--line); padding-block: 12px; }
details summary { cursor: pointer; font-weight: 600; }
details p { margin: 8px 0 0; }

.site-foot { border-top: 1px solid var(--line); padding-block: 24px 40px; display: flex; flex-wrap: wrap; gap: 12px 28px; justify-content: space-between; color: var(--muted); font-size: .88rem; }
.site-foot nav { display: flex; gap: 18px; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---- iPhone preview ---- */
.screen { container-type: inline-size; margin-inline: auto; }
.screen.phone { box-shadow: 0 0 0 5px #1b1d1c, var(--shadow); }
.screen.phone .thumb { width: 34%; border-radius: 10px; }
.lock { position: absolute; inset: 0; pointer-events: none; color: rgba(255,255,255,.94); font-family: -apple-system, "SF Pro Display", "Helvetica Neue", sans-serif; text-align: center; }
.lock.on-light { color: rgba(0,0,0,.78); }
.lock .island { position: absolute; top: 3.1%; left: 50%; transform: translateX(-50%); width: 31%; height: 4.2%; background: #000; border-radius: 999px; }
.lock .ldate { position: absolute; top: 10.4%; width: 100%; font-size: 5.4cqw; font-weight: 600; opacity: .9; }
.lock .lclock { position: absolute; top: 12.6%; width: 100%; font-size: 25cqw; font-weight: 700; line-height: 1; letter-spacing: -0.01em; }
.lock .lbtn { position: absolute; bottom: 6.2%; width: 12.5%; aspect-ratio: 1; border-radius: 50%; background: rgba(0,0,0,.28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.lock .lbtn.l { left: 11%; } .lock .lbtn.r { right: 11%; }
.lock .lbar { position: absolute; bottom: 1.1%; left: 50%; transform: translateX(-50%); width: 36%; height: .55%; border-radius: 99px; background: currentColor; opacity: .85; }
.tpl-tabs button { padding: 6px 12px; }

/* ---- save sheet (touch devices) ---- */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(10,14,12,.6); display: flex; align-items: center; justify-content: center; padding: 20px; padding-block: calc(20px + env(safe-area-inset-top, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)); }
.sheet-card { position: relative; background: var(--surface); color: var(--fg); border-radius: 14px; padding: 18px; width: min(420px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.sheet-card img { max-height: 58vh; width: auto; max-width: 100%; margin-inline: auto; border-radius: 10px; box-shadow: var(--shadow); }
.sheet-close { position: absolute; top: 8px; right: 10px; border: 0; background: none; color: var(--muted); font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 4px 8px; }

/* ---- phone cards ---- */
.cards.phones { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.cards.phones .pair { aspect-ratio: auto; box-shadow: none; overflow: visible; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cards.phones .pair img { position: static; clip-path: none; height: auto; aspect-ratio: 420 / 911; border-radius: 12% / 5.5%; box-shadow: var(--shadow); }
.prose.wide { max-width: none; }
.btn.inline { display: inline-block; text-decoration: none; }

/* ---- blog ---- */
.post-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.post-item { display: flex; flex-direction: column; gap: 6px; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.post-item:hover { border-color: var(--accent); color: inherit; }
.post-item time { font: 500 .74rem var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.post-item h3 { margin: 0; font-size: 1.08rem; line-height: 1.3; text-wrap: balance; }
.post-item p { margin: 0; color: var(--muted); font-size: .93rem; }
.eyebrow a { text-decoration: none; }
.post h2 { margin-top: 34px; }
.post code { font-family: var(--f-mono); font-size: .9em; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.post blockquote { margin: 0; padding: 4px 18px; border-left: 3px solid var(--accent); color: var(--muted); }
.cover { position: relative; margin: 0 0 24px; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); aspect-ratio: 1200 / 776; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover img + img { clip-path: polygon(55% 0, 100% 0, 100% 100%, 45% 100%); }
.cover.phone { aspect-ratio: auto; overflow: visible; box-shadow: none; display: grid; grid-template-columns: repeat(2, minmax(0, 180px)); gap: 12px; }
.cover.phone img { position: static; height: auto; aspect-ratio: 420 / 911; border-radius: 12% / 5.5%; box-shadow: var(--shadow); clip-path: none; }
.cta-box { max-width: 68ch; display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; }
.cta-box p { margin: 4px 0 0; color: var(--muted); }
.cta-box > div { min-width: 0; flex: 1 1 260px; }
.post td + td { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---- wide screens: heading/TOC column + reading column ---- */
.toc { display: none; }
@media (min-width: 1000px) {
  .content > section.prose:not(.wide):has(> h2) {
    max-width: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); column-gap: 56px; align-items: start;
  }
  .content > section.prose:not(.wide):has(> h2) > * { grid-column: 2; max-width: 68ch; }
  .content > section.prose:not(.wide):has(> h2) > h2 { grid-column: 1; grid-row: 1 / span 40; position: sticky; top: calc(var(--head-h) + 24px); max-width: 16ch; }
  .doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); column-gap: 56px; align-items: start; }
  .doc-layout > .doc { grid-column: 2; }
  .toc { display: block; grid-column: 1; grid-row: 1; position: sticky; top: calc(var(--head-h) + 24px); font-size: .92rem; }
  .toc p { margin: 0 0 8px; font: 500 .72rem var(--f-mono); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
  .toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; border-left: 1px solid var(--line); }
  .toc a { display: block; padding-left: 14px; margin-left: -1px; border-left: 2px solid transparent; text-decoration: none; color: var(--muted); }
  .toc a:hover { color: var(--fg); border-left-color: var(--accent); }
  .content > .cta-box { margin-left: calc((100% - 56px) / 3 + 56px); }
}
.doc h2 { scroll-margin-top: calc(var(--head-h) + 16px); }
.lock.small-island .island { width: 22%; height: 3.6%; top: 3.3%; }

/* mobile header: one row, nav scrolls sideways (kept last so it wins the cascade) */
@media (max-width: 640px) {
  .site-head { gap: 10px; }
  .site-head .logo { font-size: 1.15rem; flex: none; }
  .site-head nav { flex-wrap: nowrap; overflow-x: auto; gap: 14px; scrollbar-width: none; min-width: 0; font-size: .9rem; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 16px; }
  .site-head nav::-webkit-scrollbar { display: none; }
  .site-head nav a { white-space: nowrap; }
  :root { --head-h: 56px; }
}

/* ---- generator details ---- */
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: .9rem; }
.opts .toggle { font-size: .9rem; }
.opt-select { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.opt-select select { width: auto; flex: 1; max-width: 60%; padding: 6px 8px; }
.seed-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.seed-row .btn { padding: 7px 12px; font-size: .88rem; }
.seed-no { font: 500 .78rem var(--f-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.link-btn { border: 0; background: none; color: var(--muted); font: inherit; font-size: .82rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 0; }
.link-btn:hover { color: var(--fg); }
