/* Castle Finder website
   VOICE: Rosco talking to one person. Plain, warm, no hype.
   IDEA: the app on a bigger screen. Same misty keep at night, same glass cards.
   PICTURE: a dot map of Scotland built from the castles themselves.
   COLOUR and TYPE: app palette (slate, paper, gorse ochre, banner red); rounded display like SF Rounded.
   LAYOUT: full-bleed backdrop, 1180px content, everything stacks under 720px. */

:root {
  color-scheme: dark;
  --deep: #1E2630;
  --peat: #2A3542;
  --raised: #3B4855;
  --granite: #323C4A;
  --edge: rgba(245, 239, 224, 0.12);
  --paper: #F5EFE0;
  --dim: #C9C4B6;
  --muted: #8C94A0;
  --gorse: #D4A24A;
  --gorse-soft: rgba(212, 162, 74, 0.14);
  --banner: #C94E3D;
  --glass: rgba(30, 38, 48, 0.62);
  --display: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --maxw: 1180px;
}

*, *::before, *::after { box-sizing: border-box; min-width: 0; }
html { scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; background: var(--deep); }
body {
  margin: 0;
  background: transparent;
  color: var(--paper);
  font: 17px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  min-height: 100vh;
  position: relative;
}
body::before, body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
body::before { background: var(--deep) url("backdrop.jpg") center bottom / cover no-repeat; }
body::after {
  background: linear-gradient(to bottom, rgba(30,38,48,0.10) 0%, rgba(30,38,48,0.40) 50%, rgba(30,38,48,0.78) 100%);
}
@media (min-width: 900px) {
  /* Wide screens: the portrait backdrop sits on the right at full height,
     edges faded into a sky gradient that matches the image's own tones */
  html { background: linear-gradient(to bottom, #192533 0%, #2D3C4F 62%, #1C2836 100%) fixed; }
  body::before {
    inset: auto 3vw 0 auto; width: 55.4vh; height: 120vh;
    background: url("backdrop.jpg") center / cover no-repeat;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 35%, #000 70%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 35%, #000 70%, transparent 100%);
  }
  body::after { background: linear-gradient(to bottom, transparent 55%, rgba(30,38,48,0.55) 100%); }
}

a { color: var(--gorse); text-decoration: none; }
a:hover { color: var(--paper); }
:focus-visible { outline: 2px solid var(--gorse); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
  text-wrap: balance;
  text-shadow: 0 2px 14px rgba(0,0,0,0.35);
}
h1 { font-size: clamp(2.1rem, 6vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.3rem); }
h3 { font-size: 1.2rem; line-height: 1.25; }
p { margin: 0 0 1em; }
.lede { font-size: 1.12rem; color: var(--dim); max-width: 62ch; }
.small { font-size: 0.88rem; color: var(--muted); }
.label {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--gorse);
  letter-spacing: 0.02em;
  margin-bottom: 0.6em;
  display: block;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 max(4vw, 18px); }
.band { padding-block: clamp(36px, 6vw, 80px); }

/* Navigation */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: rgba(30, 38, 48, 0.72);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--edge);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 10px 22px; padding-block: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--paper); font-family: var(--display); font-weight: 800; font-size: 1.08rem; white-space: nowrap; }
.brand img { width: 40px; height: 40px; border-radius: 10px; display: block; }
.nav-links { display: flex; gap: 6px 18px; flex-wrap: wrap; font-size: 0.95rem; }
.nav-links a { color: var(--dim); white-space: nowrap; padding: 6px 0; }
.nav-links a:hover, .nav-links a[aria-current] { color: var(--paper); }
.nav-links a.get { color: var(--deep); background: var(--gorse); padding: 6px 14px; border-radius: 999px; font-weight: 600; }
@media (max-width: 640px) { .nav-inner { flex-wrap: nowrap; } .nav-links { gap: 16px; font-size: 0.92rem; flex-wrap: nowrap; } .nav-links a.get { display: none; } .brand img { width: 34px; height: 34px; } }

