/* SD Pen Club site styles. Shared by every page; link as /assets/site.css.

   PALETTE
   Every color below reads from the tokens in :root. The navy is --ink.
   To make a black version, swap that one line, for example:
       --ink: #111418;
   --ink-deep and --ink-shadow are mixed from --ink (see the @supports
   block under :root), so the deep hover shade, the footer and every
   shadow follow the swap on their own. The fixed values next to them are
   fallbacks for old browsers and match the navy build exactly.
   --teal is the accent and stays put in either version.

   MOTION
   All movement lives in @media (prefers-reduced-motion: no-preference)
   blocks, so reduced motion gets a still page. Anything that starts
   hidden (scroll reveal, the nib drawing) is also gated behind the "js"
   class that site.js puts on <html>, so the page stays fully visible
   when JavaScript fails. The hero entrance is pure CSS keyframes that
   end on the element's normal style, so it never needs JavaScript. */

:root {
  --ink: #082F48;
  --ink-deep: #061F31;
  --teal: #4B8EA2;
  --text: #1C2230;
  --muted: #5E6573;
  --line: #E6E8EC;
  --soft: #F7F8FA;
  --white: #FFFFFF;
  --radius: 10px;
  --wrap: 1120px;
  --read: 640px;

  --gutter: 24px;
  --header-h: 76px;
  --glass: rgba(0, 0, 0, .48);
  --teal-deep: #35768A;
  --teal-soft: #9CC1CC;
  --on-ink: #FFFFFF;
  --on-ink-muted: rgba(255, 255, 255, .76);
  --on-ink-line: rgba(255, 255, 255, .16);
  --ink-texture: rgba(255, 255, 255, .035);
  --ink-shadow: rgba(8, 47, 72, .16);
  --focus: var(--teal);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
}
@supports (color: color-mix(in srgb, red, blue)) {
  :root {
    /* 66% ink with a near black gives exactly #061F31 from the navy. */
    --ink-deep: color-mix(in srgb, var(--ink) 66%, #020004);
    --ink-shadow: color-mix(in srgb, var(--ink) 16%, transparent);
    --teal-soft: color-mix(in srgb, var(--teal) 55%, #FFFFFF);
  }
}

/* Base */
* { box-sizing: border-box; }
html { scroll-padding-top: 88px; }
body { margin: 0; font-family: "Open Sans", system-ui, sans-serif; font-weight: 400; font-size: 17px; line-height: 1.75; color: var(--text); background: var(--white); }
h1, h2, h3 { font-family: Arimo, Arial, sans-serif; font-weight: 700; line-height: 1.15; color: var(--ink); margin: 0 0 .6em; letter-spacing: -.01em; }
p { margin: 0 0 1.2em; }
a { color: var(--ink); }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
section { padding: 128px 0; }
section + section { border-top: 1px solid var(--line); }
.kicker { font-size: 13px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--teal); margin: 0 0 18px; }
.hidden { position: absolute; left: -9999px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Text links: a quiet resting underline, and a full one that sweeps in on hover and focus. */
:where(main p, main li, .site-footer) a:not(.btn) {
  text-decoration: underline;
  text-underline-offset: 3px;
}
@supports (color: color-mix(in srgb, red, blue)) {
  :where(main p, main li, .site-footer) a:not(.btn) {
    text-decoration: none;
    background-image: linear-gradient(currentColor, currentColor), linear-gradient(color-mix(in srgb, currentColor 35%, transparent), color-mix(in srgb, currentColor 35%, transparent));
    background-size: 0% 1.5px, 100% 1px;
    background-position: 0 100%, 0 100%;
    background-repeat: no-repeat;
    padding-bottom: 2px;
    transition: background-size .45s var(--ease-out), color .2s ease;
  }
  :where(main p, main li, .site-footer) a:not(.btn):is(:hover, :focus-visible) { background-size: 100% 1.5px, 100% 1px; }
}

/* Ink surfaces: navy with white type. Reuse .on-ink on any band, card or footer. */
.on-ink { background-color: var(--ink); color: var(--on-ink); --focus: var(--teal-soft); }
.on-ink :is(h1, h2, h3) { color: var(--on-ink); }
.on-ink p { color: var(--on-ink-muted); }
.on-ink a:not(.btn) { color: var(--on-ink); }
.on-ink .kicker { color: var(--teal-soft); }
.ink-texture { background-image: repeating-linear-gradient(135deg, var(--ink-texture) 0 1px, transparent 1px 16px); }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid transparent; transition: background-color .35s ease, border-color .3s ease, box-shadow .3s ease; }
.site-header.scrolled { border-bottom-color: var(--line); box-shadow: 0 10px 24px -20px var(--ink-shadow); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); }
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); border-radius: 6px; transition: color .35s ease; }
.logo svg { width: 36px; height: 36px; flex: none; }
.logo svg :is(line, circle) { transition: stroke .35s ease, fill .35s ease; }
.logo-text { display: flex; flex-direction: column; line-height: 1.05; }
.logo-text strong { font-family: Arimo, Arial, sans-serif; font-size: 18px; letter-spacing: .06em; }
.logo-text span { font-size: 10px; letter-spacing: .34em; text-transform: uppercase; color: var(--muted); margin-top: 4px; transition: color .35s ease; }
.nav-toggle { background: none; border: 0; padding: 10px; cursor: pointer; color: var(--ink); border-radius: 8px; transition: color .35s ease; }
.nav-toggle svg { width: 26px; height: 26px; }
.nav-panel { position: fixed; inset: var(--header-h) 0 auto 0; background: var(--white); border-bottom: 1px solid var(--line); padding: 8px var(--gutter) 20px; display: none; box-shadow: 0 18px 30px -24px var(--ink-shadow); }
.nav-panel.open { display: block; }
.nav-panel a { display: block; color: var(--ink); text-decoration: none; font-size: 17px; padding: 14px 0; border-bottom: 1px solid var(--line); transition: color .2s ease; }
.nav-panel a:last-child { border-bottom: 0; }
.nav-panel a:focus-visible { outline-offset: -2px; border-radius: 4px; }
@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .nav-panel { position: static; display: flex !important; gap: 36px; background: none; border: 0; padding: 0; box-shadow: none; }
  .nav-panel a { position: relative; border: 0; font-size: 15px; padding: 6px 0; color: var(--muted); }
  .nav-panel a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1.5px; background: var(--ink); transform: scaleX(0); transform-origin: right center; }
  .nav-panel a:is(:hover, :focus-visible) { color: var(--ink); }
  .nav-panel a:is(:hover, :focus-visible)::after { transform: scaleX(1); transform-origin: left center; }
  .nav-panel a:focus-visible { outline-offset: 4px; }
}

