/*
Theme Name: StudentAnswers
Theme URI: https://studentanswers.org/
Author: StudentAnswers
Description: An "answer sheet" theme for studentanswers.org. Graph-paper surfaces, ink and highlighter colours, numbered questions, a random Popular Topics block under every answer, light/dark modes, and a raw Header widget area printed right after the site header for analytics and ad code.
Version: 1.0.0
Requires at least: 6.2
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: studentanswers
Tags: blog, education, one-column, two-columns, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready, accessibility-ready, dark-mode
*/

/* ==========================================================================
   1. Tokens (daisyUI-style semantic roles, two themes)
   ========================================================================== */
:root {
	--c-base-100: #fbf8f1;   /* paper */
	--c-base-200: #f3eee1;   /* paper, folded */
	--c-base-300: #e3dccb;   /* rules */
	--c-surface: #fffdf8;
	--c-content: #1b1f3b;    /* ink */
	--c-muted: #4b5070;
	--c-primary: #1b1f3b;
	--c-primary-content: #fbf8f1;
	--c-hl: #e4f75a;         /* highlighter */
	--c-hl-content: #1b1f3b;
	--c-pen: #c9372f;        /* red pen */
	--c-grid: rgba(27, 31, 59, 0.055);
	--c-t1: #e4f75a;
	--c-t2: #ffb59e;
	--c-t3: #b9d6ff;
	--c-t4: #d6c6ff;
	--c-shadow: #1b1f3b;
	--c-foot: #1b1f3b;
	--c-foot-content: #ece8dc;

	--f-display: "Fraunces", "Iowan Old Style", Georgia, serif;
	--f-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
	--f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

	--r-sm: 8px;
	--r-md: 14px;
	--r-lg: 22px;
	--border: 1.5px;
	--wrap: 1200px;
	--gutter: clamp(16px, 4vw, 32px);
	--head-h: 72px;
	--ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--c-base-100: #14162b;
		--c-base-200: #1b1e3a;
		--c-base-300: #2f3359;
		--c-surface: #1d2042;
		--c-content: #eeeae0;
		--c-muted: #b6b4c9;
		--c-primary: #e4f75a;
		--c-primary-content: #14162b;
		--c-hl: #d6ec44;
		--c-hl-content: #14162b;
		--c-pen: #ff7a6e;
		--c-grid: rgba(238, 234, 224, 0.045);
		--c-t1: #d6ec44;
		--c-t2: #ff9d82;
		--c-t3: #8fb8ff;
		--c-t4: #b9a3ff;
		--c-shadow: #000;
		--c-foot: #0e1022;
		--c-foot-content: #d9d6cc;
		color-scheme: dark;
	}
}

:root[data-theme="dark"] {
	--c-base-100: #14162b;
	--c-base-200: #1b1e3a;
	--c-base-300: #2f3359;
	--c-surface: #1d2042;
	--c-content: #eeeae0;
	--c-muted: #b6b4c9;
	--c-primary: #e4f75a;
	--c-primary-content: #14162b;
	--c-hl: #d6ec44;
	--c-hl-content: #14162b;
	--c-pen: #ff7a6e;
	--c-grid: rgba(238, 234, 224, 0.045);
	--c-t1: #d6ec44;
	--c-t2: #ff9d82;
	--c-t3: #8fb8ff;
	--c-t4: #b9a3ff;
	--c-shadow: #000;
	--c-foot: #0e1022;
	--c-foot-content: #d9d6cc;
	color-scheme: dark;
}

