/* Infiniyo Booklet — a single, dependency-free stylesheet. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --ink: #16181d;
  --ink-2: #4a4f5a;
  --muted: #71767f;
  --line: #dfe2e8;
  --line-2: #c9cdd6;
  --accent: #252a34;
  --accent-ink: #ffffff;
  --focus: #3d6be3;
  --danger: #b3261e;
  --danger-bg: #fdeceb;
  --warn: #8a5a00;
  --warn-bg: #fff5e0;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 18, 24, .06), 0 4px 16px rgba(16, 18, 24, .05);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216;
    --surface: #181b21;
    --surface-2: #1f232a;
    --ink: #e9ebef;
    --ink-2: #b6bbc4;
    --muted: #8b9098;
    --line: #2a2f38;
    --line-2: #3a4049;
    --accent: #e9ebef;
    --accent-ink: #14161a;
    --focus: #7aa0ff;
    --danger: #ff9a92;
    --danger-bg: #34191a;
    --warn: #f0c073;
    --warn-bg: #2e2415;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 20px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: min(1180px, 100% - 2.5rem); margin-inline: auto; }

a { color: inherit; }

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.014em; }

/* ---------------------------------------------------------------- header */

.site-head {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
}

.head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-weight: 650;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand svg { width: 28px; height: 28px; flex: none; }
.brand svg rect { fill: var(--accent); }
.brand svg path { fill: none; stroke: var(--accent-ink); stroke-width: 1.6; stroke-linejoin: round; }

.site-head nav { display: flex; gap: 1.25rem; font-size: .92rem; }
.site-head nav a { color: var(--ink-2); text-decoration: none; }
.site-head nav a:hover { color: var(--ink); text-decoration: underline; }

/* ------------------------------------------------------------------ hero */

.hero { padding: 2.75rem 0 1.75rem; max-width: 60ch; }
.hero h1 { margin: 0 0 .6rem; font-size: clamp(1.65rem, 1.1rem + 2vw, 2.4rem); }
.lede { margin: 0; color: var(--ink-2); font-size: 1.03rem; }

/* ----------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.muted { color: var(--muted); }
.small { font-size: .86rem; }

/* -------------------------------------------------------------- dropzone */

.dropzone {
  border: 2px dashed var(--line-2);
  border-radius: var(--radius);
  padding: 2.5rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: var(--surface-2);
}

.dropzone:hover, .dropzone:focus-visible { border-color: var(--focus); outline: none; }
.dropzone.is-over { border-color: var(--focus); background: color-mix(in srgb, var(--focus) 8%, var(--surface-2)); }

.drop-icon { width: 34px; height: 34px; stroke: var(--muted); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.drop-title { margin: .6rem 0 .2rem; font-weight: 600; }
.drop-hint { margin: 0; color: var(--muted); font-size: .88rem; }
.link { color: var(--focus); text-decoration: underline; }

.file-info { display: flex; align-items: center; gap: .9rem; }
.file-icon svg { width: 34px; height: 34px; fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: round; }
.file-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.file-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta span { font-size: .87rem; }

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: .6rem 1.05rem;
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s;
}

.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { opacity: .9; }
.btn.ghost { background: transparent; }
.btn.small { padding: .4rem .7rem; font-size: .87rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* --------------------------------------------------------------- alerts */

.alert {
  border-radius: var(--radius-sm);
  padding: .8rem 1rem;
  margin-bottom: 1.1rem;
  font-size: .93rem;
  border: 1px solid transparent;
}

.alert.error { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert p { margin: 0 0 .4rem; }
.alert p:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------ workspace */

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.25rem;
}

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem;
}

/* Deliberately not sticky: the settings list is taller than most viewports,
   and an inner scrollbar hides options people need to find. */
.settings { align-self: start; }

fieldset { border: 0; border-top: 1px solid var(--line); margin: 0 0 1rem; padding: 1rem 0 0; }
fieldset:first-of-type { border-top: 0; padding-top: 0; }
legend { font-weight: 650; font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 0; }

.row { margin-top: .8rem; display: flex; flex-direction: column; gap: .3rem; }
.row label { font-size: .87rem; color: var(--ink-2); font-weight: 500; display: flex; justify-content: space-between; gap: .5rem; }
.row output { color: var(--muted); font-variant-numeric: tabular-nums; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .9rem; }
@media (max-width: 420px) { .grid-2 { grid-template-columns: 1fr; } }

