/* ==========================================================================
   11 Plus Blocks: components
   --------------------------------------------------------------------------
   Each of these is the web twin of something in the app, so a parent who taps
   through from the site recognises where they've landed. Where the app uses a
   SwiftUI modifier the comment names it.
   ========================================================================== */

/* --- Buttons -------------------------------------------------------------
   The app's PrimaryButton is a filled capsule in the chrome colour with
   onAccent text: never plain white, because chrome flips to pale lilac in
   dark mode and white-on-lilac is unreadable. */

.btn {
  --btn-bg: var(--chrome);
  --btn-fg: var(--on-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  padding: 0.85em 1.6em;
  min-height: 48px;              /* comfortably over the 44pt touch target */
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-label);
  font-size: var(--step-0);
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease-spring),
              box-shadow var(--dur) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out);
}
.btn:hover { color: var(--btn-fg); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0) scale(0.98); box-shadow: var(--shadow-sm); }

.btn--lg { padding: 1.05em 2em; font-size: var(--step-1); min-height: 56px; }
.btn--sm { padding: 0.6em 1.1em; font-size: var(--step--1); min-height: 40px; }
.btn--full { width: 100%; }

/* Secondary: the app's bordered variant. Reads as a real control, not a link. */
.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--deep);
  box-shadow: inset 0 0 0 2px var(--hairline-2);
}
.btn--ghost:hover { --btn-bg: var(--wash); box-shadow: inset 0 0 0 2px var(--lilac); }

.btn--surface {
  --btn-bg: var(--surface);
  --btn-fg: var(--deep);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--hairline);
}

/* Course-tinted button: set --btn-bg to a course accent at the call site. */
.btn[data-course] { --btn-bg: var(--course-accent, var(--chrome)); }

.btn__icon { width: 1.25em; height: 1.25em; flex: none; }

/* --- App Store badge ------------------------------------------------------
   Apple's badge has fixed artwork rules, so it stays an image. The wrapper
   gives it a hit area and a hover that matches everything else. */
.store-badge {
  display: inline-flex;
  border-radius: 12px;
  transition: transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur) var(--ease-out);
}
.store-badge img { height: 54px; width: auto; }
.store-badge:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
  align-items: center;
}
.cta-row--centre { justify-content: center; }

/* --- Cards ----------------------------------------------------------------
   Brand.Metrics.cardRadius = 20. Surface on ground, hairline, soft purple
   shadow: the app's grouped-row look. */
.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: var(--space-m);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--hairline);
}
.card--flush { padding: 0; overflow: hidden; }
.card--lift { box-shadow: var(--shadow-md); }

/* --- Course tile ----------------------------------------------------------
   The app's CourseTile: an illustrated line-art scene over a 10% wash of the
   course accent. The wash is deliberately low: the page ground is already a
   purple-tinted white, so a purple wash at 30% dissolved into it while teal
   and terracotta popped at the same value. */
.tile {
  --course-accent: var(--purple);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-m);
  border-radius: var(--radius-tile);
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--course-accent) 10%, transparent),
      color-mix(in srgb, var(--course-accent) 4%, transparent)),
    var(--surface);
  border: 1px solid color-mix(in srgb, var(--course-accent) 22%, transparent);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  isolation: isolate;
  transition: transform var(--dur) var(--ease-spring),
              box-shadow var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out);
}
.tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--course-accent) 45%, transparent);
  color: inherit;
}
.tile:hover .tile__scene { transform: scale(1.04) rotate(-1deg); }

.tile__scene {
  height: 132px;
  display: grid;
  place-items: center;
  margin: calc(var(--space-2xs) * -1) 0 var(--space-2xs);
  transition: transform var(--dur-slow) var(--ease-spring);
}
.tile__scene svg { width: 100%; height: 100%; }

/* The scenes are stroked line art drawn on a ~1700-unit canvas. The inliner
   strips the root stroke so the accent can be applied here, and every stroke
   is pinned with non-scaling-stroke: without it a 16-unit stroke shrinks to
   half a pixel by the time the artwork fits a 130px tile. */
