/* =============================================================
   Gridlabel Studio — styles.css
   1 Tokens · 2 Reset · 3 Utilities · 4 Type · 5 Components
   6 Tool card · 7 Content sections · 8 Responsive · 9 Reduced motion
   ============================================================= */

/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --paper: #f4f2ed;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #17191f;
  --ink-soft: #454a56;
  --muted: #6d7382;
  --line: #e3ded4;
  --line-strong: #cfc8bb;
  --accent: #e2542b;
  --accent-ink: #ffffff;
  --accent-soft: #fdeee8;
  --good: #1f7a4d;
  --warn: #9a5b00;
  --warn-soft: #fdf3e2;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(23, 25, 31, .05), 0 8px 24px -12px rgba(23, 25, 31, .18);
  --shadow-lift: 0 2px 4px rgba(23, 25, 31, .06), 0 18px 40px -18px rgba(23, 25, 31, .28);

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Oswald", "Inter", system-ui, sans-serif;
  --mono: "Roboto Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --wrap: 1180px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121418;
    --surface: #1a1d23;
    --surface-2: #21252c;
    --ink: #f0eee9;
    --ink-soft: #c6c9d1;
    --muted: #949aa8;
    --line: #2c313a;
    --line-strong: #3b414c;
    --accent: #ff6a3d;
    --accent-ink: #1a1005;
    --accent-soft: #2a1a12;
    --good: #4ec48b;
    --warn: #f0b357;
    --warn-soft: #2b2114;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .5), 0 18px 40px -18px rgba(0, 0, 0, .7);
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
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; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* =============================================================
   3. Utilities
   ============================================================= */
.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 999;
  padding: .6rem 1rem; background: var(--ink); color: var(--paper);
  border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }
.nowrap { white-space: nowrap; }

/* =============================================================
   4. Typography
   ============================================================= */
.h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.9rem, 1.2rem + 3vw, 3.1rem);
  letter-spacing: -0.015em;
  line-height: 1.05;
}
.h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.45rem, 1.1rem + 1.6vw, 2.1rem);
  letter-spacing: -0.01em;
}
.h3 { font-size: 1.12rem; font-weight: 700; letter-spacing: -0.005em; }
.lede { font-size: clamp(1rem, .95rem + .3vw, 1.14rem); color: var(--ink-soft); max-width: 62ch; }
.eyebrow {
  font-family: var(--mono); font-size: .72rem; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}

/* =============================================================
   5. Components
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 1rem;
  min-height: 60px;
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; letter-spacing: -0.01em; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: var(--ink); color: var(--paper);
  display: grid; place-items: center;
}
.brand-mark svg { width: 16px; height: 16px; }
.header-nav { margin-left: auto; display: flex; gap: 1.1rem; font-size: .9rem; color: var(--ink-soft); }
.header-nav a:hover { color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .72rem 1.1rem; border-radius: var(--radius-sm);
  font-weight: 650; font-size: .95rem; line-height: 1.1;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: transform .18s var(--ease-out), box-shadow .18s var(--ease-out), background .18s var(--ease-out), border-color .18s var(--ease-out);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-primary {
  background: var(--accent); color: var(--accent-ink); border-color: transparent;
  box-shadow: 0 1px 2px rgba(226, 84, 43, .28);
}
.btn-primary:hover { box-shadow: 0 10px 22px -10px rgba(226, 84, 43, .8); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-soft); }
.btn-sm { padding: .45rem .75rem; font-size: .85rem; border-radius: 7px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.field { display: block; }
.field > .label,
.label {
  display: block; font-size: .8rem; font-weight: 650; color: var(--ink-soft);
  margin-bottom: .32rem; letter-spacing: .005em;
}
.input, .select, .textarea {
  width: 100%; padding: .62rem .7rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  transition: border-color .16s var(--ease-out), box-shadow .16s var(--ease-out);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.textarea { min-height: 168px; resize: vertical; font-family: var(--mono); font-size: .88rem; line-height: 1.55; }
.select { appearance: none; padding-right: 2rem;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4.5 6 8.5 10 4.5' fill='none' stroke='%236d7382' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .6rem center; background-size: 12px;
}
.hint { font-size: .78rem; color: var(--muted); margin-top: .3rem; }
.check { display: flex; align-items: center; gap: .5rem; font-size: .88rem; color: var(--ink-soft); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; cursor: pointer; }
.row { display: grid; gap: .8rem; }
.row-2 { grid-template-columns: 1fr 1fr; }
.row-3 { grid-template-columns: repeat(3, 1fr); }

/* =============================================================
   6. The tool
   ============================================================= */
