/* The outer page (index.html): everything around the isolated editor. */
/* Colours as tokens: light by default, dark when theme.js sets data-theme="dark" (the system
   setting or the visitor's pick), or, without JavaScript, when the system prefers dark.
   editor/editor.css repeats the same tokens for the editor's frame; keep the two in step. */
:root {
    --ink: #15171C;
    --ink-2: #2A2F36;
    --ink-3: #3A3F47;
    --muted: #4F555E;
    --ground: #F3F4F1;
    --surface: #FFFFFF;
    --line: #D9DBD5;
    --line-soft: #E6E8E3;
    --accent: #1F3FC4;
    --accent-hover: #18329E;
    --link: #1F3FC4;
    --on-ink: #FFFFFF;
    --ok: #0C4A33;
    --logo-bg: #15171C;
    --shadow: rgba(21, 23, 28, 0.16);
    color-scheme: light;
}
:root[data-theme="dark"] {
    --ink: #ECEDE9;
    --ink-2: #D4D6D1;
    --ink-3: #BFC2BC;
    --muted: #9CA1A9;
    --ground: #111316;
    --surface: #1A1D21;
    --line: #30353C;
    --line-soft: #262A30;
    --accent: #3F5BE0;
    --accent-hover: #3651D6;
    --link: #9DB1FF;
    --on-ink: #111316;
    --ok: #7FD3B0;
    --logo-bg: #2E333A;
    --shadow: rgba(0, 0, 0, 0.5);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --ink: #ECEDE9;
        --ink-2: #D4D6D1;
        --ink-3: #BFC2BC;
        --muted: #9CA1A9;
        --ground: #111316;
        --surface: #1A1D21;
        --line: #30353C;
        --line-soft: #262A30;
        --accent: #3F5BE0;
        --accent-hover: #3651D6;
        --link: #9DB1FF;
        --on-ink: #111316;
        --ok: #7FD3B0;
        --logo-bg: #2E333A;
        --shadow: rgba(0, 0, 0, 0.5);
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--ground);
    color: var(--ink);
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

/* links: ink text with a thin, faint accent underline that fills in on hover (not the browser's
   default blue); quiet ones in the footer and breadcrumbs have no underline */
a {
    color: var(--ink);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent);
    text-underline-offset: 0.22em;
    transition: color 0.15s, text-decoration-color 0.15s;
}
a:hover { color: var(--link); text-decoration-color: currentColor; }
a:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 2px; }
.footer-links a, .crumbs a { color: var(--muted); text-decoration: none; }
.footer-links a:hover, .crumbs a:hover { color: var(--ink); }

.page {
    max-width: 1360px;
    margin: 0 auto;
    padding: 0 clamp(16px, 4vw, 40px) 48px;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* the home page's main landmark, laid out like .page around it */
.home { display: flex; flex-direction: column; gap: 40px; }

.site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.01em;
}

.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.site-nav a {
    padding: 10px 14px;
    border-radius: 6px;
    color: var(--ink-2);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
}
.site-nav a:hover { background: var(--line-soft); color: var(--ink); }
.site-nav a[aria-current="page"] { background: var(--line-soft); color: var(--ink); font-weight: 600; }

.local-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line);
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-2);
}

.hero[hidden] { display: none; }
.hero { display: flex; flex-direction: column; gap: 12px; max-width: 820px; }
.hero h1 { margin: 0; font-size: clamp(36px, 5vw, 56px); line-height: 1.05; letter-spacing: -0.025em; font-weight: 700; }
.hero .lead { margin: 0; font-size: 19px; color: var(--ink-3); max-width: 680px; }
.hero .facts { margin: 0; font-size: 14px; color: var(--muted); }

.editor-frame {
    position: relative;
    border: 1.5px solid var(--ink);
    border-radius: 14px;
    background: var(--surface);
    padding: 28px clamp(14px, 2vw, 24px) 24px;
}

.editor-badge {
    position: absolute;
    top: -13px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--ink);
    color: var(--on-ink);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    letter-spacing: 0.02em;
}