.tile__scene svg { stroke: var(--course-accent); stroke-width: 2.4; }
.tile__scene svg * { vector-effect: non-scaling-stroke; }

.tile__title {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 600;
  color: var(--course-accent);
  margin: 0;
  line-height: var(--leading-snug);
}
.tile__meta {
  font-family: var(--font-label);
  font-size: var(--step--1);
  font-weight: 700;
  color: var(--ink-soft);
  margin: 0;
}
.tile__body { color: var(--ink-soft); font-size: var(--step-0); margin: 0; }

/* The app tags unfinished papers "Sample" rather than letting a demo pass as
   finished content. The site is bound by the same honesty. */
.tile__flag {
  position: absolute;
  top: var(--space-s);
  right: var(--space-s);
  z-index: 2;
}

.tile-grid {
  display: grid;
  gap: var(--space-s);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
}

/* --- Pills and badges -----------------------------------------------------
   The app's count badges: accent at 20% with the accent as text. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.35em 0.85em;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--course-accent, var(--purple)) 18%, transparent);
  color: var(--course-accent, var(--purple));
  font-family: var(--font-label);
  font-size: var(--step--1);
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}
.pill--solid {
  background: var(--course-accent, var(--chrome));
  color: var(--on-accent);
}
.pill--quiet {
  background: var(--wash-strong);
  color: var(--ink-soft);
}

/* --- Glass ----------------------------------------------------------------
   The app's floating menu is Glass.clear with a 10% purple tint. On the web
   that is a blurred backdrop, a hairline top edge to catch the light, and a
   solid fallback wherever backdrop-filter is unavailable: the layout has to
   stand up without the finish, exactly as on iOS 18. */
.glass {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow-glass);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass {
    background:
      linear-gradient(var(--glass-accent), var(--glass-accent)),
      var(--glass-tint);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
  }
}

/* --- Feature row ----------------------------------------------------------
   Icon, heading, one line. The app's grouped list translated to a marketing
   grid; rowRadius = 14. */
.feature {
  display: flex;
  gap: var(--space-s);
  align-items: flex-start;
  padding: var(--space-s);
  border-radius: var(--radius-row);
  background: var(--surface);
  border: 1px solid var(--hairline);
}
.feature__icon {
  flex: none;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--course-accent, var(--purple)) 14%, transparent);
  color: var(--course-accent, var(--purple));
}
.feature__icon svg { width: 24px; height: 24px; }
.feature h3 { font-size: var(--step-1); margin-bottom: 0.2em; }
.feature p { color: var(--ink-soft); font-size: var(--step-0); margin: 0; }

.feature-grid {
  display: grid;
  gap: var(--space-s);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

/* --- Stat -----------------------------------------------------------------
   Numbers do the reassuring: a parent scanning wants scale, fast. */
.stat { text-align: center; }
.stat__value {
  font-family: var(--font-display);
  font-size: var(--step-4);
  font-weight: 600;
  color: var(--deep);
  line-height: 1;
  display: block;
}
.stat__label {
  font-family: var(--font-label);
  font-size: var(--step--1);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-top: 0.4em;
  display: block;
}
.stat-row {
  display: grid;
  gap: var(--space-m);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}

/* --- Block tower ----------------------------------------------------------
   The product's own metaphor: mastery stacks. Used decoratively as a divider
   and as the progress illustration. Course-coloured, with a visible seam -
   without one a tall stack reads as a single extruded prism, not blocks. */
.tower { display: flex; align-items: flex-end; gap: 6px; }
.tower__stack { display: flex; flex-direction: column-reverse; gap: 3px; }
.tower__block {
  width: 26px; height: 20px;
  border-radius: 5px;
  background: var(--course-accent, var(--purple));
  box-shadow: inset 0 -3px 0 rgb(0 0 0 / 0.12), inset 0 2px 0 rgb(255 255 255 / 0.22);
}
.tower__block--empty {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--hairline-2);
}

