/* Rushmore Academy base: reset, typography, layout primitives, forms, buttons, cards, focus. Needs tokens.css first. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; -webkit-tap-highlight-color: rgba(161, 120, 43, .18); }
/* Buttons and links act on the first tap: no 300 ms double-tap wait, no accidental double-tap zoom on controls. */
a, button, input, select, textarea, summary, [role="button"], [role="tab"], [role="slider"] { touch-action: manipulation; }
/* Long words and pasted addresses wrap instead of pushing the page sideways. */
p, li, td, th, dd, dt, h1, h2, h3, h4, figcaption, blockquote { overflow-wrap: break-word; }
/* Tables scroll inside their own box on a narrow screen (wrap one in .table-scroll). */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
:root[data-motion="reduce"] html, html:where([data-motion="reduce"]) { scroll-behavior: auto; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-text); font-size: var(--fs-2); line-height: var(--lh-body); font-kerning: normal; font-variant-ligatures: common-ligatures; font-variant-numeric: oldstyle-nums proportional-nums; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; min-height: 100dvh; overflow-x: hidden; hanging-punctuation: first last; }
img, svg, video { max-width: 100%; height: auto; display: block; }
svg { height: auto; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-6) 0; }

/* Typography. Headings are a Garamond at a light weight with air around them; Roman capitals are kept for inscriptions (the wordmark, eyebrows, buttons). */
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 500; line-height: var(--lh-tight); letter-spacing: 0; margin: 0 0 var(--s-3); color: var(--text); text-wrap: balance; }
h1 { font-size: var(--fs-6); } h2 { font-size: var(--fs-5); margin-top: var(--s-7); } h3 { font-size: var(--fs-4); margin-top: var(--s-5); } h4 { font-size: var(--fs-3); }
h1:first-child, h2:first-child, h3:first-child { margin-top: 0; }
p { margin: 0 0 var(--s-4); max-width: var(--measure); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }
.lead { font-size: var(--fs-3); line-height: 1.45; color: var(--text-soft); }
.sub, .meta, .caption { font-family: var(--font-ui); font-size: var(--fs-1); color: var(--muted); letter-spacing: .005em; font-variant-numeric: lining-nums; }
.sub { margin: 0 0 var(--s-5); }
.caption { font-size: var(--fs-0); }
/* Inscriptions: Roman capitals, tracked. Small capitals: the text face's true small caps. */
.caps, .eyebrow { font-family: var(--font-display); font-size: var(--fs-0); letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--gold-text); font-weight: 600; }
.eyebrow { display: block; margin-bottom: var(--s-4); }
.smallcaps, .sc { font-family: var(--font-text); font-variant-caps: small-caps; letter-spacing: .08em; font-weight: 500; }
.serif { font-family: var(--font-text); }
.ui { font-family: var(--font-ui); }
strong, b { font-weight: 700; }
em, i { font-style: italic; }
small { font-size: var(--fs-0); }
a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; text-decoration-color: color-mix(in srgb, currentColor 55%, transparent); }
a:hover { text-decoration-color: currentColor; }
ul, ol { padding-left: 1.3em; margin: 0 0 var(--s-4); }
li { margin: var(--s-1) 0; }
li::marker { color: var(--gold-text); }
blockquote { margin: var(--s-5) 0; padding: 0 0 0 var(--s-5); border-left: 1px solid var(--gold); font-style: italic; font-size: var(--fs-3); color: var(--text-soft); }
code, kbd { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: .92em; background: var(--bg-alt); padding: .1em .35em; border-radius: var(--r-1); }
details { margin-top: var(--s-2); } summary { cursor: pointer; color: var(--link); font-family: var(--font-ui); font-size: var(--fs-1); padding: 10px 0; min-height: 44px; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
details[open] summary { margin-bottom: var(--s-2); }

/* Reading surfaces follow the reader's font choice */
body, p, li, blockquote, td, th, label, input, select, textarea, button { font-family: var(--font-reading); }
.sub, .meta, .caption, .ui, button, .btn, input, select, textarea, label { font-family: var(--font-ui); }
:root[data-font="dyslexia"] body, :root[data-font="dyslexia"] .ui, :root[data-font="dyslexia"] button, :root[data-font="dyslexia"] .btn, :root[data-font="dyslexia"] input, :root[data-font="dyslexia"] select, :root[data-font="dyslexia"] h1, :root[data-font="dyslexia"] h2, :root[data-font="dyslexia"] h3 { font-family: var(--font-reading); letter-spacing: .01em; word-spacing: .08em; }
:root[data-font="dyslexia"] body { line-height: 1.7; }
:root[data-font="dyslexia"] .smallcaps, :root[data-font="dyslexia"] .sc { font-variant-caps: normal; }

/* Layout primitives: one axis. .wrap is the reading column, .wrap-wide the container; both center. */
main, .wrap { max-width: var(--content); margin: 0 auto; padding: var(--s-5) var(--gutter) var(--s-9); }
.wrap-wide { max-width: var(--container); }
.row { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 200px; }
.stack > * + * { margin-top: var(--s-4); }
.grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.center { text-align: center; } .center p { margin-left: auto; margin-right: auto; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.rule { display: flex; align-items: center; gap: var(--s-4); color: var(--gold-text); font-family: var(--font-display); font-size: var(--fs-0); letter-spacing: var(--track-caps); text-transform: uppercase; margin: var(--s-6) 0; }
.rule::before, .rule::after { content: ''; flex: 1; border-top: 1px solid var(--line-strong); }
@media (min-width: 700px) { main, .wrap { padding-top: var(--s-7); } }

/* Forms */
label { display: block; margin: var(--s-2) 0 var(--s-1); font-size: var(--fs-1); color: var(--muted); }
/* Fields are never under 16 px: iOS zooms the whole page into any smaller field when it is focused. */
input, select, textarea { font: inherit; font-size: max(1rem, var(--fs-1)); color: var(--text); background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--r-2); padding: 10px 14px; min-height: 44px; max-width: 100%; }
input::placeholder { color: var(--muted); opacity: 1; }
select { padding-right: 32px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
input:disabled, select:disabled, button:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

/* Buttons: ink primary, hairline secondary, a gold hairline for the one ceremonial control. Square corners, capitals, tracked. */
button, .btn { font: inherit; font-family: var(--font-ui); font-size: var(--fs-1); font-weight: 500; color: var(--text); background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--r-2); padding: 10px 18px; min-height: 44px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); line-height: 1.2; transition: background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out); -webkit-tap-highlight-color: transparent; }
button:hover, .btn:hover { border-color: var(--text); }
button:active, .btn:active { transform: translateY(1px); }
.primary, .btn.primary, button.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.primary:hover { background: var(--text-soft); border-color: var(--text-soft); color: var(--primary-ink); }
:root[data-theme="dark"] .primary:hover { background: var(--primary); border-color: var(--gold); }
.btn-gold, button.btn-gold { background: transparent; color: var(--gold-text); border: 1px solid var(--gold); font-family: var(--font-display); letter-spacing: .16em; text-transform: uppercase; font-size: var(--fs-0); font-weight: 600; padding: 13px 26px; }
.btn-gold:hover { background: var(--gold-text); color: var(--parchment); border-color: var(--gold-text); }
.btn-lg { font-size: var(--fs-1); padding: 16px 32px; min-height: 54px; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--link); text-decoration: underline; text-underline-offset: .2em; }
.btn-quiet:hover { border-color: transparent; background: var(--bg-alt); }

