/* ==========================================================================
   StudyDiscover — paper & ink
   Serif headlines (Newsreader), readable body (Atkinson Hyperlegible),
   warm paper background, navy ink, amber accent, highlighter marks.
   ========================================================================== */

:root {
	--paper: #fbfaf6;
	--surface: #ffffff;
	--tile: #f3efe4;
	--ink: #14213d;
	--ink-2: #2b3a55;
	--muted: #586174;
	--line: #e4dfd3;
	--line-2: #d3ccbb;
	--accent: #b45309;
	--accent-hover: #92400e;
	--accent-on-dark: #fbbf24;
	--mark: #ffd23f;
	--blue: #2f5bff;
	--blue-soft: #e4eaff;
	--coral: #ff6b4a;
	--coral-soft: #ffe6df;
	--mint: #2ed39a;
	--mint-soft: #dcf8ec;
	--sun: #ffd23f;
	--sun-soft: #fff4cc;
	--pink: #ff7ac6;
	--pink-soft: #ffe5f3;
	--bw: 2px;
	--margin-red: #e9a7a2;
	--rule-blue: #dbe5f1;
	--ok: #15803d;
	--ok-bg: #ecfdf3;
	--bad: #b91c1c;
	--bad-bg: #fef2f2;

	--serif: "Newsreader", Georgia, "Times New Roman", serif;
	--sans: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

	--r-sm: 6px;
	--r: 10px;
	--r-lg: 14px;
	--shadow-card: 0 1px 2px rgba(20, 33, 61, .06);
	--shadow-lift: 4px 4px 0 var(--ink);
	--shadow-paper: 0 1px 0 var(--line), 0 22px 40px -24px rgba(20, 33, 61, .45);
	--ease: cubic-bezier(.2, .7, .2, 1);
	--fast: 160ms;
	--med: 280ms;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
	margin: 0;
	font-family: var(--sans);
	font-size: 17px;
	line-height: 1.6;
	color: var(--ink);
	background: var(--paper);
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ink); text-decoration-color: var(--line-2); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; color: var(--ink); line-height: 1.12; margin: 0 0 .45em; letter-spacing: -.012em; }
h1, h2, h3 { text-wrap: balance; }
h1 { font-size: clamp(2.4rem, 5.2vw, 4.1rem); line-height: 1.04; }
h2 { font-size: clamp(1.75rem, 3.2vw, 2.6rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
mark { background: linear-gradient(transparent 58%, var(--mark) 58%, var(--mark) 92%, transparent 92%); color: inherit; padding: 0 .06em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }

.site-main { overflow-x: clip; }
.container { width: min(1180px, 100% - 48px); margin-inline: auto; }
.container.narrow { width: min(760px, 100% - 48px); }
.section { padding: clamp(56px, 8vw, 104px) 0; }
.screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.skip-link:focus { clip: auto; width: auto; height: auto; z-index: 999; top: 10px; left: 10px; background: #fff; padding: 10px 16px; border-radius: var(--r-sm); }
.hp-field { position: absolute; left: -9999px; }

/* ---------- Buttons & links ---------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: .5em;
	min-height: 44px; padding: .65em 1.2em; border-radius: var(--r-sm); border: 1px solid var(--ink);
	font-weight: 700; font-size: .95rem; line-height: 1.2; text-decoration: none; white-space: nowrap;
	transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast), color var(--fast);
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { color: #fff; background: var(--ink-2); }
.btn-ghost { background: var(--surface); color: var(--ink); }
.btn-ghost:hover { color: var(--ink); transform: translate(-2px, -2px); box-shadow: 2px 2px 0 var(--ink); }
.btn-light { background: #fff; color: var(--ink); }
.btn-sm { min-height: 38px; padding: .5em .9em; font-size: .9rem; }
.btn-lg { min-height: 52px; padding: .8em 1.5em; font-size: 1rem; }
.btn-danger { background: var(--bad-bg); color: var(--bad); border-color: #f3c4c4; }
.btn:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }
.btn:active:not(:disabled) { transform: translate(0, 1px); box-shadow: none; }

.text-link { display: inline-flex; align-items: center; gap: .4em; font-weight: 700; text-decoration: none; border-bottom: 2px solid var(--mark); padding-bottom: 2px; }
.text-link .icon { transition: transform var(--fast) var(--ease); }
.text-link:hover { color: var(--accent-hover); border-color: var(--accent); }
.text-link:hover .icon { transform: translateX(3px); }

.kicker, .eyebrow {
	display: inline-block; font-family: var(--sans); font-size: .78rem; font-weight: 700; letter-spacing: .12em;
	text-transform: uppercase; color: var(--accent); margin: 0 0 .8rem;
}

/* ---------- Header ---------- */
.site-header {
	position: sticky; top: 0; z-index: 100; background: rgba(251, 250, 246, .92);
	backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
	border-bottom: 1px solid transparent; transition: border-color var(--med);
}
.site-header.is-scrolled { border-color: var(--line); }
.header-inner { display: flex; align-items: center; gap: 24px; height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand:hover { color: var(--ink); }
.brand-mark {
	width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--r-sm);
	background: var(--ink); color: #fff; font-family: var(--serif); font-weight: 600; font-size: 1.3rem; font-style: italic;
	box-shadow: 3px 3px 0 var(--mark);
}
.brand-name { font-family: var(--serif); font-weight: 600; font-size: 1.45rem; letter-spacing: -.01em; }
.brand-name em { font-style: italic; color: var(--accent); }
.custom-logo { max-height: 44px; width: auto; }

.main-nav { margin-left: auto; }
.nav-list { list-style: none; display: flex; gap: 2px; margin: 0; padding: 0; }
.nav-list a {
	display: block; padding: 10px 12px; color: var(--ink); font-weight: 700; font-size: .95rem; text-decoration: none;
	border-bottom: 2px solid transparent; transition: border-color var(--fast), color var(--fast);
}
.nav-list a:hover, .nav-list .current-menu-item > a { border-color: var(--accent); color: var(--ink); }
.nav-list li { position: relative; }
.nav-list .sub-menu {
	position: absolute; list-style: none; margin: 0; padding: 6px; background: var(--surface); border: 1px solid var(--line);
	border-radius: var(--r); min-width: 220px; opacity: 0; visibility: hidden; transform: translateY(6px); transition: var(--fast) var(--ease);
}
.nav-list li:hover > .sub-menu, .nav-list li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: none; }

.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
	width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--r-sm);
	border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); transition: border-color var(--fast);
}
.icon-btn:hover { border-color: var(--ink); }
.menu-toggle { display: none; }
.menu-toggle .i-close, .menu-toggle[aria-expanded="true"] .i-open { display: none; }
.menu-toggle[aria-expanded="true"] .i-close { display: block; }
.header-search { border-top: 1px solid var(--line); padding: 14px 0; background: var(--paper); }