/* Header over the photo hero (homepage, class .over-hero). At the top of the
   page it is clear with white type; it turns back into the white header as
   soon as the page scrolls (site.js adds .scrolled) or the phone menu opens
   (.menu-open). The hero's own top shade keeps the white type readable. A
   <noscript> rule in index.html lets it scroll away with the hero instead. */
.over-hero:not(.scrolled):not(.menu-open) { background-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; --focus: var(--white); }
.over-hero:not(.scrolled):not(.menu-open) :is(.logo, .nav-toggle) { color: var(--white); }
.over-hero:not(.scrolled):not(.menu-open) .logo-text span { color: var(--white); }
.over-hero:not(.scrolled):not(.menu-open) .logo svg line { stroke: var(--ink); }
.over-hero:not(.scrolled):not(.menu-open) .logo svg circle:last-of-type { fill: var(--ink); }
@media (min-width: 900px) {
  .over-hero:not(.scrolled):not(.menu-open) .nav-panel a { color: rgba(255, 255, 255, .92); text-shadow: 0 1px 10px rgba(0, 0, 0, .35); }
  .over-hero:not(.scrolled):not(.menu-open) .nav-panel a:is(:hover, :focus-visible) { color: var(--white); }
  .over-hero:not(.scrolled):not(.menu-open) .nav-panel a::after { background: var(--white); }
}

