/* SignalsFlow design system. The rules, the tokens and the components are in DESIGN.md: change them there first. */

/* ---- Tokens ---- */

:root {
    color-scheme: light;

    /* Palette: designmd.app "Fitness App de Treinos", turned light. */
    --bg: #F7FAFC;
    --text: #1A1A1A;
    --muted: #4A5568;
    --signal: #FF6B00;
    --signal-hover: #EB6200;
    --on-signal: #1A1A1A;
    /* The bright orange, red and yellow give 2.7:1, 3.9:1 and 1.6:1 on the light background: fills and borders
       take them, text takes these darker ones of the same hue. */
    --signal-text: #AD4400;
    --danger: #E53E3E;
    --danger-text: #C53030;
    --warn: #FFC107;
    --warn-text: #975A16;

    /* Layers over the background. */
    --surface: rgb(255 255 255 / 0.8);
    --secondary: rgb(26 26 26 / 0.06);
    --popover: #FFFFFF;
    --line: rgb(26 26 26 / 0.12);
    --input: rgb(26 26 26 / 0.24);
    --glass: rgb(255 107 0 / 0.08);
    --overlay: rgb(26 26 26 / 0.45);

    --font-display: "Anton", "Oswald", Impact, "Arial Narrow", sans-serif;
    --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

    --radius: 6px;
    --radius-card: 18px;
    --ease: cubic-bezier(0.32, 0.72, 0, 1);
    --shadow: 0 2px 12px rgb(26 26 26 / 0.08);
}

/* ---- Base ---- */

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

/* A link to #anchor (the next card after a mark, a settings block) lands below the sticky header, not under it. */
html { background: var(--bg); scroll-padding-top: 96px; }

/* The attribute wins over the display of buttons and the other components. */
[hidden] { display: none !important; }

body {
    margin: 0;
    min-height: 100dvh;
    color: var(--text);
    font: 400 14px/1.5 var(--font-sans);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Two orange glows behind everything. On the light background they tint the text's backdrop: the --signal-text
   eyebrow of the hero keeps 4.5:1 over the stronger one, so they get no brighter. */
body::before, body::after {
    content: "";
    position: fixed;
    z-index: -1;
    pointer-events: none;
    border-radius: 50%;
}
body::before { left: -16rem; top: -18rem; width: 48rem; height: 48rem; background: radial-gradient(closest-side, rgb(255 107 0 / 0.1), transparent); }
body::after { right: -18rem; bottom: -20rem; width: 52rem; height: 52rem; background: radial-gradient(closest-side, rgb(255 107 0 / 0.06), transparent); }

/* The darker orange: the bright one is under the 3:1 a focus ring needs on the light background. */
:focus-visible { outline: 2px solid var(--signal-text); outline-offset: 2px; }

h1, h2, h3, p, ol, ul, dl, dd { margin: 0; }

h1 {
    margin-top: 4px;
    font: 400 clamp(2.25rem, 5vw, 3rem)/0.95 var(--font-display);
    text-transform: uppercase;
    letter-spacing: -0.01em;
    text-wrap: balance;
    overflow-wrap: anywhere;
}
h2 {
    font: 400 1.5rem/1.1 var(--font-display);
    text-transform: uppercase;
    letter-spacing: -0.005em;
}
h3 { font-size: 15px; font-weight: 600; }

a { color: var(--signal-text); text-underline-offset: 2px; }
a:hover { color: var(--text); }

strong, b { font-weight: 600; }

code {
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--secondary);
    font: 12px var(--font-mono);
}

ol, ul { padding-left: 20px; }
li + li { margin-top: 4px; }

/* ---- Text ---- */

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--font-mono); }

.eyebrow {
    color: var(--signal-text);
    font: 500 11px/1.4 var(--font-mono);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.label {
    color: var(--muted);
    font: 500 11px/1.4 var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.lead { max-width: 60ch; margin-top: 8px; color: var(--muted); }

/* ---- Shell ---- */

.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding-inline: 16px; }

.top {
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--line);
    background: rgb(247 250 252 / 0.85);
    backdrop-filter: blur(12px);
}
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding-block: 12px; }