/* ---------- Search ---------- */
.search-form {
	position: relative; display: flex; align-items: center; gap: 8px; background: var(--surface);
	border: 1px solid var(--line-2); border-radius: var(--r); padding: 6px 6px 6px 46px;
	transition: border-color var(--fast), box-shadow var(--fast);
}
.search-form:focus-within { border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; }
.search-field { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 10px 0; font-size: 1rem; }
.search-field::placeholder { color: #8a90a0; }
.suggest {
	position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30; list-style: none; margin: 0;
	padding: 6px; background: var(--surface); border: 1px solid var(--ink); border-radius: var(--r); box-shadow: var(--shadow-lift);
}
.suggest a { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--r-sm); font-weight: 700; text-decoration: none; }
.suggest a:hover, .suggest a.is-active { background: var(--tile); color: var(--ink); }
.suggest .s-icon { width: 34px; height: 34px; display: grid; place-items: center; background: var(--tile); border-radius: var(--r-sm); }

/* ---------- Hero ---------- */
.hero { position: relative; padding: clamp(40px, 6vw, 80px) 0 0; overflow: hidden; }
.hero::before {
	content: ""; position: absolute; inset: 0 0 0 45%; pointer-events: none;
	background-image: linear-gradient(rgba(20, 33, 61, .055) 1px, transparent 1px), linear-gradient(90deg, rgba(20, 33, 61, .055) 1px, transparent 1px);
	background-size: 28px 28px;
	mask-image: radial-gradient(ellipse at 55% 45%, #000 20%, transparent 70%);
	-webkit-mask-image: radial-gradient(ellipse at 55% 45%, #000 20%, transparent 70%);
}
.hero-inner { position: relative; display: grid; grid-template-columns: 1.1fr .9fr; gap: 56px; align-items: center; }
.hero-copy h1 { max-width: 14ch; }
.hero-lead { font-size: 1.15rem; color: var(--muted); max-width: 54ch; }
.hero-search { max-width: 560px; margin: 28px 0 16px; }
.hero-popular { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; font-size: .95rem; color: var(--muted); margin: 0; }
.hero-popular span { font-weight: 700; }
.hero-popular a { font-weight: 700; color: var(--ink); text-decoration: underline; text-decoration-color: var(--mark); text-decoration-thickness: 3px; }
.hero-popular a:hover { text-decoration-color: var(--accent); }

/* 3D index-card deck */
.hero-deck { position: relative; height: 440px; perspective: 1300px; }
.deck {
	position: absolute; inset: 0; transform-style: preserve-3d;
	transform: rotateX(var(--rx, 8deg)) rotateY(var(--ry, -16deg));
	transition: transform .7s var(--ease);
}
.index-card {
	position: absolute; left: 50%; top: 50%; width: 360px; max-width: 86vw; min-height: 230px; margin: 0;
	padding: 18px 22px 18px 54px; border-radius: 4px; border: 1px solid var(--line);
	background:
		linear-gradient(90deg, transparent 40px, var(--margin-red) 40px, var(--margin-red) 41px, transparent 41px),
		linear-gradient(transparent 46px, #f4c8c4 46px, #f4c8c4 47px, transparent 47px),
		repeating-linear-gradient(transparent 0 27px, var(--rule-blue) 27px 28px) 0 47px / 100% calc(100% - 47px) no-repeat,
		#fff;
	box-shadow: var(--shadow-paper);
	transition: transform .7s var(--ease);
}
.ic-1 { transform: translate(-60%, -12%) translateZ(70px); }
.ic-2 { transform: translate(-46%, -54%) translateZ(0) rotateZ(3deg); }
.ic-3 { transform: translate(-32%, -96%) translateZ(-70px) rotateZ(6deg); }
.hero-deck:hover .ic-2 { transform: translate(-40%, -60%) translateZ(0) rotateZ(4deg); }
.hero-deck:hover .ic-3 { transform: translate(-22%, -106%) translateZ(-70px) rotateZ(8deg); }
.ic-label { font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 0 0 14px; line-height: 1; }
.ic-timer { font-family: var(--serif); font-size: 3.6rem; font-weight: 600; line-height: 1; margin: 6px 0 10px; font-variant-numeric: tabular-nums; }
.ic-note { color: var(--muted); font-size: .9rem; margin: 0; }
.ic-cite { font-family: var(--serif); font-size: 1.1rem; line-height: 28px; margin: 0; padding-left: 1.4em; text-indent: -1.4em; }
.ic-row { display: flex; gap: 16px; align-items: flex-end; }
.ic-row label { display: grid; gap: 2px; font-size: .85rem; color: var(--muted); font-weight: 700; }
.ic-row input {
	width: 92px; border: 0; border-bottom: 2px solid var(--ink); background: transparent; padding: 2px 0; outline: 0;
	font-family: var(--serif); font-size: 1.8rem; font-weight: 600; color: var(--ink);
}
.ic-row input:focus { border-color: var(--accent); }
.ic-result { display: flex; align-items: baseline; gap: 12px; margin: 14px 0 8px; }
.ic-result strong { font-family: var(--serif); font-size: 2.8rem; font-weight: 600; line-height: 1; }
.ic-result span { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; padding: 0 10px; border: 1.5px solid var(--accent); color: var(--accent); border-radius: 4px; transform: rotate(-3deg); }
.ic-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .9rem; }

.how-strip {
	list-style: none; margin: clamp(32px, 5vw, 56px) 0 0; padding: 18px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
	border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line);
}
.how-strip li { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.how-strip span {
	width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%;
	border: 1px solid var(--ink); font-family: var(--serif); font-style: italic;
}

/* ---------- Section heads ---------- */
.section-head { max-width: 680px; margin: 0 0 44px; }
.section-head p { color: var(--muted); font-size: 1.08rem; }
.section-head.row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; max-width: none; flex-wrap: wrap; }
.section-head.row h2 { margin: 0; }
.sub-head { font-size: 1.5rem; margin: 0 0 20px; }

/* ---------- Tool index ---------- */
.tool-empty { color: var(--muted); }
.tool-group { display: grid; grid-template-columns: 260px 1fr; gap: 40px; padding: 30px 0 34px; border-top: 1px solid var(--ink); }
.tool-group[hidden] { display: none; }
.tool-group-head { position: sticky; top: 96px; align-self: start; }
.group-num { display: block; font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: var(--accent); margin-bottom: 4px; }
.tool-group-head h3 { font-size: 1.55rem; margin-bottom: 6px; }
.tool-group-head p { color: var(--muted); font-size: .95rem; margin: 0; }

.tool-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tool-card {
	display: grid; grid-template-columns: 46px 1fr 20px; align-items: center; gap: 14px;
	padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line);
	text-decoration: none; color: var(--ink);
	transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), border-color var(--fast);
}
.tool-card[hidden] { display: none; }
.tool-card:hover { color: var(--ink); border-color: var(--ink); transform: translate(-2px, -2px); box-shadow: var(--shadow-lift); }
.tool-ico {
	width: 46px; height: 46px; display: grid; place-items: center; border-radius: var(--r-sm);
	background: var(--tile); color: var(--ink); border: 1px solid var(--line);
	transition: background var(--fast), color var(--fast);
}
.tool-card:hover .tool-ico { background: var(--mark); border-color: #f4d35e; }
.tool-ico.big { width: 68px; height: 68px; border-radius: var(--r); }
.tool-ico.sm { width: 34px; height: 34px; }
.tool-text { display: grid; gap: 1px; min-width: 0; }
.tool-name { font-weight: 700; font-size: 1.02rem; }
.tool-desc { font-size: .9rem; color: var(--muted); }
.tool-go { color: var(--muted); display: flex; transition: transform var(--fast) var(--ease), color var(--fast); }
.tool-card:hover .tool-go { color: var(--accent); transform: translateX(3px); }

/* ---------- Subjects ---------- */
.learning-section { background: var(--surface); border-block: 1px solid var(--line); }
.subject-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: 32px; border-top: 1px solid var(--ink); }
.subject-list li { border-bottom: 1px solid var(--line); }
.subject-list a { display: grid; grid-template-columns: 32px 1fr auto; gap: 14px; align-items: center; padding: 18px 8px; text-decoration: none; color: var(--ink); transition: background var(--fast); }
.subject-list a:hover { background: var(--paper); }
.subject-ico { color: var(--accent); display: flex; }
.subject-name { display: block; font-family: var(--serif); font-size: 1.25rem; font-weight: 600; }
.subject-desc { display: block; font-size: .9rem; color: var(--muted); }
.subject-count { font-size: .8rem; font-weight: 700; color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: 1px 9px; }

