/* Pastel workshop: mint paper, deep-teal ink, one peach accent. Light theme only. */
@font-face {
  font-family: "Young Serif"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/young-serif-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Young Serif"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/young-serif-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/schibsted-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/schibsted-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --paper:   oklch(97.6% 0.016 175);
  --surface: oklch(94.2% 0.034 175);
  --ink:     oklch(29% 0.045 215);
  --ink-2:   oklch(45% 0.04 215);
  --rule:    oklch(29% 0.045 215 / .14);
  --rule-hi: oklch(29% 0.045 215 / .38);
  --grid-minor: oklch(29% 0.045 215 / .05);
  --grid-major: oklch(29% 0.045 215 / .1);
  --accent:  oklch(83% 0.095 48);      /* pastel peach: fills only, always with --ink text */
  --accent-deep: oklch(48% 0.15 38);   /* same hue, dark enough for text, focus and indicators */
  --ok:      oklch(36% 0.09 155);
  --ok-bg:   oklch(91% 0.06 155);
  --bad:     oklch(42% 0.15 25);
  --bad-bg:  oklch(92% 0.05 20);

  --serif: "Young Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);       /* ease-out-expo */
  --gutter: clamp(16px, 4vw, 40px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.5 var(--sans); }
a { color: inherit; text-decoration-color: var(--rule-hi); text-underline-offset: .18em; }
a:hover { color: var(--accent-deep); text-decoration-color: currentColor; }
::selection { background: var(--accent); color: var(--ink); }
input { caret-color: var(--accent-deep); }
input[type=checkbox] { accent-color: var(--accent-deep); }
html { scrollbar-color: var(--rule-hi) transparent; }
code { font: .9em ui-monospace, "SF Mono", Menlo, monospace; }
:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 2px; }

.skip { position: absolute; left: var(--gutter); top: -4rem; background: var(--ink); color: var(--paper); padding: .5rem .9rem; z-index: 10; }
.skip:focus { top: .5rem; }
.skip:hover, .skip:focus { color: var(--paper); }   /* beats the generic a:hover accent colour */

/* ---------- masthead ---------- */
.masthead, .sheet, footer { max-width: 1240px; margin-inline: auto; padding-inline: var(--gutter); }
.masthead { display: grid; grid-template-columns: 1fr minmax(0, 38ch); gap: 1rem 3rem; align-items: end; padding-block: clamp(28px, 6vw, 64px) clamp(20px, 3vw, 32px); }
h1 { margin: 0; font: 400 clamp(2.5rem, 1.2rem + 5.6vw, 4.75rem)/1 var(--serif); letter-spacing: -.015em; text-wrap: balance; }
h1 em { font-style: normal; color: var(--accent-deep); }
.lede p { margin: 0; color: var(--ink-2); text-wrap: pretty; }
.quota { margin-top: .6rem !important; font-size: .8125rem; }
.quota:empty { display: none; }
@media (max-width: 760px) { .masthead { grid-template-columns: 1fr; } }

/* ---------- layout ---------- */
.sheet { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); padding-block: 8px 48px; align-items: start; }
@media (max-width: 860px) { .sheet { grid-template-columns: 1fr; } }

.label { margin: 0; font: 600 .75rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }

/* ---------- spec sheet (form) ---------- */
.spec { border-top: 2px solid var(--ink); padding-top: 14px; display: grid; gap: 18px; }
.spec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.units-link { font-size: .8125rem; color: var(--ink-2); white-space: nowrap; }
.units-link .flag { width: 1.15em; height: auto; vertical-align: -.12em; margin-left: .25em; border-radius: 1.5px; outline: 1px solid var(--rule); }
.field { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; row-gap: 3px; align-items: center; }
.field label { font-weight: 500; font-size: .9375rem; }
.field small { grid-column: 1 / -1; color: var(--ink-2); font-size: .8125rem; line-height: 1.35; text-wrap: pretty; }
.control { display: inline-flex; align-items: center; gap: 6px; }
.unit { color: var(--ink-2); font-size: .875rem; min-width: 1.6em; }
input[type=number] {
  font: 500 1rem var(--sans); font-variant-numeric: tabular-nums; color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule-hi); border-radius: 4px; padding: 7px 9px; min-width: 0;
  transition: border-color .15s, background-color .15s;
}
input[type=number] { width: 6.6rem; text-align: right; }
.more input[type=number][id^=bed] { width: 4.6rem; }
input[type=number]:hover { border-color: var(--ink-2); }
input[type=number]:user-invalid { border-color: var(--bad); background: var(--bad-bg); }

.more { border-top: 1px solid var(--rule); padding-top: 12px; }
.more[open] { display: grid; gap: 18px; }
.more summary { cursor: pointer; font-size: .9375rem; font-weight: 500; list-style: none; display: flex; align-items: center; gap: 8px; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: ""; width: .45em; height: .45em; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .25s var(--ease); }
.more[open] summary::before { transform: rotate(45deg); }
.more summary:hover { color: var(--accent-deep); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .9375rem; line-height: 1.35; cursor: pointer; }
.check input { margin-top: .2em; accent-color: var(--accent-deep); width: 1rem; height: 1rem; flex: none; }