/* The logo is a picture, sized by height and kept at its own aspect ratio: the width and height attributes in the markup
   only reserve the place before it loads. */
.brand { display: flex; line-height: 0; }
.brand img { display: block; width: auto; height: 40px; }

.top nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13px; }
.top nav a { padding: 4px 8px; border-radius: var(--radius); color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--text); }
.top nav a[aria-current="page"] { background: var(--secondary); color: var(--text); font-weight: 500; }
.top nav .sep { width: 1px; height: 16px; margin: 0 4px; background: var(--line); }

.account { display: flex; align-items: center; gap: 12px; margin-left: auto; color: var(--muted); font-size: 13px; }
.account :is(button, .btn) { padding: 6px 12px; }
/* Not the landing's "Sign up": an orange button keeps its own hover, the orange outline would ring it. */
.account :is(button, .btn):not(.primary):hover { border-color: var(--signal); color: var(--signal-text); }

main.wrap { padding-top: 32px; padding-bottom: 80px; }

/* ---- Surfaces ---- */

.surface {
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 24px;
}
.surface.tight { padding: 20px; }
.surface.dashed { border-style: dashed; box-shadow: none; }
.surface:not(form) > * + * { margin-top: 12px; }
.surface > .eyebrow + h1, .surface > .eyebrow + h2 { margin-top: 4px; }
.surface.hero > *, .surface.steps > * { margin-top: 0; }

.block { margin-top: 24px; }

.danger-zone {
    margin-top: 24px;
    border: 1px solid rgb(229 62 62 / 0.4);
    border-radius: var(--radius-card);
    padding: 24px;
}
.danger-zone h2 { color: var(--danger-text); }
.danger-zone > * + * { margin-top: 12px; }

.box {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 12px 16px;
}
.box > * + * { margin-top: 8px; }
.box.dashed { border-style: dashed; }

/* ---- Layout ---- */

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head + * { margin-top: 24px; }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stack { display: grid; gap: 12px; }
.stack > * { margin: 0; }

.grid-2 { display: grid; align-items: start; gap: 16px; margin-top: 24px; }
.split { display: grid; gap: 24px; margin-top: 16px; }
.split > div, .split > aside { display: grid; gap: 24px; align-content: start; min-width: 0; }

.crumbs { font: 12px var(--font-mono); color: var(--muted); }
.crumbs + *, .hero + .crumbs { margin-top: 12px; }

.spread { justify-content: space-between; }
.narrow { max-width: 20rem; }
.page-head a.meta, .project-top a.meta { display: inline-block; margin-top: 4px; }

.project-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

@media (min-width: 768px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr 1fr; }
    .form-grid .wide { grid-column: 1 / -1; }
}
@media (min-width: 1024px) {
    .split { grid-template-columns: minmax(0, 1fr) 380px; }
}
@media (min-width: 640px) {
    .wrap { padding-inline: 24px; }
}
@media (max-width: 639px) {
    .account .email { display: none; }

    /* The landing's sections are a scroll away on a phone; their links would wrap the header to a second row. */
    .top nav.anchors { display: none; }
}

/* ---- Buttons ---- */