/* Buttons */
.btn-row { display: flex; flex-wrap: wrap; gap: 14px; }
.btn { display: inline-block; text-decoration: none; font-weight: 600; font-size: 15px; border-radius: var(--radius); padding: 16px 26px; line-height: 1.2; cursor: pointer; font-family: inherit; border: 1px solid var(--ink); transition: background-color .25s ease, color .25s ease, border-color .25s ease, box-shadow .3s ease; }
.btn:is(:hover, :focus-visible) { box-shadow: 0 14px 26px -14px var(--ink-shadow), 0 4px 10px -6px var(--ink-shadow); }
.btn-solid { background: var(--ink); color: var(--white); }
.btn-solid:is(:hover, :focus-visible) { background: var(--ink-deep); border-color: var(--ink-deep); }
.btn-line { background: transparent; color: var(--ink); }
.btn-line:is(:hover, :focus-visible) { background: var(--ink); color: var(--white); }
.on-ink .btn-line { color: var(--on-ink); border-color: rgba(255, 255, 255, .55); }
.on-ink .btn-line:is(:hover, :focus-visible) { background: var(--on-ink); border-color: var(--on-ink); color: var(--ink); box-shadow: 0 14px 28px -14px rgba(0, 0, 0, .45); }

/* Hero: a full width photo (the pen on the right, soft on the left) with a
   dark glass card on the left. It pulls up under the header by the header
   height plus its 1px bottom border, so the photo starts at the very top of
   the page with no white hairline above it.
   Under 900px the photo becomes a band across the top, framed on the pen,
   and the card starts just below the pen where the photo fades into ink.
   That keeps the pen in view on phones. */
.hero { position: relative; isolation: isolate; display: flex; align-items: center; min-height: 88vh; min-height: 88svh; margin-top: calc((var(--header-h) + 1px) * -1); padding: calc(var(--header-h) + 56px) 0 88px; background-color: var(--ink-deep); color: var(--on-ink); overflow: hidden; }
section.hero, .hero + section { border-top: 0; }
.hero .wrap { width: 100%; }
.hero-photo { position: absolute; inset: 0; z-index: -1; overflow: hidden; }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 40% 62%; }
/* The top shade that keeps the clear header's white type readable. */
.hero-photo::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to bottom, rgba(0, 0, 0, .62) 0, rgba(0, 0, 0, .42) var(--header-h), rgba(0, 0, 0, 0) calc(var(--header-h) + 120px)); }
.hero-card { max-width: 520px; padding: 50px 50px 54px; border-radius: var(--radius); background: var(--glass); color: var(--on-ink); --focus: var(--white); }
.hero .kicker { color: rgba(255, 255, 255, .92); }
.hero h1 { color: var(--on-ink); font-size: clamp(38px, 4.3vw, 58px); line-height: 1.08; margin-bottom: 22px; text-wrap: balance; }
.hero .lede { font-size: 18px; line-height: 1.7; color: rgba(255, 255, 255, .92); max-width: 30em; margin-bottom: 34px; }
/* Teal primary (deep ink type passes contrast on teal) and a white outline. */
.hero .btn-solid { background: var(--teal); border-color: var(--teal); color: var(--ink-deep); font-weight: 700; }
.hero .btn-solid:is(:hover, :focus-visible) { background: var(--teal-deep); border-color: var(--teal-deep); color: var(--white); box-shadow: 0 16px 30px -14px rgba(0, 0, 0, .5); }
.hero .btn-line { color: var(--white); border-color: rgba(255, 255, 255, .72); }
.hero .btn-line:is(:hover, :focus-visible) { background: var(--white); border-color: var(--white); color: var(--ink); box-shadow: 0 14px 28px -14px rgba(0, 0, 0, .45); }
@media (min-width: 900px) and (max-width: 1199px) {
  .hero-card { max-width: 470px; padding: 44px 42px 48px; }
}
@media (max-width: 899px) {
  .hero { --band: clamp(190px, 52vw, 480px); display: block; min-height: 0; padding: calc(var(--header-h) + var(--band)) 0 56px; }
  .hero-photo { bottom: auto; height: calc((var(--header-h) + var(--band)) * 1.32); }
  .hero-photo img { object-position: 90% 60%; }
  .hero-photo::after { background: linear-gradient(to bottom, rgba(0, 0, 0, .62) 0, rgba(0, 0, 0, .42) var(--header-h), rgba(0, 0, 0, 0) calc(var(--header-h) + 100px), transparent 72%, var(--ink-deep) 100%); }
  .hero-card { max-width: 620px; padding: 36px 26px 32px; border: 1px solid rgba(255, 255, 255, .08); }
  .hero .btn-row .btn { flex: 1 1 200px; text-align: center; }
}

