/* The Cave Academy: design tokens, layout shell and shared components.
   Mobile-first; one desktop breakpoint at 1100px. Page-specific rules go in
   static/css/<page>.css, never here. */

:root {
  --navy: #0f1a3c;
  --navy-soft: #27315a;
  --gold: #f5c518;
  --gold-deep: #e0a800;
  --gold-text: #8a6100;   /* AA on white (5.5:1); --gold and --gold-deep are for fills only */
  --gold-grad: linear-gradient(180deg, #ffd84a 0%, #f5c518 45%, #e0a800 100%);
  --pale-yellow: #fff3c4;
  --white: #fff;
  --paper: #f6f7fb;
  --line: #dfe2ec;
  --wa: #15803d;
  --wa-deep: #166534;
  --text: #1c2547;

  --shadow-sm: 0 2px 8px rgba(15, 26, 60, .08);
  --shadow-md: 0 8px 24px rgba(15, 26, 60, .10);
  --shadow-gold: 0 6px 16px rgba(224, 168, 0, .38);

  --r-sm: 10px;
  --r-md: 18px;
  --r-lg: 24px;
  --r-pill: 999px;

  --font-head: "Poppins", "Montserrat", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --header-h: 72px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--white);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--navy); line-height: 1.2; margin: 0; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.site-footer :focus-visible, .btn--navy:focus-visible { outline-color: var(--gold); }
::placeholder { color: #5d6788; opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link {
  position: absolute; left: 12px; top: -80px; z-index: 100; padding: 10px 18px;
  background: var(--navy); color: var(--white); border: 2px solid var(--gold); border-radius: var(--r-pill);
  font: 600 14px var(--font-head);
}
.skip-link:focus { top: 12px; }
main:focus { outline: none; }
body.nav-locked { overflow: hidden; }