/* ---------- Quizzes ---------- */
.quiz-panel {
	display: grid; grid-template-columns: 1.1fr .9fr; gap: 56px; align-items: center;
	background: var(--ink); color: #e8ebf2; border-radius: var(--r-lg); padding: clamp(32px, 5vw, 64px);
}
.quiz-panel h2 { color: #fff; }
.quiz-panel .kicker { color: var(--accent-on-dark); }
.quiz-copy > p { color: #c7cedb; }
.quiz-links { list-style: none; margin: 24px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
.quiz-links a {
	display: flex; align-items: center; gap: 12px; padding: 14px 0; color: #fff; text-decoration: none; font-weight: 700;
	border-bottom: 1px solid rgba(255, 255, 255, .14); transition: color var(--fast);
}
.quiz-links a span { flex: 1; }
.quiz-links .quiz-arrow { opacity: .5; transition: transform var(--fast) var(--ease), opacity var(--fast); }
.quiz-links a:hover { color: var(--accent-on-dark); }
.quiz-links a:hover .quiz-arrow { opacity: 1; transform: translateX(3px); }
.sample-q {
	color: var(--ink); background: #fff; padding: 22px 24px; border-radius: 4px; box-shadow: 0 30px 50px -24px rgba(0, 0, 0, .6);
	transform: perspective(900px) rotateY(-6deg) rotateZ(-1.5deg);
}
.sample-text { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; line-height: 1.25; margin-bottom: 16px; }
.sample-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sample-options button {
	min-height: 46px; text-align: left; padding: 10px 14px; border-radius: var(--r-sm); background: var(--paper);
	border: 1px solid var(--line-2); font-weight: 700; transition: border-color var(--fast), background var(--fast);
}
.sample-options button:hover:not(:disabled) { border-color: var(--ink); }
.sample-options button.is-correct { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.sample-options button.is-wrong { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.sample-options button:disabled { cursor: default; }
.sample-feedback { min-height: 26px; margin: 12px 0 0; font-weight: 700; }

/* ---------- Posts ---------- */
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.post-card {
	display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
	overflow: hidden; transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), border-color var(--fast);
}
.post-card:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lift); border-color: var(--ink); }
.post-thumb { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--tile); border-bottom: 1px solid var(--line); }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-fallback {
	display: grid; place-items: center; color: var(--ink);
	background: repeating-linear-gradient(transparent 0 23px, rgba(20, 33, 61, .07) 23px 24px), var(--tile);
}
.post-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.post-cat { align-self: flex-start; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); text-decoration: none; margin-bottom: 8px; }
.post-title { font-size: 1.35rem; margin-bottom: 8px; }
.post-title a { text-decoration: none; }
.post-title a:hover { color: var(--accent-hover); }
.post-excerpt { color: var(--muted); font-size: .95rem; flex: 1; }
.post-meta { display: flex; justify-content: space-between; align-items: center; font-size: .88rem; color: var(--muted); margin: 0; }
.read-more { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--ink); text-decoration: none; }
.empty-note { color: var(--muted); grid-column: 1 / -1; padding: 28px; border: 1px dashed var(--line-2); border-radius: var(--r); margin: 0; }