/* Welcome */
.welcome .inner { max-width: var(--read); margin: 0 auto; }
.welcome h2 { font-size: clamp(30px, 4vw, 40px); }
.tagline { text-align: center; font-family: Arimo, Arial, sans-serif; font-weight: 500; font-size: clamp(22px, 3vw, 30px); color: var(--ink); max-width: 760px; margin: 96px auto 0; }

/* New to pens: the full width ink band */
section.newbie, .newbie + section { border-top: 0; }
.newbie .wrap { display: grid; gap: 56px; align-items: center; }
.newbie h2 { font-size: clamp(30px, 4vw, 40px); }
.newbie .copy { max-width: var(--read); }
.newbie .btn { margin-top: 8px; }
.nib-art { width: 100%; max-width: 260px; margin: 0 auto; overflow: visible; }
.nib-art path { fill: none; stroke: var(--on-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nib-art .accent { stroke: var(--teal-soft); stroke-width: 1.5; }
@media (min-width: 900px) { .newbie .wrap { grid-template-columns: 1.4fr 1fr; } }

/* Topics */
.topics .head { max-width: var(--read); margin: 0 auto 72px; text-align: center; }
.topics h2 { font-size: clamp(30px, 4vw, 40px); }
.topics .head p:not(.kicker) { color: var(--muted); margin: 0; }
.topic-grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.topic { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px 28px 34px; transition: border-color .35s ease, box-shadow .35s ease; }
.topic svg { width: 30px; height: 30px; color: var(--ink); margin-bottom: 18px; transition: color .35s ease; }
.topic h3 { font-size: 20px; margin-bottom: .35em; }
.topic p { margin: 0; color: var(--muted); font-size: 16px; }
.topic:hover { border-color: transparent; box-shadow: 0 22px 40px -26px var(--ink-shadow), 0 2px 8px -4px var(--ink-shadow); }
.topic:hover svg { color: var(--teal); }

/* Signup: navy card on a white section */
.signup .inner { max-width: 640px; margin: 0 auto; text-align: center; border-radius: calc(var(--radius) * 1.6); padding: 72px 64px 60px; box-shadow: 0 30px 60px -40px var(--ink-shadow); }
.signup h2 { font-size: clamp(30px, 4vw, 40px); }
.signup .inner > p { margin-bottom: 36px; }
.signup form { display: grid; gap: 12px; text-align: left; margin-top: 36px; }
.signup input { font: inherit; font-size: 16px; padding: 15px 16px; border-radius: var(--radius); border: 1px solid transparent; width: 100%; background: var(--white); color: var(--text); transition: box-shadow .2s ease; }
.signup input::placeholder { color: var(--muted); opacity: 1; }
.signup input:focus { outline: 2px solid var(--teal-soft); outline-offset: 2px; }
.signup .btn { width: 100%; margin-top: 4px; }
/* Teal submit. Deep ink type on teal passes AA; on hover it deepens and the type turns white. */
.signup .btn-solid { background: var(--teal); border-color: var(--teal); color: var(--ink-deep); font-weight: 700; }
.signup .btn-solid:is(:hover, :focus-visible) { background: var(--teal-deep); border-color: var(--teal-deep); color: var(--white); box-shadow: 0 16px 30px -14px rgba(0, 0, 0, .5); }
.signup .inner > p.kicker { margin-bottom: 18px; }
.signup .inner > p.intro { margin-bottom: 10px; }
.signup .inner > p.rhythm { margin-bottom: 0; }
.signup .inner > p.privacy { font-size: 14px; line-height: 1.6; margin: 20px 0 0; }
@media (min-width: 640px) { .signup form { grid-template-columns: 1fr 1fr; } .signup .btn { grid-column: 1 / -1; } }
@media (max-width: 639px) { .signup .inner { padding: 52px 22px 44px; } }

/* FAQ (homepage): a full width photo (desk and pens on the right, plain wall
   on the left) with a dark glass box on the left. The questions are teal
   bars and the answers open inside the box. The min-height leaves room for
   an answer to open without the section, and so the photo, changing size.
   Under 900px the box goes full width and the photo becomes a band along the
   bottom of the section, framed on the pens.
   The plain details and summary styles after this block are the journal
   posts' FAQ; .faq-box overrides them further down. */
.faq { display: flex; align-items: center; min-height: clamp(660px, 54vw, 920px); padding: 104px 0; border-top: 0; background: var(--ink-deep) url(/assets/faq-bg.jpg) 66% 34% / cover no-repeat; }
.faq .wrap { width: 100%; }
.faq-box { max-width: 600px; padding: 52px 48px 48px; border-radius: var(--radius); background: var(--glass); color: var(--on-ink); --focus: var(--white); }
.faq-box h2 { color: var(--on-ink); font-size: clamp(28px, 3.2vw, 38px); margin: 0 0 30px; text-wrap: balance; }
@media (max-width: 899px) {
  .faq {
    --band: clamp(220px, 50vw, 400px);
    display: block; min-height: 0; padding: 72px 0 var(--band);
    background-image: linear-gradient(to bottom, var(--ink-deep) calc(100% - var(--band) - 100px), transparent calc(100% - var(--band) + 20px)), url(/assets/faq-bg.jpg);
    background-size: 100% 100%, auto calc(var(--band) * 1.9);
    background-position: 0 0, 86% 100%;
  }
  .faq-box { max-width: none; padding: 36px 20px 30px; border: 1px solid rgba(255, 255, 255, .08); }
}

details { border-bottom: 1px solid var(--line); padding: 26px 0; }
details:first-of-type { border-top: 1px solid var(--line); }
summary { cursor: pointer; font-family: Arimo, Arial, sans-serif; font-weight: 500; font-size: 19px; color: var(--ink); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; border-radius: 4px; transition: color .2s ease; }
summary::-webkit-details-marker { display: none; }
summary::after {
  content: ""; flex: none; width: 16px; height: 16px; color: var(--muted);
  background: linear-gradient(currentColor, currentColor) center / 14px 1.5px no-repeat, linear-gradient(currentColor, currentColor) center / 1.5px 14px no-repeat;
  transition: background-size .35s var(--ease-out), color .2s ease, transform .35s var(--ease-out);
}
summary:hover::after { color: var(--ink); }
details[open]:not(.is-closing) summary::after { background-size: 14px 1.5px, 1.5px 0; transform: rotate(180deg); }
details p { margin: 14px 0 0; color: var(--muted); max-width: 40em; }
summary:focus-visible { outline-offset: 6px; }

/* Homepage FAQ bars: brand teal, white bold type (19px bold is large text,
   so white on teal passes), a plus on the left that turns into a minus.
   The answer uses padding, not margin, so site.js measures it exactly. */
.faq-box details { border: 0; padding: 0; }
.faq-box details + details { margin-top: 12px; }
.faq-box summary { justify-content: flex-start; gap: 14px; padding: 17px 22px; border-radius: 9px; background: var(--teal); color: var(--white); font-weight: 700; font-size: 19px; line-height: 1.35; transition: background-color .25s ease, box-shadow .3s ease; }
.faq-box summary::after { content: none; }
.faq-box summary::before {
  content: ""; flex: none; width: 16px; height: 16px;
  background: linear-gradient(currentColor, currentColor) center / 14px 2px no-repeat, linear-gradient(currentColor, currentColor) center / 2px 14px no-repeat;
  transition: background-size .35s var(--ease-out), transform .35s var(--ease-out);
}
.faq-box details[open]:not(.is-closing) summary::before { background-size: 14px 2px, 2px 0; transform: rotate(180deg); }
.faq-box summary:hover { background: var(--teal-deep); box-shadow: 0 12px 24px -14px rgba(0, 0, 0, .6); }
.faq-box summary:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }
.faq-box details p { margin: 0; max-width: none; padding: 16px 22px 8px 52px; color: var(--on-ink); font-size: 17px; line-height: 1.7; }
.faq-box a:not(.btn) { color: var(--on-ink); }
@media (max-width: 899px) {
  .faq-box summary { gap: 12px; padding: 15px 18px; }
  .faq-box details p { padding: 14px 18px 6px; }
}

/* Footer */
.site-footer { background-color: var(--ink-deep); padding: 40px 0 48px; font-size: 14px; color: var(--on-ink-muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }
.site-footer a:not(.btn) { color: var(--on-ink-muted); transition: color .2s ease, background-size .45s var(--ease-out); }
.site-footer a:not(.btn):is(:hover, :focus-visible) { color: var(--on-ink); }

/* Mobile action bar */
.action-bar { display: none; }
@media (max-width: 899px) {
  section { padding: 88px 0; }
  .tagline { margin-top: 72px; }
  .topics .head { margin-bottom: 48px; }
  .site-footer { padding-bottom: 104px; }
  .action-bar { display: flex; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 40; background: var(--ink); border: 1px solid var(--on-ink-line); border-radius: 14px; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .35); overflow: hidden; }
  .action-bar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 11px 0 9px; color: var(--on-ink); text-decoration: none; font-size: 12px; font-weight: 500; transition: background-color .2s ease; }
  .action-bar a + a { border-left: 1px solid var(--on-ink-line); }
  .action-bar a:is(:hover, :focus-visible) { background: rgba(255, 255, 255, .07); }
  .action-bar a:focus-visible { outline: 2px solid var(--teal-soft); outline-offset: -4px; border-radius: 12px; }
  .action-bar svg { width: 22px; height: 22px; }
}