button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    padding: 8px 14px;
    font: 500 13px/1.2 var(--font-sans);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.2s;
}
button:hover, .btn:hover { border-color: rgb(26 26 26 / 0.4); color: var(--text); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

:is(button, .btn).primary { border-color: transparent; background: var(--signal); color: var(--on-signal); font-weight: 600; }
:is(button, .btn).primary:hover { background: var(--signal-hover); color: var(--on-signal); box-shadow: 0 4px 12px rgb(26 26 26 / 0.15); }
/* A toggle that is on (aria-pressed) looks like .ink: "Answered" of the comment posted. */
:is(button, .btn).ink, button[aria-pressed="true"] { border-color: transparent; background: var(--text); color: var(--bg); }
:is(button, .btn).ink:hover, button[aria-pressed="true"]:hover { background: rgb(26 26 26 / 0.85); color: var(--bg); }
:is(button, .btn).danger { border-color: rgb(229 62 62 / 0.5); background: transparent; color: var(--danger-text); }
:is(button, .btn).danger:hover { background: rgb(229 62 62 / 0.08); color: var(--danger-text); }
:is(button, .btn).link {
    border: 0;
    background: none;
    padding: 0;
    color: var(--signal-text);
    font-weight: 400;
    text-decoration: underline;
    text-underline-offset: 2px;
}
:is(button, .btn).link:hover { color: var(--text); }
:is(button, .btn).link.danger { color: var(--danger-text); }
:is(button, .btn).link.danger:hover { background: none; color: var(--text); }
:is(button, .btn).small { padding: 5px 10px; font-size: 12px; }
:is(button, .btn).large { padding: 12px 20px; font-size: 15px; }

/* A square button of a glyph CSS draws, no text: its name is in aria-label, its hint in title. */
button.icon { position: relative; width: 32px; height: 32px; padding: 0; }
/* Copy: two sheets, the front one over the back one. */
.icon.copy::before, .icon.copy::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 12px;
    border: 1.5px solid currentColor;
    border-radius: 2px;
}
.icon.copy::before { left: 9px; top: 7px; }
.icon.copy::after { left: 13px; top: 11px; background: var(--popover); }
/* Copied: a tick, for two seconds. */
.icon.copy.done::before { left: 12px; top: 7px; width: 7px; height: 14px; border-width: 0 2px 2px 0; border-radius: 0; transform: rotate(45deg); }
.icon.copy.done::after { content: none; }

/* In place of a button whose work takes a while: writing the comments (issue #18). The button's box, so that the row
   does not jump, and an empty track the orange fills. The site does not know how far the work is — one call of the
   model — so the fill goes by the time it usually takes, slows down and stops short of the end rather than run out
   early. Without motion the track stays empty: the text says it all. */
.progress {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 11rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--secondary);
    padding: 8px 14px;
    color: var(--on-signal);
    font: 500 13px/1.2 var(--font-sans);
}
.progress::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    background: var(--signal);
    transform: scaleX(0);
    transform-origin: left;
    animation: fill 40s cubic-bezier(0.15, 0.6, 0.35, 1) forwards;
}

/* ---- Forms ---- */

form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
form.stack { display: grid; align-items: stretch; }
form.form-grid { display: grid; align-items: start; gap: 12px; }

input:not([type="checkbox"], [type="radio"], [type="hidden"]), textarea, select {
    width: 100%;
    border: 1px solid var(--input);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    padding: 7px 10px;
    font: 400 14px/1.4 var(--font-sans);
    letter-spacing: normal;
    text-transform: none;
    transition: border-color 0.2s;
}
input:hover, textarea:hover, select:hover { border-color: rgb(26 26 26 / 0.4); }
textarea { resize: vertical; min-height: 80px; }
textarea.reply { min-height: 18rem; line-height: 1.65; }
/* Lighter than the typed text, still above 4.5:1 on a field over the orange glow. */
input::placeholder, textarea::placeholder { color: rgb(74 85 104 / 0.85); }
input[type="number"] { width: 96px; }
input.mono, textarea.mono { font: 12px/1.5 var(--font-mono); }
.row > .grow { flex: 1 1 18rem; width: auto; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; margin: 0; accent-color: var(--signal); }

select {
    width: auto;
    max-width: 100%;
    padding-right: 30px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%234A5568' stroke-width='1.5'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}
select option { background: var(--popover); color: var(--text); }

/* A label above its field: the caption in mono capitals, the field under it. */
label.field { display: grid; gap: 4px; color: var(--muted); font: 500 11px/1.4 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; }
label.tick { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }

.field-validation-error { color: var(--danger-text); font-size: 13px; }

/* ---- Notices ---- */

.notice, .error, .warn {
    position: relative;
    margin: 12px 0;
    border: 1px solid;
    border-radius: var(--radius);
    background: var(--surface);
    padding: 8px 12px 8px 30px;
    font-size: 13px;
}
.notice { border-color: rgb(255 107 0 / 0.4); }
.notice::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 14px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--signal);
}
.notice.working::before { animation: pulse 1.6s ease-in-out infinite; }
.error { border-color: rgb(229 62 62 / 0.5); color: var(--danger-text); }
.warn { border-color: var(--warn); }
.error::before, .warn::before { position: absolute; left: 12px; top: 8px; font: 600 13px var(--font-mono); }
.error::before { content: "✕"; }
.warn::before { content: "!"; color: var(--warn-text); }
.warn ul { margin-top: 4px; padding-left: 16px; }
.warn form { margin-top: 8px; }

