:root {
  --bg: #faf6ef;
  --surface: #ffffff;
  --surface-2: #f3ece0;
  --ink: #1f2a37;
  --muted: #5b6675;
  --line: #e4dccd;
  --accent: #d2581f;
  --accent-hover: #b84a17;
  --accent-ink: #ffffff;
  --accent-soft: #fbe6da;
  --good: #2f7d5b;
  --good-soft: #dff1e8;
  --warn: #8a5300;
  --warn-soft: #fdf1d6;
  --star: #e3a008;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31, 42, 55, .06), 0 6px 20px rgba(31, 42, 55, .06);
  --font-head: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15191f;
    --surface: #1d232b;
    --surface-2: #252c36;
    --ink: #ece7de;
    --muted: #a3acb8;
    --line: #313946;
    --accent: #f07a3f;
    --accent-hover: #ff8e55;
    --accent-ink: #1a1208;
    --accent-soft: #3a261b;
    --good: #6fcf9f;
    --good-soft: #1d3329;
    --warn: #f5c56b;
    --warn-soft: #3a2f17;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font-body);
}
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 .5em; font-weight: 650; }
h1 { font-size: clamp(1.9rem, 6vw, 3rem); letter-spacing: -.01em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
img, svg { max-width: 100%; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* Header / footer */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; }
.brand:hover { color: var(--ink); }
.brand svg { width: 28px; height: 28px; color: var(--accent); }
.brand b { color: var(--accent); font-weight: 700; }
.site-nav { display: flex; gap: 4px; }
.site-nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .92rem; padding: 8px 10px; border-radius: 8px; white-space: nowrap; }
/* Phones: logo on top, menu on its own row underneath. */
@media (max-width: 640px) {
  .site-header .wrap { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 4px; row-gap: 2px; }
  .site-nav { width: 100%; gap: 0; margin-left: -8px; overflow-x: auto; scrollbar-width: none; }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { padding: 8px 8px; font-size: .88rem; }
}
@media (max-width: 360px) {
  .site-nav a { padding: 8px 6px; font-size: .82rem; }
}
.site-nav a:hover { color: var(--ink); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--accent); }
.entry-head { margin-bottom: 4px; }
.entry-box { font-family: var(--font-head); font-weight: 650; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.entry-box:hover { color: var(--accent); text-decoration: underline; }
.latest-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.latest-head h2 { margin-bottom: 10px; }
.latest-head a { white-space: nowrap; font-weight: 600; text-decoration: none; }
.latest-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.latest-item { display: flex; align-items: center; gap: 12px; padding: 8px; margin: 0 -8px; border-radius: 12px; text-decoration: none; color: var(--ink); }
.latest-item:hover { background: var(--surface-2); color: var(--ink); }
.latest-item img, .latest-thumb { flex: none; width: 56px; height: 56px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); background: var(--surface-2); }
.latest-thumb { display: grid; place-items: center; color: var(--accent); }
.latest-thumb svg { width: 28px; height: 28px; }
.latest-text { display: flex; flex-direction: column; min-width: 0; }
.latest-title { font-family: var(--font-head); font-weight: 650; font-size: 1.05rem; line-height: 1.25; }
.latest-meta { font-size: .85rem; color: var(--muted); }
.page-lede { font-size: 1.1rem; color: var(--muted); max-width: 36em; }
.buy-new { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
.buy-new h3 { margin-bottom: 2px; }
.buy-new p { margin: 0; }
.buy-new .disclosure-inline { flex-basis: 100%; font-size: .78rem; color: var(--muted); }
.tip-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; background: var(--accent-soft); border-color: transparent; }
.tip-card h2 { margin-bottom: 4px; }
.tip-card p { margin: 0; }
.disclosure { color: var(--muted); font-size: .78rem; margin-top: 10px; }
.site-footer { margin-top: 56px; padding: 24px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }

.demo-banner { background: var(--warn-soft); color: var(--warn); font-size: .88rem; padding: 8px 0; }

main { padding: 28px 0; }

