/* ace-paces.uk shared styles. "The Anatomist's Notebook": iron-gall ink on warm paper, one red-chalk accent, real
   historical drawings lifted onto the page. Light only. Direction chosen by Jev scoring (see DESIGN.md). */
/* Newsreader (Production Type) and IM Fell English (Igino Marini), both SIL OFL, latin subsets, self-hosted so no
   visitor data goes to a font CDN. */
@font-face { font-family: "Newsreader"; src: url("/assets/fonts/newsreader-latin.woff2") format("woff2"); font-weight: 400 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("/assets/fonts/newsreader-latin-italic.woff2") format("woff2"); font-weight: 400 500; font-style: italic; font-display: swap; }
@font-face { font-family: "IM Fell English"; src: url("/assets/fonts/imfell-english-latin-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "IM Fell English"; src: url("/assets/fonts/imfell-english-latin.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
:root {
  /* Paper and ink */
  --paper: #F4EDE0; --paper-deep: #ECE3D2; --paper-light: #FAF6EE;
  --ink: #2B2119; --ink-deep: #211912; --ink-soft: #5E4E40; --rule: #DACDB6;
  /* Red chalk (Leonardo's sanguine): the only action colour */
  --chalk: #A23E25; --chalk-dark: #7F2E1A; --chalk-bright: #C0583C; --chalk-wash: #F0DDD0;
  --on-ink: #E9DFCC; --on-ink-soft: #B9A88F;
  --danger: #A33535; --danger-bg: #F8E5E1; --low-stock: #8A5A00;
  /* Older token names, kept so every page and the case apps resolve to the same palette */
  --navy: var(--ink); --navy-deep: var(--ink-deep); --blue: var(--chalk); --blue-dark: var(--chalk-dark);
  --blue-mid: var(--chalk-bright); --blue-soft: var(--chalk-wash); --blue-tint: var(--paper-deep); --border: var(--rule);
  --text: var(--ink); --muted: var(--ink-soft); --white: #FFFFFF; --accent: var(--chalk-bright); --on-navy: var(--on-ink);
  --serif: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --fell: 'IM Fell English', 'Newsreader', Georgia, serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  /* Paper grain: fractal noise, very faint, so the page reads as a sheet rather than a screen */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .27 0 0 0 0 .18 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: light;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 17px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scrollbar-color: #C9B99E var(--paper-deep); overflow-x: clip; }
body {
  font-family: var(--serif); font-weight: 400;
  background: var(--paper) var(--grain); color: var(--ink); line-height: 1.6; -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column; caret-color: var(--chalk); overflow-x: clip;
  font-variant-numeric: oldstyle-nums proportional-nums;
}
main { flex: 1; }
::selection { background: var(--chalk-wash); color: var(--ink-deep); }
a { color: var(--chalk); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--chalk-dark); }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--chalk-bright); outline-offset: 3px; border-radius: 2px; }
img { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.container { max-width: 1040px; margin: 0 auto; padding: 0 28px; }
.container--narrow { max-width: 720px; }

/* Header: the running head of the notebook */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(244, 237, 224, .92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.25rem; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--ink); }
.brand-accent { color: var(--chalk); font-style: italic; font-weight: 500; }
.nav { display: flex; align-items: center; gap: 20px; }
.nav a:not(.btn) { color: var(--ink); font-size: 1rem; text-decoration: none; white-space: nowrap; }
.nav a:not(.btn):hover { color: var(--chalk); text-decoration: underline; }
/* Tabs: the site's two products and the guide. The current page is underlined in red chalk, like a pen mark. */
/* Main menus: "Courses" (with the Ace Neuro sub-menu) and Blog, each a native <details> so they open by tap, click or keyboard without JS */
.site-header .container { position: relative; }
.menus { display: flex; align-items: center; gap: 8px; margin: 0 auto 0 30px; }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 7px; padding: 8px 10px; color: var(--ink); font-size: 1rem; white-space: nowrap; border-bottom: 2px solid transparent; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .2s ease; }
.menu[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
.menu > summary:hover, .menu[open] > summary { color: var(--chalk); }
.menu.is-current > summary { border-bottom-color: var(--chalk); }
.menu-panel { position: absolute; top: calc(100% + 8px); left: 0; z-index: 60; width: 320px; padding: 8px; background: var(--paper-light); border: 1px solid var(--rule); border-radius: 3px; box-shadow: 0 14px 34px rgba(42, 33, 24, .14); }
.menu-panel a { display: block; padding: 10px 12px; border-radius: 2px; text-decoration: none; color: var(--ink); }
.menu-panel a:hover, .menu-panel a:focus-visible { background: var(--paper); }
.menu-panel a b { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.12rem; line-height: 1.25; }
.menu-panel a span { display: block; margin-top: 2px; font-size: .9rem; color: var(--ink-soft); line-height: 1.35; }
.menu-panel a[aria-current="page"] b { color: var(--chalk-dark); }
.menu-panel .all { border-top: 1px solid var(--rule); margin-top: 6px; padding-top: 10px; font-family: var(--fell); font-style: italic; color: var(--chalk-dark); }
/* Ace Neuro: a sub-menu inside the "I want to" panel, opened in place */
.submenu > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; padding: 10px 12px; border-radius: 2px; }
.submenu > summary::-webkit-details-marker { display: none; }
.submenu > summary:hover, .submenu > summary:focus-visible { background: var(--paper); }
.submenu > summary b { grid-column: 1; font-family: var(--serif); font-weight: 400; font-size: 1.12rem; line-height: 1.25; color: var(--ink); }
.submenu > summary span { grid-column: 1; margin-top: 2px; font-size: .9rem; color: var(--ink-soft); line-height: 1.35; }
.submenu > summary::after { content: ""; grid-column: 2; grid-row: 1 / span 2; width: 7px; height: 7px; border-right: 1.5px solid var(--ink-soft); border-bottom: 1.5px solid var(--ink-soft); transform: translateY(-2px) rotate(45deg); transition: transform .2s ease; }
.submenu[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
.submenu-links { margin: 0 0 4px 14px; padding-left: 8px; border-left: 1px solid var(--rule); }
.submenu-links a b { font-size: 1.04rem; }
@media (max-width: 860px) { .menus { margin-left: 12px; gap: 2px; } }

.announcement-bar { background: var(--ink-deep); color: var(--on-ink); font-size: .82rem; font-weight: 600; text-align: center; padding: 10px 24px; }
.announcement-bar strong { color: var(--chalk-wash); }

/* Buttons: pressed red chalk */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: none; border-radius: 3px;
  padding: 12px 24px; font-family: var(--serif); font-weight: 600; font-size: 1.02rem; line-height: 1.3; letter-spacing: .01em;
  background: var(--chalk); color: #FFF8F0; text-decoration: none; white-space: nowrap;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .14);
  transition: background .2s ease, transform .2s var(--ease-out);
}
.btn:hover { background: var(--chalk-dark); color: #FFF8F0; }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn[disabled] { background: #B7A898; cursor: not-allowed; box-shadow: none; }
.btn svg { width: 16px; height: 16px; flex: 0 0 auto; transition: transform .25s var(--ease-out); }
.btn:hover svg { transform: translateX(3px); }
.btn.small { padding: 8px 16px; font-size: .95rem; }
.btn.light { background: var(--paper-light); color: var(--ink); }
.btn.light:hover { background: var(--chalk-wash); color: var(--ink-deep); }
.btn.quiet { background: transparent; color: var(--chalk); border: 1px solid var(--rule); box-shadow: none; }
.btn.quiet:hover { background: var(--paper-light); border-color: var(--chalk); color: var(--chalk-dark); }
.nav .btn.quiet { border-color: var(--chalk); background: var(--paper-light); } /* the free case: the lead magnet, always one tap away */
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #862B2B; }

/* Sections and type */
section { padding: 72px 0; }
.section-alt { background: var(--paper-deep) var(--grain); }
.section-title { font-family: var(--serif); font-size: clamp(1.9rem, 4.2vw, 2.7rem); font-weight: 400; line-height: 1.12; letter-spacing: -0.018em; color: var(--ink); text-wrap: balance; }
.section-sub { font-size: 1.1rem; color: var(--ink-soft); margin-top: 10px; max-width: 58ch; }
.section-head { margin-bottom: 30px; }
.prose { max-width: 60ch; } /* about 75 characters a line in Newsreader */
.prose h2 { font-family: var(--serif); font-weight: 500; font-size: 1.5rem; color: var(--ink); margin: 32px 0 8px; }
.prose p + p, .prose p + ul, .prose ul + p { margin-top: 1em; }
.prose ul { padding-left: 1.3em; }
.prose li + li { margin-top: .35em; }
.muted { color: var(--ink-soft); }

/* Plates: a real drawing lifted onto the page, with a museum label */
.plate { margin: 0; }
.plate img { display: block; width: 100%; height: auto; }
.plate figcaption { font-family: var(--fell); font-style: italic; font-size: .95rem; line-height: 1.4; color: var(--ink-soft); margin-top: 10px; max-width: 34ch; }
.plate figcaption b { font-style: normal; font-weight: 400; color: var(--chalk); margin-right: .35em; }
/* Background plates: artistic wallpaper behind a single text column, never a layout column. Put .has-plate on the
   container and an aria-hidden .plate.bg-plate figure (img alt="", no caption: credits go in the footer) inside it,
   positioned per page to bleed off one edge. The mask dissolves its edges into the paper. */
.has-plate { position: relative; }
section:has(> .has-plate) { overflow-x: clip; } /* the plate may bleed past the container, never past the page */
.has-plate > :not(.bg-plate) { position: relative; z-index: 1; }
.bg-plate { position: absolute; z-index: 0; margin: 0; opacity: var(--plate-opacity, .11); pointer-events: none; user-select: none;
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent 100%); mask-image: radial-gradient(closest-side, #000 55%, transparent 100%); }
@media (max-width: 860px) { .bg-plate { --plate-opacity: .07; } } /* faded-ink text stays above 5:1 where it crosses a drawing */

/* Forms */
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 500; color: var(--ink); font-size: 1rem; }
.input {
  width: 100%; padding: 12px 14px; border-radius: 3px; border: 1px solid #CDBEA4; background: var(--paper-light);
  color: var(--ink); font: inherit; font-weight: 400; font-size: 1rem;
}
.input::placeholder { color: #7A6A56; } /* 4.8:1 on light leaf */
.input:focus { outline: none; border-color: var(--chalk); box-shadow: 0 0 0 3px var(--chalk-wash); }
.notice { border-radius: 3px; padding: 14px 16px; background: var(--chalk-wash); color: var(--ink); }
.notice.error { background: var(--danger-bg); color: var(--danger); }

/* Cards: a lighter leaf laid on the page */
.card { background: var(--paper-light); border: 1px solid var(--rule); border-radius: 3px; padding: 24px; }

/* Page header for inner pages: a title page, ink on paper, closed by a hairline */
.page-band { background: transparent; color: var(--ink); padding: 56px 0 30px; border-bottom: 1px solid var(--rule); }
.page-band h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.2rem, 5vw, 3.1rem); line-height: 1.1; letter-spacing: -0.02em; text-wrap: balance; }
.page-band p { color: var(--ink-soft); margin-top: 12px; max-width: 60ch; }

