/* The HippaFone build guide at /HippaFone (Pages/HippaFone.cshtml). Adapted from the guide's own web
   page (docs/hippafone-build-guide/build/build_html.py in the HippaFone repository), scoped under
   .hf-guide so Bootstrap and the site layout keep working around it. System fonts only: the public
   site loads no fonts from other hosts. Light only, like the rest of the public site. */

.hf-guide {
    --hf-surface: #fff;
    --hf-surface-2: #ebe7f3;
    --hf-text: #1d1a27;
    --hf-muted: #5a5470;
    --hf-line: #d5cfe3;
    --hf-accent: #5b33b5;
    --hf-accent-soft: #e9e1fa;
    --hf-gold: #a87400;
    --hf-gold-soft: #fbf1d6;
    --hf-bar: #26232f;
    --hf-bar-text: #f1eef8;
    --hf-bar-gold: #f0c24b;
    --hf-red: #b3261e;
    --hf-red-soft: #fbe9e7;
    --hf-green: #1b7a38;
    --hf-green-soft: #e4f4e8;
    --hf-code-bg: #f0edf7;
    --hf-focus: #1a56db;
    --hf-shadow: 0 1px 2px rgba(30, 20, 60, .12);
    /* The sticky bar's height, so a heading jumped to is not hidden under it. */
    --hf-bar-h: 64px;
    color: var(--hf-text);
    font-size: 1.0625rem;
    line-height: 1.65;
}

.hf-guide :focus-visible { outline: 3px solid var(--hf-focus); outline-offset: 2px; border-radius: 3px; }
.hf-guide a { color: var(--hf-accent); text-underline-offset: 2px; }
.hf-guide a:hover { text-decoration-thickness: 2px; }

/* ── The bar: brand, PDF, Contents ─────────────────────────────────────────────────────────── */

.hf-guide header.top {
    position: sticky; top: 0; z-index: 9;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 10px; border-bottom: 3px solid var(--hf-bar-gold);
    background: var(--hf-bar); color: var(--hf-bar-text);
}
.hf-guide header.top .brand {
    margin-right: auto; color: var(--hf-bar-text); text-decoration: none;
    font-weight: 700; font-size: 1.15rem; letter-spacing: .01em; white-space: nowrap;
}
.hf-guide header.top .brand b { color: var(--hf-bar-gold); font-weight: 700; }
.hf-guide header.top .sub { font-weight: 500; opacity: .8; }
.hf-guide .bar-btn {
    display: inline-flex; align-items: center; gap: .35em; min-height: 40px; padding: 6px 12px;
    font: inherit; font-size: .9rem; line-height: 1.2; white-space: nowrap; text-decoration: none; cursor: pointer;
    color: var(--hf-bar-text); background: transparent; border: 1px solid #6f6a82; border-radius: 6px;
}
.hf-guide .bar-btn:hover { color: var(--hf-bar-text); border-color: var(--hf-bar-gold); }
.hf-guide .bar-btn:focus-visible { outline-color: #fff; }
@media (max-width: 520px) {
    .hf-guide header.top .sub { display: none; }
}

/* ── Contents and the chapter area ─────────────────────────────────────────────────────────── */

.hf-guide nav#toc {
    display: none; margin: 16px 0; padding: 8px;
    background: var(--hf-surface); border: 1px solid var(--hf-line); border-radius: 10px;
}
.hf-guide nav#toc.open { display: block; }
.hf-guide nav#toc ol { list-style: none; margin: 0; padding: 0; }
.hf-guide nav#toc li { margin: 0; }
.hf-guide nav#toc a {
    display: flex; gap: 8px; align-items: baseline; padding: 8px 10px; border-radius: 6px;
    color: var(--hf-text); text-decoration: none; font-size: .95rem; line-height: 1.35;
}
.hf-guide nav#toc a:hover { background: var(--hf-surface-2); }
.hf-guide nav#toc a[aria-current="page"] {
    background: var(--hf-accent-soft); font-weight: 700; box-shadow: inset 3px 0 0 var(--hf-accent);
}
.hf-guide nav#toc .tk { flex: none; width: 1.1em; text-align: center; color: var(--hf-green); font-weight: 700; }
.hf-guide nav#toc a.done .tk::before { content: "\2713"; }
.hf-guide .hf-main { min-width: 0; padding-top: 18px; }

.hf-guide .draftbar {
    margin-top: 14px; padding: 8px 12px; border: 1px solid var(--hf-gold); border-radius: 8px;
    background: var(--hf-gold-soft); font-size: .92rem; line-height: 1.45;
}
.hf-guide .draftbar strong { color: var(--hf-gold); }

.hf-guide .view > * { max-width: 66ch; }
.hf-guide .view > figure, .hf-guide .view > .tablewrap, .hf-guide .view > .code,
.hf-guide .view > .pager, .hf-guide .view > .roadmap { max-width: 100%; }
.hf-guide .view, .hf-guide [id] { scroll-margin-top: calc(var(--hf-bar-h) + 10px); }

