:root {
  --ink: #3d3236;
  --muted: #7a6f72;
  --line: #e4e0dc;
  --bg: #faf9f7;
  --card: #fff;
  --accent: #ffd633;
  --accent-ink: #3d3236;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ---------- Header ---------- */
.site-header { background: var(--accent); }
.ruler {
  height: 14px;
  background:
    repeating-linear-gradient(90deg, rgba(61,50,54,.55) 0 1px, transparent 1px 37.8px) top/100% 14px no-repeat,
    repeating-linear-gradient(90deg, rgba(61,50,54,.4) 0 1px, transparent 1px 3.78px) top/100% 6px no-repeat;
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; }
.brand { font-weight: 800; text-decoration: none; font-size: 1.15rem; }
.menu { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.menu > li { position: relative; }
.menu > li > a { display: block; padding: 6px 12px; border-radius: 6px; text-decoration: none; font-weight: 600; font-size: .95rem; }
.menu > li > a:not(.btn-bmc):hover { background: rgba(0,0,0,.07); }
.menu > li > a[aria-current="page"] { background: var(--ink); color: var(--accent); }
.has-sub > a::after { content: ""; display: inline-block; margin-left: 6px; vertical-align: 2px;
  border: 4px solid transparent; border-top-color: currentColor; border-bottom: 0; }
.sub {
  display: none; position: absolute; right: 0; top: 100%; z-index: 20; min-width: 270px;
  list-style: none; margin: 0; padding: 6px; background: #fff; border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
}
.has-sub:hover > .sub, .has-sub:focus-within > .sub { display: block; }
.sub a { display: flex; justify-content: space-between; gap: 12px; padding: 7px 10px; border-radius: 6px; text-decoration: none; font-size: .92rem; }
.sub a:hover { background: #f4f1ee; }
.sub small { color: var(--muted); }

.btn-bmc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff !important;
  font-weight: 600;
  font-size: .88rem;
  text-decoration: none;
  line-height: 1.2;
  margin-left: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
  transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.menu > li > a.btn-bmc:hover,
.btn-bmc:hover {
  background: #ff5e5b !important;
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.22);
}
.btn-bmc .bmc-icon {
  width: 15px;
  height: 15px;
  fill: currentColor;
  flex-shrink: 0;
}

.site-footer { margin-top: 56px; padding: 32px 0 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; background: #f4f2ef; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.footer-grid strong { color: var(--ink); }
.footer-grid ul { list-style: none; padding: 0; margin: 8px 0 0; }
.footer-grid li { margin: 3px 0; }
.footer-grid a { text-decoration: none; }
.footer-grid a:hover { text-decoration: underline; }
.copyright { margin-top: 24px; font-size: .85rem; }
.policy h1 { margin: 8px 0 0; font-size: clamp(1.7rem, 4vw, 2.4rem); }
.policy h2 { font-size: 1.2rem; margin-top: 32px; }
.policy li { margin: 6px 0; }

/* ---------- Ad slots (reserve space → no CLS) ---------- */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  margin: 16px auto;
}
.ad-slot ins { width: 100%; }
.ad-leaderboard { max-width: 728px; min-height: 90px; }
.ad-rect { width: 300px; min-height: 250px; }
.ad-inarticle { min-height: 250px; }
.ad-mobile { display: none; }

/* ---------- Tool layout ---------- */
.tool-layout { display: block; }
.tool-main { max-width: 1000px; margin: 0 auto; }
.tool-title { margin: 8px 0 0; font-size: 1.75rem; line-height: 1.2; }
.tool-lead { margin: 4px 0 16px; color: var(--muted); }

.tool-card {
  display: grid; grid-template-columns: 300px minmax(0, 1fr);
  background: var(--card); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 6px 24px rgba(0,0,0,.06);
  overflow: hidden;
}
.tool-controls { padding: 20px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 16px; }

.type-picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.type-picker button {
  aspect-ratio: 1; border: 0; background: none; color: var(--muted); border-radius: 8px; cursor: pointer; padding: 6px;
}
.type-picker button svg { width: 100%; height: 100%; display: block; }
.type-picker button:hover { background: #f4f1ee; color: var(--ink); }
.type-picker button[aria-checked="true"] { background: var(--ink); color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field .label { font-size: .9rem; font-weight: 400; color: var(--ink); }
.slider-row { display: flex; align-items: center; gap: 10px; }
.slider-row input[type="range"] { flex: 1; min-width: 0; accent-color: var(--ink); }
.num-unit { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.num-unit input { width: 58px; border: 0; padding: 6px; text-align: right; font: inherit; }
.num-unit select { border: 0; border-left: 1px solid var(--line); background: #f7f5f3; font: inherit; padding: 0 4px; }
output { min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }

.swatches { display: flex; gap: 8px; }
.swatches button {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; background: var(--c);
  box-shadow: 0 0 0 1px var(--line); cursor: pointer;
}
.swatches button[aria-checked="true"] { box-shadow: 0 0 0 2px var(--ink); }

.two-col { flex-direction: row; gap: 10px; }
.two-col label { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: .9rem; font-weight: 400; color: var(--ink); }
.two-col select { font: inherit; font-size: .95rem; color: var(--ink); padding: 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

.pages-row { flex-direction: row; align-items: center; justify-content: space-between; }
.stepper { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.stepper button { width: 34px; border: 0; background: #f7f5f3; font: inherit; font-size: 1.1rem; cursor: pointer; color: var(--ink); }
.stepper button:hover { background: #ece8e4; }
.stepper input { width: 52px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  text-align: center; font: inherit; padding: 6px 0; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.btn { font: inherit; font-weight: 600; border-radius: 6px; padding: 12px 16px; cursor: pointer; border: 2px solid transparent; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(.96); }
.btn-ghost { background: #fff; border-color: var(--ink); color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: #fff; }
.btn:disabled { opacity: .6; cursor: wait; }

.tool-preview {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 20px; background: #efece8;
}
.paper { width: 100%; display: flex; justify-content: center; }
.paper svg {
  display: block; height: auto; width: auto; max-width: 100%; max-height: min(760px, 85vh);
  box-shadow: 0 2px 10px rgba(0,0,0,.15); background: #fff;
}
.preview-note { margin: 0; font-size: .8rem; color: var(--muted); }

.prose { max-width: 760px; }
.callout {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 20px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.callout p {
  margin: 0;
  font-size: .95rem;
  line-height: 1.5;
}
.callout a {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.callout a:hover {
  text-decoration-thickness: 2px;
}
.tool-content h2 { margin-top: 32px; font-size: 1.3rem; }
.tool-content h3 { font-size: 1.05rem; margin-bottom: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  .ad-mobile { display: flex; }
}
@media (max-width: 700px) {
  .tool-card { grid-template-columns: 1fr; }
  .tool-controls { border-right: 0; border-bottom: 1px solid var(--line); }
  .paper svg { max-height: 420px; }
  .ad-leaderboard { min-height: 100px; max-width: 320px; }
  .nav { flex-direction: column; align-items: flex-start; padding-bottom: 8px; gap: 0; }
  .btn-bmc { margin-left: 0; margin-top: 4px; }
}

/* ---------- Print: only the generated sheet ---------- */
#print-root { display: none; }
@media print {
  body { background: #fff; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; overflow: hidden; }
  #print-root svg { display: block; }
  .print-page { overflow: hidden; break-after: page; page-break-after: always; }
  .print-page:last-child { break-after: auto; page-break-after: auto; }
}

/* ---------- Site pages ---------- */
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.hero { padding-top: 32px; }
.hero h1, .page-head h1 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.15; }
.lead { color: var(--muted); font-size: 1.08rem; max-width: 760px; margin: 8px 0 0; }
.page-head { margin: 8px 0 24px; }
.section-title { font-size: 1.4rem; margin: 40px 0 16px; }
.section-sub { margin: -8px 0 16px; }
.aka { margin: 6px 0 0; font-size: .9rem; color: var(--muted); }

.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 20px 0 8px; font-size: .88rem; color: var(--muted); }
.breadcrumb li + li::before { content: "›"; margin-right: 6px; }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.card { display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05); overflow: hidden; }
.card-thumb { display: flex; justify-content: center; padding: 20px; background: #efece8; }
.card-thumb img { width: 46%; height: auto; box-shadow: 0 2px 8px rgba(0,0,0,.15); background: #fff; transition: transform .2s; }
.card:hover .card-thumb img { transform: translateY(-3px); }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.card-body p { margin: 0 0 10px; font-size: .95rem; }
.card-title { margin: 0 0 2px; font-size: 1.12rem; line-height: 1.3; }
.card-title a { text-decoration: none; }
.card-title a:hover { text-decoration: underline; }
.card-meta { color: var(--muted); font-size: .85rem !important; }
.card-links { margin-top: auto !important; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-links > a:not(.pill) { font-weight: 600; text-decoration: none; font-size: .9rem; }
.card-tool { background: var(--ink); color: #fff; }
.card-tool .card-meta { color: #d8cfcf; }
.card-tool .card-body { justify-content: center; padding: 28px 22px; }

.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--ink);
  text-decoration: none; font-weight: 600; font-size: .85rem; white-space: nowrap; }
.pill:hover { background: var(--ink); color: #fff; }
.pill-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pill-accent:hover { background: #fff; color: var(--ink); }
.pill-active { background: var(--ink); color: var(--accent); }

.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
table.data { width: 100%; border-collapse: collapse; font-size: .93rem; }
.data th, .data td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data thead th { background: #f4f1ee; font-size: .82rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.data tbody th { font-weight: 600; }
.data tbody tr:hover { background: #fcfbf9; }
.data tbody tr:last-child > * { border-bottom: 0; }
.data a { text-decoration: none; }
.data tbody th a:hover, .data td > a:not(.pill):hover { text-decoration: underline; }
.matrix td { text-align: center; }
.matrix td a { font-weight: 700; padding: 2px 4px; border-radius: 4px; }
.matrix td a:hover { background: var(--accent); }
.thumb-cell img { display: block; width: 44px; height: auto; box-shadow: 0 1px 4px rgba(0,0,0,.2); background: #fff; }

.detail { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0; background: var(--card);
  border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 6px 24px rgba(0,0,0,.06); overflow: hidden; }
.detail-preview { background: #efece8; padding: 28px; display: flex; align-items: center; justify-content: center; }
.detail-preview img { display: block; width: auto; height: auto; max-width: 100%; max-height: 560px; box-shadow: 0 2px 10px rgba(0,0,0,.15); background: #fff; }
.detail-panel { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.specs { border-collapse: collapse; width: 100%; font-size: .95rem; }
.specs th, .specs td { text-align: left; padding: 7px 0; border-bottom: 1px solid var(--line); }
.specs th { color: var(--muted); font-weight: 400; width: 40%; }
.opt-row { display: flex; gap: 12px; }
.opt-row label { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }
.opt-row select { font: inherit; padding: 7px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.detail .actions .btn { text-align: center; text-decoration: none; }

.size-chips { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin-bottom: 20px; }
.size-chip { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px; border-radius: 8px; text-decoration: none; font-size: .85rem; }
.size-chip:hover { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.size-chip small { color: var(--muted); }
.sheet { display: block; background: #fff; border: 1px solid #cfc8c2;
  background-image: linear-gradient(#e8e4e0 1px, transparent 1px), linear-gradient(90deg, #e8e4e0 1px, transparent 1px);
  background-size: 6px 6px; }

.size-summary { display: grid; grid-template-columns: 90px minmax(0, 360px) 1fr; gap: 24px; align-items: center;
  background: var(--card); padding: 20px; border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.sheet-lg { display: block; width: 90px; background: #fff; border: 1px solid #cfc8c2;
  background-image: linear-gradient(#e8e4e0 1px, transparent 1px), linear-gradient(90deg, #e8e4e0 1px, transparent 1px);
  background-size: 7px 7px; }
.other-sizes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.other-sizes .label { width: 100%; color: var(--muted); font-size: .85rem; }

@media (max-width: 860px) {
  .detail { grid-template-columns: 1fr; }
  .detail-preview img { max-height: 420px; }
  .size-summary { grid-template-columns: 70px 1fr; }
  .sheet-lg { width: 70px; }
  .other-sizes { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .sub { position: static; box-shadow: none; min-width: 0; }
  .menu { width: 100%; }
}
.wrap.prose { max-width: 1200px; }
.wrap.prose > * { max-width: 760px; }
