/* ==========================================================================
   HEIC to JPG — stylesheet
   Tokens -> base -> layout -> components -> converter -> content -> utilities
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --bg-tint: #eef2fb;
  --surface: #ffffff;
  --surface-2: #f1f3f7;
  --text: #141821;
  --muted: #566070;
  --border: #dde2ea;
  --border-strong: #c3cad6;
  --accent: #2350d4;
  --accent-hover: #1b41b3;
  --accent-ink: #ffffff;
  --accent-soft: #e9eefc;
  --success: #17703f;
  --success-soft: #e6f4ec;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --warning: #7a4f00;
  --focus: #2350d4;
  --shadow: 0 1px 2px rgba(20, 24, 33, .05), 0 8px 24px -8px rgba(20, 24, 33, .12);
  --radius: 14px;
  --radius-sm: 9px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --container: 1120px;
  --reading: 740px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1117;
    --bg-tint: #131a29;
    --surface: #161a22;
    --surface-2: #1d222c;
    --text: #e7eaf0;
    --muted: #a3acbb;
    --border: #2a303c;
    --border-strong: #3a4250;
    --accent: #85a6ff;
    --accent-hover: #a3bcff;
    --accent-ink: #0b1020;
    --accent-soft: #1c2643;
    --success: #5fcf95;
    --success-soft: #14281e;
    --danger: #ff8f86;
    --danger-soft: #2f1716;
    --warning: #f0c46b;
    --focus: #a3bcff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -10px rgba(0, 0, 0, .6);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1117;
  --bg-tint: #131a29;
  --surface: #161a22;
  --surface-2: #1d222c;
  --text: #e7eaf0;
  --muted: #a3acbb;
  --border: #2a303c;
  --border-strong: #3a4250;
  --accent: #85a6ff;
  --accent-hover: #a3bcff;
  --accent-ink: #0b1020;
  --accent-soft: #1c2643;
  --success: #5fcf95;
  --success-soft: #14281e;
  --danger: #ff8f86;
  --danger-soft: #2f1716;
  --warning: #f0c46b;
  --focus: #a3bcff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -10px rgba(0, 0, 0, .6);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; margin: 0 0 .6em; }
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem); font-weight: 760; letter-spacing: -.028em; }
h2 { font-size: clamp(1.45rem, 1.2rem + 1vw, 1.9rem); font-weight: 720; }
h3 { font-size: 1.15rem; font-weight: 680; }
p, ul, ol, dl, table { margin: 0 0 1.1em; }
ul, ol { padding-inline-start: 1.3em; }
li + li { margin-top: .35em; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .container { padding: 0 28px; } }
.reading { max-width: var(--reading); margin-left: auto; margin-right: auto; }
main { display: block; }
.section { padding: 3.5rem 0 1rem; }
.section-tight { padding-top: 2rem; }

.skip-link {
  position: absolute; inset-inline-start: 12px; top: -48px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: .55rem 1rem; border-radius: var(--radius-sm);
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; color: var(--accent-ink); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) { .site-header { background: var(--bg); } }
.header-inner { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 760; font-size: 1.08rem; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.brand:hover { color: var(--text); }
.brand-mark { width: 30px; height: 30px; flex: none; }
.nav { margin-inline-start: auto; }
.nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav li + li { margin-top: 0; }
.nav a {
  display: block; padding: .45rem .75rem; border-radius: 8px;
  color: var(--muted); font-weight: 560; font-size: .97rem; text-decoration: none;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.header-actions { display: flex; align-items: center; gap: 4px; }
.icon-button {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-button:hover { background: var(--surface-2); color: var(--text); }
.icon-button svg { width: 20px; height: 20px; }
.menu-toggle { display: none; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

@media (max-width: 760px) {
  .menu-toggle { display: inline-grid; }
  .nav { order: 3; margin-inline-start: 0; flex-basis: 100%; display: none; padding-bottom: 12px; }
  .nav.is-open { display: block; }
  .nav ul { flex-direction: column; }
  .nav a { padding: .7rem .75rem; }
  .header-inner { flex-wrap: wrap; }
  .header-actions { margin-inline-start: auto; }
}

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-border: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .55rem 1.1rem; border-radius: 10px;
  border: 1px solid var(--btn-border); background: var(--btn-bg); color: var(--btn-fg);
  font: inherit; font-size: .97rem; font-weight: 620; line-height: 1.2; text-decoration: none;
  cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { --btn-bg: var(--surface-2); color: var(--btn-fg); text-decoration: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { --btn-bg: var(--accent); --btn-fg: var(--accent-ink); --btn-border: var(--accent); }
.btn-primary:hover { --btn-bg: var(--accent-hover); --btn-border: var(--accent-hover); }
.btn-large { min-height: 52px; padding: .75rem 1.5rem; font-size: 1.05rem; border-radius: 12px; }
.btn-small { min-height: 36px; padding: .35rem .8rem; font-size: .9rem; border-radius: 8px; }
.btn-ghost { --btn-border: transparent; --btn-bg: transparent; --btn-fg: var(--muted); }
.btn-ghost:hover { --btn-bg: var(--surface-2); --btn-fg: var(--text); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ---------- Hero ---------- */
.hero {
  padding: 3rem 0 2rem; text-align: center;
  background:
    radial-gradient(60% 120% at 50% 0%, var(--bg-tint) 0%, transparent 70%);
}
.hero .lede { max-width: 640px; margin: 0 auto 1.4rem; color: var(--muted); font-size: clamp(1.05rem, 1rem + .4vw, 1.2rem); }
.format-flow { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 1.2rem; font-family: var(--mono); font-size: .8rem; font-weight: 600; letter-spacing: .04em; }
.chip { display: inline-block; padding: .25rem .6rem; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); }
.chip-accent { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.format-flow svg { width: 18px; height: 18px; color: var(--muted); }
.hero-points { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.4rem; list-style: none; padding: 0; margin: 0; color: var(--muted); font-size: .95rem; }
.hero-points li { display: inline-flex; align-items: center; gap: .45rem; margin: 0; }
.hero-points svg { width: 18px; height: 18px; color: var(--success); flex: none; }
/* ---------- Converter card ---------- */
.converter {
  max-width: 920px; margin: 0 auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow);
  padding: 16px;
}
@media (min-width: 720px) { .converter { padding: 24px; } }