/* ==========================================================================
   2. Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--head-h) + 16px);
}

body {
	margin: 0;
	background-color: var(--c-base-100);
	color: var(--c-content);
	font-family: var(--f-body);
	font-size: 1.0625rem;
	line-height: 1.6;
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}

img, svg, video { max-width: 100%; height: auto; }
img { display: block; }

a { color: inherit; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }

h1, h2, h3, h4 {
	font-family: var(--f-display);
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -0.015em;
	margin: 0 0 0.5em;
	text-wrap: balance;
}

p { margin: 0 0 1em; }

:focus-visible {
	outline: 3px solid var(--c-hl);
	outline-offset: 2px;
	box-shadow: 0 0 0 5px var(--c-content);
	border-radius: 4px;
}

::selection { background: var(--c-hl); color: var(--c-hl-content); }

.wrap {
	width: 100%;
	max-width: var(--wrap);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.screen-reader-text {
	border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
	height: 1px; width: 1px; margin: -1px; overflow: hidden; padding: 0;
	position: absolute !important; word-wrap: normal !important;
}

.skip-link {
	position: absolute; left: 12px; top: -60px; z-index: 100;
	background: var(--c-hl); color: var(--c-hl-content);
	padding: 10px 16px; border-radius: var(--r-sm); font-weight: 700;
	transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }

.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }

.site-main { display: block; outline: none; }

/* ==========================================================================
   3. Components: eyebrow, badge, buttons, askbar
   ========================================================================== */
.eyebrow {
	display: inline-flex; align-items: center; gap: 8px;
	font-family: var(--f-mono); font-size: 0.75rem; font-weight: 700;
	letter-spacing: 0.08em; text-transform: uppercase;
	color: var(--c-muted); margin: 0 0 14px;
}
.eyebrow__dot {
	width: 10px; height: 10px; border-radius: 50%;
	background: var(--c-pen); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-pen) 20%, transparent);
}

.badge {
	display: inline-flex; align-items: center; min-height: 28px;
	padding: 2px 12px; border: var(--border) solid var(--c-content); border-radius: 999px;
	font-family: var(--f-mono); font-size: 0.72rem; font-weight: 700;
	letter-spacing: 0.04em; text-transform: uppercase; text-decoration: none;
	background: var(--c-hl); color: var(--c-hl-content);
	transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
a.badge:hover { transform: translate(-1px, -1px); box-shadow: 2px 2px 0 var(--c-shadow); }

.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 48px; padding: 10px 20px; cursor: pointer;
	border: var(--border) solid var(--c-content); border-radius: var(--r-sm);
	font: 700 1rem/1.2 var(--f-body); text-decoration: none;
	transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), background-color 0.18s;
}
.btn--ink { background: var(--c-primary); color: var(--c-primary-content); border-color: var(--c-primary); }
.btn--ink:hover { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--c-hl), 4px 4px 0 var(--c-content); }
.btn--ghost { background: transparent; color: var(--c-content); }
.btn--ghost:hover { background: var(--c-base-200); }
.btn--sm { min-height: 44px; padding: 8px 14px; font-size: 0.9rem; }
.btn:active { transform: translate(0, 0); box-shadow: none; }

.askbar {
	display: flex; align-items: center; gap: 10px;
	max-width: 620px; padding: 8px 8px 8px 18px;
	background: var(--c-surface); border: 2px solid var(--c-content); border-radius: var(--r-md);
	box-shadow: 5px 5px 0 var(--c-shadow);
}
.askbar__q { font-family: var(--f-display); font-weight: 800; font-size: 1.35rem; color: var(--c-pen); }
.askbar__input {
	flex: 1; min-width: 0; min-height: 48px; border: 0; background: transparent;
	color: var(--c-content); font: 400 1.05rem var(--f-body);
	border-bottom: 2px dashed var(--c-base-300);
}
.askbar__input:focus { outline: none; border-bottom-color: var(--c-content); }
.askbar__input::placeholder { color: var(--c-muted); opacity: 0.85; }

/* ==========================================================================
   4. Masthead
   ========================================================================== */
.masthead {
	position: sticky; top: 0; z-index: 50;
	background: color-mix(in srgb, var(--c-base-100) 92%, transparent);
	-webkit-backdrop-filter: saturate(1.4) blur(10px);
	backdrop-filter: saturate(1.4) blur(10px);
}
.masthead::after {
	content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 6px;
	background: radial-gradient(circle at 6px -1px, transparent 4px, var(--c-base-100) 4.5px) 0 0 / 12px 6px repeat-x;
	pointer-events: none;
}
.masthead__inner {
	display: flex; align-items: center; gap: 20px; min-height: var(--head-h);
	border-bottom: 1.5px dashed var(--c-base-300);
}
.admin-bar .masthead { top: 32px; }
@media (max-width: 782px) { .admin-bar .masthead { top: 0; position: relative; } }