/* Cards & pieces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.code-pill { display: inline-block; font: 600 .85rem/1 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .12em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 12px; border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); font: 600 1rem var(--font-body); cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-block { width: 100%; }

/* Home */
.hero { padding: 24px 0 8px; }
.hero p.lede { font-size: 1.15rem; color: var(--muted); max-width: 34em; }
.steps { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 24px 0; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.step .num { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; margin-bottom: 10px; }
.lookup { display: flex; gap: 10px; flex-wrap: wrap; }
.lookup input { flex: 1 1 180px; text-transform: uppercase; letter-spacing: .12em; font-family: ui-monospace, Consolas, monospace; }

/* Box page */
.box-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.box-head h1 { margin-bottom: 4px; }
.meta-line { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 18px 0 4px; }
@media (min-width: 560px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.stat .v { font-family: var(--font-head); font-size: 1.45rem; font-weight: 650; line-height: 1.2; }
.stat .l { font-size: .8rem; color: var(--muted); }

.callout { display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; padding: 12px 14px; margin-top: 14px; font-size: .95rem; }
.callout.good { background: var(--good-soft); color: var(--good); }
.callout.warn { background: var(--warn-soft); color: var(--warn); }
.callout strong { color: inherit; }

.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 1fr 2.4em; align-items: center; gap: 6px 10px; font-size: .92rem; }
.bar-row > span:first-child { grid-column: 1 / -1; font-weight: 600; }
.bar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar-ends { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); grid-column: 1; margin-top: -4px; }
@media (min-width: 560px) {
  .bar-row { grid-template-columns: 11em 1fr 2.4em; gap: 10px; }
  .bar-row > span:first-child { grid-column: auto; font-weight: 400; }
  .bar-ends { grid-column: 2; margin-top: -8px; }
}
.bar-row .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

