/* =============================================================================
 * FreePrintLab visual system. Type + color + spacing only; structure/copy and
 * the renderer are untouched. No framework, no build, inline-SVG icons only.
 * ========================================================================== */

/* One self-hosted, rounded display face for headings (Fredoka, Latin subset,
 * ~16 KB, preloaded in each page head). Body stays on the system stack. */
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/fredoka-600.woff2') format('woff2');
}

/* ---- One place to retune the whole palette ---- */
:root {
  /* surfaces & ink (bright soft-white page, never pure white; near-black, never #000) */
  --bg:          #FEFCFF;
  --surface:     #FFFFFF;
  --surface-2:   #FBFAFE;
  --ink:         #2A2431;
  --ink-soft:    #6B6472;
  --hairline:    #ECE7F1;

  /* one friendly primary (grape) + one contrasting accent (small pops) */
  --primary:     #6338E0;   /* white text passes AA (6.6) */
  --primary-strong:#5024C4;
  --primary-tint:#EFEAFE;
  --accent:      #3F73E3;   /* friendly blue — pops */

  /* per-card accents (each tool card its own tint) */
  --card-accent: var(--primary);
  --card-tint:   var(--primary-tint);

  /* type */
  --font-display: 'Fredoka', 'Segoe UI', system-ui, sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  /* surfaces — soft & bubbly */
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(42,36,49,.05), 0 8px 24px rgba(42,36,49,.07);
  --shadow-lift: 0 8px 18px rgba(42,36,49,.10), 0 20px 46px rgba(42,36,49,.14);
  --shadow-cta: 0 8px 20px rgba(99,56,224,.30);
  --focus: 0 0 0 3px var(--bg), 0 0 0 5.5px var(--primary);
  --maxw: 1100px;
}
/* Per-card --card-accent / --card-tint are set inline from tools.mjs by
 * scripts/build-sitemap.mjs, so adding a tool needs no CSS. Fallbacks: */
.card { --card-accent: var(--primary); --card-tint: var(--primary-tint); }

/* ---- base ---- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); }
a:hover { color: var(--primary-strong); }

h1, h2, h3, .brand {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
h1 { font-size: clamp(2.15rem, 5.5vw, 2.85rem); line-height: 1.04; margin: 6px 0 6px; }
h2 { font-size: 1.4rem; line-height: 1.15; }
h3 { font-size: 1.05rem; line-height: 1.2; }

/* ---- header (bright, not a dark corporate bar) ---- */
header.site {
  background: var(--surface);
  box-shadow: 0 1px 0 var(--hairline);
  padding: 11px 20px;
  display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap;
}
header.site .brand { font-size: 1.2rem; text-decoration: none; display: inline-flex; align-items: center; gap: 9px; }
/* app-icon tile: the test-tube glyph centred on a rounded, gray-bordered square.
   The glyph is fully inside the SVG viewBox (no overflow), so the tile clips clean. */
header.site .brand .logo {
  width: 36px; height: 36px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid #d8d4de;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(42,36,49,.06);
  overflow: hidden;
  flex: 0 0 auto;
}
header.site nav { display: flex; gap: 18px; }
header.site nav a { color: var(--ink-soft); text-decoration: none; font-size: .95rem; font-weight: 500; }
header.site nav a:hover { color: var(--primary); }

main { max-width: var(--maxw); margin: 0 auto; padding: 28px 20px 60px; }
.tagline, .intro { margin: 0 0 22px; color: var(--ink-soft); font-size: 1.12rem; line-height: 1.5; max-width: 60ch; }