.brand { margin: 0; line-height: 0; flex: none; }
.brand__link { display: inline-block; border-radius: 6px; }
.brand__img { width: auto; height: 46px; }
.brand__img--dark { display: none; }
[data-theme="dark"] .brand--header .brand__img--light { display: none; }
[data-theme="dark"] .brand--header .brand__img--dark { display: block; }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .brand--header .brand__img--light { display: none; }
	:root:not([data-theme="light"]) .brand--header .brand__img--dark { display: block; }
}

.masthead__search {
	flex: 1; max-width: 460px; margin-left: auto;
	display: flex; align-items: center; gap: 6px;
	padding: 0 4px 0 14px; min-height: 46px;
	background: var(--c-surface); border: var(--border) solid var(--c-base-300); border-radius: 999px;
	transition: border-color 0.18s, box-shadow 0.18s;
}
.masthead__search:focus-within { border-color: var(--c-content); box-shadow: 3px 3px 0 var(--c-shadow); }
.masthead__search-q { font-family: var(--f-display); font-weight: 800; color: var(--c-pen); }
.masthead__search input {
	flex: 1; min-width: 0; border: 0; background: transparent; color: var(--c-content);
	font: 400 1rem var(--f-body); min-height: 44px;
}
.masthead__search input:focus { outline: none; }
.masthead__search-btn {
	display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%;
	background: var(--c-primary); color: var(--c-primary-content); cursor: pointer;
}

.masthead__tools { display: flex; align-items: center; gap: 6px; }
.tool {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	min-width: 44px; min-height: 44px; padding: 0 12px;
	border: var(--border) solid transparent; border-radius: 999px;
	background: transparent; color: var(--c-content); cursor: pointer;
	font: 700 0.92rem var(--f-body); text-decoration: none;
	transition: background-color 0.18s, border-color 0.18s;
}
.tool:hover { background: var(--c-base-200); border-color: var(--c-base-300); }
.tool--popular { background: var(--c-hl); color: var(--c-hl-content); border-color: var(--c-content); }
.tool--popular:hover { background: var(--c-hl); box-shadow: 2px 2px 0 var(--c-shadow); }
.tool--search { display: none; }
.tool--theme .icon--sun { display: none; }
[data-theme="dark"] .tool--theme .icon--sun { display: block; }
[data-theme="dark"] .tool--theme .icon--moon { display: none; }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .tool--theme .icon--sun { display: block; }
	:root:not([data-theme="light"]) .tool--theme .icon--moon { display: none; }
}

.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; }
.progress span { display: block; height: 100%; width: 100%; background: var(--c-pen); transform-origin: 0 50%; transform: scaleX(0); }

@media (max-width: 860px) {
	.masthead__inner { gap: 10px; }
	.brand__img { height: 34px; }
	.tool--search { display: inline-flex; }
	.tool--popular span { display: none; }
	.masthead__tools { margin-left: auto; }
	.masthead__search {
		display: none; position: absolute; left: var(--gutter); right: var(--gutter); top: calc(100% + 8px);
		max-width: none; margin: 0; box-shadow: 4px 4px 0 var(--c-shadow); border-color: var(--c-content);
	}
	.masthead.is-searching .masthead__search { display: flex; }
}

/* ==========================================================================
   5. Hero (graph paper + answer sheet)
   ========================================================================== */
