/* PeerReview — "manuscript under review" theme. No build step needed. */

@font-face { font-family: "Bricolage Grotesque"; src: url("../fonts/bricolage-grotesque.woff") format("woff"); font-weight: 200 800; font-stretch: 75% 100%; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("../fonts/source-serif-4.woff") format("woff"); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("../fonts/source-serif-4-italic.woff") format("woff"); font-weight: 200 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Caveat"; src: url("../fonts/caveat.woff") format("woff"); font-weight: 400 700; font-display: swap; }

:root {
    /* Desk, paper and the reviewer's tools */
    --desk: #eef0f4;
    --grid: #e2e6ee;
    --paper: #ffffff;
    --ink: #171a2e;
    --ink-2: #464a63;
    --muted: #6d7189;
    --rule: #d8dce6;
    --pencil: #2e3ad6;       /* blue editing pencil */
    --pencil-dark: #2029a8;
    --pencil-soft: #e6e8fc;
    --marker: #ffe34d;       /* highlighter */
    --marker-soft: #fff3a6;
    --redpen: #d63a2a;
    --good: #157a55;  --good-soft: #dcf2e8;
    --info: #2e3ad6;  --info-soft: #e6e8fc;
    --warn: #8f5600;  --warn-soft: #fff0bf;
    --bad: #c2321f;   --bad-soft: #fde4df;

    --ui: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
    --read: "Source Serif 4", Georgia, "Times New Roman", serif;
    --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
    --mono: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
    --radius: 6px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; color: var(--ink);
    font: 400 15.5px/1.55 var(--ui);
    background-color: var(--desk);
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 28px 28px;
    display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1; }
::selection { background: var(--marker); color: var(--ink); }
a { color: var(--pencil); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--marker); outline-offset: 2px; border-radius: 3px; }