/* site.js sets the height the editor reports */
#editor { display: block; width: 100%; height: 640px; border: 0; }

.how { display: flex; flex-direction: column; gap: 20px; }
.how h2 { margin: 0; font-size: 28px; letter-spacing: -0.015em; }
.how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.how-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.how-card h3 { margin: 0; font-size: 18px; }
.how-card p { margin: 0; font-size: 15px; color: var(--ink-3); }
.how-step { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 13px; color: var(--muted); }

.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    font-size: 13px;
    color: var(--muted);
}
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-links [hidden] { display: none; }
.build code { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12px; }

/* ad slot (ads.js; only in builds with an ad network configured): outside the editor, labelled,
   with its space reserved so the page doesn't jump when the ad arrives */
.ad-slot { display: flex; flex-direction: column; gap: 6px; min-height: 130px; }
.ad-slot[hidden] { display: none; }
.ad-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* content pages (guides, FAQ, imprint) */
.article { max-width: 760px; display: flex; flex-direction: column; gap: 4px; }
.article h1 { margin: 0 0 8px; font-size: clamp(32px, 4.5vw, 46px); line-height: 1.1; letter-spacing: -0.02em; }
.article h2 { margin: 28px 0 4px; font-size: 22px; letter-spacing: -0.01em; }
.article p, .article li { font-size: 17px; line-height: 1.65; color: var(--ink-3); }
.article p { margin: 8px 0; }
.article ul, .article ol { margin: 8px 0; padding-left: 24px; display: flex; flex-direction: column; gap: 6px; }
.article .lead { font-size: 19px; color: var(--ink-2); }
.article code { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 0.88em; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.article .note { font-size: 15px; color: var(--muted); border-left: 3px solid var(--line); padding-left: 12px; }
.crumbs { margin: 0; font-size: 14px; }
/* privacy notice: contents links, and the one promise that matters most set apart */
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.toc a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 14px; font-weight: 500; text-decoration: none; }
.toc a:hover { border-color: var(--ink); color: var(--ink); }
.article h2[id] { scroll-margin-top: 16px; }
.key-point { margin-top: 28px; background: var(--surface); border: 1.5px solid var(--ink); border-radius: 14px; padding: 4px 24px 12px; }
.key-point h2 { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.key-point p { color: var(--ink-2); }
.table-wrap { overflow-x: auto; }
table.plain { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 15px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
table.plain th, table.plain td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
table.plain th { font-size: 13px; color: var(--muted); font-weight: 600; }
.guide-list { list-style: none; padding: 0 !important; gap: 12px !important; }
.guide-list li { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; }
.guide-list a { color: var(--ink); text-decoration: none; font-size: 18px; }
.guide-list a:hover { color: var(--link); }
.guide-list span { font-size: 15px; color: var(--muted); }
.cta { margin-top: 28px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border: 1.5px solid var(--ink); border-radius: 14px; padding: 20px 24px; }
.cta p { margin: 0; flex: 1 1 320px; }
.cta-button { display: inline-flex; align-items: center; min-height: 46px; padding: 0 20px; border-radius: 8px; background: var(--accent); color: #FFFFFF; font-weight: 600; text-decoration: none; }
.cta-button:hover { background: var(--accent-hover); color: #FFFFFF; }

/* inline icons drawn for the light theme: their colours come from the tokens instead */
.brand svg rect:first-child { fill: var(--logo-bg); }
.local-badge svg, .key-point h2 svg { stroke: var(--ok); }
.editor-badge svg { stroke: currentColor; }

/* the header's right end: the "runs in your browser" badge and the theme switcher (theme.js) */
.header-end { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.theme-switch { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.theme-switch[hidden] { display: none; }
.theme-switch button { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.theme-switch button:hover { background: var(--line-soft); color: var(--ink); }
.theme-switch button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.theme-switch button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
/* phones: the switcher goes up beside the logo instead of taking a row of its own */
@media (max-width: 600px) {
    .site-header { position: relative; }
    .theme-switch { position: absolute; top: 12px; right: 0; }
}