.hero {
	position: relative; overflow: hidden;
	background-image:
		linear-gradient(var(--c-grid) 1px, transparent 1px),
		linear-gradient(90deg, var(--c-grid) 1px, transparent 1px);
	background-size: 28px 28px;
	background-position: -1px -1px;
	border-bottom: 1.5px solid var(--c-base-300);
}
.hero__inner {
	display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr);
	gap: clamp(32px, 6vw, 80px); align-items: center;
	padding-block: clamp(48px, 8vw, 104px);
}
.hero__title {
	font-size: clamp(2.3rem, 5.4vw, 4.4rem); font-weight: 800; line-height: 1.02;
	letter-spacing: -0.03em; margin-bottom: 20px; font-variation-settings: "opsz" 144;
}
.hero__title mark {
	color: inherit; padding: 0 0.08em;
	background: linear-gradient(100deg, transparent 0.3em, var(--c-hl) 0.3em, var(--c-hl) calc(100% - 0.15em), transparent calc(100% - 0.15em)) 0 62% / 100% 0.62em no-repeat;
	-webkit-box-decoration-break: clone; box-decoration-break: clone;
}
[data-theme="dark"] .hero__title mark { color: var(--c-content); background-size: 100% 0.2em; background-position: 0 92%; }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .hero__title mark { background-size: 100% 0.2em; background-position: 0 92%; }
}
.hero__text { font-size: 1.18rem; color: var(--c-muted); max-width: 52ch; margin-bottom: 28px; }

.sheet { position: relative; transform: rotate(-2deg); transition: transform 0.4s var(--ease); }
.sheet:hover { transform: rotate(0deg) translateY(-4px); }
.sheet__tab {
	display: inline-block; margin-left: 24px; padding: 6px 14px 8px;
	background: var(--c-pen); color: #fff; border-radius: 10px 10px 0 0;
	font: 700 0.72rem var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase;
}
.sheet__paper {
	position: relative; padding: 28px 28px 24px 64px;
	background-color: var(--c-surface);
	background-image: repeating-linear-gradient(transparent 0 31px, color-mix(in srgb, var(--c-t3) 55%, transparent) 31px 32px);
	background-position: 0 14px;
	border: 2px solid var(--c-content); border-radius: var(--r-md);
	box-shadow: 8px 8px 0 var(--c-shadow);
}
.sheet__paper::before {
	content: ""; position: absolute; top: 0; bottom: 0; left: 46px; width: 2px;
	background: color-mix(in srgb, var(--c-pen) 70%, transparent);
}
.sheet__label { position: absolute; left: 14px; margin: 0; font: 800 1.2rem var(--f-display); color: var(--c-pen); }
.sheet__label--a { color: var(--c-content); }
.sheet__q { font-size: 1.4rem; line-height: 1.25; margin: 0 0 18px; }
.sheet__link { text-decoration: none; }
.sheet__link::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-md); }
.sheet__link:hover { text-decoration: underline; text-decoration-color: var(--c-pen); }
.sheet__a { color: var(--c-muted); line-height: 2; margin: 0 0 12px; }
.sheet__foot { display: flex; align-items: center; gap: 8px; margin: 0; font: 700 0.8rem var(--f-mono); color: var(--c-muted); }
.sheet__check {
	display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
	background: var(--c-hl); color: var(--c-hl-content); border: var(--border) solid var(--c-content);
}
.sheet__check .icon { width: 15px; height: 15px; }

@media (max-width: 900px) {
	.hero__inner { grid-template-columns: 1fr; }
	.sheet { max-width: 520px; transform: rotate(-1deg); }
}

/* ==========================================================================
   6. Sections and rows
   ========================================================================== */
.section { padding-block: clamp(40px, 6vw, 72px); }
.section + .section { padding-top: 0; }
.section__head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.section__title { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0; }