.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: .4rem; min-height: 230px; padding: 2rem 1rem;
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  transition: border-color .15s ease, background-color .15s ease;
}
.dropzone.is-dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-icon { width: 54px; height: 54px; color: var(--accent); margin-bottom: .3rem; }
.dropzone-title { font-size: 1.15rem; font-weight: 680; margin: 0; }
.dropzone-or { color: var(--muted); margin: 0; font-size: .95rem; }
.dropzone .btn { margin: .3rem 0 .4rem; }
.dropzone-hint { margin: 0; color: var(--muted); font-size: .88rem; }
.has-files .dropzone { min-height: 0; padding: 1.1rem 1rem; flex-direction: row; flex-wrap: wrap; gap: .4rem 1rem; }
.has-files .dropzone-icon, .has-files .dropzone-or { display: none; }
.has-files .dropzone-title { font-size: 1rem; }
.has-files .dropzone .btn { margin: 0; }
.has-files .dropzone-hint { flex-basis: 100%; }

.notice {
  margin: 14px 0 0; padding: .7rem .9rem; border-radius: var(--radius-sm);
  background: var(--danger-soft); color: var(--danger); font-size: .93rem; border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
}
.notice ul { margin: .3rem 0 0; }
.notice-close { float: inline-end; margin-block: -4px 0; margin-inline: 8px -6px; width: 32px; height: 32px; color: inherit; }

