/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f1eee6;
  --surface: #ffffff;
  --surface-2: #e9e3d3;
  --text: #1c1b18;
  --text-muted: #5c584f;
  --border: #ddd6c4;
  --accent: #d97a3f;
  --accent-ink: #ffffff;
  --ok: #2e7d4f;
  --warn: #b8860b;
  --bad: #c0392b;
  --info: #3b6ea5;
  --radius: 14px;
  --radius-sm: 9px;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow: 0 1px 2px rgba(20, 18, 14, 0.04), 0 8px 24px -12px rgba(20, 18, 14, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171613;
    --surface: #1f1e1a;
    --surface-2: #262420;
    --text: #f3f1ea;
    --text-muted: #b3aea1;
    --border: #34322b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  position: relative;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
/* Persistent, subtle page texture — a faint grid + two soft accent washes,
   fixed so it reads as one continuous surface behind every section instead
   of a flat, blank background. Low-contrast on purpose: felt, not seen. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(65% 45% at 8% -8%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 62%),
    radial-gradient(55% 40% at 100% 8%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 58%),
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: auto, auto, 46px 46px, 46px 46px;
  background-position: 0 0, 0 0, -1px -1px, -1px -1px;
  opacity: .5;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.12; letter-spacing: -0.01em; font-weight: 800; }
ul { list-style: none; padding: 0; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.container { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: 1.1rem; }

.skip-link {
  position: fixed; top: -100px; left: 1rem; padding: .6rem 1rem;
  background: var(--text); color: var(--bg); z-index: 9999; border-radius: 8px; font-weight: 600;
  transition: top .2s var(--ease-out);
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   3. Header / footer
   ============================================================= */
.site-header { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 40; }
.header-row { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.logo { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.05rem; }
.header-nav { display: none; gap: 1.4rem; font-weight: 600; font-size: .92rem; }
.header-nav a { color: var(--text-muted); transition: color .15s var(--ease-out); }
.header-nav a:hover { color: var(--text); }
@media (min-width: 720px) { .header-nav { display: flex; } }
.header-nav a.header-nav-tool { padding: .35rem .75rem; border: 1px solid var(--border); border-radius: 999px; font-weight: 700; color: var(--text); }
.header-nav a.header-nav-tool:hover { border-color: var(--accent); color: var(--accent); }

.site-footer { border-top: 1px solid var(--border); margin-top: 3rem; padding-block: 1.6rem; color: var(--text-muted); font-size: .88rem; }
.footer-row { display: flex; flex-wrap: wrap; gap: .8rem 1.6rem; align-items: center; justify-content: space-between; }
.footer-nav { display: flex; gap: 1.2rem; }
.footer-nav a:hover { color: var(--text); }
.footer-credit { font-size: .82rem; color: var(--text-muted); opacity: .75; }

/* =============================================================
   4. Hero
   ============================================================= */
.hero { position: relative; padding-block: 3.6rem 2.4rem; text-align: center; overflow: clip; isolation: isolate; }
.hero-bg {
  /* Adds extra warmth on top of the global body::before texture — the grid
     itself already comes from the page background, so this only layers the
     brighter accent wash, fading out toward the rest of the page. */
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 55% at 18% 8%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 70%),
    radial-gradient(50% 50% at 88% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 65%);
  -webkit-mask-image: linear-gradient(to bottom, black, transparent);
  mask-image: linear-gradient(to bottom, black, transparent);
}
.hero-inner { position: relative; }
.hero h1 { font-size: clamp(1.9rem, 4.8vw, 2.9rem); max-width: 20ch; margin-inline: auto; }
.hero-sub { margin-top: .9rem; color: var(--text-muted); font-size: 1.05rem; max-width: 46ch; margin-inline: auto; }

/* =============================================================
   5. Tool section
   ============================================================= */
.tool-section { padding-block: .6rem 2rem; }
.tool-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 1.2rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 1.6rem;
}
@media (min-width: 720px) { .tool-card { padding: 1.8rem; } }

.tool-block { display: flex; flex-direction: column; gap: .7rem; }
.block-title { font-size: 1.05rem; }
.block-subtitle { font-size: .92rem; font-weight: 700; margin-top: .3rem; color: var(--text-muted); }

.field-label { display: block; font-size: .82rem; font-weight: 700; color: var(--text-muted); margin-bottom: .35rem; }
.field-label-inline { display: flex; align-items: center; gap: .5rem; font-size: .82rem; font-weight: 700; color: var(--text-muted); }
.field-row { display: grid; grid-template-columns: 1fr; gap: .8rem; }
@media (min-width: 540px) { .field-row { grid-template-columns: 1fr 1fr; } }
.field-row-tight { align-items: center; grid-template-columns: auto 1fr; }