/* Glass surfaces, as in the app */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--edge);
  border-radius: 20px;
}
.card { padding: 22px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .g2, .g3 { grid-template-columns: minmax(0, 1fr); } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  border-radius: 999px; border: 1px solid var(--edge);
  background: rgba(245, 239, 224, 0.06); color: var(--paper);
  font: 600 0.98rem/1 var(--body); cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: var(--gorse); color: var(--paper); }
.btn.primary { background: var(--gorse); color: var(--deep); border-color: var(--gorse); }
.btn.primary:hover { background: #E0B262; color: var(--deep); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 0.9rem; }
.btn[aria-pressed="true"] { background: var(--gorse-soft); border-color: var(--gorse); color: var(--gorse); }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* Hero */
.hero { padding-top: clamp(48px, 9vw, 120px); padding-bottom: clamp(28px, 4vw, 48px); }
.hero h1 { max-width: 16ch; }
.wordmark { display: block; width: min(100%, 560px); height: auto; margin: 0 0 clamp(22px, 4vw, 36px); filter: drop-shadow(0 4px 18px rgba(0,0,0,0.4)); }
.hero .lede { margin-bottom: 26px; }
.hero-stats { display: flex; gap: 10px 28px; flex-wrap: wrap; margin-top: 34px; }
.hero-stats div { font-size: 0.9rem; color: var(--dim); }
.hero-stats b { display: block; font-family: var(--display); font-weight: 900; font-size: 2.2rem; color: var(--paper); line-height: 1.05; }

/* Finder */
.finder { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 860px) { .finder { grid-template-columns: minmax(0, 1fr); } }
.mapbox { position: relative; padding: 10px; }
.mapbox svg { display: block; width: 100%; height: auto; touch-action: manipulation; cursor: pointer; }
.map-key { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 0.82rem; color: var(--muted); padding: 4px 10px 8px; }
.map-key i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.panel { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--edge); background: rgba(245,239,224,0.05);
  color: var(--dim); font: 500 0.9rem/1 var(--body); cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--gorse-soft); border-color: var(--gorse); color: var(--gorse); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
select, input[type="search"] {
  min-height: 44px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--edge); background: rgba(30,38,48,0.7); color: var(--paper);
  font: 16px var(--body); max-width: 100%;
}
input[type="search"] { width: 100%; }
.row input[type="search"] { flex: 1 1 200px; width: auto; }
.count { font-size: 0.86rem; color: var(--muted); }

.results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.results li button {
  width: 100%; text-align: left; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 12px;
  padding: 12px 14px; border-radius: 14px; border: 1px solid var(--edge);
  background: rgba(30,38,48,0.5); color: var(--paper); font: inherit; cursor: pointer;
}
.results li button:hover, .results li button[aria-current="true"] { border-color: var(--gorse); }
.results .nm { font-weight: 600; }
.results .mi { font-family: var(--mono); font-size: 0.85rem; color: var(--gorse); white-space: nowrap; align-self: center; grid-row: span 2; }
.results .sub { font-size: 0.84rem; color: var(--muted); }

/* Selected castle card */
.pick { padding: 18px; border-color: rgba(212,162,74,0.45); }
.pick h3 { font-size: 1.45rem; margin-bottom: 4px; }
.meta { color: var(--muted); font-size: 0.9rem; margin-bottom: 10px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; padding: 0; list-style: none; }
.facts li { font-size: 0.82rem; padding: 4px 10px; border-radius: 999px; background: var(--gorse-soft); color: var(--gorse); white-space: nowrap; }
.facts li.no { background: rgba(245,239,224,0.06); color: var(--muted); }
.notice { font-size: 0.86rem; color: var(--dim); background: rgba(201,78,61,0.14); border: 1px solid rgba(201,78,61,0.4); border-radius: 12px; padding: 8px 12px; }

