@font-face {
  font-family: Desk;
  src: url('/assets/type/schibsted-grotesk-latin.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: News;
  src: url('/assets/type/newsreader-latin-roman.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: News;
  src: url('/assets/type/newsreader-latin-italic.woff2') format('woff2');
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: LetterScript;
  src: url('/assets/hands/script.woff2') format('woff2');
  font-display: swap;
}

:root {
  font: 16px/1.5 Desk, system-ui, sans-serif;
  color: #272c26;
  background: #f7f5ed;
  --ink: #272c26;
  --muted: #626658;
  --border: #d9d9cc;
  --surface: #fdfbf5;
  --accent: #a54228;
  --mono: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --serif: News, Georgia, serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, h3, p, figure { margin: 0; }
button, input, textarea { color: inherit; font: inherit; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { opacity: .63; cursor: wait; }
a { color: inherit; }
button, a, input, textarea, summary { outline-offset: 4px; }
:focus-visible { outline: 2px solid var(--accent); }
i[data-icon] { display: inline-flex; vertical-align: middle; }
i[data-icon] svg { width: 1.05em; height: 1.05em; }
.wrap { width: min(100% - 88px, 1152px); margin-inline: auto; }
.appbar { background: var(--ink); color: #f7f4e9; }
.topbar { min-height: 65px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.identity { display: inline-flex; align-items: center; gap: 8px; font-size: 23px; font-weight: 650; line-height: 1; letter-spacing: -.06em; text-decoration: none; white-space: nowrap; }
.identity i { margin-right: 2px; color: #f6a47f; }
.identity i svg { width: 25px; height: 25px; }
.app-word { border-left: 1px solid #63655a; padding-left: 10px; color: #e4e5d8; font: 24px var(--serif); letter-spacing: -.035em; }
.topbar nav { display: flex; align-items: center; gap: clamp(14px, 3vw, 38px); font-size: 14px; }
.topbar nav a { text-decoration: none; color: #efeee3; white-space: nowrap; }
.topbar nav a:hover { text-decoration: underline; text-underline-offset: 5px; }
.topbar a:focus-visible { outline-color: #f6a47f; }
.studio-link span { color: #f6a47f; margin-left: 4px; }
footer .studio-link span { color: var(--accent); }

.hero { display: grid; grid-template-columns: 1fr 1.13fr; gap: clamp(36px, 6vw, 86px); align-items: center; padding: 54px 0 49px; }
.label { font: 500 11px/1.3 var(--mono); letter-spacing: .07em; }
.eyebrow { color: var(--accent); text-transform: uppercase; margin-bottom: 18px; }
h1, h2 { font-family: var(--serif); font-weight: 400; }
h1 { font-size: clamp(62px, 7.9vw, 108px); line-height: .87; letter-spacing: -.058em; }
h1 em { font-weight: 400; }
.intro-copy { color: var(--muted); font-size: 16px; max-width: 38ch; margin-top: 23px; }
.hero-actions, .editor-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.hero-actions { gap: 17px; margin-top: 24px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 42px; padding: 9px 14px; border: 1px solid transparent; border-radius: 4px; font-size: 14px; font-weight: 600; line-height: 1.25; text-decoration: none; white-space: nowrap; }
.primary { background: var(--accent); color: #fffaf1; }
.primary:hover { background: #8d361f; }
.secondary { background: var(--surface); border-color: #cdcfc0; }
.secondary:hover { background: #eeeee4; }
.text-link { font-size: 14px; padding: 9px 0; text-decoration-color: #b9b9ab; text-underline-offset: 4px; }
.text-link span { color: var(--accent); padding-left: 3px; }
.hero-figure { position: relative; overflow: hidden; aspect-ratio: 1.49; border: 1px solid #3d4437; border-radius: 6px; background: radial-gradient(ellipse at 48% 42%, #646954 0%, #40473a 59%, #30382e 100%); isolation: isolate; }
.hero-figure::before { content: ''; position: absolute; inset: 16px; border: 1px solid #dde2c429; background-image: linear-gradient(#e2e3cd16 1px, transparent 1px), linear-gradient(90deg,#e2e3cd16 1px,transparent 1px); background-size: 25px 25px; z-index: -1; }
.hero-figure canvas, .preview-board canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.preview-board canvas { grid-area:1 / 1; }
#preview-desk-shadow, #preview-contacts { pointer-events:none; }
#preview-desk-shadow { filter:blur(1px); }
#preview-desk-shadow:not([hidden]) + #preview-paper { filter:none !important; }
.hero-figure figcaption { position: absolute; right: 26px; bottom: 24px; left: 26px; display: flex; justify-content: space-between; gap: 12px; color: #f4f1de; font: 11px/1.2 var(--mono); }

.featured-app { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); margin-bottom: 34px; overflow: hidden; scroll-margin-top: 22px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.featured-copy { align-self: center; padding: clamp(20px, 3vw, 34px); }
.featured-copy h2 { font-size: clamp(36px, 4.3vw, 49px); line-height: 1; letter-spacing: -.035em; }
.featured-copy > p { margin-top: 8px; max-width: 48ch; color: var(--muted); font-size: 15px; }
.featured-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 17px; }
.letter-art { display: grid; justify-items: center; align-items: start; overflow: hidden; max-height: 210px; min-height: 185px; background: linear-gradient(120deg, #b8b19455, #dcd1b63d), url('/assets/cotton/ash-worktop.webp') center / cover; }
.letter-art-sheet { position: relative; width: 175px; aspect-ratio: 3 / 4; margin-top: 12px; padding: 39px 17px 17px; transform: rotate(-9deg); background: #faf5e8 url('/assets/papers/ivory.webp') center / cover; color: #303c45; box-shadow: 3px 7px 14px #40372957; font: 18px/1.03 LetterScript, cursive; }
.letter-art-sheet img { position: absolute; top: 10px; right: 8px; object-fit: contain; opacity: .87; }
.letter-art-sheet p + p { margin-top: 12px; }

.templates, .build, .after-workshop { border-top: 1px solid var(--border); padding-top: 26px; }
.templates, .build { scroll-margin-top: 22px; }
.section-heading { display: flex; align-items: baseline; gap: 8px 20px; flex-wrap: wrap; margin-bottom: 17px; }
.section-heading h2 { font-size: clamp(31px, 4.5vw, 43px); line-height: 1.05; letter-spacing: -.035em; }
.section-heading p { color: var(--muted); font-size: 14px; }
.template-grid { display: grid; grid-template-columns: repeat(3,minmax(0, 1fr)); gap: 13px; }
.template { display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; align-items: center; gap: 14px; min-height: 84px; padding: 11px 13px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; text-align: left; }
.template:hover, .template[data-current='true'] { border-color: #9a9d87; background: #f3f2e8; }
.template-text { display: grid; gap: 2px; }
.template-text strong { font-weight: 650; font-size: 15px; }
.template-text > span { color: var(--muted); font-size: 12px; }
.template i { color: #616653; }
.template-art { display: grid; place-items: center; height: 59px; overflow: hidden; border-radius: 3px; background: #e1e2d4; }
.template-art span { position: relative; display: block; width: 25px; height: 35px; background: #fcf8e8; box-shadow: 1px 2px 3px #39413240; }
.fold-art span { transform: rotate(-15deg); background: linear-gradient(135deg, #e1e2d4 0 13%, #fcf8e8 13%); }
.fold-art span::before { content: ''; position: absolute; top: 0; left: 0; width: 11px; aspect-ratio: 1; background: linear-gradient(135deg, transparent 50%, #e0c99f 50%); }
.tear-art { background: #e9ddc9; }
.tear-art span { transform: rotate(14deg) translate(-1px, -5px); height: 24px; clip-path: polygon(0 0,100% 0,100% 95%,80% 86%,69% 99%,52% 91%,38% 99%,18% 89%,0 94%); }
.tear-art::after { content: ''; width: 24px; height: 10px; margin-top: -19px; transform: rotate(5deg) translate(3px, 3px); background: #faf4e5; clip-path: polygon(0 10%,18% 5%,38% 22%,52% 5%,69% 19%,80% 0,100% 12%,100% 100%,0 100%); }
.crease-art { background: #deddd0; }
.crease-art span { transform: rotate(11deg); background: linear-gradient(151deg, #fcf8e8 44%, #d6ceb7 47%, #fcf8e8 51%); }

.build { margin-top: 35px; }
.workshop { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .94fr); gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 7px; }
.editor, .preview { padding: clamp(16px, 2.4vw, 28px); min-width: 0; }
.preview { border-left: 1px solid var(--border); }
.editor-heading, .preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 31px; margin-bottom: 7px; }
.editor label, .preview h3 { font-size: 15px; font-weight: 650; }
.editor-heading .label { margin-left: 6px; color: var(--muted); }
.preview-heading .label { color: var(--muted); white-space: nowrap; }
.recipe-heading { margin-top: 14px; }
.ghost { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 5px 6px; min-height: 29px; border: 1px solid transparent; border-radius: 3px; background: none; color: var(--muted); font-size: 12px; }
.ghost:hover { color: var(--ink); background: #edeee4; }
input, textarea { display: block; width: 100%; padding: 8px 11px; background: #fffefa; border: 1px solid #cfcfc0; border-radius: 4px; }
input { min-height: 40px; }
textarea { min-height: 209px; max-height: 620px; padding: 13px; font: 13px/1.55 var(--mono); background: #f1f1e9; resize: vertical; tab-size: 2; }
.field-hint, .feedback, .saved-empty { margin-top: 8px; color: var(--muted); font-size: 13px; }
.feedback:empty:not(#share-status) { display: none; }
.feedback[data-error='true'] { color: #982f20; }
.editor-actions { margin-top: 16px; }
.permalink { margin-top: 16px; }
.permalink-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.permalink-controls input { flex: 1 1 13rem; min-width: 0; font-size: 13px; }
#share-status:empty { margin: 0; }
.preview-board { display: grid; place-items: center; overflow: hidden; aspect-ratio: 1.55; border-radius: 4px; background-color: #dedccd; background-image: linear-gradient(#efeee288, #d6d8c88a), url('/assets/cotton/ash-worktop.webp'); background-position: center; background-size: cover; }
.letter-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 11px; color: var(--muted); font-size: 12px; }
.letter-actions .button { min-height: 35px; color: var(--ink); }
.response { margin-top: 15px; border: 1px solid var(--border); border-radius: 4px; background: #f1f1e9; }
.response summary { cursor: pointer; padding: 8px 11px; font-size: 13px; }
.response pre { max-height: 185px; overflow: auto; margin: 0; padding: 10px 11px; border-top: 1px solid var(--border); font: 12px/1.45 var(--mono); }

.shared-heading { padding-top: clamp(30px, 6vw, 70px); }
.shared-heading h1 { font-size: clamp(42px, 7.5vw, 82px); line-height: .98; overflow-wrap: anywhere; }
.shared-heading .button { margin-top: 18px; }
body[data-shared-project] [data-workshop-only] { display: none; }
body[data-shared-project] .build { margin: 0 0 42px; border-top: 0; }
body[data-shared-project] .editor-heading:first-child,
body[data-shared-project] #app-name { display: none; }
body[data-shared-project] .recipe-heading { margin-top: 0; }

.after-workshop { display: grid; grid-template-columns: 1fr .94fr; gap: clamp(26px, 5vw, 68px); margin-top: 42px; padding-bottom: 48px; }
.after-workshop .section-heading { display: block; }
.after-workshop h2 { margin-bottom: 5px; }
#saved-apps { margin: 0; padding: 0; list-style: none; }
#saved-apps li + li { margin-top: 5px; }
#saved-apps button { display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%; gap: 10px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); text-align: left; overflow-wrap: anywhere; }
#saved-apps button:hover { background: #f0f1e6; }
#saved-apps button[aria-current='true'] { border-color: #9a9d87; }
#saved-apps button small { font-size: 11px; color: var(--muted); }
.saved-tools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; margin-top: 8px; }
.saved-tools p { margin-top: 0; }
.doc-links { display: flex; flex-wrap: wrap; gap: 8px; }
.doc-links a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; background: var(--surface); text-decoration: none; }
.doc-links a:hover { border-color: #9a9d87; }
.doc-links a span { color: var(--accent); }
footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 56px; }
footer a { text-underline-offset: 3px; }

@media (max-width: 880px) {
  .wrap { width: min(100% - 56px, 1152px); }
  .hero { gap: 28px; }
  .template { gap: 9px; grid-template-columns: 43px minmax(0, 1fr) auto; padding: 9px; }
  .template-art { height: 46px; }
  .hero-figure figcaption { inset-inline: 21px; bottom: 20px; font-size: 10px; }
  .hero-figure::before { inset: 12px; }
}
@media (max-width: 660px) {
  .wrap { width: calc(100% - 36px); }
  .topbar { min-height: 56px; gap: 8px; }
  .topbar nav { gap: 12px; font-size: 12px; }
  .topbar a[href='#templates'] { display: none; }
  .identity { gap: 5px; font-size: 20px; }
  .app-word { padding-left: 6px; font-size: 20px; }
  .identity i svg { width: 19px; height: 19px; }
  .hero { grid-template-columns: 1fr; gap: 25px; padding: 36px 0 27px; }
  h1 { font-size: clamp(59px, 11vw, 78px); }
  h1 br { display: none; }
  .intro-copy { margin-top: 15px; }
  .hero-actions { margin-top: 18px; }
  .hero-figure { width: min(100%, 450px); }
  .featured-app { grid-template-columns: 1fr; margin-bottom: 28px; }
  .letter-art { max-height: 160px; min-height: 150px; }
  .letter-art-sheet { margin-top: 1px; }
  .template-grid, .workshop, .after-workshop { grid-template-columns: 1fr; }
  .template-grid { gap: 8px; }
  .template { min-height: 66px; }
  .preview { border-left: 0; border-top: 1px solid var(--border); }
  .build, .after-workshop { margin-top: 28px; }
}
@media (max-width: 440px) {
  .topbar a[href='#origami'] { display: none; }
  .hero-actions { gap: 8px 13px; }
  .button { padding-inline: 10px; }
}
@media (max-width: 360px) {
  .topbar .studio-link { display: none; }
}

.origami-gallery { border-top: 1px solid var(--border); padding: 26px 0 34px; }
.origami-models { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; }
.origami-models a { overflow:hidden; background:var(--surface); border:1px solid var(--border); border-radius:6px; text-decoration:none; }
.origami-models img { display:block; width:100%; height:auto; aspect-ratio:2; object-fit:cover; background:#d2c8b8; }
.origami-models a > span { display:flex; align-items:center; justify-content:space-between; padding:10px 15px; font:24px var(--serif); }
.origami-models a:hover { border-color:#8e9483; }
.origami-models i { color:var(--muted); font-size:16px; }
@media (min-width: 761px) and (max-width: 1100px) {
  .origami-models { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(max-width:620px) {
  .origami-models { grid-template-columns:1fr; gap:8px; }
  .origami-models a { display:grid; grid-template-columns:100px 1fr; }
  .origami-models img { min-height:64px; height:100%; }
}