.text-input, .select-input {
  width: 100%; padding: .68rem .8rem; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: .96rem;
  transition: border-color .15s var(--ease-out);
}
.text-input:focus, .select-input:focus { border-color: var(--accent); }
.check-label { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }

.seg-tabs { display: flex; flex-wrap: wrap; gap: .45rem; }
.seg-tabs button {
  padding: .5rem .85rem; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--surface); font-size: .86rem; font-weight: 600; color: var(--text-muted);
  transition: all .15s var(--ease-out);
}
.seg-tabs button:hover { border-color: var(--accent); color: var(--text); }
.seg-tabs button.is-active { background: var(--text); border-color: var(--text); color: var(--bg); }

.color-field { display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: .55rem .8rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: .88rem; font-weight: 600; }
.color-field input[type="color"] { width: 38px; height: 30px; border: none; border-radius: 6px; padding: 0; background: none; cursor: pointer; }

.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: .4rem; }
.emoji-btn { font-size: 1.3rem; padding: .35rem 0; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--surface); }
.emoji-btn.is-active { border-color: var(--accent); background: var(--surface-2); }

.link-btn { align-self: flex-start; font-size: .84rem; font-weight: 700; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.preview-block { align-items: center; text-align: center; }
.preview-2d-wrap { display: flex; justify-content: center; padding: 1rem; background: var(--surface-2); border-radius: var(--radius); }
.qr-preview-2d { line-height: 0; }
.qr-preview-2d canvas, .qr-preview-2d svg { border-radius: 8px; max-width: 100%; height: auto; }

.dl-row { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }
.dl-row-3d { justify-content: flex-start; }

.btn {
  padding: .78rem 1.3rem; border-radius: 999px; border: 1.5px solid transparent; font-weight: 700; font-size: .95rem;
  transition: transform .12s var(--ease-out), filter .15s var(--ease-out);
  max-width: 100%;
}
.dl-row .btn { flex: 1 1 auto; text-align: center; }
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-tertiary { background: transparent; border-color: var(--border); color: var(--text-muted); }

.viewer-3d { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.viewer-3d-canvas { width: 100%; aspect-ratio: 4 / 3; touch-action: none; }
@media (min-width: 720px) { .viewer-3d-canvas { aspect-ratio: 16 / 10; } }
.viewer-status {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: .8rem; align-items: center; justify-content: center; text-align: center;
  padding: 1.2rem; font-size: .88rem; font-weight: 600; color: var(--text-muted); background: var(--surface-2);
}
/* The bare [hidden] UA rule loses to the class rule above (equal specificity,
   author stylesheet wins the cascade) — without this, an "empty" status box
   stays display:flex and opaque, sitting on top of the WebGL canvas and
   blocking it from view even though nothing is visibly wrong with it. */
.viewer-status[hidden] { display: none; }
.viewer-retry-btn { padding: .55rem 1.1rem; font-size: .86rem; }
.viewer-status-error { color: var(--bad); }
.viewer-status-loading { color: var(--text-muted); }
.viewer-hint { position: absolute; left: .6rem; bottom: .5rem; font-size: .74rem; color: var(--text-muted); background: color-mix(in srgb, var(--surface) 80%, transparent); padding: .2rem .5rem; border-radius: 999px; }

.print-warnings { display: flex; flex-direction: column; gap: .4rem; }
.warn-item { font-size: .86rem; padding: .55rem .75rem; border-radius: var(--radius-sm); border-left: 3px solid var(--border); background: var(--surface-2); }
.warn-item.warn-ok { border-left-color: var(--ok); }
.warn-item.warn-warn { border-left-color: var(--warn); }
.warn-item.warn-bad { border-left-color: var(--bad); color: var(--bad); }
.warn-item.warn-info { border-left-color: var(--info); }

.privacy-badge { font-size: .84rem; color: var(--text-muted); background: var(--surface-2); border-radius: var(--radius-sm); padding: .8rem 1rem; }

/* =============================================================
   6. Ad placeholders
   ============================================================= */
.ad-slot {
  margin-block: 1.6rem; min-height: 90px; border: 1.5px dashed var(--border); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: .8rem;
}
.ad-leaderboard { min-height: 100px; }
.ad-incontent { min-height: 250px; max-width: 336px; }
.ad-label { font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase; font-size: .72rem; }

.ad-corner {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 60; width: 240px; min-height: 90px;
  background: var(--surface); border: 1.5px dashed var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; padding: .6rem;
}
.ad-close { position: absolute; top: .3rem; right: .3rem; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); font-size: .8rem; line-height: 1; }

.ad-popup { border: none; border-radius: var(--radius); padding: 1.4rem; max-width: 360px; width: calc(100% - 2rem); box-shadow: var(--shadow); position: relative; background: var(--surface); color: var(--text); }
.ad-popup::backdrop { background: rgba(10, 9, 7, 0.5); }
.ad-popup-body { min-height: 200px; display: flex; align-items: center; justify-content: center; border: 1.5px dashed var(--border); border-radius: var(--radius-sm); margin-bottom: 1rem; }
.ad-popup-continue { width: 100%; }

/* =============================================================
   7. Content sections
   ============================================================= */
.content-section { padding-block: 2.2rem; }
.content-section h2 { font-size: clamp(1.3rem, 3vw, 1.7rem); margin-bottom: 1.2rem; }
.seo-text p { color: var(--text-muted); margin-bottom: 1rem; max-width: 74ch; }
.seo-text strong { color: var(--text); }

.steps-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 720px) { .steps-grid { grid-template-columns: repeat(3, 1fr); } }
.step-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; }
.step-card svg { color: var(--accent); margin-bottom: .6rem; }
.step-card h3 { font-size: 1.02rem; margin-bottom: .4rem; }
.step-card p { color: var(--text-muted); font-size: .92rem; }