/* ==========================================================================
   CAROUSEL (markup contract lives at the top of /assets/site.js)
   Without JavaScript it is a plain horizontal scroll with snap points.
   site.js adds .is-ready (shows the controls) and .is-static (the slides
   all fit, so the controls hide and it behaves as a plain layout).
   Per instance knobs: --slide-w (slide width), --slide-gap.
   Add .carousel--bleed to let the track run to the screen edges inside .wrap.
   ========================================================================== */
.carousel { position: relative; }
.carousel-track {
  position: relative;
  display: flex;
  gap: var(--slide-gap, 16px);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-block: 6px 28px;
}
.carousel-slide { flex: 0 0 var(--slide-w, 82%); min-width: 0; scroll-snap-align: start; }
.carousel--bleed .carousel-track { margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter); }
.carousel.is-ready .carousel-track { scrollbar-width: none; }
.carousel.is-ready .carousel-track::-webkit-scrollbar { display: none; }
.carousel-track:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: var(--radius); }

.carousel-controls { display: none; align-items: center; justify-content: center; gap: 14px; margin-top: 4px; }
.carousel.is-ready:not(.is-static) .carousel-controls { display: flex; }
.carousel-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--white); color: var(--ink); cursor: pointer; transition: background-color .25s ease, color .25s ease, border-color .25s ease, box-shadow .3s ease, opacity .25s ease; }
.carousel-btn svg { width: 18px; height: 18px; }
.carousel-btn:is(:hover, :focus-visible) { background: var(--ink); border-color: var(--ink); color: var(--white); box-shadow: 0 12px 22px -12px var(--ink-shadow); }
.carousel-btn[aria-disabled="true"] { opacity: .35; cursor: default; background: var(--white); border-color: var(--line); color: var(--ink); box-shadow: none; }
.carousel-dots { display: flex; align-items: center; gap: 2px; }
.carousel-dot { position: relative; width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 12px; }
.carousel-dot::before { content: ""; position: absolute; top: 50%; left: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 4px; background: var(--line); transition: background-color .3s ease, width .35s var(--ease-out), margin .35s var(--ease-out); }
.carousel-dot:hover::before { background: var(--teal); }
.carousel-dot[aria-current="true"]::before { width: 20px; margin-left: -10px; background: var(--ink); }
.carousel-dot:focus-visible { outline-offset: 0; }
.on-ink .carousel-btn { background: transparent; border-color: var(--on-ink-line); color: var(--on-ink); }
.on-ink .carousel-btn:is(:hover, :focus-visible) { background: var(--on-ink); color: var(--ink); }
.on-ink .carousel-dot::before { background: var(--on-ink-line); }
.on-ink .carousel-dot[aria-current="true"]::before { background: var(--on-ink); }