.warn-text { color: var(--warn-text); }
.danger-text { color: var(--danger-text); }

/* ---- Chips and tags ---- */

/* .rules — the rules of the subreddit on a feed card: a muted chip. */
.chip, .counts a, .rules {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 3px 10px;
    color: var(--text);
    font: 400 11px/1.5 var(--font-mono);
    text-decoration: none;
}
.counts a:hover, a.chip:hover { border-color: var(--signal); color: var(--text); }
.chip.muted, .rules { color: var(--muted); }
.counts { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.tag, .new, .draft {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 10px;
    font: 500 10px/1.5 var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.new { background: var(--signal); color: var(--on-signal); }
.draft { border: 1px solid rgb(255 107 0 / 0.5); color: var(--signal-text); }
.tag.project { background: var(--text); color: var(--bg); }
.tag.project a { color: inherit; text-decoration: none; }
.tag.project a:hover { text-decoration: underline; }

/* The judge's score: a bar of --score and the number. */
.score { display: inline-flex; align-items: center; gap: 6px; font: 600 11px var(--font-mono); }
.score::before {
    content: "";
    width: 40px;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(to right, var(--signal) var(--score, 0%), var(--secondary) 0);
}

/* ---- Hero and stats ---- */

.hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: grid;
    gap: 20px;
    background: var(--glass);
    animation: rise 0.45s var(--ease) both;
}
.hero::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset-block: 0;
    left: 0;
    width: 33%;
    background: rgb(255 255 255 / 0.5);
    filter: blur(40px);
    transform: translateX(-130%) skewX(-22deg);
    animation: sheen 9s linear infinite;
}
.hero h1 { line-height: 0.92; }
@media (min-width: 768px) {
    .hero { grid-template-columns: 1fr auto; align-items: end; }
}

.stats { display: grid; grid-template-columns: repeat(3, auto); gap: 24px; font-family: var(--font-mono); }
.stats dt { color: var(--muted); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }
.stats dd { font: 400 30px/1.1 var(--font-display); }
.stats .hot { color: var(--signal-text); }

.stat {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 6px 10px;
    color: var(--muted);
    font: 11px var(--font-mono);
    text-decoration: none;
}
.stat b { color: var(--text); font: 400 20px/1 var(--font-display); }
.stat:hover { border-color: var(--signal); color: var(--muted); }

/* The new cards of a project, large. */
.fresh { flex: none; text-align: right; text-decoration: none; }
.fresh .new, .fresh .quiet {
    display: block;
    padding: 0;
    background: none;
    color: var(--signal-text);
    font: 400 36px/1 var(--font-display);
    letter-spacing: 0;
}
.fresh .quiet { color: var(--muted); }
.fresh .label { display: block; margin-top: 4px; font-size: 10px; }

.steps { display: grid; gap: 24px; margin-top: 24px; }
.steps p { margin-top: 4px; color: var(--muted); }
@media (min-width: 768px) {
    .steps { grid-template-columns: repeat(3, 1fr); }
}

.empty { padding: 40px 24px; text-align: center; }
.empty .lead { margin-inline: auto; }

/* ---- Feed ---- */

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
    font: 12px var(--font-mono);
}
.tabs a, .tabs strong { border-radius: var(--radius); padding: 6px 12px; }
.tabs a { border: 1px solid var(--line); color: var(--muted); text-decoration: none; }
.tabs a:hover { color: var(--text); }
.tabs strong { background: var(--text); color: var(--bg); font-weight: 500; }

.filters { padding-block: 16px; }
form.search textarea { flex-basis: 100%; }
.filters select { padding-block: 6px; font-size: 12px; }
.filters a { font-size: 12px; }