.rows { border-top: 2px solid var(--c-content); }
.row {
	position: relative;
	display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 8px 24px; align-items: start;
	padding: 26px 0; border-bottom: 1.5px dashed var(--c-base-300);
	transition: background-color 0.2s;
}
.row::before {
	content: ""; position: absolute; left: -12px; top: 18px; bottom: 18px; width: 4px; border-radius: 4px;
	background: var(--c-hl); transform: scaleY(0); transition: transform 0.25s var(--ease);
}
.row:hover::before, .row:focus-within::before { transform: scaleY(1); }
.row__num {
	font: 700 1.05rem var(--f-mono); color: var(--c-pen); padding-top: 6px; letter-spacing: -0.02em;
}
.row__top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 10px; position: relative; z-index: 2; }
.row__meta { display: inline-flex; align-items: center; gap: 6px; font: 500 0.82rem var(--f-mono); color: var(--c-muted); }
.row__title { font-size: clamp(1.25rem, 2.2vw, 1.6rem); margin: 0 0 8px; }
.row__link { text-decoration: none; background: linear-gradient(var(--c-hl), var(--c-hl)) 0 88% / 0 0.35em no-repeat; transition: background-size 0.3s var(--ease); }
.row__link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.row:hover .row__link { background-size: 100% 0.35em; }
.row__excerpt { color: var(--c-muted); margin: 0; max-width: 70ch; }
.row__thumb { width: 168px; aspect-ratio: 16 / 10; border-radius: var(--r-sm); overflow: hidden; border: var(--border) solid var(--c-content); }
.row__thumb img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 720px) {
	.row { grid-template-columns: 1fr; padding: 22px 0; }
	.row__num { padding: 0; font-size: 0.9rem; }
	.row__thumb { display: none; }
}

.empty { padding: 32px; border: 2px dashed var(--c-base-300); border-radius: var(--r-md); color: var(--c-muted); }

/* Pagination */
.pager { margin-top: 32px; }
.pager ul { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.pager .page-numbers {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	min-width: 46px; min-height: 46px; padding: 0 14px;
	border: var(--border) solid var(--c-base-300); border-radius: var(--r-sm);
	font: 700 0.95rem var(--f-mono); text-decoration: none;
}
.pager a.page-numbers:hover { border-color: var(--c-content); box-shadow: 2px 2px 0 var(--c-shadow); }
.pager .current { background: var(--c-primary); color: var(--c-primary-content); border-color: var(--c-primary); }
.pager .dots { border-color: transparent; }

/* ==========================================================================
   7. Popular Topics
   ========================================================================== */
.popular {
	position: relative; padding: clamp(24px, 4vw, 40px);
	background: var(--c-base-200); border: 2px solid var(--c-content); border-radius: var(--r-lg);
}
.popular__head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 6px 24px; margin-bottom: 24px; }
.popular__head .eyebrow { order: 2; margin: 0; }
.popular__title { font-size: clamp(1.7rem, 3.2vw, 2.4rem); margin: 0; }
.popular__grid {
	display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px;
	list-style: none; margin: 0; padding: 0;
}
.pcard {
	position: relative; display: flex; flex-direction: column; min-height: 196px;
	padding: 26px 20px 18px; overflow: hidden;
	background: var(--c-surface); border: var(--border) solid var(--c-content); border-radius: var(--r-md);
	transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
.pcard::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 8px; background: var(--tone); border-bottom: var(--border) solid var(--c-content); }
.pcard--t1 { --tone: var(--c-t1); }
.pcard--t2 { --tone: var(--c-t2); }
.pcard--t3 { --tone: var(--c-t3); }
.pcard--t4 { --tone: var(--c-t4); }
.pcard:hover, .pcard:focus-within { transform: translate(-3px, -3px); box-shadow: 5px 5px 0 var(--c-shadow); }
.pcard__num {
	position: absolute; right: 14px; top: 14px;
	font: 800 2.4rem/1 var(--f-display); color: var(--tone);
	-webkit-text-stroke: 1.5px var(--c-content); opacity: 0.9;
}
.pcard__title { font-size: 1.08rem; line-height: 1.3; margin: 18px 40px 12px 0; flex: 1; }
.pcard__link { text-decoration: none; }
.pcard__link::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-md); }
.pcard__link:focus-visible { outline: none; box-shadow: none; }
.pcard:has(.pcard__link:focus-visible) { outline: 3px solid var(--c-hl); outline-offset: 3px; }
.pcard__meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; padding-right: 44px; font: 500 0.75rem var(--f-mono); color: var(--c-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.pcard__go {
	position: absolute; right: 14px; bottom: 14px; display: grid; place-items: center;
	width: 34px; height: 34px; border-radius: 50%; border: var(--border) solid var(--c-content);
	background: var(--c-base-100); transition: background-color 0.2s, transform 0.22s var(--ease);
}
.pcard:hover .pcard__go { background: var(--tone); transform: rotate(-35deg); }
.pcard__go .icon { width: 16px; height: 16px; }

@media (max-width: 1024px) { .popular__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
	.popular__grid { grid-template-columns: 1fr; gap: 12px; }
	.pcard { min-height: 0; }
}

/* ==========================================================================
   8. Single answer
   ========================================================================== */
.answer__head { padding-top: clamp(28px, 4vw, 48px); max-width: calc(var(--wrap)); }
.answer__badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.answer__title { font-size: clamp(2rem, 4.6vw, 3.5rem); font-weight: 800; line-height: 1.06; letter-spacing: -0.028em; max-width: 22ch; font-variation-settings: "opsz" 144; }
.answer__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font: 500 0.85rem var(--f-mono); color: var(--c-muted); margin-bottom: 0; }
.answer__meta span { display: inline-flex; align-items: center; gap: 6px; }

