/* ==========================================================================
   CouRage Against Anxiety – based on the book's design: warm yellow to red, brush lettering, watercolour.
   Calm and easy to read for anxious and neurodivergent readers. All text pairs meet WCAG 2.2 AA:
   ink on cream 16.7:1, muted 9.9:1, red links 6.3:1, ink on yellow 11.5:1, white on red 6.5:1.
   "Calm mode" (html.calm) removes the watercolour, colour gradients and motion, and adds space.
   ========================================================================== */
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/atkinson-400.woff2) format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: italic; font-weight: 400; font-display: swap; src: url(/fonts/atkinson-400-italic.woff2) format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/atkinson-700.woff2) format('woff2'); }
@font-face { font-family: 'Dancing Script'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/dancing-script.woff2) format('woff2'); }

:root {
  --ink: #1F1A17;        /* text */
  --muted: #4A3F38;      /* secondary text */
  --red: #A8361F;        /* links and accents (6.3:1 on cream) */
  --yellow: #F8D000;     /* logo yellow: backgrounds and buttons only */
  --orange: #E9964F;     /* logo orange: decoration only */
  --coral: #D0553F;      /* logo red: decoration only */
  --cream: #F3F9FC;      /* page: a very light, calming blue (Melissa, 8 Nov; was a warm cream) */
  /* Each part's colour from the book (--pN), plus a deeper shade for text (--pN-ink, 5:1 or more on cream) */
  --p1: #C42538; --p1-ink: #A82634; --p1-tint: #FBE3E5;   /* Part 1 Knowledge is power: red */
  --p2: #B23E97; --p2-ink: #8E3579; --p2-tint: #F6E1F0;   /* Part 2 Face it: magenta */
  --p3: #0EA2D3; --p3-ink: #1F6E8E; --p3-tint: #DDF1F9;   /* Part 3 Calm your farm: sky blue */
  --p4: #11B3A1; --p4-ink: #1B7568; --p4-tint: #DDF4F1;   /* Part 4 Plan it: teal */
  --peach: #E7F3F9;      /* soft panels: light blue */
  --white: #FFFFFF;
  --brush: 'Dancing Script', cursive;   /* headline script (Melissa's choice, 8 Nov) */
  --body: 'Atkinson Hyperlegible', system-ui, sans-serif;
  --radius: 22px;
  --wrap: 1180px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--body); font-size: 1.15rem; line-height: 1.7; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--red); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
p { margin: 0 0 1em; max-width: 68ch; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .4em; }
h2 { font-family: var(--brush); font-weight: 700; font-size: clamp(2.5rem, 5vw, 3.5rem); line-height: 1.1; }
h3 { font-size: 1.3rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 16px; top: -100px; z-index: 30; background: var(--ink); color: var(--cream); padding: 12px 16px; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 32px; }
.section { padding: 56px 0; } /* every gap between sections: 56 + 56 = 112px (phones 40 + 40) */
.section-peach { background: var(--peach); }
.section-white { background: var(--white); }
.section-yellow { background: #FFF2B8; }               /* soft logo yellow (ink text 15:1) */
.section-yellow .edition { background: var(--ink); color: var(--yellow); }
.lead { font-size: 1.3rem; color: var(--muted); }
.wc { mix-blend-mode: multiply; } /* watercolour images: their white background melts into the page, like the book */
.num { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; } /* figures: Atkinson's zero is slashed */
.gradient-text { background: linear-gradient(90deg, #E0B000, var(--orange) 45%, var(--coral)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 26px; border-radius: 999px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; border: 2px solid var(--ink); transition: transform .2s var(--ease); }
.btn:hover { transform: translateY(-2px); text-decoration: none; }
.btn-primary { background: var(--yellow); color: var(--ink); }
.btn-dark { background: var(--ink); color: var(--cream); }
.btn-outline { background: transparent; color: var(--ink); }
.btn svg { width: 20px; height: 20px; flex: none; }
.actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 28px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--white); border-bottom: 1px solid rgba(31, 26, 23, .12); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; min-height: 76px; padding-top: 14px; padding-bottom: 14px; }
.brand { display: inline-flex; align-items: center; min-height: 44px; }
.brand img { height: 66px; width: auto; }
.nav { display: flex; flex-wrap: wrap; gap: 4px clamp(20px, 2.2vw, 34px); font-weight: 400; font-size: 1rem; } /* regular weight, so the logo leads */
.nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); text-decoration: none; border-bottom: 3px solid transparent; }
.nav a:hover, .nav a[aria-current=page] { border-bottom-color: var(--orange); }
.calm-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 2px solid var(--ink); border-radius: 999px;
  background: var(--white); color: var(--ink); font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer; }
.calm-toggle { text-decoration: none; }
.calm-toggle:hover, .calm-toggle[aria-current=page] { background: var(--ink); color: var(--cream); }
.calm-toggle svg { width: 20px; height: 20px; }

/* Hero */
.hero { position: relative; overflow: hidden; padding: 56px 0 56px; background: var(--white); }
.hero-inner { display: grid; grid-template-columns: 1.05fr .95fr; gap: 24px; align-items: center; }
.hero h1 { margin: 0; }
.hero h1 img { width: min(100%, 340px); }
.tagline { font-family: var(--brush); font-weight: 700; font-size: clamp(2.2rem, 4.4vw, 3.2rem); line-height: 1.15; margin: 18px 0 8px; }
.hero-art { position: relative; }
.hero-inner > div:first-child { position: relative; z-index: 1; } /* text stays on top */
.hero-art { position: relative; z-index: 0; }
.hero-art { align-self: stretch; min-height: 520px; }
/* The mountain fills the column down to the bottom of the hero section and fades softly into it.
   Its height is worked out so the climber (about a third of the way down the image) lines up with "CouRage". */
