/* pAIthfinder exercise pages · design preview 2026-11
   Works with the existing markup (body > nav, main, footer) and with the
   richer exercise layout (header.site-bar, .flow, .step, .prompt-card, .next). */

:root {
    --paper: #141311;
    --ink: #faf8f5;
    --muted: #bdb6ae;
    --line: #3a3632;
    --panel: #1c1a18;
    --panel-2: #24211e;
    --orange: #ffab77;
    --orange-hi: #ffc39e;
    --on-orange: #141311;
    --sans: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
    --measure: 44rem;
    color-scheme: dark;
    font-family: var(--sans);
    line-height: 1.65;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-size: 16.5px;
    background: radial-gradient(ellipse 60rem 36rem at 90% -10%, #26211d 0, transparent 70%), var(--paper);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

main, body > nav, footer, .site-bar nav {
    width: min(var(--measure), calc(100% - 32px));
    margin-inline: auto;
}

a { color: var(--orange); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { color: var(--orange-hi); }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; border-radius: 4px; }

.skip {
    position: fixed; z-index: 10; left: 12px; top: 10px;
    padding: 9px 15px; border-radius: 8px;
    background: var(--orange); color: var(--on-orange); font-weight: 650;
    transform: translateY(-160%);
}
.skip:focus { transform: none; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Top bar (old pages: body > nav, new pages: header.site-bar) ---------- */
body > nav, .site-bar nav {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    min-height: 68px;
}
body > nav { border-bottom: 1px solid var(--line); }
.site-bar { border-bottom: 1px solid var(--line); background: #121110; }
body > nav a, .site-bar nav a {
    display: inline-flex; align-items: center; min-height: 44px;
    font-size: .92rem; font-weight: 600; text-decoration: none; color: #e6e2dd;
}
body > nav a:hover, .site-bar nav a:hover { color: var(--orange); }
body > nav a:first-child::before { content: "←"; margin-right: .45em; color: var(--orange); }

.brand { gap: 10px; font-size: 1.28rem !important; font-weight: 700 !important; letter-spacing: -.06em; color: var(--ink) !important; }
.brand b { color: #f08a4c; font-weight: 750; }
.mark {
    position: relative; flex: none; width: 28px; height: 28px; border-radius: 50%;
    background: #35322f; border: 1px solid #74706c; box-shadow: inset 0 0 0 3px #282624;
}
.mark::before, .mark::after {
    content: ""; position: absolute; left: 8.5px; top: 3px; width: 10px; height: 20px;
    transform: rotate(37deg); background: #ffa068; clip-path: polygon(50% 0, 100% 63%, 50% 100%, 0 37%);
}
.mark::after { background: #a14c26; clip-path: polygon(50% 100%, 0 37%, 100% 63%); }
.bar-links { display: flex; align-items: center; gap: clamp(12px, 3vw, 28px); }
.bar-links .lang {
    padding: 0 14px; border: 1px solid #524e4a; border-radius: 999px; min-height: 42px !important;
}

/* ---------- Typography ---------- */
h1 {
    font-size: clamp(2rem, 6.2vw, 3.3rem); line-height: 1.06; letter-spacing: -.04em;
    font-weight: 650; margin: .9em 0 .5em; text-wrap: balance;
}
h2 {
    font-size: clamp(1.3rem, 3.4vw, 1.6rem); line-height: 1.2; letter-spacing: -.025em;
    font-weight: 650; margin: 2.2rem 0 .8rem;
}
p, ul, ol { margin: 1rem 0; }
main > p:first-of-type, .lede { font-size: 1.08rem; color: #e4dfd9; max-width: 40rem; }
main { padding-bottom: 2rem; }

.kicker {
    display: flex; align-items: center; gap: 9px; margin: 2.4rem 0 0;
    font: 600 .72rem/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--orange);
}
.kicker::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.kicker a { color: inherit; text-decoration: none; }
.kicker a:hover { text-decoration: underline; }
.kicker + h1 { margin-top: .45em; }

/* ---------- Flow overview: 1 copy · 2 paste · 3 check ---------- */
.flow {
    list-style: none; padding: 0; margin: 1.6rem 0 0;
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
}
.flow li {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
    font-size: .86rem; line-height: 1.3; color: #e4dfd9;
}
.num, .flow li span {
    display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%;
    border: 1px solid #5a544e; font: 600 .72rem/1 var(--mono); color: var(--ink);
}
.step h2 { display: flex; align-items: center; gap: 12px; }
.step h2 .num { border-color: var(--orange); color: var(--orange); }

/* ---------- Prompt ---------- */
blockquote, details {
    margin: 1.2rem 0; padding: 1.1rem 1.25rem; overflow-wrap: anywhere;
    background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
}
blockquote[data-copy-prompt] { border-left: 3px solid var(--orange); line-height: 1.7; }
.prompt-card {
    margin: 1.2rem 0; border: 1px solid #4a4540; border-radius: 16px; background: var(--panel); overflow: hidden;
}
.prompt-head {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 10px 10px 10px 18px; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.prompt-head .label { font: 600 .7rem/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.prompt-card blockquote[data-copy-prompt] {
    margin: 0; border: 0; border-radius: 0; background: transparent; padding: 1.1rem 1.25rem 1.25rem;
}
pre[data-copy-prompt] {
    margin: 1.2rem 0; padding: 1.1rem 1.25rem; white-space: pre-wrap; overflow-wrap: anywhere;
    font: .88rem/1.65 var(--mono); color: #ece7e1;
    background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--orange); border-radius: 14px;
}
.prompt-card pre[data-copy-prompt] { margin: 0; border: 0; border-radius: 0; background: transparent; padding: 1.1rem 1.25rem 1.25rem; }
main > ul, main > ol:not(.flow), .step > ul { padding-left: 1.3rem; }
main li + li { margin-top: .35rem; }
[data-copy-slot] { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: .92rem; }

.prompt-copy {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font: inherit; font-size: .95rem; font-weight: 650;
    min-height: 44px; padding: .5rem 1.1rem;
    border: 1px solid var(--orange); border-radius: 10px;
    background: var(--orange); color: var(--on-orange); cursor: pointer;
    transition: background-color .15s;
}
.prompt-copy:hover { background: var(--orange-hi); border-color: var(--orange-hi); }
.prompt-copy[data-state="copied"] { background: #2c2925; color: var(--orange); border-color: var(--orange); }
.prompt-copy-status { margin: .4rem 0 0; color: var(--muted); font-size: .9rem; }
.prompt-copy-status:empty { display: none; }
[data-copy-slot] .prompt-copy-status { margin: 0; }

/* ---------- Answer key ---------- */
details { padding: 0; }
summary {
    display: flex; align-items: center; gap: 10px; min-height: 52px; padding: .8rem 1.25rem;
    cursor: pointer; font-weight: 650; list-style: none; border-radius: 14px;
}
summary::-webkit-details-marker { display: none; }
summary::before {
    content: "+"; display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px;
    border-radius: 50%; border: 1px solid var(--orange); color: var(--orange); font-weight: 600; line-height: 1;
    transition: transform .15s;
}
details[open] > summary::before { transform: rotate(45deg); }
summary:hover { color: var(--orange); }
details > :not(summary) { margin-inline: 1.25rem; }
details > :last-child { margin-bottom: 1.2rem; }
details[open] > summary { border-bottom: 1px solid var(--line); border-radius: 14px 14px 0 0; }

table { border-collapse: collapse; width: 100%; font-size: .92rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; }
tbody tr:last-child td { border-bottom: 0; font-weight: 650; }
.table-scroll { max-width: 100%; overflow-x: auto; overflow-wrap: normal; margin-top: 1rem; }
.table-scroll:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.note { color: var(--muted); font-size: .95rem; padding-left: 1rem; border-left: 1px solid var(--line); }

/* ---------- Next step ---------- */
.next { margin: 2.6rem 0 1rem; padding-top: 1.6rem; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.next-card {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 14px;
    padding: 16px 18px; border: 1px solid #4a4540; border-radius: 14px; background: var(--panel);
    color: var(--ink); text-decoration: none;
}
.next-card:hover { border-color: var(--orange); color: var(--ink); }
.next-card .label { font: 600 .7rem/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.next-card strong { grid-row: 2; font-size: 1.05rem; line-height: 1.35; letter-spacing: -.015em; }
.next-card .arrow { grid-row: 1 / 3; grid-column: 2; color: var(--orange); font-size: 1.2rem; }
.next > a:not(.next-card) { justify-self: start; display: inline-flex; align-items: center; min-height: 44px; }

footer { border-top: 1px solid var(--line); padding: 1rem 0 2rem; color: var(--muted); font-size: .9rem; }
footer p { margin: 0; }
footer a { display: inline-flex; align-items: center; min-height: 44px; }

@media (max-width: 560px) {
    body { font-size: 16px; }
    main, body > nav, footer, .site-bar nav { width: calc(100% - 32px); }
    body > nav, .site-bar nav { min-height: 60px; }
    .flow { grid-template-columns: 1fr; gap: 6px; }
    .flow li { padding: 8px 12px; }
    .prompt-head { padding: 10px 10px 10px 14px; }
    .prompt-card blockquote[data-copy-prompt] { padding: 1rem 1rem 1.1rem; }
    summary { padding-inline: 1rem; }
    details > :not(summary) { margin-inline: 1rem; }
    .brand { font-size: 1.15rem !important; }
}

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

@media print {
    :root { color-scheme: light; }
    body { background: #fff; color: #000; }
    a { color: #000; }
    .prompt-copy, .prompt-copy-status, .site-bar, body > nav, .next, footer, .skip { display: none !important; }
    blockquote, details, .prompt-card { background: #fff; border-color: #999; }
    details > :not(summary) { display: block; }
}