/* The circular gold-outlined settings button (motion.js mounts it) */
.ra-settings-btn { position: fixed; z-index: 60; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); width: 48px; height: 48px; min-height: 0; padding: 0; border-radius: 50%; border: 1px solid var(--gold); background: color-mix(in srgb, var(--bg) 82%, transparent); color: var(--gold-text); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.ra-settings-btn:hover { background: var(--gold-text); color: var(--parchment); border-color: var(--gold-text); }
.ra-settings-btn svg { width: 22px; height: 22px; }
.ra-on-dark .ra-settings-btn { background: rgba(14, 20, 27, .55); color: var(--gold-bright); border-color: var(--gold-bright); }
.ra-on-dark .ra-settings-btn:hover { background: var(--gold-bright); color: #0E141B; }

/* Cards: a hairline, no shadow */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-3); padding: var(--s-5) var(--s-5); margin: 0 0 var(--s-4); }
.card > :first-child { margin-top: 0; }
.card h2 { font-size: var(--fs-3); margin-top: 0; }
.card.hw, .card.honor { border-left: 2px solid var(--gold); }
.well { background: var(--bg-alt); border-radius: var(--r-3); padding: var(--s-5); }
.ok { color: var(--ok); } .no { color: var(--no); }
.ok, .no { font-family: var(--font-ui); font-size: var(--fs-1); }

/* Focus: always visible, never removed */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: var(--r-1); }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.ra-on-dark :focus-visible { outline-color: var(--gold-bright); }
.skip-link { position: absolute; left: var(--s-4); top: -100px; background: var(--card); color: var(--text); padding: 10px 14px; border-radius: var(--r-2); z-index: 100; border: 1px solid var(--line-strong); font-family: var(--font-ui); }
.skip-link:focus { top: var(--s-4); }

/* Selection and scrollbars */
::selection { background: var(--gold); color: var(--ink); }
:root[data-theme="dark"] ::selection { background: var(--gold-bright); }