.hero-art img { position: absolute; bottom: -72px; left: 62%; transform: translateX(-53%); height: calc((100% + 30px) / .72); width: auto; max-width: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent 100%); mask-image: linear-gradient(to bottom, #000 72%, transparent 100%); } /* larger, tucked a little under the text; the empty mist above is pulled up */ /* the watercolour fades out at its edges, so it can spill a little */
.splash { position: absolute; z-index: -1; pointer-events: none; opacity: .35; left: -120px; top: -60px; width: min(800px, 90vw); }

/* Cards: the journey */
.journey { list-style: none; margin: 36px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; }
.journey li { position: relative; background: var(--white); border: 2px solid var(--ink); border-radius: var(--radius); padding: 24px 22px 26px; transition: transform .2s var(--ease); }
.journey li:hover, .journey li:focus-within { transform: translateY(-4px); }
.journey img { width: 92px; margin-bottom: 10px; }
.journey h3 a { color: var(--ink); text-decoration: none; }
.journey h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.journey p { margin: 0; color: var(--muted); font-size: 1.05rem; }
.part-label { display: block; font-size: .95rem; font-weight: 700; color: var(--key-ink, var(--red)); }
/* Part colours: set --key on a card or a whole part page (class part-1 … part-4) */
.part-1 { --key: var(--p1); --key-ink: var(--p1-ink); --key-tint: var(--p1-tint); }
.part-2 { --key: var(--p2); --key-ink: var(--p2-ink); --key-tint: var(--p2-tint); }
.part-3 { --key: var(--p3); --key-ink: var(--p3-ink); --key-tint: var(--p3-tint); }
.part-4 { --key: var(--p4); --key-ink: var(--p4-ink); --key-tint: var(--p4-tint); }
.journey li { border-top: 10px solid var(--key, var(--orange)); }
.journey li:hover, .journey li:focus-within { background: var(--key-tint, var(--peach)); }

/* Two columns */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.split-narrow { grid-template-columns: .8fr 1.2fr; align-items: start; } /* photo lines up with the top of the text */
.book-cover { max-width: min(100%, 380px); margin: 0 auto; border-radius: 6px; box-shadow: 0 18px 40px rgba(31, 26, 23, .25); }
.portrait { max-width: min(100%, 420px); } /* plain photo, no arch frame (Melissa, 9 Nov) */
.quote { font-family: var(--brush); font-weight: 700; font-size: 2.1rem; line-height: 1.2; color: var(--red); margin: 0 0 16px; }

/* Neurodivergence teaser */
.nd-list { list-style: none; margin: 28px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.nd-list li { position: relative; padding: 20px 22px; border: 2px solid transparent;
  background: linear-gradient(var(--bg), var(--bg)) padding-box, linear-gradient(150deg, var(--key, var(--coral)), var(--yellow)) border-box; }
.nd-list a { color: var(--ink); text-decoration: none; }
.nd-list a::after { content: ""; position: absolute; inset: 0; }
.nd-list li:hover, .nd-list li:focus-within { background: linear-gradient(var(--key-tint), var(--key-tint)) padding-box, linear-gradient(150deg, var(--key, var(--coral)), var(--yellow)) border-box; }
.nd-list h3 a { color: var(--ink); }
.nd-list p { margin: 4px 0 0; color: var(--muted); font-size: 1.02rem; }
.draft-note { border: 2px dashed var(--red); border-radius: 12px; padding: 10px 14px; font-size: 1rem; background: var(--white); }

/* Support and footer */
.support { background: var(--ink); color: var(--cream); }
.support h2 { color: var(--yellow); }
.support a { color: var(--yellow); }
.support-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.support-list li { border: 2px solid rgba(255, 251, 242, .35); border-radius: 16px; padding: 14px 18px; }
.support-list strong { display: block; font-size: 1.2rem; }
/* Footer: soft peach (Charlie & Chai's black ears need a light background) */
.site-footer { background: var(--peach); color: var(--ink); padding: 24px 0; font-size: 1rem; font-weight: 700; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; align-items: center; }
.site-footer p { margin: 0; }
.site-footer a { color: var(--ink); }
.social { display: flex; gap: 10px; }
.social a { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--ink); }
.dogs-btn:hover { background: var(--white) !important; }

/* Contact */
.contact { background: var(--white); }
#copy-email .icon-tick { display: none; }
#copy-email.is-copied .icon-copy { display: none; }
#copy-email.is-copied .icon-tick { display: inline; }

/* Second edition label */
.edition { display: inline-block; margin: 0 0 6px; padding: 2px 14px; border-radius: 999px; background: var(--yellow); font-weight: 700; }

/* Journey map: the mountain from the book's "Your journey" spread, with real links for each part */
.mountain { position: relative; max-width: 1100px; margin: 24px auto 0; }
.mountain img { width: 100%; }
.mountain svg.trail { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.marker { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--key-ink, var(--ink)); }
.marker .dot { width: 28px; height: 28px; border-radius: 50%; background: var(--white); border: 7px solid var(--key, var(--orange)); box-shadow: 0 2px 6px rgba(0, 0, 0, .25); flex: none; }
.marker .label { font-family: var(--brush); font-weight: 700; font-size: clamp(1.1rem, 2.2vw, 1.6rem); line-height: 1; background: rgba(255, 255, 255, .92); padding: 4px 12px; border-radius: 999px; }
.marker:hover .label { text-decoration: underline; }
.marker.flag .dot { border-color: var(--p1); border-radius: 4px 50% 50% 4px; }
.marker.you .dot { border-color: var(--yellow); }
.marker.left { flex-direction: row-reverse; }

/* Calm mode: no watercolour
.social svg { width: 20px; height: 20px; }

/* Charlie & Chai: footer dogs and their game (copied from the portfolio's design tools, in the book's colours) */
.supervised { display: inline-flex; align-items: center; gap: 10px; }
.dogs { display: inline-flex; }
.dog { width: 34px; height: 34px; }
.dog + .dog { margin-left: 8px; } /* a little space between Charlie and Chai */
/* The dogs open the game */
.dogs-btn { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; padding: 4px 6px; margin: -4px 0 -4px -6px;
  border: 0; border-radius: 14px; background: transparent; cursor: pointer; }
.dogs-btn:hover { background: var(--peach); }
.dogs-btn:hover .dog { transform: translateY(-3px); }
.dog { transition: transform .3s var(--ease); }
.dogs-btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }


/* Copied from the portfolio's styles.css; keep the two in step */
/* Charlie & Chai's bone hunt (js/dog-game.js) */
.dog-game { width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 3px solid var(--ink);
  border-radius: var(--radius); background: var(--cream); color: var(--ink); font-family: var(--body); font-size: 1.05rem; line-height: 1.5; overflow: auto; }