/* --- Accordion (FAQs) -----------------------------------------------------
   Native <details>, so it works with no JavaScript and is answerable by
   search engines as FAQPage schema. */
.faq {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-row);
  background: var(--surface);
  overflow: hidden;
}
.faq + .faq { margin-top: var(--space-2xs); }
.faq > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s);
  padding: var(--space-s) var(--space-m);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 600;
  color: var(--deep);
  list-style: none;
  transition: background var(--dur-fast) var(--ease-out);
}
.faq > summary::-webkit-details-marker { display: none; }
.faq > summary:hover { background: var(--wash); }
.faq > summary::after {
  content: "";
  flex: none;
  width: 12px; height: 12px;
  border-right: 2.5px solid var(--purple);
  border-bottom: 2.5px solid var(--purple);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--dur) var(--ease-out);
}
.faq[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.faq__body { padding: 0 var(--space-m) var(--space-m); color: var(--ink-soft); }
.faq__body > :first-child { margin-top: 0; }

/* --- Quote ---------------------------------------------------------------- */
.quote {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: var(--space-m);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-sm);
}
.quote__text { font-size: var(--step-1); color: var(--ink); line-height: 1.5; }
.quote__by {
  font-family: var(--font-label);
  font-size: var(--step--1);
  font-weight: 700;
  color: var(--ink-soft);
  margin-top: var(--space-xs);
}
.quote__stars { color: #E8A33D; letter-spacing: 0.1em; font-size: var(--step-0); }

/* --- Device frame ---------------------------------------------------------
   A phone bezel around a screenshot. Pure CSS so there is no chrome image to
   ship and it stays sharp at any density. */
.device {
  position: relative;
  width: min(300px, 78vw);
  aspect-ratio: 9 / 19.5;
  border-radius: 44px;
  padding: 10px;
  background: linear-gradient(160deg, #3A2A55, #241A38 45%, #4A3A6B);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px rgb(255 255 255 / 0.14);
}
.device__screen {
  width: 100%; height: 100%;
  border-radius: 35px;
  overflow: hidden;
  background: var(--ground);
  position: relative;
}
.device__screen img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.device::before {                     /* the island */
  content: "";
  position: absolute;
  top: 20px; left: 50%;
  transform: translateX(-50%);
  width: 82px; height: 24px;
  border-radius: var(--radius-pill);
  background: #100C1A;
  z-index: 2;
}

/* --- Sticky mobile CTA ----------------------------------------------------
   On a phone the fold is short and the header CTA scrolls away, so the ask
   comes back and stays. Hidden on desktop, where the header CTA is always
   visible. */
.sticky-cta {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 90;
  padding: var(--space-2xs) var(--space-s) calc(var(--space-2xs) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--glass-edge);
  transform: translateY(110%);
  transition: transform var(--dur-slow) var(--ease-out);
}
.sticky-cta.is-visible { transform: translateY(0); }
.sticky-cta .btn { width: 100%; }
@media (min-width: 860px) { .sticky-cta { display: none; } }

/* --- Notices -------------------------------------------------------------- */
.notice {
  padding: var(--space-s) var(--space-m);
  border-radius: var(--radius-row);
  background: var(--wash);
  border: 1px solid var(--hairline);
  color: var(--ink-soft);
  font-size: var(--step-0);
}
.notice--correct { background: color-mix(in srgb, var(--correct) 12%, transparent); border-color: color-mix(in srgb, var(--correct) 30%, transparent); }
.notice--warn    { background: color-mix(in srgb, var(--incorrect) 10%, transparent); border-color: color-mix(in srgb, var(--incorrect) 28%, transparent); }

/* --- Course accent hooks --------------------------------------------------
   Set once on a container; every nested component picks it up. */
[data-course="maths"]      { --course-accent: var(--maths); }
[data-course="english"]    { --course-accent: var(--english); }
[data-course="verbal"]     { --course-accent: var(--verbal); }
[data-course="non-verbal"] { --course-accent: var(--non-verbal); }
[data-course="brand"]      { --course-accent: var(--purple); }