.ideas-grid { display: grid; grid-template-columns: 1fr; gap: .9rem; }
@media (min-width: 540px) { .ideas-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .ideas-grid { grid-template-columns: repeat(3, 1fr); } }
.idea-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; }
.idea-emoji { font-size: 1.6rem; display: block; margin-bottom: .5rem; }
.idea-card h3 { font-size: .98rem; margin-bottom: .35rem; }
.idea-card p { color: var(--text-muted); font-size: .88rem; }

.faq-list { display: flex; flex-direction: column; gap: .6rem; max-width: 74ch; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem 1.1rem; }
.faq-item summary { cursor: pointer; font-weight: 700; font-size: .96rem; }
.faq-item p { margin-top: .6rem; color: var(--text-muted); font-size: .92rem; }

.more-tools p { color: var(--text-muted); max-width: 60ch; }
.tool-cross-link {
  margin-top: 1.2rem; display: flex; align-items: center; gap: 1rem; max-width: 34rem;
  padding: 1.1rem 1.3rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  transition: border-color .15s var(--ease-out), transform .15s var(--ease-out);
}
.tool-cross-link:hover { border-color: var(--accent); transform: translateY(-1px); }
.tool-cross-link-emoji { font-size: 1.6rem; flex-shrink: 0; }
.tool-cross-link strong { display: block; font-size: .96rem; }
.tool-cross-link small { display: block; color: var(--text-muted); font-size: .84rem; margin-top: .15rem; }
.tool-cross-link-arrow { margin-left: auto; color: var(--accent); font-size: 1.2rem; flex-shrink: 0; }

/* =============================================================
   9. Tools hub grid
   ============================================================= */
.tools-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 540px) { .tools-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .tools-grid { grid-template-columns: repeat(4, 1fr); } }

.tool-tile {
  position: relative; display: flex; flex-direction: column; gap: .4rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.4rem 1.3rem 1.3rem; min-height: 190px;
  transition: border-color .15s var(--ease-out), transform .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
a.tool-tile:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.tool-tile-num { position: absolute; top: 1.1rem; right: 1.2rem; font-family: var(--mono); font-size: .78rem; color: var(--text-muted); opacity: .6; }
.tool-tile-emoji { font-size: 1.9rem; }
.tool-tile-title { font-size: 1.05rem; margin: .2rem 0 0; }
.tool-tile-desc { font-size: .86rem; color: var(--text-muted); flex-grow: 1; }
.tool-tile-cta { font-size: .84rem; font-weight: 700; color: var(--accent); margin-top: .3rem; }

.tool-tile.is-soon { opacity: .55; border-style: dashed; }
.tool-tile.is-soon .tool-tile-emoji { filter: grayscale(1); }
.tool-tile.is-soon .tool-tile-title { color: var(--text-muted); }

/* =============================================================
   8. Responsive
   ============================================================= */
@media (min-width: 960px) {
  .tool-card { padding: 2.2rem; }
}