#dg-live { top: 0; left: 0; } /* keep the screen reader message from adding scroll */
.dog-game::backdrop { background: rgba(46, 10, 92, .75); }
.dg-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px 12px 24px; background: var(--ink); color: var(--white); }
.dg-title { margin: 0; font-family: var(--brush); font-weight: 800; font-size: 1.35rem; color: var(--yellow); }
.dg-title:focus { outline: none; }
.dg-screen { padding: 16px 20px 20px; }
.dg-big { margin: 0 0 12px; font-family: var(--brush); font-weight: 800; font-size: clamp(1.4rem, 4vw, 2.2rem); line-height: 1.15; letter-spacing: -0.02em; }
.dg-help { margin: 20px 0 12px; color: var(--muted); }
.dg-players { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.dg-player { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px; border: 2px solid var(--ink); border-radius: var(--radius);
  background: var(--white); color: var(--ink); font: inherit; cursor: pointer; transition: background-color .3s var(--ease), transform .3s var(--ease); }
.dg-player:hover, .dg-player:focus-visible { background: var(--peach); transform: translateY(-3px); }
.dg-player:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.dg-face svg { width: 96px; height: 96px; }
.dg-name { font-family: var(--brush); font-weight: 800; font-size: 1.5rem; }
.dg-breed { font-size: .95rem; color: var(--muted); }
.dg-btn { min-height: 44px; padding: 0 18px; border: 2px solid var(--ink); border-radius: 14px; background: transparent; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.dg-bar .dg-btn { border-color: var(--yellow); color: var(--yellow); }
.dg-btn:hover { background: var(--ink); color: var(--yellow); }
.dg-bar .dg-btn:hover { background: var(--yellow); color: var(--ink); }
.dg-primary { background: var(--ink); color: var(--yellow); }
.dg-btn:focus-visible, .dg-arrow:focus-visible, .dg-link:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.dg-link { min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.dg-status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; margin-bottom: 8px; font-weight: 700; }
.dg-status strong { font-family: var(--brush); font-weight: 800; font-size: 1.2rem; }
.dg-stage { position: relative; display: flex; justify-content: center; }
.dg-stage canvas { display: block; max-width: 100%; border-radius: 12px 0 12px 0; touch-action: none; }
.dg-stage canvas:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.dg-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0; padding: 8px 20px; border-radius: 14px;
  background: var(--yellow); color: var(--ink); font-family: var(--brush); font-weight: 800; font-size: 1.5rem; pointer-events: none; }
.dg-controls { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }
.dg-pad { display: grid; grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(2, 46px); gap: 6px; }
.dg-arrow { border: 2px solid var(--ink); border-radius: 14px; background: var(--white); color: var(--ink); font-size: 1.4rem; font-weight: 700; cursor: pointer; }
.dg-arrow:active, .dg-arrow:hover { background: var(--yellow); }
.dg-arrow[data-dir="up"] { grid-column: 2; grid-row: 1; }
.dg-arrow[data-dir="left"] { grid-column: 1; grid-row: 2; }
.dg-arrow[data-dir="down"] { grid-column: 2; grid-row: 2; }
.dg-arrow[data-dir="right"] { grid-column: 3; grid-row: 2; }
.dg-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 14px; }
/* Puppy pics slider: the photo fits the screen height, so no scrolling */
.dg-slide { margin: 0; display: flex; justify-content: center; }
.dg-slide img { display: block; width: auto; height: auto; max-width: 100%; /* height is fitted to the screen by dog-game.js */
  border: 2px solid var(--ink); border-radius: var(--radius); object-fit: contain; }
.dg-slide-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; }
.dg-slide-nav .dg-btn { padding: 0 12px; white-space: nowrap; }
.dg-count { margin: 0; font-weight: 700; white-space: nowrap; }
@media (max-width: 420px) {
  /* Narrow phones: Previous / Next show just the arrows (the words stay for screen readers) */
  .dg-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .dg-slide-nav .dg-btn { min-width: 52px; font-size: 1.2rem; }
}




/* Calm mode: no watercolour, gradients or motion; plainer colours and more space */
html.calm .splash, html.calm .deco { display: none !important; }
html.calm .wc { mix-blend-mode: multiply; } /* watercolour images: their white background melts into the page, like the book */
.num { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; } /* figures: Atkinson's zero is slashed */
.gradient-text { background: none; color: var(--ink); }
html.calm .section-peach { background: var(--cream); --bg: var(--cream); }
html.calm body { line-height: 1.85; }
html.calm *:not(.breath-circle), html.calm *::before, html.calm *::after { transition: none !important; animation: none !important; } /* the breathing guide is started on purpose */
html.calm .btn:hover, html.calm .journey li:hover, html.calm .journey li:focus-within { transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .btn:hover, .journey li:hover, .journey li:focus-within { transform: none; }
}

@media (max-width: 860px) {
  .wrap { padding: 0 20px; }
  .section { padding: 40px 0; }
  .hero { padding: 32px 0 40px; }
  .hero-inner, .split, .split-narrow { grid-template-columns: minmax(0, 1fr); }
  .hero-art { order: -1; max-width: 460px; margin: 0 auto; }
  .hero-art { min-height: 0; }
  .hero-art img { position: static; transform: none; width: 100%; height: auto; margin: 0; -webkit-mask-image: none; mask-image: none; }
  .brand img { height: 56px; }
}

/* New-tab arrow on links to other websites (js/external-links.js) */
.ext-icon { flex: none; width: .9em; height: .9em; margin-left: 6px; vertical-align: -0.08em; }

/* Journey steps */
.steps { margin: 12px 0 8px; padding-left: 1.4em; max-width: 68ch; }
.steps li { margin: 6px 0; }