.summary { font-size: 12px; color: var(--muted); }

.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 24px; font: 12px var(--font-mono); }

/* Post cards: the feed and the search. */
.cards { display: grid; gap: 16px; margin-top: 16px; padding: 0; list-style: none; }
.cards > li {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 20px;
    animation: rise 0.45s var(--ease) both;
    transition: border-color 0.2s;
}
.cards > li:nth-child(2) { animation-delay: 60ms; }
.cards > li:nth-child(3) { animation-delay: 120ms; }
.cards > li:nth-child(4) { animation-delay: 180ms; }
.cards > li:nth-child(5) { animation-delay: 240ms; }
.cards > li:nth-child(6) { animation-delay: 300ms; }
.cards > li:nth-child(n+7) { animation-delay: 360ms; }
.cards > li::after {
    content: "";
    position: absolute;
    z-index: -1;
    top: 0;
    right: -24px;
    width: 96px;
    height: 100%;
    background: var(--glass);
    transform: skewX(-20deg);
    transition: transform 0.5s var(--ease);
}
.cards > li:hover { border-color: rgb(255 107 0 / 0.4); }
.cards > li:hover::after { transform: translateX(8px) skewX(-20deg); }
.cards > li > * + * { margin-top: 8px; }

/* A card the feed's script is changing in place (wwwroot/js/feed.js): faded till the site answers, so that the click
   shows. Its content, not the card: the card's own opacity is held by its rise. What the script puts in the card's
   place rises at once: the delay by order is for the cards of a page just loaded. */
.cards > li[aria-busy="true"] > * { opacity: 0.6; }
.cards > li.swapped { animation-delay: 0s; }

.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.post-title { font: 600 18px/1.35 var(--font-sans); text-transform: none; letter-spacing: normal; text-wrap: balance; overflow-wrap: anywhere; }
.post-title a { color: var(--text); text-decoration: none; }
.post-title a:hover { color: var(--signal-text); text-decoration: underline; }
.meta { color: var(--muted); font: 11px/1.5 var(--font-mono); }
.snippet { max-width: 68ch; font-size: 13px; overflow-wrap: anywhere; text-wrap: pretty; }

/* The score and the theses: one wrapping row of chips. */
.check, .theses { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-right: 6px; font-size: 13px; }
.check.muted { font-size: 12px; }

.marks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 8px; }

/* The block left in place of a card just marked not a fit: lighter than a card, gone on the next load of the feed. */
.cards > li.reason { border-style: dashed; padding-block: 16px; }
.cards > li.reason::after { content: none; }

/* ---- Long texts ---- */

.post-body {
    max-height: 480px;
    overflow: auto;
    font-size: 13px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.post-body.reading { max-height: none; font-size: 14px; line-height: 1.65; }

/* A long post on a feed card unfolds in place: the rest follows the snippet in its paragraph and the toggle stays under
   the text. The rest is hidden only where :has() works, so an older browser shows the whole text rather than none. */
.post-text > details { margin-top: 4px; }
.post-text summary { width: fit-content; list-style: none; }
.post-text summary::-webkit-details-marker { display: none; }
.post-text details[open] > summary { margin-bottom: 0; }
.post-text details:not([open]) .less, .post-text details[open] .more { display: none; }
.post-text:has(details:not([open])) .rest, .post-text:has(details[open]) .cut { display: none; }
.post-text:has(details[open]) > .snippet { max-height: 480px; overflow: auto; white-space: pre-wrap; }
.post .post-title { font-size: 1.375rem; }
.text-block {
    max-height: 192px;
    overflow: auto;
    border-radius: var(--radius);
    background: var(--secondary);
    padding: 12px;
    font: 11px/1.6 var(--font-mono);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.text-block.sans { max-height: none; font: 13px/1.6 var(--font-sans); }

details > summary { cursor: pointer; color: var(--signal-text); font-size: 13px; }
details > summary:hover { color: var(--text); }
details[open] > summary { margin-bottom: 8px; }
details > :not(summary) + * { margin-top: 8px; }
details.box > summary { color: var(--text); font-weight: 500; }

/* Rows of actions where an opened details takes the whole width. */
.actions { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; }
.actions > details[open] { flex-basis: 100%; order: 1; }

/* ---- Lists ---- */

.list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--radius); }
.list > li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0; padding: 8px 12px; font-size: 13px; }
.list > li + li { border-top: 1px solid var(--line); }
.list > li > form { margin-left: auto; }
.list ul { flex-basis: 100%; margin: 0; padding-left: 16px; color: var(--muted); font-size: 12px; }
.label + .list { margin-top: 6px; }