/* Planner */
.plan-list { list-style: none; margin: 0; padding: 0; counter-reset: stop; display: flex; flex-direction: column; gap: 8px; }
.plan-list li {
  counter-increment: stop; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 14px; background: rgba(30,38,48,0.5); border: 1px solid var(--edge);
}
.plan-list li::before {
  content: counter(stop); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gorse); color: var(--deep); font-family: var(--display); font-weight: 900;
}
.plan-list li.start { counter-increment: none; }
.plan-list li.start::before { content: "\2302"; background: var(--banner); color: var(--paper); }
.plan-list .leg { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); white-space: nowrap; }
.iconbtn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--edge); background: transparent; color: var(--muted); cursor: pointer; font-size: 1.1rem; }
.iconbtn:hover { color: var(--paper); border-color: var(--banner); }
.empty { color: var(--muted); font-size: 0.95rem; padding: 14px; border: 1px dashed var(--edge); border-radius: 14px; }

/* Badges */
.badges { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 12px; }
@media (max-width: 600px) { .badges { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.badge { text-align: center; font-size: 0.82rem; color: var(--muted); }
.badge svg { width: 100%; max-width: 86px; height: auto; display: block; margin: 0 auto 6px; }
.badge.earned { color: var(--paper); }
.badge .shield { fill: rgba(245,239,224,0.06); stroke: var(--edge); stroke-width: 2; }
.badge.earned .shield { fill: var(--gorse); stroke: #E9C27A; }
.badge text { font-family: var(--display); font-weight: 900; font-size: 26px; fill: var(--muted); }
.badge.earned text { fill: var(--deep); }
.progress { height: 10px; border-radius: 999px; background: rgba(245,239,224,0.08); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--gorse); border-radius: 999px; transition: width 0.4s; }
@media (prefers-reduced-motion: reduce) { .progress i, .btn { transition: none; } }

/* App feature tiles */
.feature h3 { color: var(--gorse); margin-bottom: 6px; }
.feature p { margin: 0; color: var(--dim); font-size: 0.97rem; }
.store { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.store span { display: inline-flex; flex-direction: column; justify-content: center; min-height: 52px; padding: 6px 18px; border-radius: 14px; border: 1px solid var(--edge); background: rgba(30,38,48,0.6); font-weight: 600; line-height: 1.2; }
.store small { font-weight: 400; font-size: 0.75rem; color: var(--muted); }

/* Guide lists */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.list li a { display: block; height: 100%; padding: 14px 16px; border-radius: 16px; background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border: 1px solid var(--edge); color: var(--paper); }
.list li a:hover { border-color: var(--gorse); }
.list .sub { display: block; font-size: 0.84rem; color: var(--muted); margin-top: 2px; }
.list .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.list .tags i { font-style: normal; font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; background: var(--gorse-soft); color: var(--gorse); }

/* Timeline (history page) */
.century { display: grid; grid-template-columns: 9em minmax(0,1fr); gap: 14px; padding: 16px 0; border-top: 1px solid var(--edge); }
.century h3 { color: var(--gorse); margin: 0; }
.century .names { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.century .names a { color: var(--paper); }
.century .names a:hover { color: var(--gorse); }
@media (max-width: 600px) { .century { grid-template-columns: minmax(0,1fr); gap: 6px; } }

/* Castle page */
.castle-head { padding-top: clamp(36px, 6vw, 72px); padding-bottom: 20px; }
.crumbs { font-size: 0.9rem; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--dim); }
.detail { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 860px) { .detail { grid-template-columns: minmax(0,1fr); } }
.dl { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 8px 18px; margin: 0; }
.dl dt { color: var(--muted); font-size: 0.92rem; }
.dl dd { margin: 0; font-weight: 500; }
.near-list { list-style: none; margin: 0; padding: 0; }
.near-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--edge); }
.near-list li:first-child { border-top: 0; }
.near-list .mi { font-family: var(--mono); font-size: 0.85rem; color: var(--gorse); white-space: nowrap; }
.prose { max-width: 70ch; }
.prose h2 { margin-top: 1.4em; font-size: 1.5rem; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 0.4em; }

/* Directory */
.az { display: flex; gap: 4px; flex-wrap: wrap; margin: 12px 0 20px; }
.az a { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--edge); color: var(--dim); font-weight: 600; }
.az a:hover { border-color: var(--gorse); color: var(--paper); }
.dir { columns: 3 240px; column-gap: 28px; padding: 0; list-style: none; margin: 0; }
.dir li { break-inside: avoid; padding: 3px 0; font-size: 0.95rem; }
.dir li span { color: var(--dim); }
.dir h3 { column-span: all; margin: 22px 0 8px; color: var(--gorse); }