/* Calm zone: themed in Part 3's sky blue (Calm your farm). Text stays dark: ink on the blues is 10:1 or more */
.theme-calm main > section:first-child { background: #EEF8FC; }
html.calm .theme-calm .section-peach { background: var(--p3-tint); }
.theme-calm .section-sky { background: #EEF8FC; }
.theme-calm main h1, .theme-calm main h2 { color: var(--p3-ink); }
.theme-calm .btn-primary { background: #8FD3EC; }
.theme-calm .sense-n { background: #8FD3EC; }
.theme-calm .options input, .theme-calm .volume input { accent-color: var(--p3-ink); }
.theme-calm .quick a { border-color: var(--p3-ink); }

/* Calm zone */
.quick { margin-top: 24px; }
.quick-label { font-weight: 700; margin: 0 0 10px; }
.quick ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.quick a { display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 22px; border-radius: 999px; border: 2px solid var(--ink);
  background: var(--white); color: var(--ink); font-weight: 700; text-decoration: none; }
.quick a:hover { background: var(--p3-tint); }
.quick svg { width: 22px; height: 22px; flex: none; color: var(--p3-ink); }
.calm-art { max-width: min(100%, 420px); margin: 0 auto; }
.options { border: 0; margin: 0 0 20px; padding: 0; }
.options legend { font-weight: 700; margin-bottom: 6px; }
.options label { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 6px 0; cursor: pointer; }
.options input { width: 22px; height: 22px; margin: 4px 0 0; accent-color: var(--ink); flex: none; }
.options-row label { display: inline-flex; margin-right: 22px; }
.breathe { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.breath-stage { position: relative; display: grid; place-items: center; aspect-ratio: 1; max-width: 420px; width: 100%; margin: 0 auto; }
.breath-circle { position: absolute; inset: 0; margin: auto; width: 100%; height: 100%; border-radius: 50%;
  background: linear-gradient(150deg, var(--p3), 75%, var(--yellow)); transform: scale(.45); opacity: .85; /* blue-to-yellow, about 3/4 blue */
  transition-property: transform, opacity; transition-timing-function: ease-in-out; transition-duration: 1.5s; }
.breath-circle.is-big { transform: scale(1); }
.breath-circle.no-scale { transform: scale(.85); opacity: .35; }   /* reduced motion: the colour deepens instead of growing */
.breath-circle.no-scale.is-big { opacity: .95; }
.breath-text { position: relative; margin: 0; padding: 0 12%; text-align: center; font-weight: 700; font-size: 1.6rem; line-height: 1.2; } /* plain, easy-to-read words while breathing */
.breath-count { display: block; font-size: 2.6rem; font-weight: 700; font-family: system-ui, sans-serif; }
.breath-left { position: absolute; bottom: -8px; margin: 0; font-weight: 700; color: var(--muted); }
.sound-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }
.volume { display: inline-flex; align-items: center; gap: 12px; font-weight: 700; min-height: 44px; }
.volume input { width: 200px; accent-color: var(--ink); }
.senses { list-style: none; margin: 12px 0 20px; padding: 0; display: grid; gap: 10px; max-width: 520px; }
.senses li { display: flex; align-items: center; gap: 14px; background: var(--white); border-radius: 14px; padding: 10px 16px; font-size: 1.2rem; }
.sense-n { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--yellow); font-weight: 800; font-size: 1.3rem; }
@media (max-width: 860px) { .breathe { grid-template-columns: minmax(0, 1fr); } }

/* Resources */
.res-jump { margin-top: 20px; }
.res-jump a { min-height: 44px; padding: 0 16px; font-size: 1rem; }
.res-note { margin-top: 18px; color: var(--muted); font-size: 1rem; }
.res-group { padding: 8px 0 32px; border-bottom: 1px solid rgba(31, 26, 23, .12); scroll-margin-top: 100px; }
.res-group:last-child { border-bottom: 0; }
.res-group h3 { font-size: 1.35rem; margin: 26px 0 6px; }
.res-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.res-list li { background: var(--cream); border-radius: 16px; padding: 16px 18px; }
.res-list h3, .res-list h4 { margin: 0 0 4px; font-size: 1.1rem; }
.res-list p { margin: 0; font-size: 1rem; }
.res-list .res-meta { margin-top: 6px; color: var(--muted); font-size: .95rem; font-weight: 700; }

/* ==========================================================================
   The book's gradient frames (Contents page, quote boxes): a thin border from the part colour into yellow.
   Use .gframe on any box; part-1…part-4 set the colour (default: the logo's orange).
   ========================================================================== */
.section { --bg: var(--cream); }
.section-white { --bg: var(--white); }
.section-peach { --bg: var(--peach); }
.gframe, .journey li, .res-group, .book-frame, .support-frame, .challenge {
  border: 2px solid transparent; border-radius: 0;
  background: linear-gradient(var(--bg, var(--white)), var(--bg, var(--white))) padding-box,
              linear-gradient(150deg, var(--key, var(--coral)), var(--yellow)) border-box; }

/* Part frames, like the Contents page: the script part name breaks the top border */
.journey { gap: 40px 22px; margin-top: 44px; }
.journey li { border-top-width: 2px; padding: 34px 22px 24px; transform: none; }
.journey li:hover, .journey li:focus-within { background: linear-gradient(var(--key-tint, var(--peach)), var(--key-tint, var(--peach))) padding-box,
  linear-gradient(150deg, var(--key, var(--coral)), var(--yellow)) border-box; transform: none; }
.journey .part-label { position: absolute; top: -.85em; left: 14px; padding: 0 8px; background: var(--bg, var(--cream));
  font-family: var(--brush); font-weight: 700; font-size: 1.7rem; line-height: 1.2; color: var(--key-ink, var(--red)); }
.journey li:hover .part-label, .journey li:focus-within .part-label { background: var(--bg, var(--cream)); }

/* Workbook section and crisis lines: white with a gradient frame, instead of yellow and black */
.section-yellow { background: var(--white); --bg: var(--white); }
.section-yellow .split { padding: 40px 44px; --key: var(--coral); }
.section-yellow .split { border: 2px solid transparent; background: linear-gradient(var(--white), var(--white)) padding-box, linear-gradient(150deg, var(--coral), var(--orange) 45%, var(--yellow)) border-box; }
.edition, .section-yellow .edition { background: transparent; color: var(--red); border: 2px solid var(--orange); }
.support { background: var(--white); color: var(--ink); --bg: var(--white); padding-top: 40px; } /* white, sits close under Get in touch */
.contact { padding-top: 56px; padding-bottom: 48px; }
@media (max-width: 860px) { .contact { padding-top: 40px; padding-bottom: 40px; } }
.support .wrap { padding: 36px 40px; border: 2px solid transparent; background: linear-gradient(var(--bg), var(--bg)) padding-box, linear-gradient(150deg, var(--p1), var(--yellow)) border-box; }
.support h2 { color: var(--p1-ink); }
.support a { color: var(--red); }
.support-list li { border: 2px solid transparent; border-radius: 0; /* same part-colour frames as the neurodivergence boxes */
  background: linear-gradient(var(--bg, var(--white)), var(--bg, var(--white))) padding-box, linear-gradient(150deg, var(--key, var(--coral)), var(--yellow)) border-box; }

/* Resource groups: each in a part-coloured frame, heading breaking the top border */
.res-group { position: relative; margin: 56px 0 0; padding: 30px 28px 26px; border-bottom: 2px solid transparent; }
.res-group > h2 { position: absolute; top: -.75em; left: 18px; margin: 0; padding: 0 10px; font-size: clamp(1.8rem, 3.4vw, 2.4rem); background: var(--bg, var(--white)); color: var(--key-ink, var(--red)); line-height: 1.3; }
.res-group:last-child { border-bottom: 2px solid transparent; }

/* CouRage Challenges page */
.progress-box { margin: 24px 0 8px; max-width: 520px; }
.progress-text { margin: 0 0 8px; font-size: 1.15rem; }
.progress-bar { height: 16px; border-radius: 999px; background: var(--peach); overflow: hidden; border: 1.5px solid rgba(31, 26, 23, .25); }
.progress-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--p1), var(--p2), var(--p3), var(--p4)); transition: width .4s var(--ease); }
.challenges { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 480px), 1fr)); gap: 32px; }
.challenge { padding: 26px 26px 22px; position: relative; }
.challenge.is-done::after { content: "✓ Done"; position: absolute; top: -14px; right: 18px; padding: 2px 12px; border-radius: 999px; background: var(--white); border: 2px solid var(--key); color: var(--key-ink); font-weight: 700; }
.challenge-head { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; }
.challenge-head img { width: 96px; flex: none; }
.challenge-part { margin: 0; font-weight: 700; color: var(--key-ink); font-size: 1rem; }
.challenge h2, .challenge h3 { font-family: var(--brush); font-weight: 700; font-size: clamp(1.9rem, 3.2vw, 2.5rem); line-height: 1.1; margin: 0; }
.challenge-n { display: block; font-size: .6em; color: var(--key-ink); }
.steps-check { border: 0; padding: 0; margin: 8px 0 12px; }
.steps-check legend { font-weight: 700; margin-bottom: 4px; }
.steps-check ul { list-style: none; margin: 0; padding: 0; }
.steps-check label, .done-check { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 6px 0; cursor: pointer; }
.steps-check input, .done-check input { width: 22px; height: 22px; margin: 3px 0 0; accent-color: var(--key-ink); flex: none; }
.done-check { font-weight: 700; border-top: 1px solid rgba(31, 26, 23, .15); padding-top: 12px; }
.challenge-actions { margin: 4px 0 14px; }
.btn-small { min-height: 44px; padding: 0 18px; font-size: 1rem; }
.reset-row { margin-top: 32px; }

