/* Paper Studio look: warm paper, kraft card and a terracotta accent.
   Solid rule = cut line, dashed rule = fold line. Sheets of paper lie on the page with a soft shadow. */
:root {
  --bg: #f6efe2;
  --surface: #fffdf8;
  --ink: #3a2a20;
  --muted: #6d5645;
  --accent: #b4472c;
  --accent-strong: #8f3620;
  --accent-soft: #f0d9cf;
  --leaf: #4c6636;
  --leaf-soft: #e3e9d3;
  --kraft: #d9bf98;
  --kraft-deep: #c1a67d;
  --line: #e0d2b8;
  --warn: #8a5200;
  --warn-soft: #fbefd9;
  --shadow: 0 1px 0 #e3d6bf, 0 12px 22px rgba(90, 60, 30, .13);
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body: "Inter", "Segoe UI", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
}

* { box-sizing: border-box; }
html { height: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100%; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.55;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.12; margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: var(--accent-strong); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem var(--gutter); border-bottom: 2px dashed var(--kraft);
}
.brand { font-family: var(--display); font-weight: 700; font-size: 1.4rem; color: var(--ink); text-decoration: none; }
.brand b { color: var(--accent); font-weight: 700; }
.topbar nav a { color: var(--ink); text-decoration: none; font-weight: 500; font-size: .95rem; padding-bottom: 2px; border-bottom: 2px dashed var(--accent); }
.topbar nav a:hover { color: var(--accent-strong); }

main { flex: 1; padding: 2rem var(--gutter) 3.5rem; width: 100%; max-width: 1400px; margin-inline: auto; }
.loading { color: var(--muted); }
.footer { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; justify-content: space-between; padding: 1.2rem var(--gutter); border-top: 2px dashed var(--kraft); color: var(--muted); font-size: .85rem; }

/* Home: hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; margin-bottom: 2.6rem; }
.hero-text { display: flex; flex-direction: column; gap: 1.1rem; }
.hero h1 { font-size: clamp(2.2rem, 5.4vw, 4rem); font-weight: 700; letter-spacing: -0.01em; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 46ch; }
.cta { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: .3rem; }
.pill { display: inline-block; padding: .8rem 1.5rem; border-radius: 999px; border: 0; background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; cursor: pointer; box-shadow: 0 3px 0 #7d2f1c; }
.pill:hover { background: var(--accent-strong); }
.pill:active { transform: translateY(2px); box-shadow: 0 1px 0 #7d2f1c; }
.pill.ghost { background: transparent; color: var(--ink); box-shadow: none; outline: 2px dashed var(--ink); outline-offset: -2px; }
.pill.ghost:hover { background: var(--surface); }
/* A kraft sheet lying on the table; the live fold animation sits on it. */
.hero-sheet { background: var(--kraft); padding: clamp(10px, 1.6vw, 18px); border-radius: 4px; box-shadow: 0 2px 0 var(--kraft-deep), 0 22px 34px rgba(90, 60, 30, .22); transform: rotate(1.6deg); }
.hero-view { position: relative; aspect-ratio: 4 / 3; background: #e9dcc4; overflow: hidden; border-radius: 2px; }
.hero-view canvas { display: block; touch-action: pan-y; }
.hero-view .hint { position: absolute; left: .6rem; bottom: .5rem; font-size: .78rem; color: var(--ink); background: rgba(255, 253, 248, .8); padding: .15rem .55rem; border-radius: 999px; pointer-events: none; }
@media (max-width: 860px) { .hero { grid-template-columns: minmax(0, 1fr); } .hero-sheet { transform: rotate(.8deg); } }

/* Home: three steps written on paper notes */
.how { list-style: none; margin: 0 0 2.6rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1.2rem; }
.how li { background: var(--surface); box-shadow: var(--shadow); border-radius: 4px; padding: 1rem 1.1rem 1.1rem; display: flex; flex-direction: column; gap: .3rem; }
.how li:nth-child(odd) { transform: rotate(-.7deg); }
.how li:nth-child(even) { transform: rotate(.6deg); }
.how b { font-family: var(--display); font-size: 1.15rem; }
.how .n { font-family: var(--display); font-style: italic; color: var(--accent); font-size: .95rem; }
.how span:last-child { color: var(--muted); font-size: .93rem; }

/* A cut line with scissors, used as a section divider */
.snip { display: flex; align-items: center; gap: .7rem; margin: 0 0 1.6rem; color: var(--muted); }
.snip::before { content: "\2702\FE0E"; font-size: 1.2rem; color: var(--accent); }
.snip::after { content: ""; flex: 1; border-top: 2px dashed var(--kraft-deep); }
.snip h2 { font-size: 1.5rem; color: var(--ink); }

/* Catalogue */
.filters { display: flex; flex-direction: column; gap: .9rem; margin-bottom: 1.6rem; }
.search { position: relative; max-width: 520px; }
.search input { width: 100%; padding: .8rem 1.2rem; font-size: 1rem; background: var(--surface); border: 2px solid var(--ink); border-radius: 999px; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.chips .group-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin-right: .2rem; }
.chip { padding: .35rem .9rem; background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; cursor: pointer; font-size: .9rem; font-weight: 500; color: var(--ink); }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chips .sep { width: 1px; height: 1.4rem; background: var(--kraft); margin-inline: .4rem; }
.count { color: var(--muted); font-size: .9rem; margin-bottom: .9rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.6rem; }
.card { display: flex; flex-direction: column; background: var(--surface); border-radius: 6px; padding: .7rem; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); transition: transform .18s ease, box-shadow .18s ease; }
.card:hover { transform: translateY(-4px) rotate(-.8deg); box-shadow: 0 1px 0 #e3d6bf, 0 20px 30px rgba(90, 60, 30, .2); }
.card:nth-child(even):hover { transform: translateY(-4px) rotate(.8deg); }
.thumb { aspect-ratio: 4 / 3; background: #efe3cd; border-radius: 4px; display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: .85rem; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { padding: .9rem .4rem .5rem; margin-top: .7rem; display: flex; flex-direction: column; gap: .5rem; border-top: 2px dashed var(--kraft); }
.card h3 { font-size: 1.25rem; font-weight: 700; }
.card p { color: var(--muted); font-size: .92rem; }
.badges { display: flex; flex-wrap: wrap; gap: .4rem; }
.badge { font-size: .74rem; font-weight: 600; padding: .15rem .65rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); }
.badge.laser { background: var(--leaf-soft); color: var(--leaf); }
.badge.plain { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); border: 2px dashed var(--kraft); border-radius: 6px; }