/* Topics use the carousel under 900px and the grid from 900px up. */
.topic-carousel { --slide-w: min(80%, 320px); --slide-gap: 16px; }
@media (min-width: 900px) {
  .topic-carousel .carousel-track { display: grid; gap: 24px; overflow: visible; margin-inline: 0; padding: 0; scroll-snap-type: none; }
}

/* ==========================================================================
   JOURNAL CARDS
   "From the Journal" on the homepage and "Keep reading" on journal posts.
   The row is a carousel at every width. From 900px up, --cols cards share
   the row (3 by default, data-cols="2" for two), so three posts sit side by
   side as a plain row and a fourth turns the same row into a carousel.
   The Read link is stretched over the card, so the whole card is clickable.
   ========================================================================== */
.journal-teaser .head { max-width: var(--read); margin: 0 auto 72px; text-align: center; }
.journal-teaser h2 { font-size: clamp(30px, 4vw, 40px); }
.journal-teaser .head p:not(.kicker) { color: var(--muted); margin: 0; }
.journal-teaser .more { text-align: center; margin: 32px 0 0; }
.journal-carousel { --slide-w: min(84%, 360px); --slide-gap: 16px; --cols: 3; }
.journal-carousel[data-cols="2"] { --cols: 2; }
@media (min-width: 900px) {
  .journal-carousel { --slide-gap: 24px; --slide-w: calc((100% - (var(--cols) - 1) * var(--slide-gap)) / var(--cols)); }
}
.journal-card { position: relative; display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 28px 28px; transition: border-color .35s ease, box-shadow .35s ease; }
.journal-card .kicker { margin-bottom: 14px; }
.journal-card h3 { font-size: 21px; line-height: 1.28; margin-bottom: .55em; }
.journal-card p:not(.kicker) { color: var(--muted); font-size: 16px; line-height: 1.65; margin: 0 0 26px; }
.read-link { margin-top: auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; color: var(--ink); text-decoration: none; }
.read-link svg { width: 18px; height: 18px; flex: none; }
.read-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.read-link:focus-visible { outline: none; }
.read-link:focus-visible::after { outline: 2px solid var(--focus); outline-offset: 3px; }
.journal-card:is(:hover, :focus-within) { border-color: transparent; box-shadow: 0 22px 40px -26px var(--ink-shadow), 0 2px 8px -4px var(--ink-shadow); }
.journal-card:is(:hover, :focus-within) .kicker { color: var(--teal-deep); }
@media (max-width: 899px) { .journal-teaser .head { margin-bottom: 48px; } }