.answer__layout {
	display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: clamp(28px, 5vw, 64px);
	padding-top: 28px; padding-bottom: clamp(32px, 5vw, 56px); align-items: start;
}
.answer__layout--single { grid-template-columns: minmax(0, 820px); }
.answer__figure { margin: 0 0 28px; border: 2px solid var(--c-content); border-radius: var(--r-md); overflow: hidden; }
.answer__figure img { width: 100%; }

.answer__sheet {
	position: relative; padding: clamp(24px, 4vw, 44px) clamp(20px, 4vw, 44px) clamp(24px, 4vw, 40px) clamp(40px, 6vw, 76px);
	background: var(--c-surface); border: 2px solid var(--c-content); border-radius: var(--r-lg);
	box-shadow: 6px 6px 0 var(--c-shadow);
}
.answer__sheet::before {
	content: ""; position: absolute; top: 0; bottom: 0; left: clamp(22px, 3.6vw, 48px); width: 2px;
	background: color-mix(in srgb, var(--c-pen) 55%, transparent);
}

.answer__rail { position: sticky; top: calc(var(--head-h) + 24px); }
.admin-bar .answer__rail { top: calc(var(--head-h) + 56px); }
.rail { padding: 20px; border: var(--border) dashed var(--c-base-300); border-radius: var(--r-md); }
.rail__label { font: 700 0.72rem var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-muted); margin-bottom: 10px; }
.rail__toc { list-style: none; margin: 0 0 18px; padding: 0; counter-reset: toc; font-size: 0.92rem; }
.rail__toc:empty { display: none; }
.rail__toc li { counter-increment: toc; }
.rail__toc a {
	display: grid; grid-template-columns: 30px 1fr; gap: 4px; padding: 7px 0;
	text-decoration: none; color: var(--c-muted); border-bottom: 1px solid var(--c-base-300);
}
.rail__toc a::before { content: "A" counter(toc); font: 700 0.75rem/1.9 var(--f-mono); color: var(--c-pen); }
.rail__toc a:hover, .rail__toc a.is-active { color: var(--c-content); }
.rail__toc a.is-active { font-weight: 700; }

@media (max-width: 1000px) {
	.answer__layout { grid-template-columns: minmax(0, 1fr); }
	.answer__rail { display: none; }
}

.answer__tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.answer__tags a, .sa-tag {
	padding: 6px 12px; min-height: 36px; display: inline-flex; align-items: center;
	border: var(--border) solid var(--c-base-300); border-radius: 999px;
	font: 500 0.8rem var(--f-mono); text-decoration: none; color: var(--c-muted);
}
.answer__tags a:hover { border-color: var(--c-content); color: var(--c-content); }
.answer__slot, .sa-slot { margin-top: 28px; }

