/* YtubeSEO.tools — site styles. No framework, no web font: fast on every device. */
:root {
  --primary: #4338ca;
  --bg: #f6f7fb; --surface: #ffffff; --surface-2: #f0f2f8; --line: #e1e4ee;
  --text: #171a26; --muted: #5b6275; --on-primary: #ffffff;
  --good: #0f7a4d; --good-bg: #e5f6ee; --bad: #b3261e; --bad-bg: #fdecea; --info-bg: #eaf0ff; --info: #1d3fa8;
  --radius: 14px; --shadow: 0 1px 2px rgba(20, 24, 40, .05), 0 6px 20px rgba(20, 24, 40, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #0f1117; --surface: #181b25; --surface-2: #212534; --line: #2c3142;
  --text: #eceef5; --muted: #a2a9bd;
  --good: #57d39a; --good-bg: #12301f; --bad: #ff9a92; --bad-bg: #3a1a18; --info-bg: #1a2444; --info: #a9bcff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg: #0f1117; --surface: #181b25; --surface-2: #212534; --line: #2c3142;
    --text: #eceef5; --muted: #a2a9bd;
    --good: #57d39a; --good-bg: #12301f; --bad: #ff9a92; --bad-bg: #3a1a18; --info-bg: #1a2444; --info: #a9bcff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
/* links and accents need a lighter tint of the brand colour on dark backgrounds */
html { --accent: var(--primary); }
html[data-theme="dark"] { --accent: color-mix(in srgb, var(--primary) 45%, #ffffff); }
@media (prefers-color-scheme: dark) { html[data-theme="auto"] { --accent: color-mix(in srgb, var(--primary) 45%, #ffffff); } }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 16px/1.6 var(--font); color: var(--text); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; padding-bottom: 3rem; }
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); letter-spacing: -.02em; }
h2 { font-size: 1.3rem; letter-spacing: -.01em; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
code { font-family: var(--mono); font-size: .92em; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; border-radius: 6px; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 1.1rem; }
.narrow { max-width: 820px; }
.muted { color: var(--muted); } .small { font-size: .875rem; }
.sr-only, .hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .6rem 1rem; z-index: 50; }
.skip:focus { left: .5rem; top: .5rem; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .55rem 1.1rem; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 86%, #000); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--bad); color: #fff; }
html[data-theme="dark"] .btn-danger { color: #1a0605; }
.btn-sm { min-height: 36px; padding: .3rem .8rem; font-size: .92rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-btn.danger, a.danger { color: var(--bad); }
form.inline { display: inline; }

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-row { display: flex; align-items: center; gap: 1rem; min-height: 62px; }
.brand { display: inline-flex; align-items: center; text-decoration: none; color: var(--text); font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; }
.logo { height: 32px; width: auto; display: block; }
.logo-for-dark { display: none; }
html[data-theme="dark"] .logo-for-light { display: none; } html[data-theme="dark"] .logo-for-dark { display: block; }
@media (prefers-color-scheme: dark) { html[data-theme="auto"] .logo-for-light { display: none; } html[data-theme="auto"] .logo-for-dark { display: block; } }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: .25rem 1.1rem; flex-wrap: wrap; }
.site-nav a:not(.btn) { color: var(--text); text-decoration: none; font-weight: 500; padding: .4rem 0; }
.site-nav a:not(.btn):hover { color: var(--accent); }
.nav-sep { width: 1px; height: 22px; background: var(--line); }
.theme-toggle { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; display: inline-grid; place-items: center; }
.i-moon { display: none; }
html[data-theme="dark"] .i-sun { display: none; } html[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) { html[data-theme="auto"] .i-sun { display: none; } html[data-theme="auto"] .i-moon { display: block; } }
.nav-toggle { display: none; margin-left: auto; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; padding: 11px 10px; }
.nav-toggle span { display: block; height: 2px; background: var(--text); border-radius: 2px; margin: 4px 0; }
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; width: 100%; flex-direction: column; align-items: flex-start; padding: .5rem 0 1rem; gap: .3rem; }
  .site-nav.open { display: flex; }
  .header-row { flex-wrap: wrap; }
  .nav-sep { width: 100%; height: 1px; margin: .3rem 0; }
  .site-nav a:not(.btn) { padding: .55rem 0; width: 100%; }
}

/* hero + home */
.hero { background: linear-gradient(160deg, color-mix(in srgb, var(--primary) 92%, #000) 0%, color-mix(in srgb, var(--primary) 70%, #0b1030) 100%); color: #fff; padding: 3.2rem 0 4.2rem; }
.hero-inner { max-width: 780px; text-align: center; }
.hero h1 { font-size: clamp(2rem, 5.5vw, 3rem); margin-bottom: .35em; }
.hero-lead { font-size: 1.12rem; opacity: .92; margin: 0 auto 1.6rem; max-width: 40rem; }
.tool-filter { display: flex; align-items: center; gap: .6rem; background: #fff; color: #171a26; border-radius: 14px; padding: 0 1rem; max-width: 560px; margin: 0 auto; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
.tool-filter input[type="search"] { flex: 1; border: 0; background: transparent; font: inherit; padding: .95rem 0; color: inherit; outline: none; min-width: 0; min-height: 0; border-radius: 0; }
.tool-filter:focus-within { outline: 3px solid rgba(255, 255, 255, .55); outline-offset: 2px; }
.home-body { margin-top: -1.8rem; }
.tool-group { margin: 0 0 2rem; }
.home-body > .tool-group:first-child .group-head { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; box-shadow: var(--shadow); }
.group-head { display: flex; align-items: baseline; gap: .3rem 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.group-head h2 { margin: 0; } .group-head p { margin: 0; } .group-head a { margin-left: auto; font-weight: 600; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: .8rem; }
.tool-card { display: flex; gap: .85rem; align-items: flex-start; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .15s; }
.tool-card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.tool-card-icon { flex: none; width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 13%, var(--surface)); color: var(--accent); }
.tool-card-text { display: flex; flex-direction: column; min-width: 0; }
.tool-card-text span { color: var(--muted); font-size: .9rem; line-height: 1.4; }
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.post-card { display: flex; flex-direction: column; gap: .35rem; padding: 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; }
.post-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.post-card strong { font-size: 1.08rem; line-height: 1.35; }
.post-card img { border-radius: 10px; aspect-ratio: 16 / 9; object-fit: cover; margin-bottom: .3rem; }
.post-date { font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.post-cover { border-radius: var(--radius); margin-bottom: 1.2rem; }
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1.6rem; }

/* pages */
.breadcrumb { display: flex; flex-wrap: wrap; gap: .45rem; font-size: .9rem; color: var(--muted); padding: 1.3rem 0 .4rem; }
.breadcrumb a { color: var(--muted); }
.page-head { margin: .4rem 0 1.3rem; }
.lead { font-size: 1.1rem; color: var(--muted); margin: 0; }
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.6rem; align-items: start; }
.page-side { padding-top: 4.4rem; display: flex; flex-direction: column; gap: 1rem; align-self: stretch; }
.side-sticky { position: sticky; top: 78px; }
@media (max-width: 1000px) { .page-grid { grid-template-columns: minmax(0, 1fr); } .page-side { padding-top: 0; } .side-sticky { position: static; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); margin-bottom: 1.3rem; }
.side-card { margin: 0; }
.side-title { font-size: 1.02rem; margin-bottom: .7rem; }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li + li { border-top: 1px solid var(--line); }
.side-list a { display: flex; align-items: center; gap: .6rem; padding: .6rem 0; color: var(--text); text-decoration: none; font-weight: 500; }
.side-list a:hover { color: var(--accent); }
.side-list .tool-icon { color: var(--accent); flex: none; width: 18px; height: 18px; }

/* article text */
.prose { font-size: 1.03rem; line-height: 1.72; }
.prose > :first-child { margin-top: 0; } .prose > :last-child { margin-bottom: 0; }
.prose h2 { margin-top: 1.8em; font-size: 1.38rem; }
.prose h3 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1em; }
.prose li { margin-bottom: .4em; }
.prose img { border-radius: 10px; border: 1px solid var(--line); }
.prose .faq-section h3 { margin-top: 1.2em; }
.prose .faq-section p { color: var(--muted); }
.home-article { margin-top: 1rem; }

/* ads: reserve nothing when empty, centre when filled */
.ad { margin: 0 0 1.3rem; text-align: center; overflow: hidden; }
.ad-sidebar { margin: 0; }

/* forms */
.form { display: grid; gap: 1rem; }
.form label, .field { display: grid; gap: .35rem; font-weight: 600; font-size: .95rem; }
.afield > label { font-weight: 600; font-size: .95rem; }
input[type="text"], input[type="url"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], input[type="file"], select, textarea {
  width: 100%; min-height: 46px; padding: .6rem .8rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 400; }
textarea { min-height: 0; resize: vertical; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 0; border-color: var(--accent); }
::placeholder { color: var(--muted); opacity: .75; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }
.form-title { font-size: 1.05rem; margin: .6rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line); }
.check { display: flex !important; gap: .6rem; align-items: flex-start; font-weight: 500 !important; }
.check input { width: 18px; height: 18px; margin-top: .2rem; flex: none; accent-color: var(--primary); }
.alert { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid transparent; }
.alert-error { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.alert-success { background: var(--good-bg); color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.alert-info { background: var(--info-bg); color: var(--info); }
.flashes { padding-top: 1rem; }
.auth-wrap { display: grid; place-items: start center; padding-top: 2.5rem; }
.auth-card { width: 100%; max-width: 27rem; }
.auth-card h1 { font-size: 1.6rem; }
.auth-links { margin: 1rem 0 0; text-align: center; font-size: .95rem; }
.auth-body { display: grid; place-items: start center; padding: 2.5rem 1rem; }
.auth-body .auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow); }
.error-page { text-align: center; padding-top: 4rem; }
.error-code { font-size: 4.5rem; font-weight: 800; color: var(--accent); margin: 0; line-height: 1; letter-spacing: -.04em; }

/* tools */
.tool-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .9rem; }
.field-url, .field-text { grid-column: 1 / -1; }
.tool-form .field-text:not(:only-child), .tool-form .field-url:not(:only-child) { grid-column: auto / span 2; }
@media (max-width: 640px) { .tool-form .field-text:not(:only-child), .tool-form .field-url:not(:only-child) { grid-column: 1 / -1; } }
.tool-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.tool-status { margin-top: 1rem; }
.tool-status:empty { display: none; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2.5px solid color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; margin-right: .5rem; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } html { scroll-behavior: auto; } .tool-card { transition: none; } }
.tool-result, .calc-result { margin-top: 1.3rem; padding-top: 1.3rem; border-top: 1px solid var(--line); display: grid; gap: 1.2rem; }
.tool-result[hidden], .calc-result[hidden] { display: none; }
.block-label { font-weight: 700; margin: 0 0 .5rem; display: block; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: .38rem .8rem; font: inherit; font-size: .93rem; cursor: pointer; text-align: left; line-height: 1.35; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.chips.static .chip { cursor: default; }
.chips.tone-bad .chip { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.chips.tone-good .chip { background: var(--good-bg); color: var(--good); border-color: transparent; }
.chips.lines { flex-direction: column; align-items: stretch; }
.chips.lines .chip { border-radius: 10px; }
.block-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: .7rem; }
.table-wrap { overflow-x: auto; }
table.kv { width: 100%; border-collapse: collapse; font-size: .97rem; }
table.kv th, table.kv td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.kv tbody th { width: 34%; color: var(--muted); font-weight: 600; }
table.kv td { overflow-wrap: anywhere; }
table.kv thead th { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
table.kv .num, .calc-table td { text-align: right; font-variant-numeric: tabular-nums; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .9rem; }
.img-grid.small { grid-template-columns: repeat(auto-fill, minmax(120px, 160px)); }
.img-item { display: grid; gap: .45rem; font-size: .9rem; }
.img-item img { border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); width: 100%; }
.result-cards { display: grid; gap: .7rem; }
.result-card { display: flex; gap: .9rem; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; }
.result-card img { width: 150px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; flex: none; background: var(--surface-2); }
.result-card.round img { width: 56px; height: 56px; aspect-ratio: 1; border-radius: 50%; }
.result-card a { font-weight: 700; color: var(--text); text-decoration: none; }
.result-card a:hover { color: var(--accent); text-decoration: underline; }
.result-card p { margin: .15rem 0 .4rem; color: var(--muted); font-size: .9rem; }
.result-card .chips .chip { font-size: .8rem; padding: .2rem .6rem; cursor: default; }
@media (max-width: 560px) { .result-card:not(.round) { flex-direction: column; } .result-card:not(.round) img { width: 100%; } }
.note { background: var(--info-bg); color: var(--info); padding: .75rem 1rem; border-radius: 10px; margin: 0; font-size: .95rem; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; margin: 1.2rem 0; }
.stat { background: var(--surface-2); border-radius: 12px; padding: .9rem 1rem; display: grid; gap: .15rem; }
.stat span { color: var(--muted); font-size: .88rem; }
.stat strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.checks { border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; margin: 1rem 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .5rem 1rem; }
.checks legend { font-weight: 700; padding: 0 .4rem; }
.checks label, .switch { display: flex; gap: .5rem; align-items: center; font-weight: 500; cursor: pointer; }
.checks input, .switch input { width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
.embed-preview { max-width: 100%; overflow: hidden; border-radius: 12px; }
.embed-preview iframe { max-width: 100%; border: 0; }
.desc-block { margin-bottom: 1rem; }
.desc-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .35rem; font-weight: 600; }
.switch { font-size: .88rem; color: var(--muted); }
.mono { font-family: var(--mono); font-size: .9rem; }

/* footer + cookie notice */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 1.6rem 0; }
.footer-row { display: grid; gap: .5rem; text-align: center; }
.footer-row p { margin: 0; }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem 1.3rem; margin-bottom: .3rem; }
.footer-nav a { color: var(--text); text-decoration: none; font-weight: 500; padding: .3rem 0; }
.footer-nav a:hover { color: var(--accent); }
.cookie { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; max-width: 560px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .2); padding: .9rem 1rem; display: flex; gap: 1rem; align-items: center; z-index: 30; }
.cookie[hidden] { display: none; }
.cookie p { margin: 0; font-size: .92rem; flex: 1; }