/* Without JavaScript every chapter shows, one after another; keep them apart. */
.hf-guide .view + .view { margin-top: 3em; padding-top: 1em; border-top: 2px solid var(--hf-line); }
.hf-guide.hf-js .view + .view { margin-top: 0; padding-top: 0; border-top: 0; }

/* ── Text ──────────────────────────────────────────────────────────────────────────────────── */

.hf-guide h1, .hf-guide h2, .hf-guide h3, .hf-guide h4 { line-height: 1.2; color: var(--hf-text); letter-spacing: -.005em; }
.hf-guide h1 { font-size: clamp(1.9rem, 5.5vw, 2.7rem); font-weight: 800; margin: .2em 0 .5em; }
.hf-guide h1::after { content: ""; display: block; width: 72px; height: 5px; margin-top: 12px; border-radius: 3px; background: var(--hf-bar-gold); }
.hf-guide h2 { font-size: clamp(1.4rem, 3.6vw, 1.75rem); font-weight: 700; margin: 2em 0 .5em; color: var(--hf-accent); }
.hf-guide h3 { font-size: 1.2rem; font-weight: 700; margin: 1.6em 0 .4em; }
.hf-guide h4 { font-size: 1.05rem; font-weight: 700; margin: 1.4em 0 .3em; }
.hf-guide p, .hf-guide li { overflow-wrap: anywhere; }
.hf-guide p { margin: .85em 0; }
.hf-guide ol, .hf-guide ul { margin: .85em 0; padding-left: 1.5em; }
.hf-guide li { margin: .55em 0; }
.hf-guide li::marker { font-weight: 700; color: var(--hf-accent); }
.hf-guide strong { font-weight: 700; }
.hf-guide dt { font-weight: 700; margin-top: .8em; }
.hf-guide dd { margin: 0 0 0 1.4em; }

.hf-guide code {
    padding: .1em .35em; border-radius: 4px; color: inherit; background: var(--hf-code-bg);
    font-family: var(--bs-font-monospace); font-size: .88em; overflow-wrap: anywhere;
}
.hf-guide .code { position: relative; margin: 1em 0; }
.hf-guide .code pre {
    margin: 0; overflow-x: auto; padding: 14px 76px 14px 16px; line-height: 1.5; font-size: 1em;
    background: var(--hf-code-bg); border: 1px solid var(--hf-line); border-left: 4px solid var(--hf-accent); border-radius: 8px;
}
.hf-guide .code pre code { padding: 0; background: none; font-size: .85rem; white-space: pre; overflow-wrap: normal; }
.hf-guide .code .copy {
    position: absolute; top: 8px; right: 8px; min-height: 32px; padding: 4px 10px; cursor: pointer;
    font: inherit; font-size: .8rem; color: var(--hf-text); background: var(--hf-surface);
    border: 1px solid var(--hf-line); border-radius: 6px;
}
.hf-guide .code .copy:hover { border-color: var(--hf-accent); }

.hf-guide .tablewrap { overflow-x: auto; margin: 1.2em 0; background: var(--hf-surface); border: 1px solid var(--hf-line); border-radius: 8px; }
.hf-guide table { width: 100%; border-collapse: collapse; font-size: .93rem; line-height: 1.45; }
.hf-guide th, .hf-guide td {
    min-width: 4.5em; padding: 8px 12px; text-align: left; vertical-align: top;
    border-bottom: 1px solid var(--hf-line); overflow-wrap: normal;
}
.hf-guide th { background: var(--hf-surface-2); font-weight: 700; white-space: nowrap; }
.hf-guide tr:last-child td { border-bottom: 0; }

/* ── Pictures ──────────────────────────────────────────────────────────────────────────────── */