select, input[type="text"], input[type="number"] {
  width: 100%;
  font: inherit;
  font-size: .93rem;
  padding: .5rem .6rem;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}

select:focus, input:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }

input[type="range"] { width: 100%; accent-color: var(--focus); margin: .25rem 0 0; }

.check { display: flex; gap: .55rem; align-items: flex-start; margin-top: .6rem; font-size: .9rem; color: var(--ink-2); cursor: pointer; }
.check input { margin-top: .22rem; accent-color: var(--focus); flex: none; }
.check em { font-style: normal; color: var(--muted); }

.hint { font-size: .82rem; color: var(--muted); margin: .55rem 0 0; }

.reset-row { padding-top: .3rem; }

/* modes */

.modes { display: grid; gap: .5rem; margin-top: .7rem; }

.mode {
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: .65rem .75rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.mode:hover { border-color: var(--muted); }
.mode input { margin-top: .28rem; accent-color: var(--focus); flex: none; }
.mode:has(input:checked) { border-color: var(--focus); background: color-mix(in srgb, var(--focus) 7%, transparent); }
.mode:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.mode-body { display: flex; flex-direction: column; gap: .12rem; }
.mode-name { font-weight: 600; font-size: .93rem; }
.mode-desc { font-size: .81rem; color: var(--muted); line-height: 1.4; }

/* ---------------------------------------------------------------- result */

.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.result-head h2 { margin: 0 0 .15rem; font-size: 1.2rem; }
.result-head p { margin: 0; font-size: .9rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: .6rem;
  margin: 1rem 0 0;
}

.stat {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: .6rem .7rem;
}

.stat b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat span { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.instructions { margin-top: 1.1rem; background: var(--surface-2); border-radius: var(--radius-sm); padding: .9rem 1rem; }
.instructions h3 { margin: 0 0 .5rem; font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.instructions ol { margin: 0; padding-left: 1.2rem; font-size: .91rem; color: var(--ink-2); }
.instructions li { margin-bottom: .3rem; }
.instructions li:last-child { margin-bottom: 0; }
.instructions strong { color: var(--ink); }

.tabs { display: flex; gap: .3rem; margin: 1.2rem 0 .9rem; border-bottom: 1px solid var(--line); }

.tab {
  border: 0;
  background: none;
  font: inherit;
  font-size: .9rem;
  font-weight: 550;
  color: var(--muted);
  padding: .5rem .8rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

.tab-panel { min-height: 120px; }

#pdfFrame { width: 100%; height: min(72vh, 780px); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.pdf-fallback { margin: .6rem 0 0; font-size: .85rem; color: var(--muted); }

/* sheet plan */

.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }

.plan-sheet { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.plan-cap { display: flex; justify-content: space-between; gap: .4rem; font-size: .72rem; padding: .35rem .5rem; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--surface); }
.plan-cap b { color: var(--ink-2); font-weight: 600; }

.plan-slots { display: grid; gap: 2px; padding: 4px; background: var(--line); }
.plan-slot {
  background: var(--surface);
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: .95rem;
  min-height: 62px;
  color: var(--ink);
}
.plan-slot.blank { color: var(--muted); font-weight: 400; font-size: .74rem; background: repeating-linear-gradient(135deg, var(--surface), var(--surface) 5px, var(--surface-2) 5px, var(--surface-2) 10px); }
.plan-slot small { display: block; font-size: .66rem; font-weight: 400; color: var(--muted); text-align: center; }

.plan-more { margin: .8rem 0 0; font-size: .85rem; color: var(--muted); }

/* spinner */

.spinner { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .9rem; margin-top: .9rem; }
.spinner span {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line-2); border-top-color: var(--focus);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner span { animation-duration: 2s; } }

/* ----------------------------------------------------------------- prose */

.prose { max-width: 74ch; }
.prose h2 { margin: 0 0 .7rem; font-size: 1.25rem; }
.prose h3 { margin: 1.35rem 0 .35rem; font-size: 1rem; }
.prose p { margin: 0 0 .7rem; color: var(--ink-2); }
.prose code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
.steps { margin: 0; padding-left: 1.2rem; color: var(--ink-2); }
.steps li { margin-bottom: .4rem; }

/* ---------------------------------------------------------------- footer */

.site-foot { border-top: 1px solid var(--line); background: var(--surface); padding: 1.5rem 0; margin-top: 2rem; }
.site-foot p { margin: 0 0 .25rem; font-size: .9rem; color: var(--ink-2); }

[hidden] { display: none !important; }

/* ------------------------------------------------------- result actions */

.result-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn-icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }

/* --------------------------------------------------------- print passes */

.sections { margin-top: 1.1rem; }

.sections-intro {
  margin: 0 0 .6rem;
  font-size: .88rem;
  color: var(--ink-2);
}

.section-card {
  display: flex;
  align-items: center;
  gap: .85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .7rem .85rem;
  margin-bottom: .5rem;
  background: var(--surface);
}

.section-card.is-card-stock {
  border-color: color-mix(in srgb, var(--focus) 45%, var(--line));
  background: color-mix(in srgb, var(--focus) 5%, var(--surface));
}

.section-num {
  flex: none;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: .82rem;
  font-weight: 650;
}

.section-body { display: flex; flex-direction: column; gap: .1rem; min-width: 0; flex: 1; }
.section-body strong { font-size: .94rem; }
.section-meta { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.section-hint { font-size: .82rem; color: var(--ink-2); }

.section-actions { display: flex; gap: .4rem; flex: none; }

@media (max-width: 560px) {
  .section-card { flex-wrap: wrap; }
  .section-actions { width: 100%; }
  .section-actions .btn { flex: 1; }
}

/* ------------------------------------------------------- cover pickers */

.cover-pick {
  margin-top: .7rem;
  padding: .75rem .8rem .85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.cover-pick .hint { margin-top: 0; }
.cover-pick .row { margin-top: .5rem; }

/* ------------------------------------------------------ sheet plan groups */

.plan-group {
  margin: 1rem 0 .5rem;
  font-size: .78rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.plan-group:first-child { margin-top: 0; }

.plan-slot.is-role {
  font-size: .74rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  padding: 0 .3rem;
}

/* ------------------------------------------------ upload transparency */

.drop-hint code {
  font-family: var(--mono);
  font-size: .92em;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  padding: .05em .3em;
  border-radius: 3px;
}

.drop-hint-sub { margin-top: .35rem; font-size: .82rem; opacity: .85; }

.drop-note,
.privacy-badge {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  margin: .8rem 0 0;
  font-size: .84rem;
  line-height: 1.45;
  color: var(--ink-2);
}

.drop-note svg,
.privacy-badge svg {
  flex: none;
  width: 17px;
  height: 17px;
  margin-top: .1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drop-note { color: var(--muted); }
.drop-note svg { stroke: var(--warn); }

.privacy-badge {
  padding-top: .8rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.privacy-badge svg { stroke: #1f8a4c; }
@media (prefers-color-scheme: dark) { .privacy-badge svg { stroke: #64c98c; } }
.privacy-badge strong, .drop-note strong { color: var(--ink-2); }

/* ------------------------------------------------------ style thumbnails */

.mode { display: grid; grid-template-columns: auto auto 1fr; align-items: start; }

.mode-thumb {
  flex: none;
  width: 52px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: var(--surface-2);
  margin-top: .05rem;
}

.mode-thumb svg {
  width: 46px;
  height: 32px;
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mode-thumb svg .accent { stroke: var(--muted); }

.mode:has(input:checked) .mode-thumb { background: color-mix(in srgb, var(--focus) 14%, var(--surface)); }
.mode:has(input:checked) .mode-thumb svg { stroke: var(--focus); }
.mode:has(input:checked) .mode-thumb svg .accent { stroke: color-mix(in srgb, var(--focus) 65%, var(--muted)); }

/* --------------------------------------------------- printer test guide */

.test-guide {
  margin-top: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.test-guide summary {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem .85rem;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 550;
  list-style: none;
  border-radius: var(--radius-sm);
}

.test-guide summary::-webkit-details-marker { display: none; }

.test-guide summary::after {
  content: "";
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-right: 1.8px solid var(--muted);
  border-bottom: 1.8px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .15s;
}

.test-guide[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.test-guide summary:hover { color: var(--ink); }
.test-guide summary:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

.test-guide summary svg {
  flex: none;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--focus);
  stroke-width: 1.7;
  stroke-linecap: round;
}

.test-guide-body { padding: 0 .85rem .85rem; }
.test-guide-body > p { margin: 0 0 .7rem; font-size: .87rem; color: var(--ink-2); }

.symptoms { margin: 0; font-size: .86rem; }
.symptoms dt { font-weight: 600; color: var(--ink); margin-top: .6rem; }
.symptoms dt:first-child { margin-top: 0; }
.symptoms dd { margin: .12rem 0 0; color: var(--ink-2); }