.nextprev { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 36px; }
.nextprev__item { padding: 18px 20px; border: var(--border) solid var(--c-base-300); border-radius: var(--r-md); position: relative; transition: border-color 0.2s; }
.nextprev__item:hover { border-color: var(--c-content); }
.nextprev__item--next { text-align: right; grid-column: 2; }
.nextprev__item span { display: block; font: 700 0.72rem var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-muted); margin-bottom: 6px; }
.nextprev__item a { font: 700 1.02rem/1.35 var(--f-display); text-decoration: none; }
.nextprev__item a::after { content: ""; position: absolute; inset: 0; }
@media (max-width: 600px) { .nextprev { grid-template-columns: 1fr; } .nextprev__item--next { grid-column: auto; } }

.section--popular { padding-top: 0; }

/* Breadcrumbs */
.crumbs { margin-bottom: 18px; font: 500 0.8rem var(--f-mono); color: var(--c-muted); }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--c-base-300); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

/* ==========================================================================
   9. Prose
   ========================================================================== */
.prose { font-size: 1.125rem; line-height: 1.75; counter-reset: ans; overflow-wrap: break-word; }
.prose > *:first-child { margin-top: 0; }
.prose > * + * { margin-top: 1.1em; }
.prose p { margin: 0; }
.prose h2 { font-size: 1.75rem; margin: 1.8em 0 0.6em; counter-increment: ans; position: relative; }
.prose h2::before {
	content: "A" counter(ans); position: absolute; right: calc(100% + 14px); top: 0.45em;
	font: 700 0.72rem var(--f-mono); color: var(--c-pen); background: var(--c-surface); padding: 2px 4px;
}
.prose h3 { font-size: 1.35rem; margin: 1.6em 0 0.5em; }
.prose h4 { font-size: 1.12rem; margin: 1.4em 0 0.4em; }
.prose a { color: var(--c-content); text-decoration-color: var(--c-pen); }
.prose a:hover { background: var(--c-hl); color: var(--c-hl-content); text-decoration: none; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.35em; }
.prose li::marker { color: var(--c-pen); font-weight: 700; }
.prose strong { font-weight: 700; }
.prose mark { background: var(--c-hl); color: var(--c-hl-content); padding: 0 3px; }
.prose blockquote {
	margin-inline: 0; padding: 16px 20px; border-left: 4px solid var(--c-hl);
	background: var(--c-base-200); border-radius: 0 var(--r-sm) var(--r-sm) 0;
	font-family: var(--f-display); font-size: 1.2rem; font-style: italic;
}
.prose blockquote p { margin: 0; }
.prose code { font-family: var(--f-mono); font-size: 0.88em; background: var(--c-base-200); padding: 2px 6px; border-radius: 5px; }
.prose pre { font-family: var(--f-mono); font-size: 0.9rem; background: #14162b; color: #eeeae0; padding: 18px; border-radius: var(--r-md); overflow-x: auto; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.98rem; display: block; overflow-x: auto; }
.prose table > tbody, .prose table > thead { display: table; width: 100%; border-collapse: collapse; }
.prose th, .prose td { padding: 10px 12px; border: 1px solid var(--c-base-300); text-align: left; }
.prose th { background: var(--c-base-200); font-weight: 700; }
.prose img { border-radius: var(--r-sm); }
.prose figure { margin-inline: 0; }
.prose figcaption, .wp-caption-text { font: 500 0.82rem var(--f-mono); color: var(--c-muted); margin-top: 8px; }
.prose hr { border: 0; border-top: 2px dashed var(--c-base-300); margin: 2em 0; }
.prose .wp-block-details, .prose details { border: var(--border) solid var(--c-base-300); border-radius: var(--r-sm); padding: 12px 16px; }
.prose summary { font-weight: 700; cursor: pointer; }
.alignleft { float: left; margin: 0.3em 1.4em 1em 0; }
.alignright { float: right; margin: 0.3em 0 1em 1.4em; }
.aligncenter { margin-inline: auto; }
.alignwide, .alignfull { margin-inline: 0; }
.wp-caption { max-width: 100%; }
.sticky, .bypostauthor, .gallery-caption { outline: 0; }

@media (max-width: 600px) {
	.prose { font-size: 1.06rem; }
	.prose h2::before { position: static; display: inline-block; margin-right: 8px; vertical-align: middle; }
}

/* ==========================================================================
   10. Comments
   ========================================================================== */
.discuss { margin-top: 48px; padding-top: 32px; border-top: 2px solid var(--c-content); }
.discuss__title { font-size: 1.6rem; }
.discuss__list, .discuss__list .children { list-style: none; margin: 0; padding: 0; }
.discuss__list .children { padding-left: clamp(16px, 4vw, 40px); border-left: 2px dashed var(--c-base-300); }
.note__body { padding: 18px 0; border-bottom: 1px solid var(--c-base-300); }
.note__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.note__avatar { border-radius: 50%; border: var(--border) solid var(--c-content); }
.note__author { font-weight: 700; }
.note__time { font: 500 0.78rem var(--f-mono); color: var(--c-muted); }
.note__pending { color: var(--c-pen); font-size: 0.9rem; }
.note__reply a { font: 700 0.8rem var(--f-mono); text-transform: uppercase; letter-spacing: 0.05em; }
.discuss__reply { font-size: 1.3rem; margin-top: 28px; }
.comment-form label { display: block; font-weight: 700; margin-bottom: 6px; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea {
	width: 100%; padding: 12px 14px; min-height: 48px; background: var(--c-surface); color: var(--c-content);
	border: var(--border) solid var(--c-base-300); border-radius: var(--r-sm); font: 400 1rem var(--f-body);
}
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--c-content); box-shadow: 3px 3px 0 var(--c-hl); }
.comment-form p { margin-bottom: 16px; }
.comment-form .comment-form-cookies-consent { display: flex; gap: 8px; align-items: start; }
.comment-form .comment-form-cookies-consent label { font-weight: 400; }