.thesis { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 16px; }
.thesis.off { opacity: 0.6; }
.thesis > * + * { margin-top: 8px; }
.thesis-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.thesis-head .counts { margin-left: auto; }
.thesis > p { max-width: 80ch; color: var(--muted); font-size: 13px; }
.thesis details ol { color: var(--muted); }

.steps-list { display: grid; gap: 8px; padding: 0; list-style: none; font-size: 13px; }
.steps-list li { margin: 0; }
.steps-list b { margin-right: 6px; color: var(--signal-text); font-family: var(--font-mono); }

.comments { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.comments li { margin: 0; border-left: 2px solid var(--line); padding-left: 8px; font-size: 12px; }
.comments li.op { border-left-color: var(--signal); }
.comments .post-body { max-height: 240px; font-size: 12px; }

.comment-list > li { margin: 0; }
.comment-list > li + li { margin-top: 8px; }
/* A comment of the dialog: its field grows with the text where the browser can, and the copy button and "Answered"
   stand beside it, under it on a phone. In a div of the li: a grid li would lose its number. */
.comment { display: grid; gap: 8px; }
.comment textarea { min-height: 7.5em; max-height: 24rem; field-sizing: content; font: 13px/1.6 var(--font-sans); }
/* The comment whose copy button was pressed last: the script puts .copied on it and takes it off when the dialog is
   closed (issue #29). A second line of the same colour thickens the frame without moving the text, and --signal-text
   rather than --signal keeps it well above 3:1 against the field. Beats the :hover of the field, which is lighter. */
.comment.copied textarea { border-color: var(--signal-text); box-shadow: 0 0 0 1px var(--signal-text); transition: border-color 0.2s, box-shadow 0.2s; }
.comment-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (min-width: 640px) {
    .comment { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
    .comment-actions { flex-direction: column; align-items: flex-end; }
}

/* ---- Dialog ---- */

/* A dialog without JavaScript: shown while its id is the address's #fragment, closed by a link to an id no element has,
   so that the feed stays where it was. Above the sticky header; the page under it does not scroll, the dialog does. */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    overflow-y: auto;
    padding: 48px 16px;
    background: var(--overlay);
}
.modal:target { display: block; }
body:has(.modal:target) { overflow: hidden; }
/* The shade around the box is the same link back: a click beside the box closes it. */
.modal-shade { position: fixed; inset: 0; }
/* 60rem, not the 40rem it was: beside the buttons of a comment (issue #31) the field of 40rem was only about 28rem wide, and
   a comment of a few paragraphs ran to a tall narrow column that had to be scrolled. On a narrower screen the box is as
   wide as the screen less the padding of .modal. */
.modal-box { position: relative; max-width: 60rem; margin: 0 auto; background: var(--popover); animation: rise 0.3s var(--ease) both; }
/* The post the comments answer: a quote above them, scrolling on its own so that a long post does not push the comments
   out of sight. */
.modal-box .post-body { max-height: 320px; border-left: 2px solid var(--line); padding-left: 12px; }
/* The quote and its copy button (issue #34): the button stays at the top, in view while a long post scrolls in its box. */
.post-quote { display: flex; align-items: flex-start; gap: 8px; }
.post-quote .post-body { flex: 1 1 auto; min-width: 0; }
.post-quote .icon { flex: none; }

/* ---- Tables ---- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font: 500 11px/1.4 var(--font-mono);
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
    vertical-align: bottom;
}
td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:hover td { background: rgb(26 26 26 / 0.03); }
tfoot th { border-bottom: 0; color: var(--text); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.off td { color: var(--muted); }
td form { flex-wrap: nowrap; gap: 4px; }
td button { padding: 5px 10px; font-size: 12px; }
td select, td input { font-size: 12px; }

/* ---- Landing ---- */

/* The home page without a sign-in (issue #45): the hero with the text and an example card, then the sections. */
.landing-hero { gap: 32px; padding-block: 40px; }
.landing-hero h1 { font-size: clamp(2.5rem, 6vw, 4rem); }
.landing-hero .lead { font-size: 16px; }
.landing-hero .row { margin-top: 24px; }
.landing-hero .row + .small { margin-top: 12px; }
/* Over the two columns of .hero from 768 px: the text and the card share a row only where both have room. */
@media (min-width: 768px) {
    .landing-hero { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 1024px) {
    .landing-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 26rem); align-items: center; }
}

