/* Clipmeter template — plain CSS, no frameworks. Mobile first. */
:root {
  --paper: #f6f5fb;
  --surface: #ffffff;
  --ink: #1b1740;
  --muted: #5f5c82;
  --line: #dcd9ee;
  --primary: #5a3fff;
  --primary-ink: #ffffff;
  --hi: #ffe066;
  --hi-ink: #1b1740;
  --danger: #c2254a;
  --radius: 10px;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
}
:root:not([data-theme="light"]) {
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12102b;
    --surface: #1b1840;
    --ink: #eceafb;
    --muted: #a5a2cc;
    --line: #2f2b57;
    --primary: #8b75ff;
    --primary-ink: #12102b;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--primary); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

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

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--paper); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.4rem; padding-top: .8rem; padding-bottom: .8rem; }
.brand { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.brand span { background: var(--hi); color: var(--hi-ink); padding: 0 .3em; border-radius: 6px; }
.nav { display: flex; flex-wrap: wrap; gap: .1rem .3rem; margin-left: auto; }
.nav a { color: var(--ink); text-decoration: none; padding: .35rem .6rem; border-radius: 8px; font-size: .95rem; }
.nav a:hover { background: var(--surface); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }

/* Type */
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 800; }
h2 { font-size: clamp(1.45rem, 3.5vw, 1.9rem); font-weight: 700; margin-top: 2.2em; }
h3 { font-size: 1.15rem; font-weight: 700; margin-top: 1.6em; }
p { margin: 0 0 1em; }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 46rem; }
.prose { max-width: 42rem; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1em; }
.prose li { margin-bottom: .35em; }

/* Page head */
.page-head { padding: 2.2rem 0 1.4rem; }
.page-head h1 { margin-bottom: .35em; }

/* Home: tool list (ruled rows, not cards) */
.tool-list { list-style: none; margin: 1.6rem 0 0; padding: 0; border-top: 2px solid var(--ink); }
.tool-list li { border-bottom: 1px solid var(--line); }
.tool-list a { display: grid; gap: .2rem .8rem; padding: 1.1rem .2rem; text-decoration: none; color: var(--ink); grid-template-columns: 1fr; }
.tool-list a:hover { background: var(--surface); }
.tool-list .t-name { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; }
.tool-list .t-desc { color: var(--muted); }
.tool-list .t-eg { font-weight: 600; color: var(--primary); }
@media (min-width: 720px) {
  .tool-list a { grid-template-columns: 1.1fr 1.4fr .9fr; align-items: baseline; padding: 1.3rem .6rem; }
  .tool-list .t-eg { text-align: right; }
}

/* Tool panel */
.tool { display: grid; gap: 1.2rem; margin: .5rem 0 1rem; }
.tool > * { min-width: 0; }
@media (min-width: 900px) { .tool { grid-template-columns: 1.15fr .85fr; align-items: start; } .tool .result { position: sticky; top: 1rem; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.panel h2, .panel h3 { margin-top: 0; }
.field { margin-bottom: 1rem; }
.field label, .field .label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: .3rem; }
.field .hint { color: var(--muted); font-size: .85rem; margin-top: .25rem; }
input[type="number"], input[type="text"], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper);
  border: 1.5px solid var(--line); border-radius: 8px; padding: .6rem .7rem; min-height: 2.75rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.row { display: grid; gap: .8rem; grid-template-columns: 1fr 1fr; }
.row3 { display: grid; gap: .8rem; grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 480px) { .row3 { grid-template-columns: 1fr 1fr; } }
.check { display: flex; gap: .55rem; align-items: center; margin: .4rem 0; font-size: .98rem; }
.check input { width: 1.15rem; height: 1.15rem; accent-color: var(--primary); }
.btn { display: inline-flex; align-items: center; justify-content: center; font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: 8px; padding: .7rem 1.1rem; min-height: 2.75rem; background: var(--primary); color: var(--primary-ink); }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.small { min-height: 2.2rem; padding: .35rem .75rem; font-size: .9rem; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .4rem; }

/* Result */
.result .big { background: var(--hi); color: var(--hi-ink); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.result .big .num { font-family: var(--font-display); font-weight: 800; font-size: clamp(2.2rem, 8vw, 3.4rem); line-height: 1; letter-spacing: -.03em; }
.result .big .cap { font-size: .95rem; margin-top: .35rem; }
.result dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; }
.result dt { color: var(--muted); }
.result dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.note { font-size: .88rem; color: var(--muted); margin-top: 1rem; }
.error { color: var(--danger); font-weight: 600; min-height: 1.4em; }
.empty { color: var(--muted); }

/* Video rows table */
.table-scroll { overflow-x: auto; margin: 0 -.2rem; padding: 0 .2rem; }
table.videos { border-collapse: collapse; width: 100%; min-width: 600px; }
table.videos th { text-align: left; font-size: .85rem; font-weight: 600; color: var(--muted); padding: 0 .3rem .3rem; }
table.videos td { padding: .2rem .3rem; }
table.videos input { min-height: 2.4rem; padding: .4rem .5rem; min-width: 4.6rem; }
table.videos td:nth-child(2) input { min-width: 5.8rem; }
table.videos td.idx { color: var(--muted); font-size: .85rem; }
table.videos td.er { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Hashtag output */
.tagset { border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: .8rem; background: var(--paper); }
.tagset h3 { margin: 0 0 .3rem; font-size: 1rem; }
.tagset p.desc { color: var(--muted); font-size: .88rem; margin-bottom: .5rem; }
.tagset .tags { font-weight: 600; word-break: break-word; margin-bottom: .6rem; }
.tagset .meta { font-size: .82rem; color: var(--muted); margin-left: .4rem; }

/* Content sections */
.content { padding-bottom: 2rem; }
table.simple { border-collapse: collapse; width: 100%; max-width: 42rem; margin: 0 0 1.2rem; font-size: .97rem; }
table.simple th, table.simple td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.simple th { font-weight: 700; }
.formula { background: var(--surface); border-left: 4px solid var(--primary); padding: .8rem 1rem; border-radius: 0 8px 8px 0; font-weight: 600; max-width: 42rem; overflow-x: auto; }
details { border-bottom: 1px solid var(--line); max-width: 42rem; }
details summary { cursor: pointer; font-weight: 700; padding: .9rem 0; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; float: right; font-size: 1.3rem; line-height: 1; color: var(--primary); }
details[open] summary::after { content: "–"; }
details p { margin: 0 0 1em; color: var(--muted); }
.related { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .6rem; }
.related a { border: 1.5px solid var(--line); border-radius: 8px; padding: .5rem .8rem; text-decoration: none; color: var(--ink); font-weight: 600; }
.related a:hover { border-color: var(--primary); }

/* Ad slots: hidden until AdSense is approved (see README) */
.ad { display: none; }
html.ads-on .ad { display: block; margin: 1.5rem auto; min-height: 250px; max-width: 728px; text-align: center; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 3rem; padding: 1.6rem 0 2.4rem; color: var(--muted); font-size: .92rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; justify-content: space-between; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--ink); }