footer { padding: 40px 0 56px; color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--edge); background: rgba(30,38,48,0.6); margin-top: 40px; }
.foot { display: flex; justify-content: space-between; gap: 16px 28px; flex-wrap: wrap; }
.foot nav { display: flex; gap: 8px 18px; flex-wrap: wrap; }
.foot a { color: var(--dim); }

/* Photos from Wikimedia Commons, always with their credit */
.photo { margin: 0; overflow: hidden; padding: 0; }
.photo img { display: block; width: 100%; height: clamp(220px, 42vw, 480px); object-fit: cover; }
.photo figcaption, .credit { font-size: 0.78rem; color: var(--muted); padding: 8px 14px; }
.photo figcaption a, .credit a { color: var(--dim); text-decoration: underline; text-decoration-color: var(--edge); }
.list .thumb { display: block; width: calc(100% + 32px); max-width: none; height: 150px; object-fit: cover; margin: -14px -16px 12px; border-radius: 16px 16px 0 0; }
.pick .pickimg { display: block; width: calc(100% + 36px); max-width: none; height: 190px; object-fit: cover; margin: -18px -18px 0; border-radius: 20px 20px 0 0; }
.pick .credit { padding: 6px 0 10px; }

/* Taster map pins */
.pin { cursor: pointer; outline: none; }
.pin .halo { fill: rgba(212,162,74,0.18); stroke: none; transition: r 0.2s; }
.pin .dot { fill: #D4A24A; stroke: #1E2630; stroke-width: 2; }
.pin:hover .halo, .pin:focus-visible .halo, .pin.on .halo { fill: rgba(212,162,74,0.38); }
.pin.on .dot { fill: #F5EFE0; }
.pin:focus-visible .dot { stroke: #F5EFE0; stroke-width: 3; }
.panel h2 { margin-top: 4px; }

/* Bottom sheet, like the app's castle sheet */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(10,14,20,0.55); opacity: 0; transition: opacity 0.2s; }
.scrim.open { opacity: 1; }
.sheet {
  position: fixed; z-index: 41; left: 50%; bottom: 0; width: min(560px, 100%);
  max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
  transform: translate(-50%, 100%); transition: transform 0.22s ease-out;
  background: rgba(30, 38, 48, 0.92); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border: 1px solid var(--edge); border-bottom: 0; border-radius: 24px 24px 0 0;
  padding: 10px 20px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 50px rgba(0,0,0,0.45);
}
.sheet.open { transform: translate(-50%, 0); }
.grabber { width: 42px; height: 5px; border-radius: 999px; background: rgba(245,239,224,0.25); margin: 0 auto 10px; }
.sheet-close { position: absolute; top: 10px; right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--edge); background: rgba(30,38,48,0.8); color: var(--paper); font-size: 1.4rem; line-height: 1; cursor: pointer; z-index: 2; }
.sheet h3 { font-size: 1.6rem; margin: 2px 0 4px; padding-right: 44px; }
.sheet .sheet-img { display: block; width: calc(100% + 40px); max-width: none; height: 200px; object-fit: cover; margin: -10px -20px 0; border-radius: 24px 24px 0 0; }
.sheet .credit { padding: 6px 0 8px; }
.sheet-app { display: grid; grid-template-columns: 52px minmax(0,1fr); gap: 14px; margin-top: 18px; padding: 16px; border-radius: 18px; background: var(--gorse-soft); border: 1px solid rgba(212,162,74,0.35); }
.sheet-app img { border-radius: 12px; }
.sheet-app b { font-family: var(--display); font-size: 1.1rem; }
.sheet-app p { margin: 4px 0 12px; font-size: 0.93rem; color: var(--dim); }
@media (min-width: 900px) {
  .sheet { bottom: auto; top: 50%; border-radius: 24px; border-bottom: 1px solid var(--edge); transform: translate(-50%, -46%); opacity: 0; transition: transform 0.2s, opacity 0.2s; }
  .sheet.open { transform: translate(-50%, -50%); opacity: 1; }
  .grabber { display: none; }
}
@media (prefers-reduced-motion: reduce) { .sheet, .scrim, .pin .halo { transition: none; } }

/* Calmer layout */
.hero { text-align: left; }
.hero .wm { margin: 0; }
.hero .lede { margin: 0 0 24px; max-width: 34ch; }
.card.simple { color: inherit; }
.card.simple h3 { margin: 0 0 6px; }
.card.simple p { margin: 0; color: var(--dim); }
.card.simple:hover { border-color: var(--gorse); }
.panel { padding-top: 6px; }
@media (max-width: 860px) { .finder .panel { order: -1; padding: 0 2px 4px; } .finder .panel h2 { font-size: 1.5rem; margin-bottom: 4px; } .finder .panel p { margin: 0; } }

/* Opening screen: logo at the top, words and button at the bottom,
   the backdrop castle left clear in between */
.hero {
  min-height: calc(100vh - 64px);
  min-height: calc(100svh - 64px);
  display: flex; flex-direction: column;
  padding-top: clamp(28px, 6vh, 64px);
  padding-bottom: clamp(28px, 6vh, 56px);
}
.hero .wm { flex: 0 0 auto; }
.hero .lede { margin-top: auto; text-shadow: 0 2px 12px rgba(0,0,0,0.6); color: var(--paper); }
.hero .btn { align-self: flex-start; }

/* Hero strip: a scrolling band of famous castle photos, teasing the map
   below. Horizontal overflow on wider screens, native snap scroll on
   mobile for a tactile swipe. Caption lives at the bottom of each tile. */
.hero-strip {
  padding: 0 0 36px;
  margin: 0;
}
.hero-strip .rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(300px, 32%);
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 4px 24px 18px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.hero-strip .rail::-webkit-scrollbar { height: 8px; }
.hero-strip .rail::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
.hero-strip figure {
  position: relative;
  margin: 0;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  overflow: hidden;
  scroll-snap-align: start;
  border: 1px solid rgba(255,255,255,0.08);
  background: var(--slate-800, #2A3542);
}
.hero-strip figure img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.hero-strip figure:hover img { transform: scale(1.03); }
.hero-strip figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 36px 14px 12px;
  color: #F5EBD9;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.0) 40%, rgba(0,0,0,0.75) 100%);
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.hero-strip figcaption small {
  display: block;
  font-weight: 400;
  font-size: 0.8rem;
  color: rgba(245,235,217,0.75);
  margin-top: 2px;
}
@media (max-width: 760px) {
  .hero-strip .rail { grid-auto-columns: 78%; padding: 4px 16px 14px; }
}

/* Page hero: a full-width photo at the top of audience pages, with the
   page's own crumb/label/heading sitting on top. Short, atmospheric.
   Pairs with .castle-head below for the heading block. */
.page-hero {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: 0;
}
.page-hero img {
  width: 100%;
  height: clamp(220px, 32vh, 360px);
  object-fit: cover;
  display: block;
  filter: brightness(0.72);
}
.page-hero .page-hero-credit {
  position: absolute;
  bottom: 8px; right: 14px;
  color: rgba(245,235,217,0.65);
  font-size: 0.72rem;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.page-hero + .castle-head { margin-top: -40px; position: relative; }

/* Map sheet: pair of store badges where the single CTA used to be. */
.sheet-stores { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.sheet-stores a { line-height: 0; }
.sheet-stores img { height: 40px; width: auto; display: block; transition: transform 0.15s ease; }
.sheet-stores a:hover img { transform: translateY(-2px); }

/* Slim app CTA that sits just under the main nav on every page except
   the homepage. One row on desktop: icon · copy · two store badges. On
   phones the badges drop below the copy so nothing clips. */
.top-cta {
  background: linear-gradient(90deg, rgba(212, 162, 74, 0.14) 0%, rgba(201, 78, 61, 0.12) 100%);
  border-bottom: 1px solid rgba(212, 162, 74, 0.35);
}
.top-cta-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
}
.top-cta-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  flex: 0 0 auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.top-cta-copy { flex: 1 1 auto; min-width: 0; line-height: 1.3; }
.top-cta-copy b { display: block; color: var(--paper, #F5EBD9); font-weight: 800; font-size: 0.95rem; }
.top-cta-copy span { display: block; color: var(--dim, #AEB6C1); font-size: 0.82rem; }
.top-cta-badges { display: flex; gap: 8px; flex: 0 0 auto; }
.top-cta-badges a { line-height: 0; }
.top-cta-badges img { height: 40px; width: auto; display: block; transition: transform 0.15s ease; }
.top-cta-badges a:hover img { transform: translateY(-2px); }
@media (max-width: 640px) {
  .top-cta-inner { flex-wrap: wrap; gap: 10px; }
  .top-cta-copy { flex: 1 1 100%; order: 2; }
  .top-cta-badges { order: 3; width: 100%; }
  .top-cta-badges img { height: 36px; }
}

/* Families page: playful quest cards under the hero. Big icon, chunky title,
   one line of adventure. Grid collapses to 2-up then 1-up on phones. */
.quest-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 4px 0 24px;
}
@media (max-width: 860px) { .quest-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .quest-grid { grid-template-columns: 1fr; } }
.quest-card {
  background: rgba(212, 162, 74, 0.08);
  border: 1px solid rgba(212, 162, 74, 0.28);
  border-radius: 16px;
  padding: 18px 16px 16px;
  text-align: center;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.quest-card:hover {
  transform: translateY(-3px);
  border-color: var(--gorse, #D4A24A);
  background: rgba(212, 162, 74, 0.14);
}
.quest-ico {
  display: inline-block;
  font-size: 2.4rem;
  line-height: 1;
  margin-bottom: 8px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}
.quest-card h3 {
  font-family: var(--display, 'Nunito', sans-serif);
  font-weight: 900;
  font-size: 1.1rem;
  margin: 0 0 6px;
  color: var(--gorse, #D4A24A);
}
.quest-card p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--paper, #F5EBD9);
  opacity: 0.85;
}

/* Free download card: parchment-feeling block promoting the printable
   Castle Quest cheat sheet on the families page. Whole card is clickable. */
.download-card {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 20px;
  align-items: center;
  padding: 22px 24px;
  margin: 10px 0 20px;
  background: linear-gradient(135deg, rgba(212, 162, 74, 0.16) 0%, rgba(201, 78, 61, 0.1) 100%);
  border: 1.5px dashed rgba(212, 162, 74, 0.55);
  border-radius: 18px;
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.download-card:hover {
  transform: translateY(-2px);
  border-color: var(--gorse, #D4A24A);
  background: linear-gradient(135deg, rgba(212, 162, 74, 0.24) 0%, rgba(201, 78, 61, 0.14) 100%);
  color: inherit;
}
.download-ico {
  font-size: 4.2rem;
  line-height: 1;
  text-align: center;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.45));
}
.download-body h2 {
  margin: 4px 0 6px;
  font-size: 1.5rem;
  color: var(--paper, #F5EBD9);
}
.download-body p {
  margin: 0 0 12px;
  color: var(--paper, #F5EBD9);
  opacity: 0.85;
  font-size: 0.95rem;
}
.download-body .label {
  color: var(--gorse, #D4A24A);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
@media (max-width: 600px) {
  .download-card { grid-template-columns: 1fr; text-align: center; padding: 20px; }
  .download-ico { font-size: 3.4rem; }
}

/* Carousel sits inside .wrap so both edges align with the content column.
   The rail itself scrolls within that box. No overflow leaking to the
   right side any more. */
.hero-strip { padding: 0 0 36px; }
.hero-strip .rail { padding: 4px 2px 18px; }

/* Hero castle photo: sits in the hero column between the wordmark and the
   lede/button, matching the wordmark's width (560px cap) so the whole
   hero reads as a tidy vertical stack. Flex item, not absolute. */
.hero { position: relative; }
.hero-castle-left {
  width: min(100%, 460px);
  margin: auto 0 0;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hero-castle-left figure {
  position: relative;
  margin: 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(245,235,217,0.1);
  box-shadow: 0 24px 56px rgba(0,0,0,0.55);
}
.hero-castle-left .hero-main img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.hero-castle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.hero-castle-left .hero-sq img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}
.hero-castle-left figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 28px 12px 10px;
  font-size: 0.72rem;
  color: rgba(245,235,217,0.9);
  line-height: 1.3;
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.0) 40%, rgba(0,0,0,0.75) 100%);
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
@media (max-width: 900px) { .hero-castle-left { display: none; } }

/* Store badges — official-look App Store + Google Play, inline SVG so they
   stay sharp at any size and work on the dark slate background. */
.stores {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 14px 0 0;
}
.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: #0b0d10;
  border: 1px solid rgba(245,235,217,0.25);
  border-radius: 10px;
  color: #F5EBD9;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
  min-width: 170px;
}
.store-badge:hover { transform: translateY(-2px); border-color: var(--gorse, #D4A24A); }
.store-badge svg { flex: 0 0 auto; }
.store-badge .bl { line-height: 1.1; display: block; }
.store-badge .bl small { display: block; font-size: 0.68rem; opacity: 0.8; font-weight: 400; letter-spacing: 0.02em; text-transform: uppercase; }
.store-badge .bl b { display: block; font-size: 1.05rem; font-weight: 600; }

/* Family of apps section — three cards side-by-side with logo + name +
   one-line pitch + a tiny "open" link. On mobile they stack. */
.family {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 860px) { .family { grid-template-columns: 1fr; } }
.family .app {
  display: flex; flex-direction: column;
  padding: 22px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  color: inherit; text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.family .app:hover { border-color: var(--gorse, #D4A24A); transform: translateY(-2px); }
.family .app img.icon {
  width: 64px; height: 64px;
  border-radius: 14px;
  margin-bottom: 14px;
  object-fit: cover;
  background: rgba(255,255,255,0.03);
}
.family .app h3 { margin: 0 0 6px; font-size: 1.15rem; }
.family .app p { margin: 0 0 14px; color: var(--dim, #AEB6C1); font-size: 0.95rem; }
.family .app .go { color: var(--gorse, #D4A24A); font-weight: 600; font-size: 0.9rem; margin-top: auto; }
.family .app.here { border-color: var(--gorse, #D4A24A); background: rgba(212,162,74,0.08); }
.family .app.here .go { color: var(--paper, #F5EBD9); opacity: 0.6; }

/* Small store badges inside family cards + wherever a dense row is needed. */
.family .stores-mini {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 12px;
}
.family .stores-mini img { height: 34px; width: auto; display: block; }
.family .stores-mini a { display: inline-flex; transition: opacity 0.15s; }
.family .stores-mini a:hover { opacity: 0.85; }
