:root {
  color-scheme: light dark;
  --page: #faf9f7;
  --surface: #fff;
  --stage: #f2edea;
  --ink: #241f22;
  --muted: #625a60;
  --line: #e5dee1;
  --field-line: #b8acb3;
  --accent: #7d3c6b;
  --button: #7d3c6b;
  --on-button: #fff;
  --accent-wash: #f8eef5;
  --warn: #8a5a00;
  --shadow: 0 18px 36px -14px #3a1f3048, 0 3px 7px #3a1f3018;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #1a1619;
    --surface: #231e22;
    --stage: #151114;
    --ink: #f3eef1;
    --muted: #c0b4bb;
    --line: #3e3439;
    --field-line: #76686f;
    --accent: #e3b2d2;
    --button: #dcaccb;
    --on-button: #3a1530;
    --accent-wash: #3b2a36;
    --warn: #f2c46d;
    --shadow: 0 18px 36px -12px #0009, 0 3px 7px #0004;
  }
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
h1, h2, p { margin: 0; }
button, input, textarea { font: inherit; }
button, summary, .choice, .maker { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.frame { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }

.masthead { border-bottom: 1px solid var(--line); }
.brand { min-height: 66px; display: flex; align-items: center; gap: 11px; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { color: var(--button); }
@media (prefers-color-scheme: dark) { .brand-mark .brand-lines { stroke: var(--on-button); } }
.brand-by { color: var(--muted); font-weight: 500; }
.intro { padding-block: 46px 31px; }
h1 { font-size: clamp(2.4rem, 5vw, 3.75rem); line-height: 1.06; letter-spacing: -.038em; }
.intro p { margin-top: 13px; font-size: clamp(1rem, 2vw, 1.2rem); color: var(--muted); }
.points { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 18px 0 0; padding: 0; list-style: none; font-size: .9rem; font-weight: 600; }
.points li { display: flex; align-items: center; gap: 8px; }
.points li::before { content: ''; width: 14px; height: 8px; margin-top: -4px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }

.tool {
  display: grid;
  grid-template-columns: minmax(0, .78fr) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: 'settings preview' 'exports preview';
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 1px 2px #3a1f300d, 0 12px 32px -18px #3a1f3033;
}
.tool h2 { display: flex; align-items: center; gap: 10px; font-size: 1.125rem; letter-spacing: -.021em; line-height: 1.3; }
.step { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--button); color: var(--on-button); font-size: .78rem; font-weight: 700; letter-spacing: 0; }
.settings { grid-area: settings; padding: 28px 32px 16px; min-width: 0; }
.field { margin: 20px 0 0; padding: 0; border: 0; min-width: 0; }
.field > label, legend { display: block; padding: 0; font-size: .9rem; font-weight: 670; }
.optional { margin-left: 5px; color: var(--muted); font-size: .78rem; font-weight: 450; }
.field > input, .field > textarea {
  display: block;
  width: 100%;
  min-height: 46px;
  margin-top: 6px;
  padding: 9px 12px;
  border: 1px solid var(--field-line);
  border-radius: 9px;
  color: var(--ink);
  background: var(--surface);
}
.field > textarea { height: 244px; min-height: 120px; resize: vertical; line-height: 1.55; tab-size: 4; }
.field > input::placeholder, .field > textarea::placeholder { color: color-mix(in srgb, var(--muted) 78%, var(--surface)); opacity: 1; }
.hint, .status { margin-top: 6px; font-size: .82rem; color: var(--muted); }
.status:empty { margin: 0; }
.status strong { color: var(--ink); font-weight: 650; }
.status .note { color: var(--warn); }
.status ul { margin: 4px 0 0; padding-left: 18px; }
.status li { overflow-wrap: anywhere; }
.sizes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 6px; }
.choice { display: flex; align-items: center; gap: 9px; min-height: 57px; padding: 7px 10px; border: 1px solid var(--field-line); border-radius: 9px; font-size: .88rem; font-weight: 650; }
.choice:has(:checked) { border-color: var(--accent); background: var(--accent-wash); }
.choice small { display: block; color: var(--muted); font-size: .72rem; font-weight: 450; }
.choice input, .maker input { flex: none; width: 17px; height: 17px; margin: 0; accent-color: var(--button); }
.maker { display: flex; align-items: center; gap: 9px; min-height: 44px; margin-top: 11px; font-size: .88rem; }