.places { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.good { background: var(--good-soft); color: var(--good); border-color: transparent; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 22px 26px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.timeline li::after { content: ""; position: absolute; left: 10px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.entry-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.entry-top strong { font-weight: 600; }
.entry-source { font-size: .88rem; color: var(--muted); margin-top: 4px; }
.entry-edit { margin-left: 6px; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; color: var(--accent); font: 600 .78rem var(--font-body); cursor: pointer; }
.entry-edit:hover { border-color: var(--accent); }
.saved-panel { border-color: var(--good); }
.saved-panel h2 { margin-bottom: 6px; }
.link-row { display: flex; gap: 8px; margin: 10px 0 4px; }
.link-row input { flex: 1; min-width: 0; font-size: .85rem; font-family: ui-monospace, Consolas, monospace; }
.link-row .btn { flex: none; min-height: 46px; padding: 0 16px; }
.email-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.email-row input { flex: 1 1 200px; }
.form-actions { display: grid; gap: 10px; }
.btn-danger { background: transparent; color: #c0392b; border-color: currentColor; }
.btn-danger:hover { background: #fdecea; color: #a93226; }
@media (prefers-color-scheme: dark) { .btn-danger { color: #ff8a80; } .btn-danger:hover { background: #3a1f1d; color: #ffb3ab; } }
.entry-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.entry-note { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.stars { color: var(--star); letter-spacing: 1px; }
.stars-off { color: var(--line); }

.empty { text-align: center; padding: 28px 16px; }
.empty svg { width: 56px; height: 56px; color: var(--accent); margin-bottom: 8px; }

/* Forms */
form .group { border: 0; margin: 0 0 22px; padding: 0; min-width: 0; }
form legend, .label { display: block; font-weight: 600; margin-bottom: 6px; padding: 0; }
.hint { font-size: .85rem; color: var(--muted); margin: -2px 0 8px; }
.row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 480px) { .row.stack-sm { grid-template-columns: 1fr; } }
input[type=text], input[type=number], input[type=date], textarea, select {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: 16px var(--font-body);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus, .btn:focus-visible, .seg input:focus-visible + span { outline: 3px solid var(--accent-soft); outline-offset: 1px; border-color: var(--accent); }

.seg { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.seg.three { grid-template-columns: repeat(3, 1fr); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: grid; place-items: center; min-height: 46px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 600; text-align: center; font-size: .92rem; padding: 4px; }
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.seg-ends { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); margin-top: 4px; }

.checks { display: grid; gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }

.place-status { font-size: .88rem; margin: 6px 0 0; color: var(--muted); }
.place-status.warn { color: var(--warn); background: var(--warn-soft); border-radius: 10px; padding: 8px 12px; }
.place-linked { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: .88rem; color: var(--good); }
.place-linked button { background: none; border: 0; padding: 4px 0; color: var(--accent); font: 600 .85rem var(--font-body); cursor: pointer; }
.entry-source a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.entry-source a:hover { color: var(--accent); }
.money { position: relative; }
.money span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.money input { padding-left: 26px; }
.size-row { display: grid; grid-template-columns: 1fr auto 1fr 1.1fr; gap: 8px; align-items: end; }
.size-x { padding-bottom: 12px; color: var(--muted); font-weight: 600; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.photo-pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.photo-picker { display: flex; flex-direction: column; gap: 6px; }
.photo-drop { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; border: 2px dashed var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; overflow: hidden; text-align: center; }
.photo-drop:hover { border-color: var(--accent); }
.photo-picker input:focus-visible + .photo-drop { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.photo-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.photo-empty span { font-size: 1.6rem; }
.photo-drop.busy::after { content: "Preparing…"; position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 80%, transparent); font-weight: 600; font-size: .85rem; }
.photo-remove { align-self: flex-start; background: none; border: 0; padding: 4px 0; color: var(--accent); font: 600 .85rem var(--font-body); cursor: pointer; }
.entry-photos { display: flex; gap: 10px; margin-top: 10px; }
.entry-photos a { display: block; width: 120px; text-decoration: none; color: var(--muted); font-size: .78rem; }
.entry-photos img { display: block; width: 120px; height: 90px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); margin-bottom: 3px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-error { color: #c0392b; font-weight: 600; margin-top: 10px; }
@media (prefers-color-scheme: dark) { .form-error { color: #ff8a80; } }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; z-index: 10; max-width: calc(100% - 32px); }

.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* Sticker sheet */
.sticker-controls .row { align-items: end; }
.sheet { display: grid; grid-template-columns: repeat(auto-fill, 1.5in); gap: .25in; justify-content: center; margin-top: 18px; }
.sticker { width: 1.5in; height: 1.5in; background: #fff; color: #111; border: 1px dashed #bbb; border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: .07in; text-align: center; overflow: hidden; }
.sticker .s-tagline { font: 700 5.9pt/1.15 var(--font-body); letter-spacing: -.01em; margin-bottom: .02in; white-space: nowrap; }
.sticker .qr { width: .88in; height: .88in; }
.sticker .qr svg { width: 100%; height: 100%; display: block; }
.sticker .s-brand { font: 700 8pt/1.1 var(--font-head); margin-top: .02in; }
.sticker .s-code { font: 600 7pt/1.1 ui-monospace, Consolas, monospace; letter-spacing: .1em; color: #444; }

.attach-body { display: grid; gap: 18px; }
@media (min-width: 620px) { .attach-body { grid-template-columns: 220px 1fr; align-items: start; } }
.attach-figure { margin: 0; text-align: center; }
.attach-figure svg { width: 100%; max-width: 220px; height: auto; display: block; margin: 0 auto 6px; }
.attach-figure figcaption { font-size: .82rem; color: var(--muted); }
.box-lid { fill: var(--surface-2); stroke: var(--line); stroke-width: 2; }
.box-art { fill: #bcd7e6; }
.box-hills { fill: #7aa98a; }
.box-sun { fill: #f3c64f; }
.box-text { fill: var(--line); }
.box-sticker { fill: #fff; stroke: var(--accent); stroke-width: 2.5; }
.box-qr { fill: #111; }
@media (prefers-color-scheme: dark) {
  .box-art { fill: #35566a; }
  .box-hills { fill: #3f6b52; }
  .box-sun { fill: #c99a2e; }
}
.attach-steps { margin: 0; padding-left: 1.2em; display: grid; gap: 10px; }
.attach-steps li { padding-left: 4px; }
.attach-steps li::marker { color: var(--accent); font-weight: 700; }

@media print {
  .sheet.cut-lines .sticker { border: 1px dashed #999 !important; border-radius: 0; }
  @page { size: letter; margin: .5in; }
  body { background: #fff; }
  .site-header, .site-footer, .demo-banner, .no-print { display: none !important; }
  main { padding: 0; }
  .wrap { max-width: none; padding: 0; }
  .sheet { margin: 0; gap: .2in; justify-content: start; }
  .sticker { border: 0; break-inside: avoid; }
}