.actions { display: grid; gap: 10px; justify-items: start; padding-top: 6px; }
button { font: inherit; cursor: pointer; }
#go {
  width: 100%; padding: 12px 18px; font-weight: 600; letter-spacing: .01em; color: var(--ink); background: var(--accent);
  border: 0; border-radius: 4px; transition: transform .15s var(--ease), filter .15s;
}
#go:hover:not(:disabled) { filter: brightness(.95) saturate(1.1); }
#go:active:not(:disabled) { transform: translateY(1px); }
#go:disabled { cursor: progress; filter: saturate(.5); }
.link { background: none; border: 0; padding: 0; color: var(--ink-2); font-size: .875rem; text-decoration: underline; text-decoration-color: var(--rule-hi); text-underline-offset: .2em; }
.link:hover { color: var(--accent-deep); }
.error { margin: 0; padding: 10px 12px; border-radius: 4px; background: var(--bad-bg); color: var(--bad); font-size: .9rem; text-wrap: pretty; }

/* ---------- stage (preview + results) ---------- */
.stage { min-width: 0; display: grid; gap: 14px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 2.25rem; border-top: 2px solid var(--ink); padding-top: 14px; margin-bottom: -2px; flex-wrap: wrap; }
.tabs { display: flex; gap: 20px; }
.tabs button { background: none; border: 0; padding: 2px 0 6px; color: var(--ink-2); font-size: .9375rem; font-weight: 500; border-bottom: 2px solid transparent; transition: color .15s, border-color .15s; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent-deep); }

.viewer {
  position: relative; height: clamp(320px, 62vh, 560px); overflow: hidden; border: 1px solid var(--rule-hi); background-color: var(--surface);
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px), linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-minor) 1px, transparent 1px), linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
}
.viewer canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .5s var(--ease); }
.viewer.has-model canvas { opacity: 1; }
.viewer[aria-busy=true] canvas { opacity: .35; }
.empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 24px; text-align: center; color: var(--ink-2); }
.empty svg { color: var(--ink-2); opacity: .75; margin-bottom: 10px; }
.empty p { margin: 0; text-wrap: balance; }
.empty-title { font: 400 1.25rem/1.25 var(--serif); color: var(--ink); }
.empty-note { font-size: .875rem; max-width: 36ch; }
.busy { position: absolute; left: 0; right: 0; top: 0; }
.busy .bar { display: block; height: 2px; background: var(--accent-deep); transform-origin: left; animation: sweep 1.4s var(--ease) infinite; }
.busy p { margin: 12px 14px; font-size: .875rem; color: var(--ink-2); max-width: 46ch; text-wrap: pretty; }
@keyframes sweep { 0% { transform: translateX(-100%) scaleX(.4); } 100% { transform: translateX(100%) scaleX(.4); } }

#results { display: grid; gap: 12px; margin-top: 10px; }
#results .label { margin-top: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font: 600 .75rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); padding: 0 16px 8px 0; border-bottom: 1px solid var(--ink); white-space: nowrap; }
td { padding: 10px 16px 10px 0; border-bottom: 1px solid var(--rule); white-space: nowrap; font-size: .9375rem; }
td:first-child { font-family: var(--serif); font-size: 1.0625rem; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 3px; font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.warnings { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.warnings:empty { display: none; }
.warnings li { padding: 9px 12px; border-radius: 4px; background: var(--bad-bg); color: var(--bad); font-size: .9rem; text-wrap: pretty; }
.downloads { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.downloads a { display: inline-flex; gap: 8px; align-items: baseline; padding: 9px 14px; border: 1px solid var(--ink); border-radius: 4px; text-decoration: none; font-weight: 500; font-size: .9375rem; transition: background-color .15s, color .15s, border-color .15s; }
.downloads a::before { content: ""; flex: none; width: .95em; height: .95em; align-self: center; background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v8M4.5 7 8 10.5 11.5 7M3 13.5h10'/%3E%3C/svg%3E") center / contain no-repeat; }
.downloads a:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.downloads span { font-size: .8125rem; opacity: .7; }
.note { margin: 0; color: var(--ink-2); font-size: .875rem; max-width: 62ch; text-wrap: pretty; }

footer { padding-block: 20px 40px; border-top: 1px solid var(--rule); color: var(--ink-2); font-size: .8125rem; }
footer p { margin: 0; max-width: 90ch; text-wrap: pretty; }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.masthead, .spec, .stage { animation: rise .8s var(--ease) both; }
.spec { animation-delay: .07s; }
.stage { animation-delay: .14s; }
#results.reveal > * { animation: rise .6s var(--ease) both; }
#results.reveal > :nth-child(2) { animation-delay: .05s; }
#results.reveal > :nth-child(3) { animation-delay: .1s; }
#results.reveal > :nth-child(4) { animation-delay: .15s; }
#results.reveal > :nth-child(5) { animation-delay: .2s; }
#results.reveal > :nth-child(6) { animation-delay: .25s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