/* ==========================================================================
   MOTION (only when the visitor has not asked for reduced motion)
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  /* Hero entrance: the card fades in, its lines rise in a short stagger, and the photo settles from 1.04 to 1. */
  .hero-card { animation: card-in .8s var(--ease-out) backwards; }
  @keyframes card-in { from { opacity: 0; } }
  .hero .kicker, .hero h1, .hero .lede, .hero .btn-row { animation: rise-in .9s var(--ease-out) backwards; }
  .hero h1 { animation-delay: .09s; }
  .hero .lede { animation-delay: .18s; }
  .hero .btn-row { animation-delay: .27s; }
  .hero-photo img { animation: photo-in 1.5s var(--ease-out) .12s backwards; }
  @keyframes rise-in { from { opacity: 0; translate: 0 18px; } }
  @keyframes photo-in { from { opacity: 0; transform: scale(1.04); } }

  /* Scroll reveal. site.js adds .reveal and .is-in, and sets --reveal-delay for the stagger. */
  .js .reveal {
    opacity: 0; translate: 0 22px;
    transition: opacity .75s var(--ease-out) var(--reveal-delay, 0ms), translate .9s var(--ease-out) var(--reveal-delay, 0ms);
  }
  .js .reveal.is-in { opacity: 1; translate: 0 0; }
  .js .topic.reveal {
    transition: opacity .75s var(--ease-out) var(--reveal-delay, 0ms), translate .9s var(--ease-out) var(--reveal-delay, 0ms),
                transform .35s var(--ease-out), border-color .35s ease, box-shadow .35s ease;
  }

  /* The nib in the ink band draws itself once it scrolls into view. */
  .js .nib-art path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.9s var(--ease-in-out); }
  .js .nib-art path:nth-child(2) { transition-delay: .35s; }
  .js .nib-art path:nth-child(3) { transition-delay: .6s; transition-duration: 1s; }
  .js .nib-art path:nth-child(4) { transition-delay: 1.1s; transition-duration: 1s; }
  .js .nib-art path:nth-child(5) { transition-delay: 1.3s; transition-duration: 1s; }
  .js .nib-art.is-drawn path { stroke-dashoffset: 0; }

  /* Hover lifts. */
  .btn { transition: background-color .25s ease, color .25s ease, border-color .25s ease, box-shadow .3s ease, transform .3s var(--ease-out); }
  .btn:is(:hover, :focus-visible) { transform: translateY(-2px); }
  .btn:active { transform: translateY(0); transition-duration: .1s; }
  .topic { transition: transform .35s var(--ease-out), border-color .35s ease, box-shadow .35s ease; }
  .topic:hover { transform: translateY(-4px); }
  .nav-panel a::after { transition: transform .4s var(--ease-out); }
  .nav-panel.open { animation: panel-in .28s var(--ease-out); }
  @keyframes panel-in { from { opacity: 0; translate: 0 -8px; } }
  .carousel-btn:not([aria-disabled="true"]):is(:hover, :focus-visible) { transform: translateY(-2px); }
  .carousel-btn { transition: background-color .25s ease, color .25s ease, border-color .25s ease, box-shadow .3s ease, opacity .25s ease, transform .3s var(--ease-out); }

  /* Journal cards lift like the topic cards, and the Read arrow nudges forward. */
  .journal-card { transition: transform .35s var(--ease-out), border-color .35s ease, box-shadow .35s ease; }
  .js .journal-card.reveal {
    transition: opacity .75s var(--ease-out) var(--reveal-delay, 0ms), translate .9s var(--ease-out) var(--reveal-delay, 0ms),
                transform .35s var(--ease-out), border-color .35s ease, box-shadow .35s ease;
  }
  .journal-card:is(:hover, :focus-within) { transform: translateY(-4px); }
  .read-link svg { transition: transform .35s var(--ease-out); }
  .journal-card:is(:hover, :focus-within) .read-link svg { transform: translateX(4px); }
}

/* Very slight photo zoom while the pointer is over the hero, desktop pointers only. */
@media (hover: hover) and (min-width: 900px) and (prefers-reduced-motion: no-preference) {
  .hero-photo img { transition: scale 1.2s var(--ease-out); }
  .hero:hover .hero-photo img { scale: 1.03; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0ms !important; }
}