h1, h2, h3, h4 { font-family: var(--ui); line-height: 1.15; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.02em; font-stretch: 88%; }
h1 { font-size: 2.3rem; }
h2 { font-size: 1.55rem; }
h3, .h3 { font-size: 1.15rem; letter-spacing: -.01em; }
h4 { font-size: .95rem; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 1rem 0; }
ul, ol { padding-left: 1.2rem; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.page { padding-top: 36px; padding-bottom: 64px; }
.section { margin-top: 40px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.right { text-align: right; }
.mono { font-family: var(--mono); font-size: .88em; }
.eyebrow { font-size: .82rem; font-weight: 600; color: var(--pencil); margin: 0; letter-spacing: 0; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.optional { color: var(--muted); font-weight: 400; font-size: .8rem; margin-left: 4px; }
.count { color: var(--muted); font-weight: 500; font-size: 1rem; letter-spacing: 0; }

/* Highlighter swipe, reused wherever something deserves the reader's eye */
.hl, mark {
    color: inherit; padding: 0 .12em; margin: 0 -.06em;
    background: linear-gradient(100deg, transparent .2em, var(--marker) .35em, var(--marker) calc(100% - .3em), transparent calc(100% - .1em)) no-repeat 0 60% / 100% 72%;
    -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* Header ----------------------------------------------------------------- */
.site-header { background: var(--paper); border-bottom: 2px solid var(--ink); position: sticky; top: 0; z-index: 20; }
.nav { display: flex; align-items: center; gap: 28px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.3rem; letter-spacing: -.03em; font-stretch: 80%; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 2px solid var(--ink); border-radius: 4px; color: var(--pencil); font-size: 0; position: relative; }
.brand-mark::after { content: ""; width: 12px; height: 7px; border-left: 3px solid var(--pencil); border-bottom: 3px solid var(--pencil); transform: rotate(-45deg) translate(1px, -2px); }
.nav-links { display: flex; gap: 6px; flex: 1; }
.nav-links a { color: var(--ink-2); padding: 6px 10px; font-weight: 500; }
.nav-links a:hover { color: var(--ink); text-decoration: none; }
.nav-links a.active { color: var(--ink); background: linear-gradient(var(--marker), var(--marker)) no-repeat 50% 78% / calc(100% - 12px) 9px; }
.nav-user { display: flex; align-items: center; gap: 12px; }
.bell { position: relative; color: var(--ink-2); display: inline-flex; padding: 6px; }
.bell-count { position: absolute; top: -1px; right: -5px; background: var(--redpen); color: #fff; font-size: .66rem; border-radius: 99px; padding: 0 5px; font-weight: 700; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: 46px; background: var(--paper); border: 2px solid var(--ink); border-radius: var(--radius); min-width: 230px; padding: 6px; box-shadow: 4px 4px 0 rgba(23, 26, 46, .12); }
.menu-panel a, .menu-panel button { display: block; width: 100%; text-align: left; padding: 8px 12px; color: var(--ink); border-radius: 4px; background: none; border: 0; font: inherit; cursor: pointer; }
.menu-panel a:hover, .menu-panel button:hover { background: var(--marker-soft); text-decoration: none; }
.menu-head { padding: 8px 12px 10px; border-bottom: 1px solid var(--rule); margin-bottom: 4px; font-weight: 600; }
.menu-head small { display: block; color: var(--muted); font-weight: 400; }

.site-footer { background: var(--ink); color: #b9bcd0; font-size: .88rem; }
.site-footer a { color: #fff; }
.footer-inner { display: flex; justify-content: space-between; padding: 22px 24px; flex-wrap: wrap; gap: 8px; }

/* Buttons ---------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: var(--radius); border: 2px solid transparent; font: 600 .93rem/1.2 var(--ui); cursor: pointer; white-space: nowrap; transition: background-color .12s, transform .12s; }
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--pencil); color: #fff; border-color: var(--pencil); }
.btn-primary:hover { background: var(--pencil-dark); border-color: var(--pencil-dark); }
.btn-ghost { background: var(--paper); color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: var(--marker-soft); }
.btn-danger-ghost { background: var(--paper); color: var(--bad); border-color: currentColor; }
.btn-danger-ghost:hover { background: var(--bad-soft); }
.btn-sm { padding: 5px 11px; font-size: .84rem; }
.btn-lg { padding: 12px 22px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--ink-2); font: 500 .86rem var(--ui); cursor: pointer; }
.link:hover { color: var(--pencil); }
.link.danger:hover { color: var(--bad); }
.link.voted { color: var(--pencil); font-weight: 700; }
summary.link, summary.btn { list-style: none; }
summary.link::-webkit-details-marker, summary.btn::-webkit-details-marker { display: none; }

/* Surfaces --------------------------------------------------------------- */
.card { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid > .card { margin-bottom: 0; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.narrow { max-width: 720px; margin-left: auto; margin-right: auto; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.section-head h1, .section-head h2 { margin: 0; }
.section-head p { margin: 4px 0 0; }
.empty { border: 2px dashed #c3c8d6; border-radius: var(--radius); padding: 30px; text-align: center; color: var(--ink-2); background: rgba(255, 255, 255, .7); margin-bottom: 16px; font-family: var(--read); font-size: 1.02rem; }
.aside { border: 2px solid var(--ink); }
.aside h3 { margin-bottom: .3em; }
.price { font-size: 2.8rem; font-weight: 800; letter-spacing: -.04em; font-stretch: 80%; margin: 0 0 .4em; }
.ticks { list-style: none; padding: 0; margin: 0 0 1em; }
.ticks li { padding: 5px 0 5px 28px; position: relative; }
.ticks li::before { content: "✓"; position: absolute; left: 2px; top: 0; color: var(--pencil); font: 700 1.5rem/1.2 var(--hand); }
.row-card { padding: 14px 18px; margin-bottom: 10px; }
.row-card > a { font-family: var(--read); font-weight: 600; color: var(--ink); }

/* Hero ------------------------------------------------------------------- */
.hero { border-bottom: 2px solid var(--ink); background: linear-gradient(180deg, rgba(255,255,255,.85), rgba(255,255,255,.55)); overflow: hidden; }
.hero-inner { display: grid; grid-template-columns: 1fr 1.05fr; gap: 56px; padding-top: 64px; padding-bottom: 40px; align-items: center; }
.hero h1 { font-size: clamp(2.6rem, 5.2vw, 4.4rem); line-height: 1; letter-spacing: -.028em; font-stretch: 84%; font-weight: 800; margin: 0 0 .35em; }
.lede { font-family: var(--read); font-size: 1.2rem; line-height: 1.6; color: var(--ink-2); max-width: 520px; }
.hero-actions { display: flex; gap: 12px; margin: 26px 0 16px; flex-wrap: wrap; }
.hero-note { color: var(--muted); font-size: .9rem; max-width: 480px; }
.hero-tally { padding-bottom: 28px; font-family: var(--read); font-size: 1.05rem; color: var(--ink-2); }
.hero-tally strong { font-family: var(--ui); color: var(--ink); font-weight: 800; font-size: 1.2rem; }

/* The annotated manuscript */
.ms { position: relative; margin: 0; padding: 12px 120px 30px 10px; }
.ms-sheet {
    position: relative; background: var(--paper); border: 1px solid var(--rule);
    padding: 34px 34px 30px 58px; transform: rotate(-1.6deg);
    box-shadow: 0 1px 0 #fff inset, 0 22px 40px -18px rgba(23, 26, 46, .35), 8px 8px 0 -2px #f7f8fb, 8px 8px 0 -1px var(--rule);
}
.ms-sheet::before { content: ""; position: absolute; top: 0; bottom: 0; left: 40px; border-left: 1.5px solid rgba(214, 58, 42, .45); }
.ms-meta { font-size: .78rem; color: var(--muted); margin-bottom: 10px; }
.ms-title { font-family: var(--read); font-weight: 700; font-size: 1.32rem; line-height: 1.25; letter-spacing: -.01em; font-stretch: 100%; margin: 0 0 6px; }
.ms-authors { font-family: var(--read); font-style: italic; color: var(--ink-2); font-size: .93rem; margin-bottom: 18px; }
.ms-text { font-family: var(--read); font-size: .98rem; line-height: 1.75; margin: 0 0 14px; }
.ms-text .hl { background-size: 0% 72%; animation: swipe .9s .45s cubic-bezier(.6, .1, .3, 1) forwards; }
.circled { position: relative; white-space: nowrap; }
.circled::after { content: ""; position: absolute; inset: -3px -4px -2px -4px; border: 2px solid var(--pencil); border-radius: 50% 46% 52% 44% / 58% 50% 54% 46%; transform: rotate(-3deg); }
.struck { text-decoration: line-through; text-decoration-color: var(--redpen); text-decoration-thickness: 2px; color: var(--muted); }
.caret { color: var(--redpen); font-family: var(--hand); font-size: 1.3rem; font-weight: 700; line-height: 0; }
.ms-line { height: 9px; background: #e9ebf1; border-radius: 3px; margin: 11px 0; }
.ms-line.s { width: 62%; }
.ms-score { display: inline-flex; align-items: center; gap: 12px; margin-top: 10px; padding: 8px 14px; border: 2px solid var(--ink); border-radius: var(--radius); font-size: .88rem; background: var(--paper); }
.ms-score b { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; font-stretch: 80%; }
.note { position: absolute; font: 600 1.45rem/1.05 var(--hand); color: var(--pencil); opacity: 0; animation: jot .5s forwards; max-width: 150px; }
.note::before { content: ""; position: absolute; border-top: 2px solid currentColor; width: 34px; }
.note-1 { right: 0; top: 178px; transform: rotate(-4deg); animation-delay: 1.2s; }
.note-1::before { left: -42px; top: 14px; transform: rotate(8deg); }
.note-2 { right: 0; top: 246px; transform: rotate(3deg); animation-delay: 1.55s; }
.note-2::before { left: -40px; top: 12px; transform: rotate(-10deg); }
.note-3 { left: -14px; bottom: 6px; color: var(--redpen); transform: rotate(-2deg); max-width: none; animation-delay: 1.9s; }
.note-3::before { display: none; }
@keyframes swipe { to { background-size: 100% 72%; } }
@keyframes jot { from { opacity: 0; translate: 0 4px; } to { opacity: 1; translate: 0 0; } }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; padding-top: 52px; }
.step { position: relative; padding-left: 54px; }
.step-n { position: absolute; left: 12px; top: -6px; font: 700 2.4rem/1 var(--hand); color: var(--pencil); }
.step-n::after { content: ""; position: absolute; inset: 0 -9px -2px -10px; border: 2px solid var(--pencil); border-radius: 52% 48% 50% 46% / 54% 50% 52% 48%; transform: rotate(-6deg); }
.step h3 { margin-bottom: .3em; }
.step p { color: var(--ink-2); font-size: .95rem; }

/* Paper "sheets" ---------------------------------------------------------- */
.paper-card { display: flex; flex-direction: column; position: relative; padding-left: 40px; border-color: #cfd4e0; }
.paper-card::before { content: ""; position: absolute; top: 0; bottom: 0; left: 24px; border-left: 1.5px solid rgba(214, 58, 42, .38); }
.paper-card h3 { margin: 10px 0 6px; font-family: var(--read); font-size: 1.16rem; line-height: 1.3; font-weight: 650; letter-spacing: -.005em; font-stretch: 100%; }
.paper-card h3 a { color: var(--ink); }
.paper-card h3 a:hover { text-decoration: none; background: linear-gradient(var(--marker), var(--marker)) no-repeat 0 85% / 100% 40%; }
.paper-card-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.byline { color: var(--ink-2); font-size: .9rem; margin-bottom: 10px; }
.byline.lg { font-size: 1.02rem; }
.excerpt { font-family: var(--read); color: var(--ink-2); font-size: .95rem; line-height: 1.6; flex: 1; }
.paper-card-foot { display: flex; gap: 14px; color: var(--muted); font-size: .82rem; border-top: 1px dashed var(--rule); padding-top: 10px; margin-top: 4px; }
.paper-card-foot span:last-child { margin-left: auto; }

/* Badges & tags: marker strokes ----------------------------------------- */
.badge { display: inline-block; padding: 2px 10px 3px; border-radius: 3px 9px 4px 8px / 8px 4px 9px 3px; font: 650 .76rem/1.4 var(--ui); white-space: nowrap; vertical-align: middle; }
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-warn { background: var(--marker); color: #5c3b00; }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-muted { background: #e6e8ee; color: var(--ink-2); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tag { border: 1px solid var(--ink); padding: 2px 10px; border-radius: 99px; font-size: .8rem; color: var(--ink); background: var(--paper); }
.tag:hover { background: var(--marker); text-decoration: none; }

/* Alerts ----------------------------------------------------------------- */
.alert { padding: 12px 16px 12px 18px; border-radius: var(--radius); margin-bottom: 18px; border: 1px solid; border-left-width: 5px; background: var(--paper); }
.alert ul { margin: 6px 0 0; }
.alert-good { border-color: var(--good); color: #0f5b40; }
.alert-info { border-color: var(--pencil); color: #1f2899; }
.alert-warn { border-color: #e2b400; background: var(--marker-soft); color: #5c3b00; }
.alert-bad { border-color: var(--bad); color: #8d2216; }

/* Forms ------------------------------------------------------------------ */
.form { display: flex; flex-direction: column; gap: 16px; }
.form label { display: block; font-weight: 600; font-size: .9rem; }
.form label > input, .form label > select, .form label > textarea, .form label > .hint, .form label > .field-error { display: block; margin-top: 6px; }
.form label.check { display: flex; flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.form label.check > input { display: inline-block; margin-top: 0; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=file], select, textarea {
    width: 100%; padding: 10px 12px; border: 1.5px solid #c4c9d6; border-radius: var(--radius); font: 400 .95rem var(--ui); background: #fff; color: var(--ink);
}
textarea { font-family: var(--read); font-size: 1rem; line-height: 1.55; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pencil); box-shadow: 0 0 0 3px var(--pencil-soft); }
input[type=checkbox], input[type=radio] { accent-color: var(--pencil); }
input[type=file] { padding: 8px; background: #f7f8fb; border-style: dashed; }
.hint { color: var(--muted); font-size: .8rem; font-weight: 400; }
.field-error { color: var(--bad); font-size: .83rem; margin: 0; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row { display: flex; align-items: center; gap: 10px; }
.form-row.between { justify-content: space-between; }
.form-row.end { justify-content: flex-end; }
.filters { display: flex; gap: 10px; padding: 12px; flex-wrap: wrap; align-items: center; border: 2px solid var(--ink); }
.filters select { width: auto; }
.filters .grow { flex: 1; min-width: 220px; }
.auth-card { max-width: 450px; margin: 28px auto; padding: 38px; border: 2px solid var(--ink); box-shadow: 8px 8px 0 -2px #f7f8fb, 8px 8px 0 0 var(--ink); }
.auth-card h1 { font-size: 2.1rem; font-stretch: 80%; }
.auth-switch { text-align: center; margin: 22px 0 0; color: var(--muted); }

/* Paper page -------------------------------------------------------------- */
.paper-head { margin-bottom: 28px; max-width: 920px; }
.paper-title { font-family: var(--read); font-size: clamp(1.8rem, 3.4vw, 2.6rem); line-height: 1.15; font-weight: 700; letter-spacing: -.02em; font-stretch: 100%; margin: 12px 0; }
.meta-line { margin-bottom: 18px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions form { margin: 0; }
.paper-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.paper-side { position: sticky; top: 84px; }
.paper-side h3 { margin-bottom: 12px; }
.prose { font-family: var(--read); font-size: 1.03rem; line-height: 1.7; color: var(--ink); max-width: 72ch; }
.prose p:last-child { margin-bottom: 0; }
.paper-main > section.card:first-of-type, .paper-main > .card:not(.decision):first-child { position: relative; }
.decision { border-left: 5px solid var(--pencil); }
.decision .prose, .decision p { font-family: var(--hand); font-size: 1.45rem; line-height: 1.3; color: var(--pencil); }
.decision .eyebrow { font-family: var(--ui); font-size: .82rem; }
.decision-good { border-left-color: var(--good); }
.decision-bad { border-left-color: var(--bad); }
.decision-bad p:not(.eyebrow) { color: var(--redpen); }
.decision-warn { border-left-color: #e2b400; }
.overall { display: flex; align-items: baseline; gap: 8px; margin-bottom: 16px; }
.overall-n { font-size: 3rem; font-weight: 800; letter-spacing: -.05em; font-stretch: 78%; line-height: 1; background: linear-gradient(var(--marker), var(--marker)) no-repeat 0 82% / 100% 38%; padding: 0 4px; }
.meter { margin-bottom: 11px; }
.meter-label { display: flex; justify-content: space-between; font-size: .86rem; margin-bottom: 4px; }
.meter-bar { height: 7px; background: repeating-linear-gradient(90deg, #e3e6ee 0 calc(20% - 2px), transparent calc(20% - 2px) 20%); border-radius: 2px; overflow: hidden; }
.meter-bar span { display: block; height: 100%; background: var(--pencil); border-radius: 2px; }
.rec-tally { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.versions { list-style: none; padding: 0; margin: 0 0 14px; }
.versions li { padding: 9px 0; border-bottom: 1px dashed var(--rule); }
.versions li:last-child { border-bottom: 0; }
.versions a { font-weight: 600; }
.versions p { margin: 4px 0 0; color: var(--ink-2); font-family: var(--read); }
.paper-side details .form { margin-top: 12px; gap: 10px; }
.editor { border: 2px solid var(--ink); background: var(--marker-soft); }
.editor .form { gap: 10px; }

/* Reviews ---------------------------------------------------------------- */
.review { border-left: 5px solid var(--pencil); }
.review-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.who { display: flex; gap: 12px; align-items: center; }
.who .name, .comment-meta .name { font-weight: 700; color: var(--ink); }
.score-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; margin-bottom: 18px; border: 1.5px solid var(--ink); border-radius: var(--radius); overflow: hidden; }
.score { padding: 9px 6px 8px; text-align: center; border-right: 1px solid var(--rule); }
.score:last-child { border-right: 0; }
.score-n { display: block; font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; font-stretch: 80%; line-height: 1.1; }
.score-l { display: block; font-size: .74rem; color: var(--muted); }
.overall-score { background: var(--marker); }
.overall-score .score-l { color: #5c3b00; }
.sw { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--rule); }
.sw h4 { color: var(--good); }
.sw > div + div h4 { color: var(--redpen); }
.confidential { margin-top: 16px; padding: 10px 14px; background: var(--marker-soft); border: 1px dashed #d8b400; border-radius: var(--radius); font-size: .9rem; }
.review-actions { display: flex; gap: 16px; margin-top: 16px; align-items: flex-start; }
.review-actions details { flex: 1; }
.review-actions details[open] { flex-basis: 100%; }
.review-actions form { margin: 0; }
.review-form-wrap { border: 2px dashed #c3c8d6; background: rgba(255,255,255,.75); }
.review-form-wrap > summary { display: inline-flex; }
.review-form-wrap[open] { border-style: solid; border-color: var(--ink); background: var(--paper); }
.review-form-wrap[open] > summary { margin-bottom: 18px; }
.review-form { margin-top: 12px; }
.scores { border: 1.5px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; margin: 0; }
.scores legend { font-weight: 700; font-size: .9rem; padding: 0 6px; }
.rating { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }
.rating-label { font-size: .92rem; }
.rating-options { display: flex; gap: 6px; }
.rating-options label { display: block; cursor: pointer; }
.rating-options input { position: absolute; opacity: 0; pointer-events: none; }
.rating-options span { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border: 1.5px solid #c4c9d6; border-radius: 50%; font: 700 1rem var(--ui); background: #fff; transition: border-color .12s; }
.rating-options label:hover span { border-color: var(--pencil); }
.rating-options input:checked + span { border: 2.5px solid var(--pencil); color: var(--pencil); background: var(--pencil-soft); border-radius: 52% 46% 50% 44% / 56% 48% 54% 46%; transform: rotate(-4deg); }
.rating-options input:focus-visible + span { outline: 3px solid var(--marker); outline-offset: 2px; }

/* Comments: marginal discussion ------------------------------------------ */
.comment-new { padding: 16px; }
.comment-new.form { gap: 10px; }
.comment-compose { display: flex; gap: 12px; }
.comments { margin-top: 8px; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 4px 22px; }
.comments:has(> .empty) { background: none; border: 0; padding: 0; }
.comment { display: flex; gap: 12px; padding: 18px 0; border-bottom: 1px dashed var(--rule); }
.comments > .comment:last-child { border-bottom: 0; }
.comment.reply { padding: 14px 0 0; border-bottom: 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-body .prose { font-size: 1rem; }
.comment-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.comment-actions { display: flex; gap: 16px; margin-top: 8px; align-items: flex-start; flex-wrap: wrap; }
.comment-actions form { margin: 0; }
.comment-actions details[open] { flex-basis: 100%; order: 10; }
.inline-form { margin-top: 8px; gap: 8px; align-items: flex-start; }
.replies { margin-top: 8px; padding-left: 18px; border-left: 2px solid var(--pencil-soft); }
.comment.deleted .avatar { background: #eceef3; color: var(--muted); border-color: #d4d8e2; }

.avatar { flex-shrink: 0; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); color: var(--ink); font-weight: 800; font-size: .8rem; letter-spacing: -.02em; }
.avatar.sm { width: 32px; height: 32px; font-size: .72rem; }
.avatar.lg { width: 84px; height: 84px; font-size: 1.7rem; border-width: 3px; background: var(--marker); }

/* Checkout ---------------------------------------------------------------- */
.pay-methods { display: flex; flex-direction: column; gap: 10px; }
.pay-method { cursor: pointer; }
.pay-method input { position: absolute; opacity: 0; }
.pay-card { display: flex; gap: 14px; align-items: center; border: 1.5px solid #c4c9d6; border-radius: var(--radius); padding: 14px 16px; background: #fff; transition: border-color .12s, background-color .12s; }
.pay-card strong { display: block; font-size: 1rem; }
.pay-card small { color: var(--muted); font-weight: 400; }
.pay-method:hover .pay-card { border-color: var(--ink); }
.pay-method input:checked + .pay-card { border: 2px solid var(--ink); background: var(--marker-soft); padding: 13.5px 15.5px; }
.pay-method input:focus-visible + .pay-card { outline: 3px solid var(--pencil); outline-offset: 2px; }
.pay-icon { flex-shrink: 0; width: 46px; height: 32px; border-radius: 5px; background: #fff center/24px no-repeat; border: 1.5px solid var(--ink); }
.pay-stripe { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232e3ad6' stroke-width='2'%3E%3Crect x='2' y='5' width='20' height='14' rx='2'/%3E%3Cpath d='M2 10h20'/%3E%3C/svg%3E"); }
.pay-paypal { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ctext x='4' y='17' font-family='Arial' font-weight='bold' font-style='italic' font-size='14' fill='%23003087'%3EP%3C/text%3E%3Ctext x='10' y='19' font-family='Arial' font-weight='bold' font-style='italic' font-size='14' fill='%23009cde'%3EP%3C/text%3E%3C/svg%3E"); }
.pay-bank_transfer { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23171a2e' stroke-width='2'%3E%3Cpath d='M3 10h18L12 4 3 10zM5 10v8M9 10v8M15 10v8M19 10v8M3 20h18'/%3E%3C/svg%3E"); }
.pay-sandbox { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238f5600' stroke-width='2'%3E%3Cpath d='M9 3h6M10 3v6L4 19a1 1 0 0 0 1 2h14a1 1 0 0 0 1-2l-6-10V3'/%3E%3C/svg%3E"); }
.summary-title { font-family: var(--read); font-weight: 600; font-size: 1.08rem; line-height: 1.35; margin-bottom: 4px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; margin: 22px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Tables ----------------------------------------------------------------- */
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-weight: 700; color: var(--ink); font-size: .8rem; padding: 12px 16px; border-bottom: 2px solid var(--ink); background: var(--paper); }
.table td { padding: 12px 16px; border-bottom: 1px dashed var(--rule); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfd; }
.table form { margin: 0; }

/* Notifications, profile, admin ------------------------------------------ */
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px dashed var(--rule); }
.notif-list li:last-child { border-bottom: 0; }
.notif-list li a { color: var(--ink); }
.notif-list li.unread a strong { background: linear-gradient(var(--marker), var(--marker)) no-repeat 0 85% / 100% 42%; }
.notif-list .small { white-space: nowrap; }
.profile-head { display: flex; gap: 26px; align-items: flex-start; border: 2px solid var(--ink); }
.profile-head h1 { margin-bottom: 4px; }
.profile-head p:last-child { margin-bottom: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--ink); margin-bottom: 24px; }
.tabs a { padding: 10px 16px; color: var(--ink-2); font-weight: 600; border: 2px solid transparent; border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; margin-bottom: -2px; }
.tabs a.active { color: var(--ink); background: var(--paper); border-color: var(--ink); padding-bottom: 12px; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; margin-bottom: 18px; border: 2px solid var(--ink); border-radius: var(--radius); background: var(--paper); overflow: hidden; }
.stat { margin: 0; padding: 16px 18px; border: 0; border-radius: 0; background: var(--paper); box-shadow: 1px 0 0 var(--rule), 0 1px 0 var(--rule); }
.stat span { display: block; color: var(--muted); font-size: .8rem; }
.stat strong { font-size: 1.9rem; font-weight: 800; letter-spacing: -.04em; font-stretch: 80%; }

/* Circles ---------------------------------------------------------------- */
.subject-groups { display: flex; flex-wrap: wrap; gap: 44px 40px; align-items: flex-start; }
.subject-groups > .empty { flex-basis: 100%; }
.subject-group { flex: 0 1 auto; min-width: 0; }
.subject-group h2 { font-size: 1.2rem; padding-bottom: 8px; border-bottom: 2px solid var(--ink); margin-bottom: 14px; }
.subject-group .disc-grid { display: flex; flex-wrap: wrap; gap: 24px; }
.circle-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 48px; align-items: center; margin-bottom: 36px; }
.circle-head-text { max-width: 760px; }
.circle-title { font-size: clamp(2.2rem, 4.4vw, 3.4rem); line-height: 1; letter-spacing: -.035em; font-stretch: 80%; font-weight: 800; margin: 12px 0 14px; }
.lead-prose { font-size: 1.15rem; color: var(--ink-2); margin-bottom: 12px; }

.confirm-progress { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; }
.ticks-row { display: flex; gap: 6px; }
.tickbox { position: relative; display: inline-block; flex-shrink: 0; width: 22px; height: 22px; border: 2px solid var(--ink); border-radius: 4px; background: var(--paper); }
.tickbox.done::after { content: ""; position: absolute; left: 4px; top: 1px; width: 11px; height: 6px; border-left: 3px solid var(--pencil); border-bottom: 3px solid var(--pencil); transform: rotate(-45deg) translate(-1px, 3px); }
.confirm-list { list-style: none; padding: 0; margin: 16px 0 0; }
.confirm-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--rule); }
.confirm-list li:last-child { border-bottom: 0; }
.confirm-list .small { margin-left: auto; }
.proposal-panel { border: 2px solid var(--ink); }
.proposal-panel .confirm-progress { margin-top: 0; }
.proposal-panel .confirm-progress .small { font-size: 1rem; }
.dev-note { background: var(--marker-soft); border-style: dashed; }
.dev-note code { font-family: var(--mono); font-size: .85em; }

.member-list { list-style: none; padding: 0; margin: 0; }
.member-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.member-list .badge { margin-left: auto; }
.section-gap { margin-bottom: 28px; }
.howto { padding-left: 1.3rem; margin: 0 0 14px; }
.howto li { padding: 4px 0; }
.howto li::marker { font: 700 1.3rem var(--hand); color: var(--pencil); }
.join-to-review { border: 2px dashed var(--pencil); background: var(--pencil-soft); }


/* Circles drawn as circles: a single ring with the details inside ------- */
.disc {
    --d: 210px;
    position: relative; display: grid; place-items: center; flex-shrink: 0;
    width: var(--d); height: var(--d); padding: 22px;
    border: 2px solid var(--ink); border-radius: 50%;
    background: var(--paper); color: var(--ink); text-align: center;
    transition: border-color .15s, background-color .15s;
}
.disc:hover, .disc:focus-visible { text-decoration: none; border-color: var(--pencil); }
.disc:focus-visible { outline: 3px solid var(--marker); outline-offset: 4px; }
.disc-sm { --d: 140px; padding: 14px; }
.disc-lg { --d: 280px; padding: 30px; }
.is-mine { border-color: var(--pencil); border-width: 3px; }
.is-proposal { border-style: dashed; border-color: #b48f00; background: rgba(255, 255, 255, .7); }

.disc-body { display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 100%; min-width: 0; }
.disc-subject { font-size: .74rem; font-weight: 600; color: var(--pencil); }
.disc-name { font-weight: 700; font-stretch: 85%; letter-spacing: -.01em; line-height: 1.1; font-size: 1.22rem; overflow-wrap: anywhere; text-wrap: balance; }
.disc:hover .disc-name, .disc:focus-visible .disc-name { background: linear-gradient(var(--marker), var(--marker)) no-repeat 0 85% / 100% 40%; }
.disc-meta { font-size: .8rem; color: var(--muted); }
.disc-flag { margin-top: 2px; font: 700 1.05rem/1 var(--hand); color: var(--pencil); transform: rotate(-4deg); }
.disc-sm .disc-name { font-size: .95rem; }
.disc-sm .disc-subject, .disc-sm .disc-flag { display: none; }
.disc-sm .disc-meta { font-size: .72rem; }
.disc-lg .disc-name { font-size: 1.6rem; }
.disc-lg .disc-meta { font-size: .9rem; }

.disc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 30px 24px; justify-items: center; }
.disc-item { margin: 0; display: flex; flex-direction: column; align-items: center; max-width: 280px; }
.disc-item figcaption { margin-top: 6px; text-align: center; font-family: var(--read); font-size: .95rem; line-height: 1.5; color: var(--ink-2); }
.disc-closes { display: block; margin-top: 6px; font: 600 .8rem var(--ui); color: #8f5600; }
.disc-row { display: flex; flex-wrap: wrap; gap: 8px 22px; }
@media (prefers-reduced-motion: reduce) { .disc { transition: none; } }

/* Pagination ------------------------------------------------------------- */
.pagination { display: flex; gap: 4px; justify-content: center; margin: 30px 0 0; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: var(--radius); border: 1.5px solid var(--ink); background: var(--paper); font-size: .9rem; font-weight: 600; color: var(--ink); }
.pagination a:hover { background: var(--marker-soft); text-decoration: none; }
.pagination .current { background: var(--ink); color: #fff; }
.pagination .disabled { color: var(--muted); border-color: var(--rule); }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 1000px) {
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .paper-layout, .two-col { grid-template-columns: 1fr; }
    .paper-side { position: static; }
    .steps { grid-template-columns: repeat(2, 1fr); }
    .hero-inner { grid-template-columns: 1fr; gap: 36px; }
    .circle-head { grid-template-columns: 1fr; gap: 20px; }
    .circle-head-disc { justify-self: center; }
    .ms { max-width: 620px; }
}
@media (max-width: 720px) {
    .nav { gap: 12px; height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
    .nav-links { order: 3; flex-basis: 100%; overflow-x: auto; }
    .nav-user { margin-left: auto; }
    .grid-2, .grid-3, .form-grid, .sw, .steps { grid-template-columns: 1fr; }
    .hero-inner { padding-top: 40px; }
    .ms { padding-right: 10px; padding-bottom: 50px; }
    .ms-sheet { padding: 26px 22px 24px 44px; }
    .ms-sheet::before { left: 30px; }
    .note-1, .note-2 { display: none; }
    .disc-lg { --d: 240px; }
    .disc-lg .disc-name { font-size: 1.35rem; }
    .note-3 { left: 6px; }
    .score-row { grid-template-columns: repeat(3, 1fr); }
    .score:nth-child(3) { border-right: 0; }
    .score:nth-child(-n+3) { border-bottom: 1px solid var(--rule); }
    .kv { grid-template-columns: 1fr; gap: 2px; }
    .kv dd { margin-bottom: 10px; }
    .card { padding: 18px; }
    .paper-card { padding-left: 34px; }
    .paper-card::before { left: 20px; }
    .auth-card { padding: 26px; }
}
@media (prefers-reduced-motion: reduce) {
    .ms-text .hl { animation: none; background-size: 100% 72%; }
    .note { animation: none; opacity: 1; }
    .btn { transition: none; }
}
@media print {
    .site-header, .site-footer, .btn { display: none !important; }
    body { background: #fff; }
    .card { border: 0; }
}

/* A paper's circle, shown as its name in a small tag with a ring marker */
.circle-tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 5px; border: 1.5px solid var(--ink); border-radius: 99px; font-size: .8rem; font-weight: 600; color: var(--ink); background: var(--paper); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.circle-tag::before { content: ""; flex-shrink: 0; width: 10px; height: 10px; border: 2px solid var(--pencil); border-radius: 50%; }
.circle-tag:hover { text-decoration: none; background: var(--marker-soft); }
.paper-where { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Destructive confirmations */
.btn-danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-danger:hover { background: #9e2718; border-color: #9e2718; }
.danger-zone { border: 2px solid var(--bad); }
.danger-zone h1 { font-size: 1.9rem; }
.loss-list { margin: 0 0 22px; padding-left: 1.2rem; font-family: var(--read); }
.loss-list li { padding: 4px 0; }
.row-actions { display: inline-flex; gap: 6px; }