.hero { padding: clamp(1.6rem, 1rem + 3vw, 3rem) 0 1rem; }
.hero .h1 span { color: var(--accent); }
.hero .lede { margin-top: .7rem; }

.tool { padding-bottom: 1.4rem; }
.tool-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.tool-tabs {
  display: flex; gap: .25rem; padding: .5rem .5rem 0; border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.tool-tab {
  padding: .6rem .95rem; border-radius: 9px 9px 0 0; font-weight: 650; font-size: .92rem;
  color: var(--muted); border: 1px solid transparent; border-bottom: 0; margin-bottom: -1px;
}
.tool-tab[aria-selected="true"] {
  background: var(--surface); color: var(--ink);
  border-color: var(--line); border-bottom-color: var(--surface);
}
.tool-body { display: grid; grid-template-columns: 1fr; }
.tool-panel { padding: clamp(1rem, .7rem + 1.2vw, 1.5rem); }
.tool-panel[hidden] { display: none; }

/* preview column */
.preview-col {
  border-top: 1px solid var(--line);
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--line) 45%, transparent) 25%, transparent 25%, transparent 75%, color-mix(in srgb, var(--line) 45%, transparent) 75%),
    linear-gradient(45deg, color-mix(in srgb, var(--line) 45%, transparent) 25%, transparent 25%, transparent 75%, color-mix(in srgb, var(--line) 45%, transparent) 75%),
    var(--surface-2);
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
  padding: clamp(1rem, .7rem + 1.2vw, 1.5rem);
}
.preview-head { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .7rem; flex-wrap: wrap; }
.preview-head .eyebrow { flex: none; }
.preview-stage {
  display: flex; align-items: center; justify-content: center;
  padding: 1.1rem .8rem; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px dashed var(--line-strong);
  min-height: 96px; overflow-x: auto;
}
.preview-stage canvas {
  image-rendering: -webkit-optimize-contrast;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 12%, transparent);
  max-width: none;
}
.preview-meta {
  margin-top: .7rem; display: flex; flex-wrap: wrap; gap: .35rem .9rem;
  font-family: var(--mono); font-size: .76rem; color: var(--muted);
}
.preview-meta b { color: var(--ink-soft); font-weight: 500; }
.notes { margin-top: .7rem; display: grid; gap: .4rem; }
.note {
  display: flex; gap: .5rem; align-items: flex-start;
  font-size: .82rem; line-height: 1.45; padding: .5rem .65rem; border-radius: 8px;
  background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 22%, transparent);
}
.note svg { width: 15px; height: 15px; flex: none; margin-top: .12rem; }
.note-ok { background: color-mix(in srgb, var(--good) 10%, transparent); color: var(--good); border-color: color-mix(in srgb, var(--good) 24%, transparent); }

.scale-bar { display: flex; align-items: center; gap: .6rem; margin-top: .8rem; flex-wrap: wrap; }
.scale-bar .label { margin: 0; }
.scale-bar input[type="range"] { width: 150px; accent-color: var(--accent); }