/* Item page */
.crumb { font-size: .9rem; margin-bottom: .8rem; }
.crumb a { text-decoration: none; }
.item-head { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.3rem; }
.item-head h1 { font-size: clamp(1.8rem, 3.8vw, 2.7rem); font-weight: 700; }
.item-head p { color: var(--muted); max-width: 70ch; }
.workbench { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.5rem; align-items: start; }
@media (max-width: 960px) { .workbench { grid-template-columns: minmax(0, 1fr); } }

.stage-wrap { display: flex; flex-direction: column; gap: .8rem; min-width: 0; }
/* Views are folder tabs standing on the stage */
.tabs { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: -.8rem; padding-left: .5rem; }
.tab { padding: .55rem 1.1rem; background: var(--kraft); border: 0; border-radius: 8px 8px 0 0; cursor: pointer; font-weight: 600; color: var(--ink); opacity: .75; }
.tab:hover { opacity: 1; }
.tab[aria-selected="true"] { background: var(--ink); color: var(--surface); opacity: 1; }
.stage { position: relative; height: clamp(340px, 62vh, 640px); background: #e9dcc4; border-radius: 6px; box-shadow: var(--shadow); overflow: hidden; }
.stage canvas { display: block; touch-action: none; }
.stage .hint { position: absolute; left: .7rem; bottom: .6rem; font-size: .78rem; color: var(--ink); background: rgba(255, 253, 248, .8); padding: .15rem .6rem; border-radius: 999px; pointer-events: none; }
.stage-buttons { position: absolute; right: .7rem; top: .7rem; display: flex; gap: .4rem; }
.pose { display: flex; flex-direction: column; gap: .5rem; }
.pose-buttons { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn.compact { width: auto; padding: .4rem 1rem; font-size: .88rem; }
.stage-error { padding: 2rem; color: var(--warn); }
.slider-row { display: flex; align-items: center; gap: .9rem; background: var(--surface); border-radius: 6px; box-shadow: var(--shadow); padding: .7rem 1rem; }
.slider-row label { font-weight: 600; font-size: .92rem; white-space: nowrap; }
.slider-row input[type="range"] { flex: 1; min-width: 0; }
.slider-row .ends { font-size: .8rem; color: var(--muted); white-space: nowrap; }

.pages { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); justify-items: center; gap: 1rem; padding: 1rem; background: var(--kraft); border-radius: 6px; max-height: 85vh; overflow: auto; }
.page { display: flex; flex-direction: column; gap: .3rem; width: 100%; max-width: 520px; }
.page-svg { width: 100%; height: auto; display: block; box-shadow: 0 2px 8px rgba(60, 40, 20, .3); }
.page span { font-size: .78rem; color: var(--ink); }

.panel { display: flex; flex-direction: column; gap: 1.1rem; }
.box { background: var(--surface); border-radius: 6px; box-shadow: var(--shadow); padding: 1rem 1.1rem 1.15rem; display: flex; flex-direction: column; gap: .85rem; }
.box h2 { font-size: 1.1rem; font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding-bottom: .6rem; border-bottom: 2px dashed var(--kraft); }
.field { display: grid; grid-template-columns: 1fr auto; gap: .25rem .7rem; align-items: center; }
.field label { font-size: .92rem; font-weight: 500; }
.field .num { display: flex; align-items: center; gap: .3rem; }
.field input[type="number"] { width: 5.2rem; padding: .3rem .4rem; border: 1.5px solid var(--line); border-radius: 4px; background: var(--surface); text-align: right; font-variant-numeric: tabular-nums; }
.field input[type="number"]:focus { border-color: var(--ink); }
.field .unit { font-size: .82rem; color: var(--muted); min-width: 1.6rem; }
.field input[type="range"] { grid-column: 1 / -1; width: 100%; }
.field.check { grid-template-columns: auto 1fr; justify-items: start; }
input[type="range"] { accent-color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); width: 1.1rem; height: 1.1rem; }
.field select, .box > select { width: 100%; padding: .45rem .5rem; border: 1.5px solid var(--line); border-radius: 4px; background: var(--surface); }
.seg { display: inline-flex; border: 1.5px solid var(--ink); border-radius: 999px; overflow: hidden; font-family: var(--body); }
.seg button { padding: .12rem .7rem; background: transparent; border: 0; cursor: pointer; font-size: .8rem; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.presets { display: flex; flex-wrap: wrap; gap: .4rem; }
.swatches { display: flex; gap: .5rem; flex-wrap: wrap; }
.swatch { width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--surface) inset; }
.help { font-size: .82rem; color: var(--muted); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .3rem .9rem; font-size: .92rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; font-variant-numeric: tabular-nums; }
.btn { display: block; width: 100%; padding: .75rem 1rem; background: var(--accent); color: #fff; border: 0; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 1rem; text-align: center; box-shadow: 0 3px 0 #7d2f1c; }
.btn:hover { background: var(--accent-strong); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: none; outline: 2px dashed var(--ink); outline-offset: -2px; }
.btn.ghost:hover { background: var(--bg); color: var(--ink); }
.btn.small { width: auto; padding: .3rem .8rem; font-size: .82rem; background: rgba(255, 253, 248, .9); color: var(--ink); box-shadow: none; outline: 1px solid var(--line); outline-offset: -1px; }
.btn.small:hover { background: var(--surface); }
.notice { font-size: .85rem; color: var(--warn); background: var(--warn-soft); padding: .5rem .7rem; border-left: 3px solid var(--warn); }
.steps { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .5rem; font-size: .93rem; }
.steps li::marker { font-family: var(--display); font-style: italic; color: var(--accent); }

/* Text pages and the written part of an item page */
.topbar nav, .footer nav { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; }
.footer nav a { color: var(--muted); }
.crumb { color: var(--muted); }
.hero-view img, .hero-live { display: block; width: 100%; height: 100%; object-fit: cover; }
.hero-live { position: absolute; inset: 0; }
.item-shot { margin: 0; background: var(--surface); border-radius: 6px; box-shadow: var(--shadow); padding: .7rem; max-width: 900px; }
.item-shot img { display: block; width: 100%; height: auto; border-radius: 4px; }
.item-shot figcaption { padding-top: .6rem; color: var(--muted); font-size: .9rem; }
.prose { max-width: 76ch; display: flex; flex-direction: column; gap: 1.8rem; margin: 2.6rem 0; }
.prose h1 { font-size: clamp(1.9rem, 4.4vw, 3rem); }
.prose h2 { font-size: 1.45rem; padding-bottom: .5rem; border-bottom: 2px dashed var(--kraft); }
.prose h3 { font-size: 1.1rem; }
.prose section { display: flex; flex-direction: column; gap: .8rem; }
.prose .lead { font-size: 1.12rem; color: var(--muted); }
.prose ul, .prose ol { margin: 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: .4rem; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem 2rem; }
.cols > div { display: flex; flex-direction: column; gap: .5rem; }
.table-scroll { overflow-x: auto; }
.prose table { border-collapse: collapse; width: 100%; background: var(--surface); box-shadow: var(--shadow); border-radius: 6px; font-size: .95rem; font-variant-numeric: tabular-nums; }
.prose th, .prose td { text-align: left; padding: .55rem .8rem; border-bottom: 1px dashed var(--line); vertical-align: top; }
.prose thead th { font-size: .82rem; color: var(--muted); border-bottom: 2px dashed var(--kraft); }
.prose tbody tr:last-child th, .prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody th { font-weight: 600; }
.guide-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.2rem; }
.guide-list li { background: var(--surface); box-shadow: var(--shadow); border-radius: 6px; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .4rem; }
.guide-list a { font-family: var(--display); font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 3px; }
.guide-list span { color: var(--muted); font-size: .93rem; }
.empty h1 { margin-bottom: .6rem; }
.empty p { margin-bottom: 1rem; }
main > .snip { margin-top: 2.6rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .card:hover, .card:nth-child(even):hover { transition: none; transform: none; }
}