/* Settings */
.settings { margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.settings > summary {
  display: flex; align-items: center; gap: .6rem; padding: .85rem 1rem; cursor: pointer; list-style: none;
  font-weight: 650; border-radius: var(--radius);
}
.settings > summary::-webkit-details-marker { display: none; }
.settings > summary svg.chev { width: 18px; height: 18px; margin-inline-start: auto; color: var(--muted); transition: transform .15s ease; }
.settings[open] > summary svg.chev { transform: rotate(180deg); }
.settings-summary { color: var(--muted); font-weight: 450; font-size: .9rem; }
.settings-body { display: grid; gap: 18px; padding: 4px 16px 18px; }
@media (min-width: 760px) { .settings-body { grid-template-columns: 1fr 1fr; gap: 20px 32px; } }
.field { min-width: 0; margin: 0; padding: 0; border: 0; }
.field > legend, .field-label { display: block; font-weight: 620; font-size: .95rem; margin-bottom: .45rem; padding: 0; }
.field-help { margin: .35rem 0 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row output { min-width: 3.4em; text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
input[type="range"] { flex: 1; accent-color: var(--accent); height: 28px; }
.check { display: flex; align-items: flex-start; gap: .6rem; cursor: pointer; font-size: .95rem; }
.check input { width: 20px; height: 20px; margin: .15rem 0 0; accent-color: var(--accent); flex: none; }
.dims { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: .6rem 0; }
.dims label { font-size: .85rem; color: var(--muted); display: block; margin-bottom: .2rem; }
.input {
  width: 100%; min-height: 42px; padding: .45rem .7rem; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: .97rem;
}
.input:disabled { background: var(--surface-2); color: var(--muted); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.color-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.color-row input[type="color"] { width: 46px; height: 40px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); cursor: pointer; }
.swatch { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border-strong); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Queue */
.queue { margin-top: 16px; }
.queue-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 4px 0 12px; }
.queue-status { margin: 0; margin-inline-end: auto; font-weight: 600; font-size: .97rem; }
.queue-status small { display: block; color: var(--muted); font-weight: 450; font-size: .86rem; }
.queue-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 560px) {
  .queue-actions { width: 100%; }
  .queue-actions .btn { flex: 1 1 auto; }
}
.stale-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; padding: .6rem .8rem; border-radius: var(--radius-sm); background: var(--accent-soft); font-size: .93rem; }
.stale-banner p { margin: 0; margin-inline-end: auto; }