/* ---------- Guides ---------- */
.guides-section { background: var(--surface); border-block: 1px solid var(--line); }
.guides { display: grid; grid-template-columns: 1fr 1.15fr; gap: 64px; align-items: start; }
.guides-copy p { color: var(--muted); }
.guide-list { list-style: none; counter-reset: g; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.guide-list li { counter-increment: g; border-bottom: 1px solid var(--line); }
.guide-list a { display: flex; gap: 18px; align-items: baseline; padding: 18px 4px; font-family: var(--serif); font-size: 1.3rem; font-weight: 500; text-decoration: none; }
.guide-list a::before { content: counter(g, decimal-leading-zero); font-style: italic; color: var(--accent); font-size: 1rem; min-width: 2ch; }
.guide-list a:hover { color: var(--accent-hover); background: var(--paper); }

/* ---------- Facts (3D index-card flip) ---------- */
.fact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.flip-card { border: 0; padding: 0; background: none; perspective: 1100px; height: 220px; text-align: left; }
.flip-inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .7s var(--ease); }
.flip-card:hover .flip-inner { transform: rotateY(-6deg) rotateX(3deg); }
.flip-card.is-flipped .flip-inner { transform: rotateY(180deg); }
.flip-face {
	position: absolute; inset: 0; display: flex; flex-direction: column; padding: 18px 20px 18px 52px; border-radius: 4px;
	backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: var(--shadow-paper);
}
.flip-front {
	border: 1px solid var(--line);
	background:
		linear-gradient(90deg, transparent 38px, var(--margin-red) 38px, var(--margin-red) 39px, transparent 39px),
		repeating-linear-gradient(transparent 0 27px, var(--rule-blue) 27px 28px) 0 44px / 100% calc(100% - 44px) no-repeat,
		#fff;
}
.flip-back { background: var(--ink); color: #fff; transform: rotateY(180deg); padding-left: 24px; }
.fact-tag { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.flip-back .fact-tag { color: var(--accent-on-dark); }
.fact-q { font-family: var(--serif); font-weight: 600; font-size: 1.3rem; line-height: 28px; margin-top: 14px; flex: 1; }
.fact-hint { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted); font-weight: 700; }
.fact-a { font-size: 1.02rem; line-height: 1.55; margin-top: 12px; }

/* ---------- Newsletter ---------- */
.newsletter-box {
	display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center;
	padding: clamp(28px, 4vw, 48px); background: var(--surface); border: 1px solid var(--ink); border-radius: var(--r-lg);
	box-shadow: 6px 6px 0 var(--mark);
}
.newsletter-box h2 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); }
.newsletter-box p { color: var(--muted); margin: 0; }
.newsletter-form { display: flex; gap: 8px; }
.newsletter-form input[type="email"] {
	flex: 1; min-width: 0; min-height: 48px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 10px 14px; background: var(--paper); outline: 0;
}
.newsletter-form input[type="email"]:focus { border-color: var(--ink); background: #fff; }
.form-note { font-size: .85rem; color: var(--muted); margin: 10px 0 0 !important; }
.form-msg { font-weight: 700; margin: 10px 0 0 !important; }
.form-msg.ok { color: var(--ok); }
.form-msg.err { color: var(--bad); }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #c4cad6; padding: 64px 0 0; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px; }
.site-footer h3 { color: #fff; font-family: var(--sans); font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 16px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.site-footer a { color: #c4cad6; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; text-decoration-color: var(--accent-on-dark); }
.site-footer .brand { color: #fff; }
.site-footer .brand-name em { color: var(--accent-on-dark); }
.footer-about p { margin-top: 12px; max-width: 34ch; }
.socials { display: flex; gap: 8px; margin-top: 16px; }
.socials a { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r-sm); border: 1px solid rgba(255, 255, 255, .2); color: #fff; }
.socials a:hover { border-color: #fff; text-decoration: none; }
.site-footer .nav-list { flex-direction: column; gap: 8px; }
.site-footer .nav-list a { padding: 0; border: 0; font-weight: 400; font-size: 1rem; color: #c4cad6; }
.site-footer .nav-list a:hover { color: #fff; }
.footer-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 24px 0; margin-top: 48px; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .9rem; }
.footer-bottom p { margin: 0; }
.legal-links { display: flex !important; flex-wrap: wrap; gap: 18px !important; }
.to-top {
	position: fixed; right: 20px; bottom: 20px; width: 46px; height: 46px; display: grid; place-items: center; border-radius: var(--r-sm);
	background: var(--surface); color: var(--ink); border: 1px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); z-index: 90;
	opacity: 0; visibility: hidden; transition: opacity var(--med), visibility var(--med);
}
.to-top.is-visible { opacity: 1; visibility: visible; }
.to-top:hover { color: var(--ink); background: var(--mark); }

/* ---------- Inner pages ---------- */
.page-hero { padding: clamp(36px, 5vw, 64px) 0 clamp(28px, 4vw, 44px); border-bottom: 1px solid var(--line); }
.page-hero h1 { font-size: clamp(2rem, 4vw, 3.1rem); }
.page-hero .lead, .tool-title .lead { color: var(--muted); font-size: 1.12rem; max-width: 60ch; margin: 0; }
.title-icon { display: inline-flex; vertical-align: -4px; color: var(--accent); }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: .9rem; color: var(--muted); margin-bottom: 18px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--ink); }
.page-search, .tool-search { max-width: 560px; margin-top: 24px; }
.tool-search .search-field { width: 100%; min-height: 50px; border: 1px solid var(--line-2); border-radius: var(--r); padding: 12px 16px; background: var(--surface); outline: 0; }
.tool-search .search-field:focus { border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.tool-title { display: flex; align-items: center; gap: 22px; }
.tool-title h1 { margin: 0 0 6px; }
.tool-title .kicker { margin-bottom: 6px; }
.tool-section { padding-top: 36px; }
.privacy-note { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: .88rem; color: var(--muted); margin-top: 14px; }
.tool-guide { background: var(--surface); border-block: 1px solid var(--line); }
.howto { padding-left: 1.2em; }
.howto li { margin-bottom: 8px; }
.empty-state { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty-state .icon { color: var(--line-2); margin-bottom: 12px; }
.search-tools { margin-bottom: 48px; }

.article-hero h1 { max-width: 22ch; }
.article-meta { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: .95rem; margin: 0; }
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 56px; padding: 40px 0 64px; }
.article-figure { margin: 0 0 30px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); }
.aside-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.aside-box.sticky { position: sticky; top: 96px; }
.aside-box h2 { font-size: 1.15rem; }
.aside-tools { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.aside-tools a { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: var(--r-sm); font-weight: 700; font-size: .95rem; text-decoration: none; }
.aside-tools a:hover { background: var(--tile); color: var(--ink); }
.related-posts { background: var(--surface); border-top: 1px solid var(--line); }

/* Article typography */
.entry-content { font-size: 1.1rem; line-height: 1.75; }
.entry-content > * + * { margin-top: 1.15em; }
.entry-content h2 { font-size: 1.85rem; margin-top: 1.8em; }
.entry-content h3 { font-size: 1.4rem; margin-top: 1.5em; }
.entry-content a { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1.5px; }
.entry-content ul, .entry-content ol { padding-left: 1.4em; }
.entry-content li + li { margin-top: .4em; }
.entry-content blockquote { margin-left: 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--accent); font-family: var(--serif); font-size: 1.3rem; }
.entry-content table { width: 100%; border-collapse: collapse; font-size: .97rem; display: block; overflow-x: auto; }
.entry-content th, .entry-content td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; }
.entry-content th { border-bottom: 1px solid var(--ink); }
.entry-content img { border-radius: var(--r); }
.entry-content code { background: var(--tile); padding: 2px 6px; border-radius: 4px; font-size: .92em; }
.entry-content figcaption { font-size: .9rem; color: var(--muted); }
.alignwide { width: min(1100px, 100vw - 48px); margin-inline: 50%; transform: translateX(-50%); }

.pagination { margin-top: 44px; display: flex; justify-content: center; }
.pagination ul { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0; }
.pagination a, .pagination span { display: grid; place-items: center; min-width: 44px; height: 44px; padding: 0 12px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line-2); font-weight: 700; text-decoration: none; }
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }

.comments-area { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line); }
.comment-list { padding-left: 0; list-style: none; }
.comment-form input:not([type="submit"]):not([type="checkbox"]), .comment-form textarea { width: 100%; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 10px 14px; background: #fff; }
.comment-form .submit { background: var(--ink); color: #fff; border: 0; min-height: 44px; padding: 10px 20px; border-radius: var(--r-sm); font-weight: 700; }

.not-found { text-align: center; }
.not-found .page-search { margin-inline: auto; }
.big-404 { font-family: var(--serif); font-style: italic; font-size: clamp(5rem, 14vw, 9rem); line-height: 1; color: var(--accent); margin: 0 0 10px; }

/* ==========================================================================
   Tool UI (assets/js/tools.js)
   ========================================================================== */
.tool-app { position: relative; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: clamp(20px, 4vw, 40px); min-height: 220px; box-shadow: var(--shadow-card); }
.tool-loading { display: flex; justify-content: center; gap: 8px; padding: 60px 0; }
.tool-loading span { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); animation: dots 1s infinite alternate; }
.tool-loading span:nth-child(2) { animation-delay: .2s; }
.tool-loading span:nth-child(3) { animation-delay: .4s; }
@keyframes dots { to { background: var(--ink); } }

.t-grid { display: grid; gap: 16px; }
.t-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.t-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.t-split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.t-field { display: flex; flex-direction: column; gap: 6px; }
.t-field > span, .t-label { font-weight: 700; font-size: .9rem; color: var(--ink); }
.t-input, .t-select, .t-textarea {
	width: 100%; min-height: 46px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 10px 12px; background: var(--paper); outline: 0;
	transition: border-color var(--fast), background var(--fast), box-shadow var(--fast);
}
.t-input:focus, .t-select:focus, .t-textarea:focus { border-color: var(--ink); background: #fff; box-shadow: 2px 2px 0 var(--ink); }
.t-textarea { min-height: 220px; resize: vertical; line-height: 1.6; }
.t-row { display: grid; gap: 10px; align-items: center; }
.t-rows { display: grid; gap: 10px; margin-bottom: 14px; }
.t-row-head { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.t-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.t-x { width: 44px; height: 46px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--muted); font-size: 1.2rem; }
.t-x:hover { color: var(--bad); border-color: var(--bad); }
.t-result { border-radius: var(--r); padding: 24px; color: #e8ebf2; text-align: center; background: var(--ink); }
.t-result .t-big { font-family: var(--serif); font-size: clamp(2.6rem, 6vw, 3.8rem); font-weight: 600; line-height: 1.05; display: block; color: #fff; margin: 4px 0; }
.t-result .t-sub { color: #c7cedb; font-size: .95rem; }
.t-result.pop .t-big { animation: pop .3s var(--ease); }
@keyframes pop { from { transform: translateY(6px); opacity: .3; } }
.t-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.t-stat { padding: 14px; border-radius: var(--r-sm); background: var(--paper); border: 1px solid var(--line); text-align: center; }
.t-stat strong { display: block; font-family: var(--serif); font-size: 1.7rem; font-weight: 600; line-height: 1.2; }
.t-stat span { font-size: .82rem; color: var(--muted); font-weight: 700; }
.t-note { font-size: .9rem; color: var(--muted); margin: 12px 0 0; }
.t-tabs { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.t-tab { border: 0; background: none; padding: 10px 0; margin-bottom: -1px; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; min-height: 44px; }
.t-tab:hover { color: var(--ink); }
.t-tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }
.t-output { padding: 18px; border-radius: var(--r-sm); background: var(--paper); border: 1px dashed var(--line-2); font-size: 1.02rem; line-height: 1.7; word-break: break-word; }
.t-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.t-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--paper); border: 1px solid var(--line); }
.t-item.is-done .t-item-text { text-decoration: line-through; opacity: .55; }
.t-item-text { flex: 1; min-width: 0; }
.t-item small { color: var(--muted); }
.t-check { width: 22px; height: 22px; accent-color: var(--ink); }
.t-progress { height: 8px; border-radius: 999px; background: var(--tile); overflow: hidden; }
.t-progress > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s var(--ease); }
.t-empty { text-align: center; color: var(--muted); padding: 20px; }
.t-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--tile); border: 1px solid var(--line-2); font-weight: 700; font-size: .82rem; }