/* Footer: the back board */
footer { padding: 36px 24px 30px; background: var(--ink-deep); color: var(--on-ink-soft); text-align: center; font-size: .95rem; line-height: 1.7; }
footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; margin-bottom: 10px; }
footer a { color: var(--on-ink); text-decoration: none; }
footer a:hover { color: #FFF8F0; text-decoration: underline; }
footer .credits { font-family: var(--fell); font-style: italic; font-size: .88rem; max-width: 70ch; margin: 10px auto 0; color: #9C8D78; }
footer .credits a { color: inherit; text-decoration: underline; text-decoration-color: rgba(185, 168, 143, .4); }

@media (max-width: 620px) {
  html { font-size: 16px; }
  .container { padding: 0 18px; }
  section { padding: 52px 0; }
  .nav { gap: 14px; }
  .nav .hide-narrow { display: none; }
  /* Phones: the menus drop to a second row under the wordmark and the buttons; a panel spans the screen */
  .site-header .container:has(.menus) { flex-wrap: wrap; height: auto; padding-top: 10px; row-gap: 0; }
  .site-header .menus { order: 3; width: 100%; margin: 0 0 0 -10px; }
  .menu { position: static; }
  .menu-panel { left: 18px; right: 18px; width: auto; top: 100%; }
}
@media (max-width: 380px) {
  .nav { gap: 8px; }
  .nav .btn.small { padding: 7px 10px; font-size: .88rem; }
  .announcement-bar { font-size: .72rem; padding: 9px 16px; line-height: 1.5; }
  .card { padding: 20px; }
  .page-band { padding: 40px 0 24px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .btn svg { transition: none; }
}

/* Shared sections (home, masterclass, course): testimonials, about, FAQ, the closing board */
/* Testimonials: letters of reference, in a horizontal scroller */
.t-scroll-row { display: flex; align-items: center; gap: 14px; }
.t-scroll { display: flex; gap: 22px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; flex: 1; min-width: 0; padding: 4px 2px 14px; }
.t-arrow { flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--rule); background: var(--paper-light); color: var(--chalk); font-size: 1.5rem; line-height: 1; display: flex; align-items: center; justify-content: center; }
.t-arrow:hover { background: var(--chalk); color: #FFF8F0; border-color: var(--chalk); }
.t-card { flex: 0 0 340px; scroll-snap-align: start; background: var(--paper-light); border: 1px solid var(--rule); border-radius: 2px; padding: 26px 26px 22px; display: flex; flex-direction: column; box-shadow: 0 1px 0 rgba(43, 33, 25, .04), 0 12px 24px -20px rgba(43, 33, 25, .35); }
.t-card .quote { font-family: var(--serif); font-size: 1.04rem; line-height: 1.55; color: var(--ink); }
.t-card .quote::before { content: "\201C"; display: block; font-family: var(--fell); font-size: 3.2rem; line-height: .6; color: var(--chalk); margin-bottom: 10px; }
.t-card .author { margin-top: auto; padding-top: 18px; font-family: var(--fell); font-style: italic; font-size: 1rem; color: var(--ink-soft); }
.t-card .author b { display: block; font-family: var(--serif); font-style: normal; font-weight: 600; font-size: .98rem; color: var(--ink); }
.hl { color: var(--ink-deep); background: linear-gradient(transparent 62%, var(--chalk-wash) 62%); padding: 0 1px; }

/* About: a mounted print */
.about { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 26px; text-align: center; }
.about .print { width: 260px; }
.about .print { background: var(--paper-light); padding: 9px 9px 0; border: 1px solid var(--rule); box-shadow: 0 14px 28px -18px rgba(43, 33, 25, .45); transform: rotate(-1.2deg); }
.about .print img { display: block; width: 100%; height: auto; aspect-ratio: 5 / 6; object-fit: cover; filter: sepia(.18) contrast(1.02); }
.about .print figcaption { font-family: var(--fell); font-style: italic; font-size: .9rem; color: var(--ink-soft); text-align: center; padding: 6px 0 8px; }
.about p { margin: 12px auto 0; max-width: 60ch; font-size: 1.06rem; }

/* FAQ */
.faq { max-width: 740px; margin: 0 auto; }
.faq details:first-child { border-top: 1px solid var(--rule); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { list-style: none; cursor: pointer; padding: 20px 40px 20px 0; font-family: var(--serif); font-size: 1.28rem; line-height: 1.4; font-weight: 400; color: var(--ink); position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 6px; top: 15px; color: var(--chalk); font-family: var(--fell); font-size: 1.7rem; }
.faq details[open] summary::after { content: "\2212"; }
.faq summary:hover { color: var(--chalk-dark); }
.faq details p { padding: 0 0 18px; max-width: 60ch; }

/* Final call to action: the back board, with Cajal's neurons drawn faintly in light ink */
.final { background: var(--ink-deep); color: #FFF8F0; text-align: center; padding: 96px 0; position: relative; overflow: hidden; isolation: isolate; }
.final::before { content: ""; position: absolute; inset: -10% 0 auto 50%; width: min(720px, 120vw); aspect-ratio: 546 / 560; transform: translateX(-50%); background: url("/images/plates/cajal-purkinje.webp") center / contain no-repeat; filter: invert(1) sepia(.4); opacity: .11; z-index: -1; -webkit-mask-image: linear-gradient(#000 50%, transparent 92%); mask-image: linear-gradient(#000 50%, transparent 92%); }
.final h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.1rem, 5vw, 3.2rem); line-height: 1.1; letter-spacing: -0.02em; text-wrap: balance; }
.final .next { font-family: var(--fell); font-style: italic; font-size: 1.15rem; color: var(--on-ink); margin: 12px 0 28px; }
@media (max-width: 620px) {
  .t-arrow { display: none; }
  .t-card { flex: 0 0 86%; }
  .about { gap: 20px; }
  .about .print { width: 200px; }
  .final { padding: 72px 0; }
}
@media (max-width: 340px) {
  .nav .btn.quiet { display: none; } /* the narrowest phones: the hero's free-case button sits just below */
}


/* "On this page": a quiet rail of jump links in the left margin, built by site.js from each [data-nav] section.
   Only where the margin is wide enough to hold it. */
[data-nav] { scroll-margin-top: 84px; }
.page-rail { display: none; }
@media (min-width: 1200px) {
  .page-rail { display: block; position: fixed; z-index: 40; top: 50%; transform: translateY(-50%);
    left: max(16px, calc((100vw - 1040px) / 2 - 232px)); width: min(212px, calc((100vw - 1040px) / 2 - 8px)); }
  .page-rail p { font-family: var(--fell); font-style: italic; font-size: 1.05rem; color: var(--ink-soft); margin: 0 0 8px; }
  .page-rail ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
  .page-rail a { display: block; margin-left: -1px; padding: 7px 0 7px 14px; border-left: 3px solid transparent; font-size: 1.06rem; line-height: 1.3; color: var(--ink-soft); text-decoration: none; }
  .page-rail a:hover, .page-rail a:focus-visible { color: var(--chalk-dark); }
  .page-rail a[aria-current] { color: var(--ink); border-left-color: var(--chalk); }
}

/* A one-line notice under the header for a dated event (e.g. the free masterclass). Remove the markup once it has passed. */
.event-strip { border-bottom: 1px solid var(--rule); background: var(--chalk-wash); font-size: .98rem; }
.event-strip .container { padding-top: 10px; padding-bottom: 10px; text-align: center; }
.event-strip a { font-weight: 700; }