/* ==========================================================================
   Accessibility settings (js/a11y.js). Classes on <html>, set before the page draws by js/a11y-init.js.
   ========================================================================== */
@font-face { font-family: 'Lexend'; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/fonts/lexend.woff2) format('woff2'); }
@font-face { font-family: 'OpenDyslexic'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/opendyslexic-400.woff2) format('woff2'); }
@font-face { font-family: 'OpenDyslexic'; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/opendyslexic-700.woff2) format('woff2'); }

.header-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.a11y-panel { border-top: 1px solid rgba(31, 26, 23, .12); background: var(--white); padding: 24px 0 28px; max-height: calc(100vh - 80px); overflow: auto; }
.a11y-panel h2 { font-family: var(--body); font-weight: 700; font-size: 1.5rem; margin-bottom: 4px; }
.a11y-panel h2:focus { outline: none; }
.a11y-intro { color: var(--muted); }
.a11y-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px 32px; }
.a11y-panel fieldset { border: 2px solid rgba(31, 26, 23, .15); border-radius: 16px; padding: 12px 18px 14px; margin: 0; }
.a11y-panel legend { font-weight: 700; padding: 0 6px; }
.a11y-panel label { display: flex; gap: 10px; align-items: center; min-height: 44px; cursor: pointer; }
.a11y-panel input { width: 22px; height: 22px; margin: 0; accent-color: var(--ink); flex: none; }
.ff-lexend { font-family: 'Lexend', sans-serif; }
.ff-dyslexic { font-family: 'OpenDyslexic', sans-serif; }
.big-1 { font-size: 1.15em; }
.big-2 { font-size: 1.3em; }

/* Reading fonts */
html.font-lexend body, html.font-lexend .btn, html.font-lexend input, html.font-lexend button { font-family: 'Lexend', var(--body); }
html.font-dyslexic body, html.font-dyslexic .btn, html.font-dyslexic input, html.font-dyslexic button { font-family: 'OpenDyslexic', var(--body); }
html.font-lexend, html.font-dyslexic { --brush: var(--body); }
html.font-lexend { --body: 'Lexend', 'Atkinson Hyperlegible', sans-serif; }
html.font-dyslexic { --body: 'OpenDyslexic', 'Atkinson Hyperlegible', sans-serif; }
html.font-dyslexic h1, html.font-dyslexic h2, html.font-lexend h1, html.font-lexend h2 { font-weight: 700; }

/* Text size: everything is sized in rem, so the whole page scales */
html.size-2 { font-size: 118.75%; }
html.size-3 { font-size: 137.5%; }

/* Extra spacing (WCAG 1.4.12 text spacing) */
html.extra-spacing body { letter-spacing: .06em; word-spacing: .16em; line-height: 2; }
html.extra-spacing p { margin-bottom: 1.6em; }

/* Plain headings: body font instead of script */
html.plain-headings { --brush: var(--body); }
html.plain-headings h1, html.plain-headings h2, html.plain-headings .tagline, html.plain-headings .quote { font-weight: 700; font-size-adjust: none; }
html.plain-headings h2, html.font-lexend h2, html.font-dyslexic h2 { font-size: clamp(2rem, 4vw, 2.6rem); }
html.plain-headings .tagline, html.font-lexend .tagline, html.font-dyslexic .tagline { font-size: clamp(1.8rem, 3.5vw, 2.4rem); }
html.plain-headings .quote, html.font-lexend .quote, html.font-dyslexic .quote { font-size: 1.6rem; }

/* Reading guide */
.guide-band { position: fixed; left: 0; right: 0; height: 44px; z-index: 50; pointer-events: none; background: rgba(248, 208, 0, .22);
  border-top: 2px solid rgba(31, 26, 23, .35); border-bottom: 2px solid rgba(31, 26, 23, .35); }

/* Dark mode: all text pairs 7:1 or more */
html.colours-dark {
  --ink: #F3ECE3; --muted: #D6CABE; --red: #FFA48A; --cream: #16120F; --white: #211B17; --peach: #2B231D;
  --p1-ink: #FF8A93; --p2-ink: #F29AD9; --p3-ink: #8FD3EC; --p4-ink: #7FDCCF;
  --p1-tint: #3A1E21; --p2-tint: #3A2034; --p3-tint: #16303A; --p4-tint: #15322E;
  color-scheme: dark;
}