.container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 16px; }
.gold { color: var(--gold-text); }
@supports (background-clip: text) or (-webkit-background-clip: text) {
  .gold {
    background: linear-gradient(180deg, #b88200, #8a6100);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
  }
}

/* Icons: <svg class="icon"><use href="#i-NAME"/></svg>. --accent colours the gold part. */
.icon {
  --accent: var(--gold-deep);
  width: 1.25em; height: 1.25em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 22px; border: 2px solid transparent; border-radius: var(--r-pill);
  font: 600 15px/1.2 var(--font-head); color: var(--navy); cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn .icon { font-size: 18px; }
.btn--primary { background: var(--gold-grad); border-color: #e6b400; box-shadow: var(--shadow-gold); }
.btn--navy { background: var(--navy); color: var(--white); border-color: var(--gold); box-shadow: var(--shadow-md); }
.btn--navy .icon { color: var(--white); }
.btn--outline { background: var(--white); border-color: var(--navy); box-shadow: var(--shadow-sm); }
.btn--wa { background: var(--wa); color: var(--white); box-shadow: 0 6px 14px rgba(37, 211, 102, .3); }
.btn--wa:hover { background: var(--wa-deep); }
.btn--sm { padding: 8px 16px; font-size: 13px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: 12px; color: var(--white);
}
.icon-btn .icon { width: 24px; height: 24px; stroke-width: 1.6; }
.icon-btn--wa { background: var(--wa); box-shadow: 0 4px 10px rgba(37, 211, 102, .3); }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--white); box-shadow: 0 1px 0 var(--line); }
.header__bar { display: flex; align-items: center; gap: 8px; min-height: var(--header-h); }

.brand { display: flex; align-items: center; gap: 10px; flex: none; min-width: 0; }
.brand__logo { width: 46px; height: 46px; border-radius: 50%; }
.brand__text {
  display: flex; flex-direction: column; gap: 3px;
  border-left: 3px solid var(--gold); padding-left: 10px;
}
.brand__name {
  font: 800 14px/1 var(--font-head); color: var(--navy); letter-spacing: .01em;
  width: min-content; min-width: 6.4em;
}
.brand__tagline { font: 600 9px/1.25 var(--font-head); letter-spacing: .07em; color: var(--navy); max-width: 9.5em; }
.brand--light .brand__name, .brand--light .brand__tagline { color: var(--white); }

.header__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.header__actions .btn--outline { white-space: normal; text-align: center; line-height: 1.1; padding: 6px 12px; max-width: 78px; }
.header__actions .btn--outline .icon, .header__actions .btn--wa { display: none; }

.burger {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
  background: none; border: 0; color: var(--navy); cursor: pointer;
}
.burger .icon { width: 30px; height: 30px; stroke-width: 2.2; }
.burger .icon--close, .is-open .burger .icon--menu { display: none; }
.is-open .burger .icon--close { display: block; }

/* Mobile menu panel */
.nav {
  display: none; position: absolute; left: 0; right: 0; top: 100%;
  background: var(--white); box-shadow: var(--shadow-md); padding: 8px 16px 18px;
  max-height: calc(100vh - var(--header-h)); overflow-y: auto;
}
.is-open .nav { display: block; }
.nav__list > li > a {
  display: flex; align-items: center; gap: 6px; padding: 12px 4px;
  font: 600 16px var(--font-head); color: var(--navy); border-bottom: 1px solid var(--line);
}
.nav__list a[aria-current="page"] { box-shadow: inset 4px 0 0 var(--gold); padding-left: 12px; }
.nav__sub { padding: 4px 0 6px 16px; }
.nav__sub a { display: block; padding: 8px 4px; font-size: 15px; color: var(--navy-soft); }
.icon--chevron { width: 16px; height: 16px; stroke-width: 2.4; }

/* ---------- Breadcrumb ---------- */
.breadcrumb { display: flex; align-items: center; gap: 8px; padding: 12px 0 4px; font-size: 13px; color: var(--navy); }
.breadcrumb a { display: inline-flex; align-items: center; gap: 6px; }
.breadcrumb .icon { width: 16px; height: 16px; }
.breadcrumb strong { font-weight: 700; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; background: var(--white); padding-top: 18px; }
.hero__title {
  border-left: 4px solid var(--gold); padding-left: 14px;
  font: italic 800 clamp(24px, 7.2vw, 30px)/1.16 var(--font-head);
}
.hero__sub { margin-top: 14px; max-width: 34em; font-size: 15px; color: var(--navy); font-weight: 500; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.hero__img {
  display: block; width: 100%; height: 220px; object-fit: cover; object-position: 44% center;
  margin-top: 8px;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 28%);
  mask-image: linear-gradient(180deg, transparent 0, #000 28%);
}

/* ---------- Feature strip: icon + 2-line label, wraps on mobile ---------- */
.features {
  display: flex; flex-wrap: wrap; justify-content: center;
  margin-top: 12px; padding: 10px 6px;
  background: var(--paper); border-radius: var(--r-md); box-shadow: var(--shadow-sm);
}
.feature {
  flex: 1 1 30%; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 6px; text-align: center; font: 600 12px/1.3 var(--font-head); color: var(--navy);
}
.feature .icon { width: 32px; height: 32px; color: var(--navy); }

/* ---------- Section title with yellow dash ---------- */
.section-title {
  display: flex; align-items: center; gap: 12px;
  font: 700 21px/1.2 var(--font-head); color: var(--navy);
}
.section-title::before {
  content: ""; width: 32px; height: 5px; border-radius: 3px; background: var(--gold-grad); flex: none;
}

/* ---------- Cards: image with diagonal yellow edge ---------- */
.cards { display: grid; gap: 14px; margin-top: 14px; }
.card {
  display: grid; overflow: hidden; background: var(--white);
  border-radius: var(--r-md); box-shadow: var(--shadow-md); border: 1px solid #eef0f6;
  grid-template-columns: 108px 1fr auto;
  grid-template-areas: "media head cta" "media text cta";
  grid-template-rows: auto 1fr;
  column-gap: 12px; align-items: start;
}
.card__media { grid-area: media; align-self: stretch; position: relative; min-height: 112px; background: var(--gold-grad); clip-path: polygon(0 0, 100% 0, calc(100% - 20px) 100%, 0 100%); }
.card__media img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  clip-path: polygon(0 0, calc(100% - 10px) 0, calc(100% - 30px) 100%, 0 100%);
}
.card__head { grid-area: head; display: flex; align-items: center; gap: 8px; padding-top: 12px; }
.card__head .icon { width: 24px; height: 24px; color: var(--navy); }
.card__head h3 { font-size: 16px; }
.card__text { grid-area: text; padding: 4px 0 12px; font-size: 13px; line-height: 1.4; color: var(--navy-soft); }
.card__cta {
  grid-area: cta; align-self: center; margin-right: 12px;
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border-radius: 50%; background: var(--gold-grad); color: var(--navy); box-shadow: var(--shadow-gold);
}
.card__cta span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.card__cta .icon { width: 18px; height: 18px; stroke-width: 2.2; }

/* ---------- CTA banner: pale yellow, navy pill button ---------- */
.cta-banner {
  display: grid; gap: 10px 14px; align-items: center;
  grid-template-columns: auto 1fr; grid-template-areas: "icon title" "text text" "btn btn";
  padding: 18px; border-radius: var(--r-lg); box-shadow: var(--shadow-md);
  background: linear-gradient(100deg, #fffaf0 0%, var(--pale-yellow) 55%, #ffe38a 100%);
}
.cta-banner__icon { grid-area: icon; width: 52px; height: 52px; color: var(--navy); }
.cta-banner__title { grid-area: title; font-size: 19px; }
.cta-banner__text { grid-area: text; font-size: 14px; color: var(--navy); }
.cta-banner .btn { grid-area: btn; justify-self: start; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 36px; background: var(--navy); color: #dfe3f2; }
.footer__grid { display: grid; gap: 24px; padding-block: 32px; }
.footer__title { font-size: 15px; color: var(--gold); margin-bottom: 10px; }
.footer__list { display: grid; gap: 6px; font-size: 14px; }
.footer__list a:hover { color: var(--gold); }
.footer__list--cols { grid-template-columns: 1fr 1fr; column-gap: 16px; }
.footer__copy { border-top: 1px solid rgba(255, 255, 255, .12); padding-block: 14px; font-size: 13px; color: #aab1cc; }

/* ---------- Stub pages (until a page's own template lands) ---------- */
.stub { padding-block: 24px 56px; }
.stub__title { margin: 24px 0 10px; font-size: 30px; }
.stub__text { margin-bottom: 20px; font-size: 18px; }

.hero__text, .home-solutions, .home-cta { position: relative; }

/* ---------- Tablet ---------- */
@media (min-width: 640px) {
  .container { padding-inline: 24px; }
  .hero__img { height: 300px; }
  .card { grid-template-columns: 160px 1fr auto; }
  .card__media { min-height: 130px; }
  .feature { flex-basis: 0; }
  .cta-banner { grid-template-columns: auto 1fr auto; grid-template-areas: "icon title btn" "icon text btn"; padding: 22px 26px; }
  .footer__grid { grid-template-columns: 1.2fr 1fr 1.4fr; }
}

/* ---------- Desktop ---------- */
@media (min-width: 1100px) {
  body { font-size: 17px; }

  .breadcrumb { padding-top: 16px; font-size: 14px; }

  .hero { min-height: 252px; padding-top: 26px; }
  .hero__inner { position: relative; z-index: 1; }
  .hero__text { max-width: 640px; }
  .hero__title { font-size: 36px; max-width: 15em; }
  .hero__sub { font-size: 16px; max-width: 32em; }
  .hero__actions { flex-wrap: nowrap; margin-top: 18px; padding-bottom: 24px; }
  .hero__actions .btn { white-space: nowrap; }
  .hero__img {
    position: absolute; top: 0; right: 0; bottom: 0; width: 62%; height: 100%; margin: 0;
    object-position: 55% center;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 32%);
    mask-image: linear-gradient(90deg, transparent 0, #000 32%);
  }

  .features { flex-wrap: nowrap; padding: 14px 8px; margin-top: 0; border-radius: 0 0 var(--r-md) var(--r-md); }
  .feature { flex: 1 1 auto; flex-direction: row; text-align: left; gap: 14px; font-size: 13.5px; padding: 6px 14px; }
  .feature + .feature { border-left: 1px solid var(--line); }
  .feature .icon { width: 38px; height: 38px; }

  .section-title { font-size: 25px; }
  .cards { grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 18px; }
  .card {
    grid-template-columns: 40% 1fr;
    grid-template-areas: "media head" "media text" "media cta";
    grid-template-rows: auto 1fr auto; column-gap: 14px;
  }
  .card__media { min-height: 168px; clip-path: polygon(0 0, 100% 0, calc(100% - 22px) 100%, 0 100%); }
  .card__head { padding-right: 14px; padding-top: 14px; }
  .card__head h3 { font-size: 18px; }
  .card__text { padding-right: 14px; font-size: 13.5px; }
  .card__cta {
    width: auto; height: auto; justify-self: stretch; margin: 0 14px 14px 0; padding: 9px 14px;
    display: flex; justify-content: space-between; gap: 8px; background: var(--white);
    border: 1.5px solid var(--navy); border-radius: var(--r-pill); box-shadow: none; font: 600 13px var(--font-head);
  }
  .card__cta span { position: static; width: auto; height: auto; overflow: visible; clip: auto; }

  .cta-banner {
    grid-template-columns: auto minmax(0, 1.05fr) minmax(0, 1.3fr) auto; grid-template-areas: "icon title text btn";
    padding: 18px 34px; gap: 0 26px;
  }
  .cta-banner__title { font-size: 22px; border-left: 3px solid var(--gold); padding-left: 24px; }
  .cta-banner__text { font-size: 15px; border-left: 3px solid var(--gold); padding-left: 24px; }
  .cta-banner .btn { justify-self: end; padding: 14px 28px; font-size: 16px; }

  .footer__grid { padding-block: 40px; }
}

/* Desktop header: needs 1280px for brand, five nav items, the account item
   and two buttons. Between 1100 and 1279px the burger menu stays. */
@media (min-width: 1280px) {
  :root { --header-h: 84px; }

  .brand__logo { width: 62px; height: 62px; }
  .brand__text { padding-left: 14px; }
  .brand__name { font-size: 21px; }
  .brand__tagline { font-size: 9.5px; max-width: none; white-space: nowrap; }

  .burger, .header__actions .icon-btn { display: none; }
  .header__actions { margin-left: 0; gap: 10px; }
  .header__actions .btn { white-space: nowrap; }
  .header__actions .btn--outline { max-width: none; padding: 8px 16px; }
  .header__actions .btn--outline .icon, .header__actions .btn--wa { display: inline-flex; }

  .site-header .container { max-width: 1320px; }
  .header__bar { gap: 20px; }
  .nav {
    display: block; position: static; padding: 0; box-shadow: none; max-height: none; overflow: visible;
    margin-left: auto;
  }
  .nav__list { display: flex; align-items: center; gap: 26px; }
  .nav__list > li { position: relative; }
  .nav__list > li > a { padding: 10px 0; border: 0; font-size: 14px; font-weight: 600; position: relative; }
  .nav__list a[aria-current="page"] { box-shadow: none; padding-left: 0; }
  .nav__list > li > a[aria-current="page"]::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 2px; background: var(--gold-grad);
  }
  .nav__sub {
    display: none; position: absolute; top: 100%; left: -14px; min-width: 240px; padding: 8px;
    background: var(--white); border-radius: var(--r-sm); box-shadow: var(--shadow-md);
  }
  .has-sub:hover > .nav__sub, .has-sub:focus-within > .nav__sub { display: block; }
  .nav__sub a { padding: 9px 12px; border-radius: 8px; }
  .nav__sub a:hover { background: var(--pale-yellow); color: var(--navy); }
}

/* Narrow desktop (1280-1365px): shrink the brand and buttons to fit. */
@media (min-width: 1280px) and (max-width: 1365px) {
  .brand__logo { width: 52px; height: 52px; }
  .brand__text { padding-left: 10px; }
  .brand__name { font-size: 17px; }
  .brand__tagline { font-size: 9px; }
  .header__bar { gap: 12px; }
  .header__actions { gap: 8px; }
  .header__actions .btn--sm { padding: 7px 12px; }
}

/* Narrow phones (320 to 374px): tighten the header so the menu button stays on screen. */
@media (max-width: 374px) {
  .site-header .container { padding-inline: 8px; }
  .header__bar, .header__actions { gap: 4px; }
  .site-header .brand { gap: 6px; }
  .site-header .brand__logo { width: 38px; height: 38px; }
  .site-header .brand__text { padding-left: 7px; }
  .header__actions .btn--outline { padding-inline: 5px; max-width: 67px; }
}

/* Phones: breadcrumb and footer links get a 40px tap target without moving the layout. */
@media (max-width: 639px) {
  .card__cta { width: 44px; height: 44px; }
  .breadcrumb a { padding-block: 14px; margin-block: -14px; }
  .footer__list { row-gap: 0; }
  .footer__list a { display: flex; align-items: center; min-height: 44px; }
  .burger, .icon-btn { width: 44px; height: 44px; }
  .btn { min-height: 44px; }
  .header__actions .btn--outline { min-height: 44px; }
  .nav__sub a { padding-block: 12px; }
}

/* Respect the OS "reduce motion" setting: no smooth scroll, no hover lifts, no loops. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .btn:hover { transform: none; }
}