/* Pomodoro */
.pomo { display: grid; justify-items: center; gap: 20px; }
.pomo-ring { position: relative; width: min(290px, 78vw); aspect-ratio: 1; }
.pomo-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.pomo-ring circle { fill: none; stroke-width: 10; }
.pomo-ring .bg { stroke: var(--tile); }
.pomo-ring .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.pomo-time { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.pomo-time strong { font-family: var(--serif); font-size: clamp(3rem, 10vw, 4.4rem); font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
.pomo-time span { color: var(--muted); font-weight: 700; }
.pomo .t-tabs { border: 0; justify-content: center; }

/* Countdown */
.cd-units { display: flex; gap: 6px; }
.cd-unit { min-width: 56px; padding: 6px; border-radius: var(--r-sm); background: #fff; border: 1px solid var(--line); text-align: center; }
.cd-unit strong { display: block; font-family: var(--serif); font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.cd-unit span { font-size: .7rem; color: var(--muted); font-weight: 700; text-transform: uppercase; }

/* Flashcards (index cards) */
.fc-stage { perspective: 1200px; max-width: 560px; margin: 0 auto; }
.fc-card { position: relative; height: 280px; cursor: pointer; transform-style: preserve-3d; transition: transform .6s var(--ease); }
.fc-card.is-flipped { transform: rotateY(180deg); }
.fc-face {
	position: absolute; inset: 0; display: grid; place-items: center; padding: 30px 30px 30px 60px; text-align: center; border-radius: 4px;
	backface-visibility: hidden; -webkit-backface-visibility: hidden; font-family: var(--serif); font-size: 1.5rem; font-weight: 600; box-shadow: var(--shadow-paper);
}
.fc-front {
	border: 1px solid var(--line);
	background: linear-gradient(90deg, transparent 42px, var(--margin-red) 42px, var(--margin-red) 43px, transparent 43px), repeating-linear-gradient(transparent 0 31px, var(--rule-blue) 31px 32px), #fff;
}
.fc-back { background: var(--ink); color: #fff; transform: rotateY(180deg); padding-left: 30px; }
.fc-front .t-badge { font-family: var(--sans); font-size: .78rem; }
.fc-nav { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

/* Quiz */
.quiz-q { font-family: var(--serif); font-size: 1.55rem; font-weight: 600; line-height: 1.25; margin-bottom: 18px; }
.quiz-options { display: grid; gap: 8px; }
.quiz-opt {
	display: flex; align-items: center; gap: 12px; text-align: left; min-height: 52px; padding: 12px 16px; border-radius: var(--r-sm);
	background: var(--paper); border: 1px solid var(--line-2); font-weight: 700; transition: border-color var(--fast), background var(--fast);
}
.quiz-opt:hover:not(:disabled) { border-color: var(--ink); background: #fff; }
.quiz-opt .opt-key { width: 28px; height: 28px; flex-shrink: 0; display: grid; place-items: center; border-radius: 4px; border: 1px solid var(--line-2); font-size: .85rem; }
.quiz-opt.is-correct { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.quiz-opt.is-correct .opt-key { border-color: var(--ok); }
.quiz-opt.is-wrong { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
.quiz-opt.is-wrong .opt-key { border-color: var(--bad); }
.quiz-opt:disabled { cursor: default; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; font-weight: 700; color: var(--muted); }
.quiz-feedback { min-height: 28px; margin-top: 14px; font-weight: 700; }
.quiz-feedback.ok { color: var(--ok); }
.quiz-feedback.bad { color: var(--bad); }
.quiz-topics { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.quiz-topic { min-height: 44px; padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); font-weight: 700; transition: border-color var(--fast); }
.quiz-topic:hover { border-color: var(--ink); }
.quiz-topic.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.quiz-end { text-align: center; }
.score-ring { width: 160px; height: 160px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--tile) 0); }
.score-ring span { width: 130px; height: 130px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-family: var(--serif); font-size: 2.3rem; font-weight: 600; }

/* Scientific calculator */
.calc { max-width: 460px; margin: 0 auto; }
.calc-screen { background: var(--ink); color: #fff; border-radius: var(--r); padding: 16px 20px; margin-bottom: 12px; text-align: right; }
.calc-expr { min-height: 24px; font-size: 1rem; color: #aeb7c8; word-break: break-all; }
.calc-out { font-family: var(--serif); font-size: 2.4rem; font-weight: 600; word-break: break-all; font-variant-numeric: tabular-nums; }
.calc-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.calc-keys button { height: 52px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper); font-weight: 700; color: var(--ink); transition: background var(--fast), border-color var(--fast); }
.calc-keys button:hover { border-color: var(--ink); background: #fff; }
.calc-keys button:active { background: var(--tile); }
.calc-keys .k-op { background: var(--tile); }
.calc-keys .k-fn { font-size: .9rem; color: var(--ink-2); }
.calc-keys .k-eq { background: var(--ink); color: #fff; border-color: var(--ink); }
.calc-keys .k-eq:hover { background: var(--ink-2); }
.calc-keys .k-clr { color: var(--bad); }

.readability-meter { position: relative; height: 10px; border-radius: 999px; background: linear-gradient(90deg, #dc2626, #d97706, #16a34a); margin: 18px 0 6px; }
.readability-meter i { position: absolute; top: -6px; width: 4px; height: 22px; border-radius: 2px; background: var(--ink); transform: translateX(-50%); transition: left .5s var(--ease); }
.kw-list { display: flex; flex-wrap: wrap; gap: 8px; }


/* ==========================================================================
   Bold layer: flat saturated colours, 2px ink borders, hard shadows
   ========================================================================== */
.cat-math, .c1 { --c: var(--blue); --c-soft: var(--blue-soft); --on-c: #fff; }
.cat-study, .c2 { --c: var(--coral); --c-soft: var(--coral-soft); --on-c: var(--ink); }
.cat-writing, .c3 { --c: var(--mint); --c-soft: var(--mint-soft); --on-c: var(--ink); }
.cat-gk, .c4 { --c: var(--sun); --c-soft: var(--sun-soft); --on-c: var(--ink); }
.cat-science, .c5 { --c: var(--pink); --c-soft: var(--pink-soft); --on-c: var(--ink); }
.cat-all { --c: var(--ink); --c-soft: var(--tile); --on-c: #fff; }

.btn { border-width: var(--bw); }
.btn-primary { box-shadow: 3px 3px 0 var(--sun); }
.btn-primary:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--sun); }
.btn-primary:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--sun); }
.kicker {
	color: var(--ink); background: var(--sun); border: var(--bw) solid var(--ink); border-radius: 999px;
	padding: 3px 12px; letter-spacing: .1em; box-shadow: 2px 2px 0 var(--ink);
}
.eyebrow { color: var(--ink); }
.eyebrow::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--mint); border: 2px solid var(--ink); margin-right: 8px; vertical-align: -1px; }
.brand-mark { box-shadow: 3px 3px 0 var(--coral); border: var(--bw) solid var(--ink); }
.brand-name em { color: var(--blue); }
.nav-list a:hover, .nav-list .current-menu-item > a { border-color: var(--coral); }
.search-form { border: var(--bw) solid var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.search-form:focus-within { box-shadow: 4px 4px 0 var(--blue); }

/* Highlighter draws in */
mark { background: linear-gradient(var(--sun), var(--sun)) no-repeat 0 85% / 100% 38%; }
.js .hero mark { animation: highlight .9s var(--ease) .5s both; }
@keyframes highlight { from { background-size: 0 38%; } }

/* Hero deck */
.hero::before { display: none; }
.deck-bg {
	position: absolute; inset: 4% 2% 12% 6%; border-radius: 22px; border: var(--bw) solid var(--ink);
	background: linear-gradient(rgba(255, 255, 255, .14) 1px, transparent 1px) 0 0 / 26px 26px, linear-gradient(90deg, rgba(255, 255, 255, .14) 1px, transparent 1px) 0 0 / 26px 26px, var(--blue);
	box-shadow: 8px 8px 0 var(--ink); transform: rotate(2.5deg);
}
.deck-bg::after {
	content: ""; position: absolute; width: 74px; height: 74px; right: -18px; top: -18px; border-radius: 50%;
	background: var(--sun); border: var(--bw) solid var(--ink);
}
.index-card { border: var(--bw) solid var(--ink); box-shadow: 6px 6px 0 var(--ink); }
.index-card.pos-0 { transform: translate(-56%, -44%) translateZ(80px) rotateZ(-2deg); z-index: 3; }
.index-card.pos-1 { transform: translate(-40%, -74%) translateZ(0) rotateZ(4deg); z-index: 2; }
.index-card.pos-2 { transform: translate(-24%, -104%) translateZ(-80px) rotateZ(9deg); z-index: 1; }
.index-card:not(.pos-0) { cursor: pointer; }
.index-card:not(.pos-0) > * { pointer-events: none; }
.index-card:not(.pos-0):hover { box-shadow: 6px 6px 0 var(--sun); }
.hero-deck:hover .index-card.pos-1 { transform: translate(-36%, -80%) translateZ(0) rotateZ(6deg); }
.hero-deck:hover .index-card.pos-2 { transform: translate(-16%, -114%) translateZ(-80px) rotateZ(11deg); }
.index-card .ic-label {
	display: inline-block; color: var(--ink); background: var(--blue-soft); border: var(--bw) solid var(--ink);
	padding: 3px 10px; border-radius: 999px; font-size: .7rem;
}
.index-card[data-card="0"] .ic-label { background: var(--sun); }
.index-card[data-card="1"] .ic-label { background: var(--coral); }
.index-card[data-card="2"] .ic-label { background: var(--mint); }
.ic-result span { border-width: var(--bw); border-color: var(--ink); color: var(--ink); background: var(--tile); transition: background var(--fast); }
.ic-result span.grade-a { background: var(--mint); }
.ic-result span.grade-b { background: var(--blue); color: #fff; }
.ic-result span.grade-c { background: var(--sun); }
.ic-result span.grade-d { background: var(--coral); }
.ic-result span.grade-f { background: var(--pink); }
.ic-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ic-btn {
	min-height: 40px; padding: 6px 16px; border-radius: var(--r-sm); border: var(--bw) solid var(--ink);
	background: var(--ink); color: #fff; font-weight: 700; box-shadow: 2px 2px 0 var(--coral);
}
.ic-btn.ghost { background: #fff; color: var(--ink); box-shadow: none; }
.ic-btn:active { transform: translate(2px, 2px); box-shadow: none; }
.is-running .ic-timer { color: var(--coral); animation: tick 1s steps(2) infinite; }
@keyframes tick { 50% { opacity: .75; } }
.ic-switch { display: inline-flex; border: var(--bw) solid var(--ink); border-radius: var(--r-sm); overflow: hidden; margin-bottom: 10px; }
.ic-switch button { border: 0; background: #fff; padding: 6px 14px; font-weight: 700; min-height: 36px; }
.ic-switch button + button { border-left: var(--bw) solid var(--ink); }
.ic-switch button[aria-checked="true"] { background: var(--mint); }
.ic-cite { font-size: 1.02rem; }
.ic-cite.swap { animation: swap .35s var(--ease); }
@keyframes swap { from { opacity: 0; transform: translateY(6px); } }
.ic-link { margin-top: 6px; }
.deck-nav {
	position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 5; display: flex; gap: 6px;
	padding: 5px; background: #fff; border: var(--bw) solid var(--ink); border-radius: 999px; box-shadow: 3px 3px 0 var(--ink);
}
.deck-nav button { border: 0; background: none; border-radius: 999px; padding: 6px 14px; min-height: 36px; font-weight: 700; color: var(--ink); }
.deck-nav button:hover { background: var(--tile); }
.deck-nav button[aria-selected="true"] { background: var(--sun); }

.how-strip { border-top: var(--bw) solid var(--ink); }
.how-strip li:nth-child(1) span { background: var(--blue); color: #fff; }
.how-strip li:nth-child(2) span { background: var(--coral); }
.how-strip li:nth-child(3) span { background: var(--mint); }
.how-strip span { border-width: var(--bw); }

/* Ticker */
.ticker { margin: clamp(36px, 5vw, 60px) -20px 0; background: var(--sun); border-block: var(--bw) solid var(--ink); transform: rotate(-1.2deg); overflow: hidden; }
.ticker-track { display: flex; width: max-content; animation: ticker 55s linear infinite; }
.ticker:hover .ticker-track, .ticker:focus-within .ticker-track { animation-play-state: paused; }
.ticker-list { display: flex; list-style: none; margin: 0; padding: 0; }
.ticker-list a { display: inline-flex; align-items: center; gap: 10px; padding: 14px 26px; font-weight: 700; text-decoration: none; color: var(--ink); white-space: nowrap; }
.ticker-list a:hover { background: var(--ink); color: #fff; }
.ticker-list .icon { width: 30px; height: 30px; padding: 5px; border-radius: 50%; background: var(--c); color: var(--on-c); border: var(--bw) solid var(--ink); }
@keyframes ticker { to { transform: translateX(-50%); } }

/* Tool finder */
.tool-finder { display: grid; gap: 16px; margin-bottom: 36px; }
.finder-search {
	display: flex; align-items: center; gap: 12px; max-width: 560px; padding: 0 16px; background: #fff;
	border: var(--bw) solid var(--ink); border-radius: var(--r); box-shadow: 4px 4px 0 var(--ink);
}
.finder-search:focus-within { box-shadow: 4px 4px 0 var(--blue); }
.finder-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; min-height: 52px; font-size: 1.05rem; }
.need-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.need-label { font-family: var(--serif); font-style: italic; font-size: 1.15rem; margin-right: 4px; }
.need-chip {
	min-height: 42px; padding: 6px 16px; border-radius: 999px; border: var(--bw) solid var(--ink); background: #fff;
	font-weight: 700; color: var(--ink); transition: transform var(--fast) var(--ease), box-shadow var(--fast), background var(--fast);
}
.need-chip:hover { background: var(--c-soft); transform: translate(-1px, -1px); box-shadow: 2px 2px 0 var(--ink); }
.need-chip.is-active { background: var(--c); color: var(--on-c); box-shadow: 3px 3px 0 var(--ink); }

/* Tool index */
.tool-group { border-top: var(--bw) solid var(--ink); }
.group-num {
	display: inline-grid; place-items: center; width: 46px; height: 46px; margin-bottom: 12px; border-radius: var(--r-sm);
	background: var(--c); color: var(--on-c); border: var(--bw) solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
	font-size: 1.2rem; font-weight: 600;
}
.tool-card { border: var(--bw) solid var(--ink); }
.tool-card:hover { background: var(--c-soft); box-shadow: 4px 4px 0 var(--ink); }
.tool-ico { background: var(--c); color: var(--on-c); border: var(--bw) solid var(--ink); transition: transform var(--fast) var(--ease); }
.tool-card:hover .tool-ico { background: var(--c); border-color: var(--ink); transform: rotate(-8deg) scale(1.06); }
.tool-card:hover .tool-go { color: var(--ink); }

/* Subjects */
.learning-section { background: var(--paper); }
.subject-list { border-top: var(--bw) solid var(--ink); }
.subject-ico { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--c); color: var(--on-c); border: var(--bw) solid var(--ink); transition: transform var(--fast) var(--ease); }
.subject-list a { grid-template-columns: 40px 1fr auto; }
.subject-list a:hover { background: var(--c-soft, var(--tile)); }
.subject-list li:hover .subject-ico { transform: rotate(-10deg) scale(1.08); }

/* Quiz panel */
.quiz-panel { background: var(--blue); color: #fff; border: var(--bw) solid var(--ink); box-shadow: 8px 8px 0 var(--ink); }
.quiz-copy > p { color: #eef1ff; }
.quiz-panel .kicker { color: var(--ink); }
.quiz-links a { border-bottom-color: rgba(255, 255, 255, .3); }
.quiz-links a:hover { color: var(--sun); }
.sample-q { border: var(--bw) solid var(--ink); box-shadow: 8px 8px 0 var(--ink); border-radius: var(--r); }
.sample-q.bump { animation: bump .4s var(--ease); }
@keyframes bump { 40% { transform: perspective(900px) rotateY(-6deg) rotateZ(-1.5deg) scale(1.03); } }
.sample-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sample-top .ic-label { display: inline-block; background: var(--pink); color: var(--ink); border: var(--bw) solid var(--ink); padding: 3px 10px; border-radius: 999px; margin: 0; }
.sample-streak { margin: 0; font-weight: 700; }
.sample-streak strong { display: inline-grid; place-items: center; min-width: 32px; height: 32px; margin-left: 4px; border-radius: 50%; background: var(--sun); border: var(--bw) solid var(--ink); }
.sample-dots { list-style: none; display: flex; gap: 6px; padding: 0; margin: 14px 0 10px; }
.sample-dots li { flex: 1; height: 8px; border-radius: 999px; background: var(--tile); border: 1.5px solid var(--ink); }
.sample-dots li.is-now { background: var(--sun); }
.sample-dots li.is-right { background: var(--mint); }
.sample-dots li.is-wrong { background: var(--coral); }
.sample-options button { border: var(--bw) solid var(--ink); background: #fff; }
.sample-options button:hover:not(:disabled) { background: var(--sun-soft); transform: translate(-1px, -1px); box-shadow: 2px 2px 0 var(--ink); }
.sample-options button.is-correct { background: var(--mint); color: var(--ink); border-color: var(--ink); }
.sample-options button.is-wrong { background: var(--coral); color: var(--ink); border-color: var(--ink); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.sample-next { margin-top: 12px; }
.sample-feedback a { color: var(--blue); font-weight: 700; }

/* Posts */
.post-card { border: var(--bw) solid var(--ink); }
.post-thumb { border-bottom: var(--bw) solid var(--ink); }
.post-card:nth-child(5n+1) .thumb-fallback { background-color: var(--blue-soft); }
.post-card:nth-child(5n+2) .thumb-fallback { background-color: var(--coral-soft); }
.post-card:nth-child(5n+3) .thumb-fallback { background-color: var(--mint-soft); }
.post-card:nth-child(5n+4) .thumb-fallback { background-color: var(--sun-soft); }
.post-card:nth-child(5n+5) .thumb-fallback { background-color: var(--pink-soft); }
.thumb-fallback .icon { transition: transform .3s var(--ease); }
.post-card:hover .thumb-fallback .icon { transform: scale(1.15) rotate(-6deg); }
.post-cat { color: var(--ink); background: var(--sun); border: 1.5px solid var(--ink); padding: 1px 8px; border-radius: 999px; }

/* Guides: bold yellow band */
.guides-section { background: var(--sun); border-block: var(--bw) solid var(--ink); }
.guides-copy p { color: var(--ink); }
.guides-section .kicker { background: #fff; }
.guide-list { border-top: var(--bw) solid var(--ink); }
.guide-list li { border-bottom-color: rgba(20, 33, 61, .25); }
.guide-list a::before { color: var(--ink); }
.guide-list a:hover { background: #fff; color: var(--ink); padding-left: 14px; }
.guide-list a { transition: padding var(--fast) var(--ease), background var(--fast); }
.guides-section .text-link { border-color: var(--ink); }

/* Facts */
.flip-front, .flip-back { border: var(--bw) solid var(--ink); box-shadow: 5px 5px 0 var(--ink); }
.flip-front .fact-tag { color: var(--ink); background: var(--c); border: 1.5px solid var(--ink); padding: 1px 8px; border-radius: 999px; align-self: flex-start; }
.flip-back { background: var(--c); color: var(--on-c); }
.flip-back .fact-tag { color: var(--on-c); }

/* Newsletter */
.newsletter-box { background: var(--coral); border-width: var(--bw); box-shadow: 8px 8px 0 var(--ink); }
.newsletter-box p, .newsletter-box .form-note { color: var(--ink); }
.newsletter-form input[type="email"] { border: var(--bw) solid var(--ink); background: #fff; }
.newsletter-box .btn-primary { box-shadow: 3px 3px 0 #fff; }

/* Footer stripe */
.site-footer { position: relative; }
.site-footer::before {
	content: ""; position: absolute; left: 0; right: 0; top: 0; height: 8px;
	background: linear-gradient(90deg, var(--blue) 0 20%, var(--coral) 20% 40%, var(--mint) 40% 60%, var(--sun) 60% 80%, var(--pink) 80%);
}
.to-top { border-width: var(--bw); box-shadow: 3px 3px 0 var(--coral); }

/* Tool pages */
.tool-hero { background: var(--c-soft, var(--tile)); border-bottom: var(--bw) solid var(--ink); }
.tool-hero .tool-ico.big { background: var(--c); color: var(--on-c); border: var(--bw) solid var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.tool-app { border: var(--bw) solid var(--ink); box-shadow: 8px 8px 0 var(--c, var(--ink)); }
.t-result { background: var(--c, var(--ink)); color: var(--on-c, #fff); border: var(--bw) solid var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.t-result .t-big, .t-result .t-sub { color: inherit; }
.t-tab.is-active { border-bottom-color: var(--c, var(--accent)); border-bottom-width: 3px; }
.t-progress > span, .readability-meter i { background: var(--c, var(--accent)); }
.readability-meter i { background: var(--ink); }
.pomo-ring .fg { stroke: var(--c, var(--accent)); }
.score-ring { background: conic-gradient(var(--c, var(--accent)) calc(var(--p) * 1%), var(--tile) 0); border: var(--bw) solid var(--ink); }
.quiz-opt, .quiz-topic, .t-input, .t-select, .t-textarea { border-width: var(--bw); }
.quiz-opt { border-color: var(--line-2); }
.quiz-opt:hover:not(:disabled) { border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.quiz-topic.is-active { background: var(--c, var(--ink)); color: var(--on-c, #fff); border-color: var(--ink); }
.calc-keys .k-eq { background: var(--c, var(--ink)); color: var(--on-c, #fff); border-color: var(--ink); }
.fc-front, .fc-back { border: var(--bw) solid var(--ink); box-shadow: 6px 6px 0 var(--ink); }
.fc-back { background: var(--c, var(--ink)); color: var(--on-c, #fff); }
.related-tools .tool-list { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

@media (max-width: 960px) {
	.deck-bg { inset: 6% 4% 14% 4%; }
}
@media (max-width: 640px) {
	.index-card.pos-0 { transform: translate(-52%, -30%) translateZ(60px) rotateZ(-1deg); }
	.index-card.pos-1 { transform: translate(-48%, -60%) rotateZ(3deg); }
	.index-card.pos-2 { transform: translate(-44%, -90%) translateZ(-60px) rotateZ(6deg); }
	.hero-deck:hover .index-card.pos-1 { transform: translate(-48%, -60%) rotateZ(3deg); }
	.hero-deck:hover .index-card.pos-2 { transform: translate(-44%, -90%) translateZ(-60px) rotateZ(6deg); }
	.hero-deck { height: 420px; }
	.deck-bg::after { width: 48px; height: 48px; }
	.ticker-list a { padding: 12px 18px; }
	.need-label { width: 100%; }
}

/* ==========================================================================
   Motion
   ========================================================================== */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }
.js .hero-copy > * { animation: rise .6s var(--ease) both; }
.js .hero-copy > :nth-child(2) { animation-delay: .06s; }
.js .hero-copy > :nth-child(3) { animation-delay: .12s; }
.js .hero-copy > :nth-child(4) { animation-delay: .18s; }
.js .hero-copy > :nth-child(5) { animation-delay: .24s; }
.js .index-card { animation: deal .8s var(--ease) both; }
.js .index-card[data-card="2"] { animation-delay: .15s; }
.js .index-card[data-card="1"] { animation-delay: .3s; }
.js .index-card[data-card="0"] { animation-delay: .45s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes deal { from { opacity: 0; translate: 0 60px; } }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
	.post-grid, .fact-grid { grid-template-columns: repeat(2, 1fr); }
	.footer-grid { grid-template-columns: 1fr 1fr; }
	.article-layout { grid-template-columns: 1fr; }
	.tool-group { grid-template-columns: 200px 1fr; gap: 28px; }
}
@media (max-width: 960px) {
	.hero-inner { grid-template-columns: 1fr; gap: 24px; }
	.hero-deck { height: 380px; }
	.hero::before { inset: 40% 0 0 0; }
	.quiz-panel, .guides, .newsletter-box { grid-template-columns: 1fr; gap: 32px; }
	.sample-q { transform: none; }
}
@media (max-width: 900px) {
	.menu-toggle { display: grid; }
	.header-cta { display: none; }
	.main-nav {
		position: fixed; top: 72px; left: 0; right: 0; background: var(--paper); border-bottom: 1px solid var(--ink);
		padding: 8px 24px 20px; opacity: 0; visibility: hidden; transform: translateY(-8px);
		transition: opacity var(--fast), transform var(--fast), visibility var(--fast); max-height: calc(100vh - 72px); overflow-y: auto;
	}
	.main-nav.is-open { opacity: 1; visibility: visible; transform: none; }
	.nav-list { flex-direction: column; }
	.nav-list a { padding: 14px 0; border-bottom: 1px solid var(--line); font-family: var(--serif); font-size: 1.3rem; font-weight: 600; }
	.nav-list .sub-menu { position: static; opacity: 1; visibility: visible; transform: none; border: 0; padding-left: 16px; }
	.header-actions { margin-left: auto; }
	.tool-group { grid-template-columns: 1fr; gap: 16px; }
	.tool-group-head { position: static; }
	.t-split, .t-cols-3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
	body { font-size: 16px; }
	.container, .container.narrow { width: calc(100% - 32px); }
	.hero-deck { height: 370px; }
	.index-card { width: 300px; min-height: 210px; padding: 16px 16px 16px 50px; }
	.ic-1 { transform: translate(-52%, -18%) translateZ(60px); }
	.ic-2 { transform: translate(-50%, -52%) rotateZ(2deg); }
	.ic-3 { transform: translate(-48%, -86%) translateZ(-60px) rotateZ(4deg); }
	.ic-timer { font-size: 2.8rem; }
	.how-strip { grid-template-columns: 1fr; gap: 10px; }
	.tool-list, .post-grid, .fact-grid, .footer-grid, .t-cols-2, .quiz-links, .sample-options { grid-template-columns: 1fr; }
	.search-form { padding-left: 42px; }
	.search-form .btn { padding: .6em .9em; }
	.tool-title { flex-direction: column; align-items: flex-start; }
	.newsletter-form { flex-direction: column; }
	.calc-keys button { height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
	.js .reveal { opacity: 1; transform: none; }
	.deck { transform: rotateX(6deg) rotateY(-12deg); }
	.ticker-track { animation: none; }
	.ticker { overflow-x: auto; }
}