html.colours-dark .theme-calm main > section:first-child, html.colours-dark .theme-calm .section-sky { background: #12262E; }
html.colours-dark .sense-n { color: #1F1A17; }

html.colours-dark .brand img, html.colours-dark .hero h1 img { background: #FFFBF2; border-radius: 14px; padding: 6px 10px; }
html.colours-dark .wc { mix-blend-mode: normal; }
html.colours-dark .breath-text { color: #1F1A17; }
html.colours-dark .marker .label { background: rgba(22, 18, 15, .9); }
html.colours-dark .dogs-btn { background: #FFFBF2; }
html.colours-dark .site-header, html.colours-dark .a11y-panel { border-color: rgba(243, 236, 227, .18); }
html.colours-dark .a11y-panel fieldset { border-color: rgba(243, 236, 227, .25); }
/* the game keeps its light colours */
html.colours-dark .dog-game { --ink: #1F1A17; --muted: #4A3F38; --red: #A8361F; --cream: #FFFBF2; --white: #FFFFFF; --peach: #FDEBD9; color-scheme: light; }

/* High contrast: black on white, underlined links, strong borders, no tints or images behind text */
html.colours-contrast {
  --ink: #000000; --muted: #000000; --red: #0000CC; --cream: #FFFFFF; --white: #FFFFFF; --peach: #FFFFFF;
  --p1-ink: #000000; --p2-ink: #000000; --p3-ink: #000000; --p4-ink: #000000;
  --p1-tint: #FFFFFF; --p2-tint: #FFFFFF; --p3-tint: #FFFFFF; --p4-tint: #FFFFFF;
}
html.colours-contrast .section-yellow, html.colours-contrast .theme-calm main > section:first-child, html.colours-contrast .theme-calm .section-sky { background: #FFFFFF; }
html.colours-contrast section { border-top: 2px solid #000; }
html.colours-contrast a { text-decoration: underline !important; }
html.colours-contrast .journey li, html.colours-contrast .nd-list li, html.colours-contrast .senses li, html.colours-contrast .support-list li { border: 2px solid #000; }

html.colours-contrast .marker .label { background: #fff; color: #000; border: 2px solid #000; }
html.colours-contrast .breath-text { color: #000; }

@media (max-width: 860px) {
  .header-tools .calm-toggle { padding: 0 12px; }
}

/* ==========================================================================
   Buttons: no fill, just the book's gradient borders (Melissa, 8 Nov).
   Main: red to yellow. Secondary: blue to yellow. --bg is the colour behind the button.
   ========================================================================== */
.hero { --bg: var(--white); }
.contact { --bg: var(--white); }
.theme-calm main > section:first-child, .theme-calm .section-sky { --bg: #EEF8FC; }
html.calm .theme-calm .section-peach { --bg: var(--p3-tint); }
.btn, .calm-toggle, .quick a, .theme-calm .btn-primary {
  color: var(--ink); border: 2.5px solid transparent;
  background: linear-gradient(var(--bg, var(--white)), var(--bg, var(--white))) padding-box,
              linear-gradient(120deg, var(--btn-from, var(--p1)), var(--yellow)) border-box; }
.btn-outline, .calm-toggle, .quick a, .res-jump a { --btn-from: var(--p3); }
.challenge-actions .btn { --btn-from: var(--key); --hover: var(--key-tint); } /* the challenge's own colour */
#a11y-btn { --btn-from: var(--p1); }
.res-jump li[class*=part-] a { --btn-from: var(--key); } /* each matches its section's frame colour */
.res-jump li[class*=part-] a:hover { --hover: var(--key-tint); } /* Accessibility: main colours, red to yellow */
.btn:hover, .calm-toggle:hover, .calm-toggle[aria-current=page], .calm-toggle[aria-expanded=true], .quick a:hover {
  color: var(--ink);
  background: linear-gradient(var(--hover, #FFF4E5), var(--hover, #FFF4E5)) padding-box,
              linear-gradient(120deg, var(--btn-from, var(--p1)), var(--yellow)) border-box; }
.btn-outline:hover, .calm-toggle:hover, .calm-toggle[aria-current=page], .calm-toggle[aria-expanded=true], .quick a:hover { --hover: var(--p3-tint); }
#a11y-btn:hover, #a11y-btn[aria-expanded=true] { --hover: #FFF4E5; }
.site-header { --bg: var(--white); }
.a11y-panel { --bg: var(--white); }
.calm-toggle svg, .btn svg { color: var(--ink); }

/* Home icon in the menu */
.nav .nav-home { width: 44px; justify-content: center; }
.nav .nav-home svg { width: 24px; height: 24px; }
html.colours-dark { --hover: #2E2620; }
html.colours-contrast .btn, html.colours-contrast .calm-toggle, html.colours-contrast .quick a { background: #fff; border-color: #000; }

.hero .actions .btn { padding: 0 20px; }
.hero .actions { gap: 12px; }

/* Resources: link text in black (still underlined, so it reads as a link) */
.res-list a { color: var(--ink); }
.res-list a:hover { text-decoration-thickness: 3px; }

/* Journey intro: text on the left, the mountain on the right */
.journey-intro { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 32px; align-items: center; }
.journey-intro .mountain { margin: 0; }
@media (max-width: 860px) { .journey-intro { grid-template-columns: minmax(0, 1fr); } }

/* Journey map progress: flags on finished parts, and the star (You) */
.mountain .star { position: absolute; width: 46px; height: 46px; transform: translate(-50%, -50%); z-index: 3; pointer-events: none;
  transition: left 1.6s cubic-bezier(.45, 0, .25, 1), top 1.6s cubic-bezier(.45, 0, .25, 1); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)); }
.mountain .star.no-move { transition: none; }
.mountain .star svg { width: 100%; height: 100%; }
.marker .flag { position: absolute; left: -6px; top: -34px; width: 30px; height: 30px; }
.marker.left .flag { left: auto; right: -6px; }
.marker .flag svg { width: 100%; height: 100%; }
.marker.is-complete .dot { background: var(--key); }
.marker.you .dot { opacity: 0; }   /* the star stands here at the start */
html.calm .mountain .star:not(.no-move) { transition: left 1.6s cubic-bezier(.45, 0, .25, 1), top 1.6s cubic-bezier(.45, 0, .25, 1) !important; }
@media (prefers-reduced-motion: reduce) { .mountain .star, html.calm .mountain .star:not(.no-move) { transition: none !important; } }

/* Celebration pop-up and confetti */
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 100; pointer-events: none; }
.climb { width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 3px solid transparent; border-radius: 0; color: var(--ink);
  background: linear-gradient(var(--white), var(--white)) padding-box, linear-gradient(150deg, var(--p1), var(--yellow)) border-box; --bg: var(--white); }
.climb::backdrop { background: rgba(31, 26, 23, .55); }
.climb-inner { padding: 28px 30px; }
.climb h2 { font-size: clamp(2rem, 4vw, 2.8rem); margin: 0 0 6px; color: var(--p1-ink); }
.climb h2:focus { outline: none; }
.climb-map .mountain { margin: 8px 0 0; }
.climb-map .marker .label { font-size: 1.05rem; }
.climb .actions { margin-top: 12px; }
.marker.is-complete { z-index: 2; } /* flags stay in front of neighbouring labels */

/* Links are black (Melissa, 8 Nov): underlined so they still read as links */
a, .support a { color: var(--ink); }

/* Challenges heading and progress sit straight above the challenge cards, on one white background */
.challenges-top { padding-bottom: 8px; }
.challenges-list { padding-top: 24px; }

/* ==========================================================================
   Menu button (phones and tablets, up to 1023px). Without scripts the full menu shows instead.
   Tablets: logo, Menu, then Accessibility and Calm zone on the right; the links drop down below.
   Phones (up to 600px): logo and Menu only; the links, Accessibility and Calm zone are all in the drop-down.
   ========================================================================== */
.menu-btn { display: none; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 2px solid transparent; border-radius: 999px;
  font: inherit; font-weight: 700; font-size: 1rem; color: var(--ink); cursor: pointer;
  background: linear-gradient(var(--bg, #fff), var(--bg, #fff)) padding-box, linear-gradient(120deg, var(--p3), var(--yellow)) border-box; }
.menu-btn svg { width: 22px; height: 22px; }
.menu-btn .i-close, .menu-btn[aria-expanded=true] .i-open { display: none; }
.menu-btn[aria-expanded=true] .i-close { display: block; }
.menu-btn:hover, .menu-btn[aria-expanded=true] { background: linear-gradient(var(--p3-tint), var(--p3-tint)) padding-box, linear-gradient(120deg, var(--p3), var(--yellow)) border-box; }
html.colours-contrast .menu-btn { background: #fff; border-color: #000; }
@media (max-width: 1099px) {
  html.js .menu-btn { display: inline-flex; }
  html.js .header-inner { justify-content: flex-start; }
  html.js .header-tools { margin-left: auto; }
  html.js .nav { display: none; order: 5; flex: 1 0 100%; flex-direction: column; gap: 0; padding: 4px 0 8px; border-top: 1px solid rgba(31, 26, 23, .12); }
  html.js .menu-open .nav { display: flex; }
  html.js .nav a { min-height: 52px; padding: 0 4px; border-bottom: 1px solid rgba(31, 26, 23, .12); font-size: 1.1rem; }
  html.js .nav a:last-child { border-bottom: 0; }
  html.js .nav a[aria-current=page] { font-weight: 700; box-shadow: inset 4px 0 0 var(--orange); padding-left: 14px; }
  html.js .nav .nav-home { width: auto; justify-content: flex-start; gap: 10px; }
  html.js .nav .nav-home .sr-only { position: static; width: auto; height: auto; margin: 0; clip: auto; clip-path: none; overflow: visible; white-space: normal; }
  /* a long menu (large text) can scroll inside the sticky header */
  html.js .site-header.menu-open { max-height: 100vh; overflow-y: auto; }
}
@media (max-width: 600px) {
  html.js .menu-btn { margin-left: auto; }
  html.js .header-tools { display: none; order: 6; flex: 1 0 100%; margin: 0 0 6px; flex-wrap: wrap; gap: 10px; }
  html.js .menu-open .header-tools { display: flex; }
}
@media (max-width: 1099px) { html.colours-dark.js .nav a { border-bottom-color: rgba(243, 236, 227, .18); } }

/* Framed boxes that are the page container themselves (workbook, crisis lines) keep a gap from the screen edge */
.section-yellow .wrap.split, .support .wrap { width: calc(100% - 64px); }
@media (max-width: 860px) {
  .section-yellow .wrap.split, .support .wrap { width: calc(100% - 40px); }
  .section-yellow .split { padding: 28px 22px; }
  .support .wrap { padding: 28px 22px; }
}

/* Shorter laptop screens (e.g. 13–14" MacBooks): shrink the hero so its buttons are visible without scrolling */
@media (min-width: 861px) and (max-height: 920px) {
  .hero h1 img { width: clamp(200px, 33vh, 340px); }
  .hero .tagline { margin: 10px 0 4px; font-size: clamp(1.9rem, 4.6vh, 3.2rem); }
  .hero .lead { margin-bottom: 0; font-size: 1.15rem; line-height: 1.65; max-width: 34em; }
  .hero .actions { margin-top: 20px; }
  .hero-art { min-height: 0; }
  .hero-art img { height: calc((100% + 110px) / .72); }
}

/* Typography: no single-word last lines (orphans) in paragraphs; even line lengths in headings */
p, li, blockquote, figcaption { text-wrap: pretty; }
h1, h2, h3, .tagline, .quote { text-wrap: balance; }

/* Even section spacing: the first and last things in a section add no extra margin (the section padding sets the gap) */
.section > .wrap > :first-child, .hero .wrap > div > :first-child { margin-top: 0; }
.section > .wrap > :last-child { margin-bottom: 0; }
.resources .wrap > .res-group:first-child { margin-top: 27px; } /* the heading that breaks the top border lines up with the section padding */
@media (max-width: 860px) { .resources .wrap > .res-group:first-child { margin-top: 20px; } }
.support-list .num { white-space: nowrap; } /* keep phone numbers on one line */

/* Resources: the 4 part colours spread evenly over the 7 groups, no repeats:
   red, red–magenta, magenta, magenta–blue, blue, blue–teal, teal. Buttons match their group's frame. */
.spread-1 { --key: var(--p1); --key-ink: var(--p1-ink); --key-tint: var(--p1-tint); }
.spread-3 { --key: var(--p2); --key-ink: var(--p2-ink); --key-tint: var(--p2-tint); }
.spread-5 { --key: var(--p3); --key-ink: var(--p3-ink); --key-tint: var(--p3-tint); }
.spread-7 { --key: var(--p4); --key-ink: var(--p4-ink); --key-tint: var(--p4-tint); }
.spread-2 { --key: color-mix(in srgb, var(--p1), var(--p2)); --key-ink: color-mix(in srgb, var(--p1-ink), var(--p2-ink)); --key-tint: color-mix(in srgb, var(--p1-tint), var(--p2-tint)); }
.spread-4 { --key: color-mix(in srgb, var(--p2), var(--p3)); --key-ink: color-mix(in srgb, var(--p2-ink), var(--p3-ink)); --key-tint: color-mix(in srgb, var(--p2-tint), var(--p3-tint)); }
.spread-6 { --key: color-mix(in srgb, var(--p3), var(--p4)); --key-ink: color-mix(in srgb, var(--p3-ink), var(--p4-ink)); --key-tint: color-mix(in srgb, var(--p3-tint), var(--p4-tint)); }
.res-jump li[class*=spread-] a { --btn-from: var(--key); }
.res-jump li[class*=spread-] a:hover { --hover: var(--key-tint); }

/* Breathing timer ("1:30 left"): a white pill behind it, rounded like the buttons, so it stays readable over the circle */
.breath-left { padding: 6px 16px; border-radius: 999px; background: var(--white); color: var(--ink); line-height: 1.4; }
.breath-left:empty { display: none; }

/* ==========================================================================
   Section spacing (Melissa, 9 Nov): one gap everywhere (--gap).
   - Two sections on the same background: just ONE gap between them (no double padding).
   - Where the background colour changes: the gap sits inside each coloured area (bottom of one, top of the next).
   - The home hero has the same space above and below.
   White sections: .hero, .section-white, .section-yellow (now white), .contact, .support.
   ========================================================================== */
:root { --gap: 72px; }
@media (max-width: 860px) { :root { --gap: 48px; } }
.section, .hero, .contact, .support { padding-top: var(--gap); padding-bottom: var(--gap); }
:is(.hero, .section-white, .section-yellow, .contact, .support) + :is(.section-white, .section-yellow, .contact, .support) { padding-top: 0; }
main:has(> :is(.hero, .section-white, .section-yellow):last-child) + .contact { padding-top: 0; }
/* the challenges heading and its cards belong together */
.section.challenges-top { padding-bottom: 8px; }
.section.challenges-list { padding-top: 24px; }

/* About: the story text runs the full width of the container (Melissa, 9 Nov) */
.story p, .full-text p { max-width: none; } /* also the Calm zone sounds section */
.support p { max-width: none; } /* crisis box intro runs the full width (Melissa, 9 Nov) */
.split > div > :first-child { margin-top: 0; }

/* ==========================================================================
   Calm your farm (Calm zone game, js/farm-game.js): animals are buttons; the picked one is lifted with a
   thick blue border. Paddock styles follow below.
   ========================================================================== */
.farm-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 28px; margin-top: 8px; }
.farm-check { display: inline-flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 6px 0 20px; cursor: pointer; }
.farm-check input { accent-color: var(--p3-ink); width: 20px; height: 20px; margin-top: 4px; flex: none; }
.farm { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 14px; max-width: 1100px; }
.farm-animal { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1; padding: 4px; cursor: pointer;
  background: var(--white); border: 2px solid rgba(31, 26, 23, .25); border-radius: 18px; color: var(--ink); font: inherit; }
.farm-animal svg { width: 100%; height: 100%; }
.farm-animal .b { fill: var(--animal); }
.farm-animal .f { fill: #FFF6E5; }
.farm-animal .k { fill: #1F1A17; }
.farm-animal:hover { border-color: var(--p3-ink); background: var(--p3-tint); }
.farm-animal[aria-pressed="true"] { border: 4px solid var(--p3-ink); background: var(--p3-tint); box-shadow: 0 6px 0 var(--p3-ink); transform: translateY(-4px); }
  background: linear-gradient(var(--white), var(--white)) padding-box, linear-gradient(150deg, var(--p4), var(--yellow)) border-box; }
html.colours-dark .farm-animal { background: #2A231E; border-color: rgba(243, 236, 227, .3); }
html.colours-contrast .farm-animal { border: 2px solid #000; }
html.colours-contrast .farm-animal[aria-pressed="true"] { border: 5px solid #000; }
@media (max-width: 600px) { .farm { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; } .farm-animal { padding: 2px; border-radius: 14px; } }

/* Calm your farm: Paddocks game. The field is a soft green; each paddock has a fence in a book colour. */
.farm-field { margin-top: 8px; padding: 16px 18px 18px; max-width: 1100px; background: #EEF7E6; border-radius: 18px; }
.farm-field-label { margin: 0 0 10px; font-weight: 700; color: #2F5B1E; }
.farm-field-empty { margin: 0; color: var(--muted); }
.farm-loose { margin: 0; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.farm-loose .farm-animal { touch-action: none; }   /* so dragging on touch screens moves the animal, not the page */
.farm-loose .farm-animal.is-lifted { opacity: .35; }
.farm-name { display: none; position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); padding: 0 8px; border-radius: 999px;
  background: var(--ink); color: var(--white); font-size: .8rem; font-weight: 700; line-height: 1.6; white-space: nowrap; }
.farm-loose.show-names .farm-name { display: block; }
.farm-hint { min-height: 1.6em; margin: 12px 0 0; font-weight: 700; color: var(--p3-ink); }
.paddocks { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; max-width: 1100px; }
.paddock { display: flex; flex-direction: column; align-items: stretch; width: 100%; min-height: 170px; padding: 12px; text-align: left; cursor: pointer;
  font: inherit; color: var(--ink); background: var(--key-tint, #FFF6CC); border: 5px solid var(--key, #F8D000); border-radius: 6px;
  background-image: repeating-linear-gradient(90deg, transparent 0 46px, var(--key, #F8D000) 46px 50px); background-size: 100% 6px; background-repeat: no-repeat; background-position: 0 100%; }
.paddock-yellow { --key: #F8D000; --key-ink: #6B5A00; --key-tint: #FFF6CC; }
.paddock-name { font-weight: 700; color: var(--key-ink, #6B5A00); }
.paddock-name .num { margin-left: 4px; font-weight: 400; color: var(--ink); }
.paddock-pen { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.paddock-animal { width: 48px; height: 48px; }
.paddock-animal svg { width: 100%; height: 100%; }
.paddock-animal .b { fill: var(--animal); } .paddock-animal .f { fill: #FFF6E5; } .paddock-animal .k { fill: #1F1A17; }
.paddock.is-target { outline: 3px dashed var(--ink); outline-offset: 3px; }
.paddock.is-over, .paddock:hover { box-shadow: inset 0 0 0 4px var(--white); filter: saturate(1.15); }
.farm-ghost { position: fixed; z-index: 100; width: 84px; height: 84px; margin: -42px 0 0 -42px; pointer-events: none; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .25)); }
.farm-ghost svg { width: 100%; height: 100%; }
.farm-ghost .b { fill: var(--animal); } .farm-ghost .f { fill: #FFF6E5; } .farm-ghost .k { fill: #1F1A17; }
html.colours-dark .farm-field { background: #1E2A1A; } html.colours-dark .farm-field-label { color: #BFE3A8; }
html.colours-dark .paddock { background-color: #241E1A; color: var(--ink); }
html.colours-contrast .paddock { background: #fff; border-color: #000; } html.colours-contrast .farm-field { background: #fff; border: 2px solid #000; }
@media (max-width: 600px) { .farm-loose { grid-template-columns: repeat(4, minmax(0, 1fr)); } .paddocks { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .paddock { min-height: 140px; padding: 8px; } .paddock-animal { width: 36px; height: 36px; } }

/* Calm your farm: the finish pop-up (reuses the journey's .climb pop-up), teal into yellow, with the whole herd */
.farm-dialog { background: linear-gradient(var(--white), var(--white)) padding-box, linear-gradient(150deg, var(--p4), var(--yellow)) border-box; }
.farm-dialog h2 { color: var(--p4-ink); }
.farm-done-herd { list-style: none; margin: 14px 0 4px; padding: 14px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; background: #EEF7E6; border-radius: 14px; }
.farm-done-herd li { width: 54px; height: 54px; }
.farm-done-herd svg { width: 100%; height: 100%; }
.farm-done-herd .b { fill: var(--animal); } .farm-done-herd .f { fill: #FFF6E5; } .farm-done-herd .k { fill: #1F1A17; }
html.colours-dark .farm-done-herd { background: #1E2A1A; }