.preview { grid-area: preview; min-width: 0; border-left: 1px solid var(--line); border-radius: 0 21px 21px 0; background: var(--stage); display: flex; flex-direction: column; }
.preview-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 23px 27px 0; }
.preview-state { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border: 1px solid var(--line); border-radius: 20px; color: var(--muted); background: var(--surface); font-size: .75rem; font-weight: 650; }
.preview-state::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ready .preview-state { color: var(--accent); }
.preview-stage { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 23px 26px 15px; background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--surface) 70%, transparent), transparent 62%); }
.card { width: min(100%, 468px); aspect-ratio: 210 / 297; background: white; box-shadow: var(--shadow); }
.card.paper-letter { width: min(100%, 500px); aspect-ratio: 8.5 / 11; }
.card svg { display: block; width: 100%; height: 100%; }
.paper-caption { text-align: center; padding: 0 16px 19px; color: var(--muted); font-size: .78rem; letter-spacing: .02em; }

.exports { grid-area: exports; padding: 0 32px 20px; }
.exports h2 { border-top: 1px solid var(--line); padding-top: 16px; margin-bottom: 11px; }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
button { min-height: 44px; padding: 8px 12px; border: 1px solid var(--field-line); border-radius: 9px; background: var(--surface); color: var(--ink); font-size: .88rem; font-weight: 680; }
button:not(:disabled):hover { background: var(--accent-wash); }
button.primary { border-color: var(--button); background: var(--button); color: var(--on-button); }
button.primary:not(:disabled):hover { background: color-mix(in srgb, var(--button) 89%, var(--on-button)); }
.actions .primary { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 9px; }
button:disabled { background: var(--surface); border-color: var(--line); color: var(--muted); }
button.primary:disabled { background: var(--button); border-color: var(--button); color: var(--on-button); opacity: .5; }
#export-message { min-height: 1.5em; }

.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px; padding: 35px 0; }
.facts > div { padding: 21px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.facts svg { display: block; box-sizing: content-box; padding: 9px; margin-bottom: 14px; border-radius: 11px; color: var(--accent); background: var(--accent-wash); }
.facts h2 { margin-bottom: 5px; font-size: 1.06rem; letter-spacing: -.012em; }
.facts p, .faq p, dialog p { color: var(--muted); font-size: .92rem; }
.faq { display: grid; grid-template-columns: minmax(0, .67fr) minmax(0, 1fr); gap: 25px; padding: 27px 0 58px; border-top: 1px solid var(--line); }
.faq h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); letter-spacing: -.04em; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { min-height: 52px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; font-weight: 650; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ''; flex: none; width: 8px; height: 8px; margin-right: 4px; border-right: 1.5px solid var(--accent); border-bottom: 1.5px solid var(--accent); transform: translateY(-2px) rotate(45deg); }
.faq details[open] summary::after { transform: translateY(2px) rotate(225deg); }
.faq p { padding: 0 22px 15px 0; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.site-footer .frame { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; min-height: 65px; }
.site-footer button { border: 0; padding-inline: 7px; background: transparent; color: var(--accent); }
dialog { width: min(430px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: #081323a0; }
dialog p, dialog form { margin-top: 13px; }
dialog form { display: flex; justify-content: end; }

@media (max-width: 760px) {
  .frame { width: min(480px, calc(100% - 32px)); }
  .brand { min-height: 57px; }
  .intro { padding-block: 29px 22px; }
  .tool { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: 'settings' 'preview' 'exports'; }
  .settings { padding: 20px 17px 11px; }
  .field > textarea { height: 150px; }
  .field { margin-top: 15px; }
  .preview { border: 1px solid var(--line); border-inline: 0; border-radius: 0; }
  .preview-bar { padding: 15px 17px 0; }
  .preview-stage { padding: 16px 14px 12px; }
  .paper-caption { padding-bottom: 13px; }
  .exports { padding: 0 17px 16px; }
  .exports h2 { border-top: 0; }
  .facts, .faq { grid-template-columns: 1fr; }
  .facts { gap: 9px; padding-block: 23px; }
  .facts > div { padding: 16px; }
  .faq { gap: 7px; padding-block: 22px 35px; }
}

@page { margin: 0; }
@page letter { size: letter portrait; margin: 0; }
@page a4 { size: A4 portrait; margin: 0; }
@media print {
  :root { background: white; color-scheme: light; }
  .masthead, .site-footer, .intro, .settings, .exports, .facts, .faq, dialog,
  .preview-bar, .paper-caption, .tool:not(.ready) .preview { display: none !important; }
  main.frame, .tool, .preview, .preview-stage, .card {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: white;
    box-shadow: none;
  }
  .card { aspect-ratio: auto; break-inside: avoid; }
  /* Leave one point of slack to avoid a second page from print rounding. The SVG centers itself. */
  .card.paper-letter { page: letter; width: 100%; height: 791pt; }
  .card.paper-a4 { page: a4; height: calc(297mm - 1pt); }
}