/* ==========================================================================
   11. Archive / search / 404 heads
   ========================================================================== */
.page-head { margin-bottom: 28px; }
.page-head__title { font-size: clamp(2rem, 4.4vw, 3.2rem); font-weight: 800; letter-spacing: -0.025em; }
.page-head__desc { color: var(--c-muted); max-width: 70ch; }
.page-head .askbar { margin-top: 20px; }

.lost { text-align: center; display: flex; flex-direction: column; align-items: center; }
.lost__mark {
	font: 800 clamp(7rem, 18vw, 12rem)/1 var(--f-display); margin: 0;
	color: var(--c-hl); -webkit-text-stroke: 3px var(--c-content); transform: rotate(8deg);
}
.lost__text { color: var(--c-muted); margin-bottom: 24px; }
.lost .askbar { width: 100%; margin-bottom: 20px; text-align: left; }

/* ==========================================================================
   12. Footer
   ========================================================================== */
.colophon { background: var(--c-foot); color: var(--c-foot-content); margin-top: clamp(32px, 6vw, 64px); }
.colophon__inner { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 28px 48px; padding-block: 48px 28px; }
.colophon .brand__img--light { display: none; }
.colophon .brand__img--dark { display: block; }
.colophon__note { margin: 16px 0 0; max-width: 46ch; opacity: 0.85; }
.colophon__menu { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 20px; list-style: none; margin: 0; padding: 0; }
.colophon__menu a { display: inline-flex; min-height: 44px; align-items: center; text-decoration: none; opacity: 0.85; }
.colophon__menu a:hover { opacity: 1; text-decoration: underline; text-decoration-color: var(--c-t1); }
.colophon__base {
	grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
	padding-top: 20px; border-top: 1.5px dashed rgba(236, 232, 220, 0.25); font: 500 0.82rem var(--f-mono);
}
.colophon__base p { margin: 0; opacity: 0.75; }
.colophon__top { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; text-decoration: none; color: var(--c-t1); }
@media (max-width: 720px) {
	.colophon__inner { grid-template-columns: 1fr; }
	.colophon__menu { justify-content: flex-start; }
}

/* ==========================================================================
   13. Motion preferences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
	.sheet, .sheet:hover { transform: none; }
}

@media print {
	.masthead, .colophon, .popular, .answer__rail, .discuss, .nextprev { display: none !important; }
	.answer__sheet { box-shadow: none; border: 0; padding: 0; }
	.answer__sheet::before { display: none; }
}
