/* Every Round help centre: a docs layout with a sidebar. Tokens match docs/index.html (see DESIGN.md).
   Hand-written; scripts/generate-help.mjs writes the HTML that uses it. */

@font-face { font-family: 'Nohemi'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/nohemi-regular.woff2') format('woff2'); }
@font-face { font-family: 'Nohemi'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/nohemi-medium.woff2') format('woff2'); }

:root {
    --ground: #F7F7F7;
    --surface: #EFEFEF;
    --line: #E4E4E4;
    --ink: #1A1A1A;
    --ink-2: #6B6B6B;
    --action: #0C7E43;
    --on-action: #FFFFFF;
    --green-tint: #E7F6EB;

    --font: 'Nohemi', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --side-w: 272px;
    --bar-h: 52px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

[data-theme="dark"] {
    --ground: #121212;
    --surface: #1C1C1E;
    --line: #383838;
    --ink: #FAFAFA;
    --ink-2: #A3A3A3;
    --action: #2EB25F;
    --on-action: #0B1F12;
    --green-tint: #13301F;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 24px;
    -webkit-text-size-adjust: 100%;
    scrollbar-color: var(--line) transparent;
}

body {
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.55;
    font-weight: 400;
    color: var(--ink-2);
    background: var(--ground);
    -webkit-font-smoothing: antialiased;
    font-synthesis: none;
    overflow-x: clip;
    transition: background-color 300ms ease, color 300ms ease;
}

::selection { background: var(--green-tint); color: var(--ink); }

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a, button { -webkit-tap-highlight-color: transparent; }
ul, ol { list-style: none; }

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

.skip-link {
    position: absolute;
    left: 16px;
    top: -60px;
    z-index: 100;
    background: var(--ink);
    color: var(--ground);
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
}
.skip-link:focus { top: calc(12px + var(--safe-top)); }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.icon {
    width: 20px;
    height: 20px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Layout */
.docs {
    display: grid;
    grid-template-columns: var(--side-w) minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
}

/* Sidebar */
.side {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 30px 0 0 26px;
    overflow: hidden;
}

.side-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    color: var(--ink);
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.2;
}
.side-brand img { width: 34px; height: 34px; border-radius: 22.5%; }
.side-brand small {
    display: block;
    margin-top: 1px;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--ink-2);
}

.side-search {
    position: relative;
    display: flex;
    align-items: center;
    margin: 0 18px 18px 0;
}
.side-search input {
    width: 100%;
    min-height: 34px;
    padding: 0 52px 0 12px;
    font: inherit;
    font-size: 0.8125rem;
    color: var(--ink);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 999px;
    -webkit-appearance: none;
    appearance: none;
}
.side-search input::placeholder { color: var(--ink-2); opacity: 1; }
.side-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.side-search input:focus-visible { outline-offset: 2px; border-radius: 999px; }
.side-search .hint {
    position: absolute;
    right: 12px;
    font: inherit;
    font-size: 0.6875rem;
    color: var(--ink-2);
    pointer-events: none;
}

/* Brand, search and footer stay put; only the article list scrolls */
.side-nav {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 18px 16px 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.grp-title {
    margin: 16px 0 7px;
    font-size: 0.8125rem;
    color: var(--ink-2);
}
.grp:first-child .grp-title { margin-top: 0; }

.side-nav li > a {
    display: block;
    padding: 3.5px 0;
    font-size: 0.84375rem;
    line-height: 1.4;
    color: var(--ink);
}
.side-nav li > a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.side-nav li.cur > a { font-weight: 500; }

.toc {
    margin: 3px 0 4px 3px;
    padding-left: 12px;
    border-left: 1px solid var(--line);
}
.side-nav .toc a {
    padding: 3px 0;
    font-size: 0.78125rem;
    color: var(--ink-2);
}
.side-nav .toc a:hover { color: var(--ink); }

.side-none { font-size: 0.84375rem; color: var(--ink-2); padding: 3.5px 0; }

.side-foot {
    flex: none;
    margin-right: 18px;
    padding: 12px 0 20px;
    border-top: 1px solid var(--line);
    font-size: 0.8125rem;
}
.side-foot .back { display: inline-block; padding: 3px 0; color: var(--ink); }
.side-foot .back:hover,
.legal a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.side-foot-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
}
.legal { display: flex; gap: 14px; font-size: 0.75rem; color: var(--ink-2); }

.theme-toggle {
    position: relative;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--ink-2);
    flex: none;
}
.theme-toggle:hover { background: var(--surface); color: var(--ink); }
.theme-toggle .icon {
    grid-area: 1 / 1;
    width: 18px;
    height: 18px;
    transition: transform 240ms ease, opacity 160ms ease;
}
.theme-toggle .i-sun { opacity: 0; transform: rotate(-90deg) scale(0.6); }
[data-theme="dark"] .theme-toggle .i-moon { opacity: 0; transform: rotate(90deg) scale(0.6); }
[data-theme="dark"] .theme-toggle .i-sun { opacity: 1; transform: none; }

/* Main column */
main {
    min-width: 0;
    padding: 44px clamp(24px, 4vw, 56px) 96px clamp(32px, 6vw, 96px);
}
main:focus { outline: none; }

.doc { max-width: 560px; }

.doc h1 {
    font-size: 1.875rem;
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin-bottom: 18px;
    text-wrap: balance;
}
.doc h1 a { color: var(--ink-2); }
.doc h1 a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.doc h1 .sep { margin: 0 6px; font-size: 1.375rem; color: var(--ink-2); }
/* Keep the article name on one line group: a long title moves whole to the next line instead of splitting after its first word. */
.doc h1 .page { display: inline-block; }

.doc .meta { margin: -8px 0 14px; font-size: 0.8125rem; color: var(--ink-2); }

.doc p,
.doc li {
    font-size: 0.9375rem;
    line-height: 1.6;
}
.doc p { margin-bottom: 14px; text-wrap: pretty; }

.doc h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 26px 0 10px;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.35;
    color: var(--ink);
    scroll-margin-top: 24px;
}
.doc h2:first-of-type { margin-top: 26px; }