/* icon picker */
.icon-picker { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.icon-picker-top { display: flex; gap: .5rem; padding: .5rem; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.icon-cats { display: flex; gap: .3rem; overflow-x: auto; padding: .45rem .5rem; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.icon-cat {
  padding: .3rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap;
  color: var(--muted); border: 1px solid var(--line);
}
.icon-cat[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.icon-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: .3rem; padding: .5rem; max-height: 214px; overflow-y: auto;
}
.icon-btn {
  aspect-ratio: 1; border-radius: 9px; border: 1px solid transparent;
  display: grid; place-items: center; padding: .35rem;
  transition: background .14s var(--ease-out), border-color .14s var(--ease-out);
}
.icon-btn svg { width: 100%; height: 100%; fill: var(--ink-soft); }
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); }
.icon-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.icon-btn[aria-pressed="true"] svg { fill: var(--accent); }
.icon-empty { padding: 1rem; text-align: center; color: var(--muted); font-size: .85rem; grid-column: 1 / -1; }

/* details / advanced */
.adv { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.adv > summary {
  padding: .68rem .8rem; cursor: pointer; font-weight: 650; font-size: .9rem;
  list-style: none; display: flex; align-items: center; gap: .5rem;
}
.adv > summary::-webkit-details-marker { display: none; }
.adv > summary::before {
  content: ""; width: 8px; height: 8px; flex: none;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg); transition: transform .2s var(--ease-out); margin-left: .1rem;
}
.adv[open] > summary::before { transform: rotate(45deg); }
.adv-body { padding: .2rem .8rem .9rem; display: grid; gap: .8rem; }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.privacy {
  display: flex; align-items: center; gap: .5rem; margin-top: .9rem;
  font-size: .84rem; color: var(--muted);
}
.privacy svg { width: 15px; height: 15px; flex: none; }

/* batch */
.batch-grid { display: grid; gap: 1rem; }
.batch-list { display: grid; gap: .45rem; max-height: 420px; overflow-y: auto; padding-right: .2rem; }
.batch-item {
  display: flex; align-items: center; gap: .7rem; padding: .45rem .55rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
.batch-item canvas { flex: none; box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent); }
.batch-item .bi-meta { font-family: var(--mono); font-size: .72rem; color: var(--muted); margin-left: auto; white-space: nowrap; }
.batch-count { font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.progress { height: 5px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: .6rem; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s linear; }

/* =============================================================
   7. Content sections
   ============================================================= */
.ad-slot {
  min-height: 104px; margin: 1.6rem 0;
  border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  display: grid; place-items: center;
  color: var(--muted); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.section { padding: clamp(2rem, 1.4rem + 2.4vw, 3.4rem) 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { max-width: 68ch; margin-bottom: 1.4rem; }
.section-head .h2 { margin-top: .35rem; }
.prose { max-width: 68ch; }
.prose p { margin-bottom: 1rem; color: var(--ink-soft); }
.prose h3 { margin: 1.6rem 0 .5rem; }
.prose ul, .prose ol { margin: 0 0 1rem 1.1rem; color: var(--ink-soft); }
.prose li { margin-bottom: .4rem; }
.prose strong { color: var(--ink); font-weight: 650; }
.prose code {
  font-family: var(--mono); font-size: .86em; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 5px; padding: .08em .34em;
}

.steps { display: grid; gap: 1rem; grid-template-columns: 1fr; counter-reset: step; }
.step {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem; position: relative;
}
.step::before {
  counter-increment: step; content: counter(step);
  font-family: var(--display); font-size: .82rem; font-weight: 600;
  width: 24px; height: 24px; border-radius: 7px; background: var(--ink); color: var(--paper);
  display: grid; place-items: center; margin-bottom: .6rem;
}
.step h3 { margin-bottom: .3rem; }
.step p { font-size: .92rem; color: var(--ink-soft); }

.cards { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.15rem; transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.card h3 { display: flex; align-items: center; gap: .5rem; margin-bottom: .45rem; }
.card h3 svg { width: 20px; height: 20px; fill: var(--accent); flex: none; }
.card p { font-size: .92rem; color: var(--ink-soft); margin-bottom: .6rem; }
.card ul { list-style: none; display: flex; flex-wrap: wrap; gap: .32rem; }
.card li {
  font-family: var(--mono); font-size: .74rem; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 6px; padding: .16rem .42rem;
  background: var(--surface-2);
}

.faq { display: grid; gap: .55rem; max-width: 74ch; }
.faq details {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .2rem .95rem;
}
.faq summary {
  cursor: pointer; padding: .78rem 0; font-weight: 650; list-style: none;
  display: flex; align-items: center; gap: .7rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; margin-left: auto; font-size: 1.15rem; color: var(--muted); font-weight: 400;
  transition: transform .2s var(--ease-out);
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details > div { padding-bottom: .9rem; color: var(--ink-soft); font-size: .94rem; }
.faq details > div p + p { margin-top: .7rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table.sizes { width: 100%; border-collapse: collapse; font-size: .9rem; background: var(--surface); }
table.sizes th, table.sizes td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--line); }
table.sizes th { font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); background: var(--surface-2); }
table.sizes tr:last-child td { border-bottom: 0; }
table.sizes td:first-child { font-family: var(--mono); font-weight: 500; }

.site-footer { border-top: 1px solid var(--line); padding: 2rem 0 2.6rem; background: var(--surface-2); }
.footer-grid { display: grid; gap: 1.2rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; font-size: .88rem; color: var(--ink-soft); }
.footer-links a:hover { color: var(--accent); }
.footer-note { font-size: .8rem; color: var(--muted); max-width: 62ch; }

.nojs { display: none; }
html.no-js .nojs {
  display: block; padding: .8rem; border-radius: var(--radius-sm);
  background: var(--warn-soft); color: var(--warn); font-size: .9rem;
}
html.no-js .needs-js { display: none; }

/* =============================================================
   8. Responsive
   ============================================================= */
@media (min-width: 720px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1.2fr 1fr; align-items: start; }
}
@media (min-width: 960px) {
  .tool-body { grid-template-columns: minmax(0, 1fr) minmax(340px, 42%); }
  .preview-col { border-top: 0; border-left: 1px solid var(--line); }
  .preview-inner { position: sticky; top: 76px; }
  .cards { grid-template-columns: repeat(4, 1fr); }
  .batch-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 539px) {
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .header-nav { display: none; }
}

/* =============================================================
   9. Reduced motion — only intrusive effects
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card:hover { transform: none; }
}

/* =============================================================
   10. Tool column ordering (preview first on small screens)
   ============================================================= */
.tool-main { min-width: 0; }
@media (max-width: 959px) {
  .preview-col { order: -1; border-top: 0; border-bottom: 1px solid var(--line); }
}
@media (min-width: 960px) {
  .tool-main { order: 0; }
  .preview-col { order: 1; }
}

/* =============================================================
   11. Mobile: keep the text field above the fold
   ============================================================= */
@media (max-width: 719px) {
  .preview-col { padding: .8rem; }
  .preview-stage { padding: .7rem .6rem; min-height: 76px; }
  .preview-meta { font-size: .72rem; gap: .2rem .7rem; margin-top: .5rem; }
  .note { font-size: .78rem; padding: .42rem .55rem; }
  .hero { padding-top: 1.1rem; }
  .hero .lede { font-size: .95rem; }
  .tool-panel { padding: .9rem; }
}

/* =============================================================
   12. Ad slots — placement & mandatory clearance
   Three placeholder slots, all inline, none of them near a control.
   AdSense policy: an ad next to a download button produces accidental
   clicks and gets accounts banned, so the clearance below is a hard
   floor, not decoration. Never reduce it, and never add a slot inside
   the tool card or trigger one from a download.
   ============================================================= */
.ad-slot { clear: both; }

/* 1 — hero: below the headline, above the tool card */
.ad-slot-hero { margin: 2.5rem 0 2.75rem; }

/* 2 — under the tool: the card's own bottom padding, plus this */
.ad-slot-below-tool { margin: 2.75rem 0 1.6rem; }

/* 3 — in content: sits between two reading sections */
.ad-slot-content { margin: 2.25rem 0; }

@media (max-width: 719px) {
  .ad-slot-hero { margin: 1.9rem 0 2rem; }
  .ad-slot-below-tool { margin: 2.25rem 0 1.4rem; }
}

/* On phones the hero slot uses a standard 320x50 mobile banner footprint
   instead of the 104px leaderboard, so it costs the tool as little
   above-the-fold room as possible while keeping its clearance. */
@media (max-width: 719px) {
  .ad-slot-hero { min-height: 62px; margin: 1.5rem 0 1.75rem; }
  .preview-stage { min-height: 68px; padding: .6rem .5rem; }
}