.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.file-list li + li { margin-top: 0; }
.file {
  display: grid; grid-template-columns: 64px 1fr; gap: 12px 14px; align-items: center;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
@media (min-width: 640px) { .file { grid-template-columns: 72px 1fr auto; } }
.file[data-state="error"] { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.thumb {
  width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--surface-2);
  display: grid; place-items: center; color: var(--muted); border: 1px solid var(--border);
}
@media (min-width: 640px) { .thumb { width: 72px; height: 72px; } }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb svg { width: 26px; height: 26px; }
.file-main { min-width: 0; }
.file-name { margin: 0; font-weight: 620; font-size: .97rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { margin: .1rem 0 0; color: var(--muted); font-size: .86rem; font-variant-numeric: tabular-nums; line-height: 1.5; }
.file-meta .good { color: var(--success); font-weight: 600; }
.file-status { margin: .2rem 0 0; font-size: .86rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.file[data-state="done"] .file-status { color: var(--success); }
.file[data-state="error"] .file-status { color: var(--danger); }
.file-status svg { width: 16px; height: 16px; flex: none; }
.progress { height: 6px; margin-top: .45rem; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .25s ease; }
.file[data-state="done"] .progress, .file[data-state="error"] .progress { display: none; }
.file-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
@media (min-width: 640px) { .file-actions { grid-column: auto; } }
.file-actions .btn-download { flex: 1 1 auto; }
@media (min-width: 640px) { .file-actions .btn-download { flex: none; } }
.remove-btn { width: 36px; height: 36px; }

.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.privacy-note { display: flex; gap: .6rem; align-items: flex-start; margin: 16px 0 0; color: var(--muted); font-size: .9rem; }
.privacy-note svg { width: 18px; height: 18px; flex: none; margin-top: .2rem; color: var(--success); }

.noscript-warning { margin-top: 12px; padding: .8rem 1rem; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); }

/* ---------- Content ---------- */
.steps { list-style: none; padding: 0; display: grid; gap: 14px; counter-reset: step; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li { margin: 0; padding: 1.2rem 1.2rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); counter-increment: step; }
.steps li::before {
  content: counter(step); display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 750; font-size: .95rem; margin-bottom: .6rem;
}
.steps h3 { margin-bottom: .35em; }
.steps p { margin: 0; color: var(--muted); font-size: .97rem; }

.features { display: grid; gap: 14px; }
@media (min-width: 640px) { .features { grid-template-columns: 1fr 1fr; } }
@media (min-width: 980px) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature { padding: 1.2rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.feature svg { width: 26px; height: 26px; color: var(--accent); margin-bottom: .6rem; }
.feature h3 { font-size: 1.05rem; }
.feature p { margin: 0; color: var(--muted); font-size: .96rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 1.2em; }
.table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; margin: 0; }
th, td { text-align: start; padding: .7rem .9rem; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { background: var(--surface-2); font-weight: 650; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody th { font-weight: 600; }

.faq-list { border-top: 1px solid var(--border); }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item > summary {
  display: flex; align-items: center; gap: 1rem; padding: 1rem .2rem; cursor: pointer; list-style: none;
  font-weight: 640; font-size: 1.03rem;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after {
  content: ""; margin-inline-start: auto; flex: none; width: 10px; height: 10px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-3px);
  transition: transform .15s ease;
}
.faq-item[open] > summary::after { transform: rotate(-135deg) translateY(-3px); }
.faq-item .answer { padding: 0 .2rem .6rem; color: var(--text); }
.faq-item h3 { display: inline; font-size: inherit; font-weight: inherit; margin: 0; letter-spacing: normal; line-height: 1.4; }

.callout { padding: 1rem 1.2rem; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); margin-bottom: 1.4em; }
.callout p:last-child { margin-bottom: 0; }

.page-header { padding: 3rem 0 1.2rem; }
.page-header p { color: var(--muted); font-size: 1.1rem; margin: 0; }
.breadcrumbs { font-size: .9rem; color: var(--muted); margin-bottom: 1rem; }
.breadcrumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .3rem; }
.breadcrumbs li { margin: 0; }
.breadcrumbs li + li::before { content: "/"; margin-inline-end: .3rem; color: var(--border-strong); }
.prose { padding-bottom: 3rem; }
.prose h2 { margin-top: 2.2rem; }
.prose h3 { margin-top: 1.6rem; }
.updated { color: var(--muted); font-size: .92rem; }
.toc { padding: 1rem 1.2rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 2rem; }
.toc h2 { font-size: 1rem; margin: 0 0 .5rem; }
.toc ol { margin: 0; }

.cta-band { margin: 3rem auto 0; padding: 1.6rem; text-align: center; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.cta-band p { color: var(--muted); }

.error-page { text-align: center; padding: 5rem 0 4rem; }
.error-code { font-family: var(--mono); font-size: .9rem; color: var(--muted); letter-spacing: .1em; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 4rem; border-top: 1px solid var(--border); background: var(--surface); font-size: .94rem; }
/* Privacy promise band: the footer's one emphasized element. */
.footer-promise {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 32px;
  padding: 1.6rem 0; border-bottom: 1px solid var(--border);
}
.footer-promise-title { margin: 0; font-size: 1.12rem; font-weight: 700; letter-spacing: -.01em; }
.footer-promise-title a { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.footer-promise-title a:hover span { text-decoration: underline; text-underline-offset: 3px; }
.footer-promise-title svg { width: 26px; height: 26px; flex: none; color: var(--accent); }
.footer-facts { display: flex; flex-wrap: wrap; gap: 8px 22px; list-style: none; margin: 0; padding: 0; color: var(--muted); }
.footer-facts li { display: inline-flex; align-items: center; gap: 7px; margin: 0; }
.footer-facts svg { width: 17px; height: 17px; flex: none; }
.footer-promise #install-app { margin-inline-start: auto; }

/* Brand + four link columns of equal width. */
.footer-grid { display: grid; gap: 28px; padding: 2.4rem 0 2rem; }
.footer-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 24px; }
@media (min-width: 640px) { .footer-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 980px) { .footer-grid { grid-template-columns: minmax(220px, 1fr) 3.4fr; gap: 48px; } }
.footer-brand p { color: var(--muted); max-width: 34ch; margin: .8rem 0 0; }
.footer-col h2 { font-size: .95rem; font-weight: 700; color: var(--text); margin: 0 0 .75rem; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin: 0; }
.footer-col li + li { margin-top: .5rem; }
.footer-col a { color: var(--muted); text-decoration: none; }
.footer-col a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* Bottom bar: copyright, consent link (with ads), language. */
.footer-bottom {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  padding: 1rem 0 1.6rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .88rem;
}
.footer-copy { margin: 0; }
.footer-bottom-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.lang-menu-footer > summary { height: 36px; border: 1px solid var(--border); font-weight: 560; font-size: .88rem; letter-spacing: 0; color: var(--text); }
.lang-menu-footer > summary svg { width: 18px; height: 18px; }
.lang-menu-footer > summary .chev { width: 15px; height: 15px; transform: rotate(180deg); transition: transform .15s ease; }
.lang-menu-footer[open] > summary .chev { transform: none; }
.lang-menu-footer .lang-panel { top: auto; bottom: calc(100% + 8px); }
@media (max-width: 640px) {
  .footer-promise #install-app { margin-inline-start: 0; }
  .footer-bottom { flex-direction: column-reverse; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .lang-menu-footer > summary .chev { transition: none; } }

/* ---------- Language menu and tools dropdown ---------- */
.lang-menu, .nav-sub { position: relative; }
.lang-menu > summary, .nav-sub > summary { list-style: none; cursor: pointer; }
.lang-menu > summary::-webkit-details-marker, .nav-sub > summary::-webkit-details-marker { display: none; }
.lang-menu > summary {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; border-radius: 10px;
  color: var(--muted); font-weight: 650; font-size: .85rem; letter-spacing: .03em;
}
.lang-menu > summary:hover, .lang-menu[open] > summary { background: var(--surface-2); color: var(--text); }
.lang-menu > summary svg { width: 20px; height: 20px; }
.lang-panel {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 30; width: min(540px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px;
}
.lang-title { margin: 0 0 6px; padding: 0 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.lang-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px; }
.lang-list li { margin: 0; }
.lang-list a { display: block; padding: .45rem .6rem; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .95rem; }
.lang-list a:hover { background: var(--surface-2); }
.lang-list a[aria-current="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.nav-sub > summary { display: flex; align-items: center; gap: 4px; padding: .45rem .75rem; border-radius: 8px; color: var(--muted); font-weight: 560; font-size: .97rem; }
.nav-sub > summary:hover, .nav-sub[open] > summary { color: var(--text); background: var(--surface-2); }
.nav-sub > summary .chev { width: 16px; height: 16px; transition: transform .15s ease; }
.nav-sub[open] > summary .chev { transform: rotate(180deg); }
.nav-sub ul {
  position: absolute; inset-inline-start: 0; top: calc(100% + 8px); z-index: 30; min-width: 220px; display: block;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px;
}
.nav-sub li + li { margin-top: 0; }
@media (max-width: 760px) {
  .nav-sub ul { position: static; box-shadow: none; border: 0; padding: 0 0 0 12px; padding-inline-start: 12px; min-width: 0; }
  .nav-sub > summary { padding: .7rem .75rem; }
  .lang-menu .lang-code { display: none; }
  /* On phones the globe button is not at the screen edge, so anchor the panel to the
     header instead of the button: it then always spans the screen with a 16px margin. */
  .lang-menu:not(.lang-menu-footer) { position: static; } /* panel resolves against the sticky .site-header */
  .lang-menu-footer .lang-panel { inset-inline: 0 auto; width: calc(100vw - 32px); max-height: 70vh; }
  .lang-panel { inset-inline: 16px; width: auto; top: calc(100% + 4px); max-height: calc(100vh - 96px); overflow-y: auto; }
  .lang-list { grid-template-columns: 1fr 1fr; }
}
.range-row output { text-align: end; }
.flow-arrow { width: 18px; height: 18px; color: var(--muted); }
[dir="rtl"] .flow-arrow, [dir="rtl"] .chev-inline { transform: scaleX(-1); }
.link-button { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; }

/* ---------- Ads (rendered only when AdSense is configured) ---------- */
/* The unit must have width to load, so it is never display:none; it has no
   height, label or margin until Google reports it as filled. */
.ad-slot { text-align: center; margin: 0 auto; }
.ad-slot .ad-label { display: none; }
.ad-slot.is-filled { margin: 2rem auto; }
.ad-slot.is-filled .ad-label { display: block; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.adsbygoogle { display: block; }
ins.adsbygoogle[data-ad-status="unfilled"] { display: none !important; }

/* ---------- Cards, lists, related ---------- */
.card-grid { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 14px; }
@media (min-width: 640px) { .card-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 980px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }
.card { margin: 0; padding: 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card h2 { font-size: 1.1rem; margin-bottom: .4rem; }
.card h2 a { color: var(--text); text-decoration: none; }
.card h2 a:hover { color: var(--accent); text-decoration: underline; }
.card p { margin: 0; color: var(--muted); font-size: .96rem; }
li.card + li.card { margin-top: 0; }
.post-list { list-style: none; padding: 0; display: grid; gap: 14px; }
.post-meta { color: var(--muted); font-size: .9rem; margin-bottom: .4rem; }
.card .post-meta { margin-bottom: .3rem; }
.tool-chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tool-chips li { margin: 0; }
.tool-chip { display: inline-block; padding: .4rem .8rem; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--text); text-decoration: none; font-size: .93rem; }
.tool-chip:hover { border-color: var(--accent); color: var(--accent); }
/* Text boxes on tool pages: same surface, border, radius and 14px gap as the step and feature
   cards, so every section shares one width and one pair of edges. */
.text-grid { display: grid; gap: 14px; align-items: stretch; }
@media (min-width: 760px) { .text-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.text-card {
  min-width: 0; padding: 1.4rem 1.4rem 1.25rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
@media (min-width: 720px) { .text-card { padding: 1.7rem 1.8rem 1.5rem; } }
.text-card h2 { font-size: clamp(1.2rem, 1.1rem + .45vw, 1.42rem); margin-bottom: .75em; }
.text-card-body { font-size: 1rem; }
.text-card-body > :last-child { margin-bottom: 0; }
.text-card-body ol, .text-card-body ul:not(.tool-chips) { padding-inline-start: 1.25em; }
.text-card .table-wrap { background: var(--bg); }
.text-card .faq-list { margin-top: -.4rem; }
.text-card.wide { grid-column: 1 / -1; }
/* A box alone in its row: heading beside the text, so lines stay at a readable length. */
@media (min-width: 900px) {
  .text-card.wide { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.3fr); gap: 0 44px; align-items: start; }
  .text-card.wide > h2 { margin: 0; position: sticky; top: 88px; }
}
.related { margin-top: 2.5rem; }
.related h2 { font-size: 1.2rem; }
.draft-flag { display: inline-block; padding: .2rem .6rem; border-radius: 6px; background: var(--danger-soft); color: var(--danger); font-weight: 700; font-size: .85rem; }
.lang-inline { list-style: none; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem 1rem; margin-top: 2rem; }
.lang-inline li { margin: 0; }
.post-body img { border-radius: var(--radius-sm); height: auto; }
.post-body blockquote { margin: 1.2em 0; padding: .6rem 1rem; border-inline-start: 4px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius-sm); }
.post-body blockquote p:last-child { margin-bottom: 0; }

/* ---------- Viewer dialog ---------- */
.viewer { width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.viewer::backdrop { background: rgba(10, 12, 18, .7); }
.viewer-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.viewer-head h2 { margin: 0; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-head .icon-button { margin-inline-start: auto; }
.viewer-body { display: grid; gap: 16px; padding: 14px; }
@media (min-width: 820px) { .viewer-body { grid-template-columns: 1fr 260px; } }
.viewer-body img { width: 100%; max-height: calc(100vh - 140px); object-fit: contain; background: var(--surface-2); border-radius: var(--radius-sm); }
.viewer-side h3 { margin-top: 0; }
.viewer-side dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem .8rem; font-size: .93rem; margin-bottom: 1rem; }
.viewer-side dt { color: var(--muted); }
.viewer-side dd { margin: 0; }
select.input { appearance: auto; }

/* ---------- Utilities ---------- */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.pointer-coarse { display: none; }
@media (hover: none) and (pointer: coarse) {
  .pointer-fine { display: none; }
  .pointer-coarse { display: inline; }
  .dropzone-or { display: none; }
}
.center { text-align: center; }