.anchor {
    display: inline-block;
    flex: none;
    padding: 2px 4px;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--ink-2);
    opacity: 0;
    transition: opacity 160ms ease;
}
.anchor::before { content: '#'; }
.doc h2:hover .anchor,
.anchor:focus-visible { opacity: 1; }
@media (hover: none) { .anchor { opacity: 1; } }

.doc :where(p, li) a {
    color: var(--action);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}
.steps { margin: 0 0 10px; padding-left: 22px; list-style: decimal; }
.steps li { margin-bottom: 7px; padding-left: 4px; }
.steps li::marker { color: var(--action); font-weight: 500; }

.doc-list { margin-bottom: 10px; }
.doc-list li { margin-bottom: 10px; }
.doc-list li > a { display: inline-block; font-size: 0.9375rem; }
.doc-list li > span { display: block; font-size: 0.875rem; line-height: 1.5; color: var(--ink-2); }

.none { font-size: 0.9375rem; }

.try {
    margin: 26px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 0.875rem;
}

/* Phone top bar and menu */
.mbar { display: none; }

@media (max-width: 859px) {
    html { scroll-padding-top: calc(var(--bar-h) + var(--safe-top) + 16px); }
    html.menu-open { overflow: hidden; }

    .docs { display: block; }

    .mbar {
        position: sticky;
        top: 0;
        z-index: 60;
        display: flex;
        align-items: center;
        gap: 4px;
        height: calc(var(--bar-h) + var(--safe-top));
        padding: var(--safe-top) max(8px, var(--safe-right)) 0 max(16px, var(--safe-left));
        background: var(--ground);
        border-bottom: 1px solid var(--line);
        transition: background-color 300ms ease;
    }
    .mbar-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-right: auto;
        color: var(--ink);
        font-size: 0.9375rem;
        font-weight: 500;
    }
    .mbar-brand img { width: 28px; height: 28px; border-radius: 22.5%; }
    .mbar-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        min-width: 44px;
        min-height: 44px;
        padding: 0 10px;
        border-radius: 10px;
        font-size: 0.9375rem;
        font-weight: 500;
        color: var(--ink);
    }
    .mbar-btn:hover { background: var(--surface); }
    .mbar-menu .i-close,
    .mbar-menu[aria-expanded="true"] .i-menu { display: none; }
    .mbar-menu[aria-expanded="true"] .i-close { display: block; }

    .side {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 50;
        height: auto;
        padding: calc(var(--bar-h) + var(--safe-top) + 16px) 0 0 max(16px, var(--safe-left));
        background: var(--ground);
    }
    html.menu-open .side { display: flex; animation: panel-in 160ms ease-out; }
    .side-brand { display: none; }
    .side-search .hint { display: none; }
    .side-search { margin-right: max(16px, var(--safe-right)); }
    .side-nav { padding-right: max(16px, var(--safe-right)); }
    .side-foot { margin-right: max(16px, var(--safe-right)); }
    .side-search input { min-height: 44px; padding: 0 16px; font-size: 1rem; }
    .side-nav li > a { padding: 8px 0; font-size: 0.9375rem; }
    .side-nav .toc a { padding: 6px 0; font-size: 0.875rem; }
    .grp-title { font-size: 0.875rem; }
    .side-foot { padding-bottom: calc(12px + var(--safe-bottom)); font-size: 0.875rem; }
    .side-foot .back { padding: 8px 0; }
    .legal { font-size: 0.8125rem; }
    .theme-toggle { width: 44px; height: 44px; }

    main { padding: 24px max(16px, var(--safe-right)) calc(64px + var(--safe-bottom)) max(16px, var(--safe-left)); }
    .doc h1 { font-size: 1.625rem; }
    .doc h1 .sep { font-size: 1.25rem; }
    .doc h2 { scroll-margin-top: calc(var(--bar-h) + var(--safe-top) + 16px); }
}

@keyframes panel-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 1ms !important;
        animation-delay: 0ms !important;
        transition-duration: 1ms !important;
    }
}

@media (prefers-contrast: more) {
    :root { --line: #808080; --ink-2: #3A3A3A; }
    [data-theme="dark"] { --line: #8A8A8A; --ink-2: #DADADA; }
}