/* ---- homepage card grid (icon, name, one line) ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin: 24px 0 8px; }
.card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--card-tint);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.card:focus-visible { outline: none; box-shadow: var(--focus), var(--shadow-lift); }
.card-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--card-accent); color: #fff;
}
.card-icon svg { width: 26px; height: 26px; }
.card h2 { margin: 2px 0 0; }
.card p { margin: 0; color: var(--ink-soft); font-size: .96rem; line-height: 1.5; }

/* ---- certificate maker: layout gallery + accent / ornament / border knobs ---- */
.maker { margin: 6px 0 22px; }
.picker-h { font-size: 1.02rem; margin: 0 0 12px; font-weight: 600; }
.picker-h span { color: var(--ink-soft); font-weight: 400; font-size: .88rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.gal {
  cursor: pointer; background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px;
  padding: 10px 10px 7px; display: flex; flex-direction: column; align-items: center; gap: 7px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.gal img { width: 100%; height: auto; border-radius: 4px; box-shadow: 0 1px 2px rgba(42,36,49,.08); }
.gal span { font-size: .82rem; color: var(--ink-soft); }
.gal:hover { border-color: var(--primary); }
.gal.is-active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-tint); }
.gal.is-active span { color: var(--ink); font-weight: 600; }

.knobs { display: flex; flex-wrap: wrap; gap: 22px 34px; align-items: flex-start; }
.knob-label { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 8px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { cursor: pointer; padding: 3px; background: none; border: 2px solid transparent; border-radius: 50%; line-height: 0; }
.swatch span { position: relative; display: block; width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.swatch .tick { position: absolute; inset: 0; margin: auto; width: 15px; height: 15px; fill: none; stroke: #fff; stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0; filter: drop-shadow(0 0 1.2px rgba(0,0,0,.55)); }
.swatch:hover { border-color: var(--hairline); }
.swatch.is-active { border-color: var(--ink); }
.swatch.is-active .tick { opacity: 1; }
.orns { display: flex; gap: 8px; flex-wrap: wrap; }
.ornbtn {
  cursor: pointer; background: var(--surface); border: 1px solid var(--hairline); border-radius: 10px;
  padding: 5px 5px 3px; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 58px;
}
.ornbtn svg { width: 34px; height: 34px; }
.ornbtn span { font-size: .62rem; color: var(--ink-soft); line-height: 1.05; text-align: center; }
.ornbtn:hover { border-color: var(--primary); }
.ornbtn.is-active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-tint); }
.knob-border .switch { display: inline-flex; align-items: center; gap: 7px; font-size: .92rem; font-weight: 500; color: var(--ink); cursor: pointer; }

/* ---- hub: grid linking every ready-made certificate (real PNG renders) ---- */
.variants { margin: 44px 0 8px; }
.variants h2 { margin: 0 0 4px; }
.variants .sub { margin: 0 0 18px; color: var(--ink-soft); max-width: 70ch; }
.variant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 18px; align-items: start; }
.variant-card {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  padding: 14px 12px; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.variant-card img { width: 100%; height: auto; border-radius: 4px; box-shadow: 0 1px 2px rgba(42,36,49,.08); }
.variant-card span { font-size: .9rem; font-weight: 600; text-align: center; line-height: 1.2; }
.variant-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.variant-card:focus-visible { outline: none; box-shadow: var(--focus), var(--shadow-lift); }

/* themed word-search grid on the hub — text chips, no thumbnails */
.themes { margin: 44px 0 8px; }
.themes h2 { margin: 0 0 4px; }
.themes .sub { margin: 0 0 18px; color: var(--ink-soft); max-width: 70ch; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.theme-card {
  display: flex; align-items: center; justify-content: center; text-align: center;
  text-decoration: none; color: var(--ink); font-weight: 600; font-size: .95rem; line-height: 1.2;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  padding: 14px 12px; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.theme-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.theme-card:focus-visible { outline: none; box-shadow: var(--focus), var(--shadow-lift); }

/* up-link from a variant page back to the configurable maker */
.uplink { margin: 22px 0 4px; font-size: 1rem; }
.uplink a { font-weight: 600; }

/* ---- panels / tool surfaces ---- */
.wrap { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.panel { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.controls { width: 380px; flex: 0 0 380px; }
.preview { flex: 1 1 480px; min-width: 320px; }

label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink); margin: 14px 0 5px; }
label.first { margin-top: 0; }
textarea, input[type=text], input[type=number], select {
  width: 100%; padding: 10px 12px; font: inherit; font-size: .92rem;
  color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { height: 150px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.5; }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.row { display: flex; gap: 12px; }
.row > div { flex: 1; }
fieldset { border: 1px solid var(--hairline); border-radius: var(--radius-sm); margin: 14px 0 0; padding: 8px 14px 14px; }
legend { font-size: .78rem; font-weight: 700; color: var(--ink-soft); padding: 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: .9rem; font-weight: 600; }
.check input { width: auto; accent-color: var(--primary); }
.hint { font-size: .8rem; color: var(--ink-soft); font-weight: 400; margin-top: 4px; line-height: 1.45; }
/* lead-in note above the shared title/date/signer group */
.fieldnote { font-size: .82rem; color: var(--ink-soft); margin: 20px 0 0; }
code { background: var(--primary-tint); color: var(--primary-strong); padding: 1px 5px; border-radius: 5px; font-size: .88em; }

/* ---- buttons; the Generate CTA is the most prominent thing on a tool page --- */
.btns { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
button {
  font: inherit; font-weight: 600; cursor: pointer;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  transition: transform .12s ease, box-shadow .15s ease, background-color .15s ease;
}
button.primary {
  background: var(--primary); color: #fff;
  font-size: 1.08rem; padding: 15px 26px; width: 100%;
  border-radius: 999px;
  box-shadow: var(--shadow-cta);
}
button.primary:hover { background: var(--primary-strong); transform: translateY(-1px); }
button.primary:active { transform: translateY(0); }
button.ghost { background: var(--surface); color: var(--primary); border-color: var(--hairline); padding: 11px 18px; font-size: .95rem; border-radius: 999px; }
button.ghost:hover { border-color: var(--primary); }
button:disabled { opacity: .55; cursor: default; box-shadow: none; transform: none; }

/* ---- status / spinner ---- */
.status {
  margin-top: 14px; background: var(--ink); color: #C6F5D6;
  font-family: ui-monospace, monospace; font-size: .78rem; line-height: 1.5;
  padding: 12px 14px; border-radius: var(--radius-sm);
  min-height: 42px; display: flex; align-items: center; gap: 10px;
}
.spinner { width: 14px; height: 14px; border: 2px solid #C6F5D6; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; flex: 0 0 auto; display: none; }
.status.busy .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

iframe.pdf { width: 100%; height: 660px; border: none; border-radius: var(--radius-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline); }

/* ---- supporting copy ---- */
.copy { margin-top: 40px; max-width: 68ch; }
.copy h2 { margin: 28px 0 8px; }
.copy h3 { margin: 18px 0 3px; }
.copy p { margin: 0 0 12px; }
.copy ul, .copy ol { margin: 0 0 12px 20px; }
.copy ol li { margin: 0 0 9px; }

/* ---- footer ---- */
.site-footer {
  max-width: var(--maxw); margin: 48px auto 0; padding: 24px 20px 44px;
  border-top: 1px solid var(--hairline); color: var(--ink-soft); font-size: .85rem;
  display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.site-footer a { color: var(--ink-soft); text-decoration: none; }
.site-footer a:hover { color: var(--primary); }
.site-footer .fine { width: 100%; color: #A99C8C; margin-top: 2px; }

/* ---- accessibility ---- */
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
a:focus-visible, .card:focus-visible { border-radius: var(--radius-sm); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .spinner { animation: none; }
}

/* ---- header nav: compact "Tools" dropdown pushed to the right ---- */
header.site nav { margin-left: auto; align-items: center; }
.toolmenu { position: relative; }
.toolmenu > summary {
  list-style: none; cursor: pointer; color: var(--ink-soft); font-weight: 600; font-size: .95rem;
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 2px;
}
.toolmenu > summary::-webkit-details-marker { display: none; }
.toolmenu > summary:hover, .toolmenu[open] > summary { color: var(--primary); }
.toolmenu .caret { font-size: .7em; }
.toolmenu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift); padding: 8px; min-width: 232px;
  display: flex; flex-direction: column; gap: 2px;
}
.toolmenu-panel a { color: var(--ink); text-decoration: none; font-size: .92rem; font-weight: 500; padding: 8px 10px; border-radius: 10px; }
.toolmenu-panel a:hover { background: var(--surface-2); color: var(--primary); }
.toolmenu-panel a[aria-current="page"] { color: var(--primary); font-weight: 700; background: var(--primary-tint); }
.toolmenu-panel .alltools { margin-top: 4px; border-top: 1px solid var(--hairline); padding-top: 10px; color: var(--primary); font-weight: 600; }

/* ---- trust strip (under the H1) ---- */
.trust { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 10px; margin: 0 0 16px; padding: 0; }
.trust li {
  font-size: .82rem; font-weight: 600; color: var(--ink-soft);
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 999px;
  padding: 5px 13px 5px 27px; position: relative;
}
.trust li::before {
  content: ""; position: absolute; left: 12px; top: 50%;
  width: 9px; height: 5px; border-left: 2px solid var(--primary); border-bottom: 2px solid var(--primary);
  transform: translateY(-70%) rotate(-45deg);
}

/* ---- breadcrumbs (variant pages) ---- */
.crumbs { font-size: .85rem; color: var(--ink-soft); margin: 2px 0 12px; display: flex; flex-wrap: wrap; gap: 4px 7px; align-items: center; }
.crumbs a { color: var(--ink-soft); text-decoration: none; }
.crumbs a:hover { color: var(--primary); }
.crumbs [aria-current="page"] { color: var(--ink); font-weight: 600; }
.crumbs .sep { color: #c7c0d0; }

/* ---- names header: label + live count ---- */
.names-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.names-head label { margin-bottom: 5px; }
.namecount { font-size: .78rem; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }

/* ---- disclosures: "Customize the look", "Print calibration", "See all …" ---- */
details.customize { margin-top: 2px; }
details.customize > summary,
details.calib > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 7px;
  font-weight: 600; color: var(--primary);
}
details.customize > summary::-webkit-details-marker,
details.calib > summary::-webkit-details-marker,
details.more-variants > summary::-webkit-details-marker { display: none; }
details.customize > summary::before,
details.calib > summary::before,
details.more-variants > summary::before { content: "\25B8"; font-size: .85em; transition: transform .15s ease; display: inline-block; }
details.customize[open] > summary::before,
details.calib[open] > summary::before,
details.more-variants[open] > summary::before { transform: rotate(90deg); }
details.customize[open] .knobs { margin-top: 16px; }
details.calib { margin: 14px 0 0; border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 12px 14px; }
details.calib > summary { font-size: .82rem; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
details.calib[open] > summary { margin-bottom: 10px; }

/* ---- "See all N designs" expander under the occasion grid ---- */
.more-variants { margin-top: 18px; }
.more-variants > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; color: var(--primary); font-size: .95rem;
  padding: 11px 20px; border: 1px solid var(--hairline); border-radius: 999px; background: var(--surface);
}
.more-variants > summary:hover { border-color: var(--primary); }
.more-variants[open] .variant-grid { margin-top: 18px; }

/* ---- /tools/ index intro ---- */
.tools-lead { margin: 0 0 22px; }

/* ---- mobile-first: stack the controls on narrow screens ---- */
@media (max-width: 760px) {
  .controls { width: 100%; flex-basis: 100%; }
  main { padding: 22px 16px 48px; }
  header.site { gap: 8px 14px; }
  .toolmenu-panel { min-width: 200px; }
}