.example { margin: 0; }
/* The caption, the card and the reply the AI wrote for it. */
.example > * + * { margin-top: 8px; }

.landing-block { margin-top: 64px; }
.landing-block > h2 { max-width: 24ch; font-size: clamp(1.75rem, 4vw, 2.25rem); text-wrap: balance; }
.landing-block > .eyebrow + h2 { margin-top: 4px; }
.landing-block > :is(.surface, .features, .faq) { margin-top: 24px; }
.landing-block .steps .eyebrow + h3 { margin-top: 4px; }

.features { display: grid; gap: 16px; }
.features p { color: var(--muted); }
@media (min-width: 768px) {
    .features { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
    .features { grid-template-columns: repeat(3, 1fr); }
}

/* Three numbers with their captions, in a row from 768 px. */
.proof { display: grid; gap: 24px; }
.surface.proof > * { margin: 0; }
.proof dt { color: var(--muted); font: 500 10px/1.4 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; }
.proof dd { margin-top: 4px; font: 400 48px/1 var(--font-display); }
.proof dd + dd { margin-top: 8px; color: var(--muted); font: 13px/1.5 var(--font-sans); }
@media (min-width: 768px) {
    .proof { grid-template-columns: repeat(3, 1fr); }
}

.plan { max-width: 28rem; }
.price { font: 400 56px/1 var(--font-display); }

.faq { display: grid; gap: 8px; max-width: 48rem; }
.faq p { color: var(--muted); }

/* The closing call: the hero's glass, centred. */
.cta { padding: 48px 24px; background: var(--glass); text-align: center; }
.cta > h2 { margin-inline: auto; }
.cta .lead { margin-inline: auto; }
.cta .row { justify-content: center; }

.foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 16px;
    margin-top: 64px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font: 11px/1.5 var(--font-mono);
}

/* ---- Sign-in ---- */

/* The card and, beside it from 768 px, what the service gives; on a phone the column goes under the card. */
.login { display: grid; grid-template-columns: minmax(0, 28rem); align-content: center; justify-content: center; gap: 24px; min-height: calc(100dvh - 120px); }
.login .surface { padding: 32px; animation: rise 0.45s var(--ease) both; }
.login .brand img { height: 64px; }
.login .brand + .eyebrow { margin-top: 24px; }
.login h1 { font-size: 2.25rem; }
.login .providers { display: grid; gap: 12px; margin-top: 24px; }
.login .providers button { width: 100%; padding: 12px 16px; font-size: 14px; }
.login .providers button:not(.primary):hover { border-color: var(--signal); }
.login-aside { animation: rise 0.45s var(--ease) 0.12s both; }
.login-aside > * + * { margin-top: 12px; }
.login-aside > .eyebrow + h2 { margin-top: 4px; }
@media (min-width: 768px) {
    .login { grid-template-columns: minmax(0, 28rem) minmax(0, 20rem); align-items: center; gap: 40px; }
}

/* ---- Motion ---- */

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes sheen { from { transform: translateX(-130%) skewX(-22deg); } to { transform: translateX(330%) skewX(-22deg); } }
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes fill { from { transform: scaleX(0.04); } to { transform: scaleX(0.9); } }

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