.hf-guide figure { margin: 1.5em 0; }
.hf-guide figure .zoom {
    display: block; width: 100%; margin: 0; padding: 0; overflow: hidden; cursor: zoom-in;
    background: #fff; border: 1px solid var(--hf-line); border-radius: 10px;
}
.hf-guide figure img { display: block; width: 100%; height: auto; background: #fff; }
.hf-guide figcaption { max-width: 66ch; margin-top: .5em; color: var(--hf-muted); font-size: .9rem; line-height: 1.5; }
.hf-guide figure.missing .soon {
    padding: 36px 16px; text-align: center; color: var(--hf-muted);
    background: var(--hf-surface); border: 2px dashed var(--hf-line); border-radius: 10px;
}
.hf-guide li figure { margin-left: -1.5em; }
.hf-guide .roadmap { margin: 1.2em 0 2em; }
.hf-guide .roadmap .zoom { border: 2px solid var(--hf-bar-gold); }

/* ── Callouts ──────────────────────────────────────────────────────────────────────────────── */

.hf-guide .callout {
    position: relative; margin: 1.3em 0; padding: 2px 16px;
    background: var(--hf-surface); border-left: 6px solid var(--hf-muted); border-radius: 0 8px 8px 0; box-shadow: var(--hf-shadow);
}
.hf-guide .callout > p { margin: .7em 0; }
.hf-guide .callout.safety { border-left-color: var(--hf-red); background: var(--hf-red-soft); }
.hf-guide .callout.safety strong:first-child { color: var(--hf-red); text-transform: uppercase; letter-spacing: .04em; font-size: .9em; }
.hf-guide .callout.checkpoint { padding-left: 44px; border-left-color: var(--hf-green); background: var(--hf-green-soft); }
.hf-guide .callout.checkpoint strong:first-of-type { color: var(--hf-green); text-transform: uppercase; letter-spacing: .04em; font-size: .9em; }
.hf-guide .callout.nty { border-left-color: var(--hf-gold); background: var(--hf-gold-soft); font-size: .92rem; }
.hf-guide .callout.nty strong:first-child { color: var(--hf-gold); }
.hf-guide .callout.draft { display: none; }
.hf-guide .callout.note { border-left-color: var(--hf-accent); background: var(--hf-accent-soft); }
.hf-guide p.see { padding: .55em 14px; border-left: 4px solid var(--hf-accent); border-radius: 0 8px 8px 0; background: var(--hf-accent-soft); }
.hf-guide .draftbox {
    margin: 1em 0; padding: 10px 16px; font-size: .95rem;
    background: var(--hf-gold-soft); border: 1px solid var(--hf-gold); border-left: 6px solid var(--hf-gold); border-radius: 8px;
}
.hf-guide .draftbox strong:first-child { color: var(--hf-gold); }

/* ── Tick boxes, progress, previous and next ───────────────────────────────────────────────── */

.hf-guide input.tick {
    appearance: none; -webkit-appearance: none; display: inline-grid; place-content: center; flex: none;
    width: 1.35rem; height: 1.35rem; margin: 0 .6em 0 0; vertical-align: -.25em; cursor: pointer;
    background: var(--hf-surface); border: 2px solid var(--hf-muted); border-radius: 5px;
}
.hf-guide input.tick:checked { background: var(--hf-green); border-color: var(--hf-green); }
.hf-guide input.tick:checked::after {
    content: ""; width: .35rem; height: .7rem; border: solid #fff; border-width: 0 3px 3px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}
.hf-guide .ctick { position: absolute; left: 12px; top: .95em; margin: 0; }
.hf-guide li:has(> input.tick:checked) { background: linear-gradient(90deg, var(--hf-green-soft), transparent 60%); border-radius: 6px; }

.hf-guide .prog { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 2.2em 0 0; color: var(--hf-muted); font-size: .92rem; }
.hf-guide .prog[hidden] { display: none; }
.hf-guide .prog button {
    min-height: 32px; padding: 4px 10px; cursor: pointer; font: inherit; font-size: .85rem;
    color: var(--hf-muted); background: transparent; border: 1px solid var(--hf-line); border-radius: 6px;
}
.hf-guide .pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 2.4em; padding-top: 1.4em; border-top: 1px solid var(--hf-line); }
.hf-guide .pn {
    display: block; padding: 12px 16px; color: var(--hf-text); text-decoration: none; font-weight: 600; line-height: 1.3;
    background: var(--hf-surface); border: 1px solid var(--hf-line); border-radius: 10px;
}
.hf-guide .pn small { display: block; color: var(--hf-muted); font-weight: 400; font-size: .8rem; }
.hf-guide .pn:hover { border-color: var(--hf-accent); }
.hf-guide .pn.next { grid-column: 2; text-align: right; }

/* ── The enlarged picture ──────────────────────────────────────────────────────────────────── */

.hf-guide #zoomer {
    position: fixed; inset: 0; z-index: 1080; display: flex; align-items: center; justify-content: center;
    padding: 16px; cursor: zoom-out; background: rgba(15, 12, 25, .86);
}
.hf-guide #zoomer[hidden] { display: none; }
.hf-guide #zoomer .mat { max-width: 100%; max-height: 100%; overflow: auto; padding: 6px; background: #fff; border-radius: 10px; }
.hf-guide #zoomer img { display: block; width: auto; height: auto; max-width: calc(100vw - 44px); max-height: calc(100vh - 44px); }
.hf-guide #zoomer button {
    position: absolute; top: 10px; right: 12px; padding: 8px 14px; cursor: pointer;
    font: inherit; color: #1d1a27; background: #fff; border: 0; border-radius: 6px;
}

/* ── Wide screens: the contents beside the chapter ─────────────────────────────────────────── */

@media (min-width: 992px) {
    .hf-guide { font-size: 1.125rem; }
    .hf-guide .shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 36px; }
    .hf-guide #menu-btn { display: none; }
    .hf-guide nav#toc {
        display: block; position: sticky; top: calc(var(--hf-bar-h) + 12px); align-self: start;
        max-height: calc(100vh - var(--hf-bar-h) - 24px); overflow-y: auto; margin: 18px 0;
    }
    .hf-guide .hf-main { padding-top: 6px; }
}

/* Without JavaScript, a <noscript> style on the page shows the contents list and drops the
   Contents button and the tick boxes. It is not done here, so the page does not jump on a phone
   while the script starts. */

@media (prefers-reduced-motion: no-preference) {
    .hf-guide.hf-js .view { animation: hf-fade .18s ease-out; }
    @keyframes hf-fade { from { opacity: 0; } to { opacity: 1; } }
}
