/* ============================================================
   Armstrong's Taekwondo Academy — dark + crimson, restrained glass
   Rules for editing this file: ../STYLE_GUIDE.md
   ============================================================ */
:root {
  --bg:        #0b0b0e;
  --bg-2:      #131217;          /* raised, non-glass surfaces */
  --ink:       #f2f1ee;
  --ink-soft:  #b8b6b9;
  --ink-dim:   #86848a;
  --accent:    #d4202c;          /* crimson */
  --accent-2:  #ff5a63;          /* lighter crimson, for text on dark */
  --rule:      rgba(255, 255, 255, 0.1);

  --glass-bg:   rgba(255, 255, 255, 0.055);
  --glass-brd:  rgba(255, 255, 255, 0.1);
  --glass-hi:   rgba(255, 255, 255, 0.2);
  --blur:       14px;

  --radius:    14px;             /* glass panels */
  --radius-sm: 8px;              /* photos, buttons, inputs */
  --maxw:      1180px;
  --measure:   50ch;             /* ≈66 characters a line in Sora */
  --shadow:    0 10px 30px rgba(0, 0, 0, 0.35);
  --ease:      cubic-bezier(0.22, 1, 0.36, 1);

  /* Spacing scale — 8px base. Use these, don't hardcode pixels. */
  --space-2xs: 0.5rem;    /*  8px */
  --space-xs:  0.75rem;   /* 12px */
  --space-sm:  1rem;      /* 16px */
  --space-md:  1.5rem;    /* 24px */
  --space-lg:  2.5rem;    /* 40px */
  --space-xl:  4rem;      /* 64px */
  --space-2xl: 6rem;      /* 96px */

  --nav-h:     88px;                      /* fixed nav height incl. top offset */
  --section-y: clamp(56px, 8vw, 104px);   /* vertical padding inside each section */
  --gutter:    clamp(16px, 4vw, 40px);    /* page side padding */

  /* Belt progression: white, yellow, green, blue, red, black */
  --belt: linear-gradient(90deg,
    #eef0f4 0 16.66%, #f5c518 16.66% 33.33%, #2ecc71 33.33% 50%,
    #3b82f6 50% 66.66%, #d4202c 66.66% 83.33%, #2a2a31 83.33% 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  background: var(--bg);   /* also paints Safari's overscroll area */
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + var(--space-md));
}
body {
  font-family: 'Sora', system-ui, sans-serif;
  /* still crimson washes (no animation) so the glass has something to sit on */
  background:
    radial-gradient(1200px 820px at 16% 0%, rgba(212, 32, 44, 0.46) 0%, transparent 72%),
    radial-gradient(900px 900px at 100% 2500px, rgba(212, 32, 44, 0.2) 0%, transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  color: var(--ink);
  line-height: 1.6;
  overflow-x: hidden;
  overflow-x: clip;   /* `hidden` on body makes iOS Safari clip the fixed nav while the page is pulled down at the top */
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: 'Oswald', 'Sora', sans-serif; font-weight: 600; line-height: 1.08; }
p, dd, li { max-width: var(--measure); }
em { font-style: normal; color: var(--ink-dim); font-size: 0.88em; }   /* placeholder notes */
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
section { scroll-margin-top: calc(var(--nav-h) + var(--space-md)); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- Glass ---------- */
.glass {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-brd);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
}

/* ---------- Buttons & links ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--accent);
  transition: background 0.2s;
}
.btn:hover { background: #e63540; }
.btn-sm { padding: 9px 16px; font-size: 0.88rem; }
.btn-lg { padding: 15px 28px; font-size: 1rem; }
.btn-block { width: 100%; }
.text-link {
  font-weight: 600;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}
.text-link:hover { color: var(--accent-2); }

/* ---------- Nav ---------- */
/* The nav is NOT position: fixed. In Safari (macOS and iOS 27 beta) a fixed element was dropped while the page
   was pulled down at the top, so the whole nav vanished. This wrapper is zero-height and sticky, so it sits in the
   page and moves with it during the pull, then sticks to the top when scrolling; the nav hangs from it. */
.nav-wrap {
  position: sticky;
  top: 0;
  height: 0;
  z-index: 100;
}
.nav {
  position: absolute;
  top: var(--space-sm);
  left: var(--gutter); right: var(--gutter);
  margin-inline: auto;
  isolation: isolate;
  max-width: var(--maxw);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 10px 16px;
  border: 1px solid var(--glass-brd);
  border-radius: var(--radius);
}
/* A background layer behind the nav's content (no blur: see the end of this file). */
.nav::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: rgba(15, 14, 18, 0.5);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: inset 0 1px 0 var(--glass-hi);
  transition: background 0.3s;
}
.nav-wrap.scrolled .nav::before { background: rgba(15, 14, 18, 0.86); }
.brand { display: flex; align-items: center; gap: var(--space-xs); }
.brand-mark { width: 40px; height: 40px; border-radius: 10px; }
.brand-text { display: flex; flex-direction: column; font-family: 'Oswald', sans-serif; font-weight: 600; font-size: 1.1rem; line-height: 1.1; }
.brand-text small { margin-top: 3px; font-family: 'Sora', sans-serif; font-weight: 400; font-size: 0.74rem; color: var(--ink-dim); }
.nav-links { list-style: none; display: flex; align-items: center; gap: 4px; }
.nav-links li { max-width: none; }
.nav-links a:not(.btn) {
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-soft);
  transition: color 0.2s;
}
.nav-links a:not(.btn):hover { color: var(--ink); }
.nav-links .btn { margin-left: var(--space-2xs); }
.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 8px; }
.nav-toggle span { width: 24px; height: 2px; background: var(--ink); border-radius: 2px; transition: 0.3s var(--ease); }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Layout ---------- */
main { display: block; }
.section { max-width: var(--maxw); margin: 0 auto; padding: var(--section-y) var(--gutter); }
.section-head { margin-bottom: var(--space-lg); }
.section h2 { position: relative; font-size: clamp(2rem, 4.4vw, 2.9rem); padding-bottom: var(--space-sm); margin-bottom: var(--space-md); }
/* signature: Taekwondo belt-progression stripe under every section heading */
.section h2::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 96px; height: 4px;
  background: var(--belt);
}
.section-head p { color: var(--ink-soft); font-size: 1.05rem; }
.lede { color: var(--ink-soft); font-size: 1.12rem; }

/* ---------- Hero ---------- */
.hero {
  max-width: var(--maxw); margin: 0 auto;
  padding: calc(var(--nav-h) + clamp(2.5rem, 6vw, 5rem)) var(--gutter) var(--space-xl);
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: clamp(28px, 5vw, 72px); align-items: center;
}
.hero h1 { font-size: clamp(2.7rem, 6.2vw, 4.8rem); line-height: 1; text-transform: uppercase; letter-spacing: 0.005em; margin-bottom: var(--space-md); }
.hero .lede { margin-bottom: var(--space-lg); }
.hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-md); }
.hero-media { padding: 8px; }
.hero-media img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius-sm); }

/* media tag (placeholder badge) */
.media-tag {
  position: absolute; bottom: 14px; right: 14px;
  font-size: 0.72rem; font-weight: 600;
  padding: 4px 9px; border-radius: 4px;
  background: rgba(0, 0, 0, 0.6); color: var(--ink-soft);
}

/* ---------- Tenets ---------- */
.tenets { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.tenets p { max-width: none; font-size: 0.88rem; color: var(--ink-dim); margin-bottom: var(--space-xs); }
.tenets ul {
  list-style: none; position: relative;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-xs) var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--rule);
}
.tenets ul::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--belt); }
.tenets li { max-width: none; font-family: 'Oswald', sans-serif; font-weight: 500; font-size: clamp(1.15rem, 2.1vw, 1.6rem); text-transform: uppercase; letter-spacing: 0.02em; }

/* ---------- Classes ---------- */
.program-media { position: relative; border-radius: var(--radius-sm); overflow: hidden; }
.program-media img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.program h3 { font-size: 1.3rem; margin-bottom: var(--space-2xs); }
.program p { color: var(--ink-soft); font-size: 0.96rem; }
.program-lead { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(24px, 4vw, 56px); align-items: center; margin-bottom: var(--space-lg); }
.program-lead .program-media img { aspect-ratio: 16 / 9; }
.program-lead h3 { font-size: clamp(1.7rem, 3vw, 2.2rem); margin-bottom: var(--space-xs); }
.program-lead p { font-size: 1.05rem; }
.program-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-md); }
.program-grid .program-media { margin-bottom: var(--space-sm); }
.programs-note { margin-top: var(--space-lg); padding-top: var(--space-md); border-top: 1px solid var(--rule); max-width: none; color: var(--ink-soft); }
.programs-note .text-link { margin-left: var(--space-2xs); white-space: nowrap; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: clamp(28px, 5vw, 72px); align-items: center; }
.about-media { padding: 8px; }
.about-media img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--radius-sm); }
.about-copy .lede { margin-bottom: var(--space-sm); }
.about-copy > p { color: var(--ink-soft); margin-bottom: var(--space-md); }
.credentials { max-width: var(--measure); margin-bottom: var(--space-lg); border-top: 1px solid var(--rule); }
.credentials div { display: grid; grid-template-columns: 7.5rem 1fr; gap: var(--space-sm); padding: var(--space-xs) 0; border-bottom: 1px solid var(--rule); }
.credentials dt { color: var(--ink-dim); font-size: 0.92rem; }
.credentials dd { font-weight: 600; }
.credentials em { font-weight: 400; }

/* ---------- Schedule ---------- */
.schedule { padding: clamp(14px, 2.5vw, 24px); }
.schedule-scroll { overflow-x: auto; }
.schedule table { width: 100%; border-collapse: collapse; min-width: 640px; }
.schedule th, .schedule td { padding: 12px 10px; text-align: center; border-bottom: 1px solid var(--rule); }
.schedule thead th { font-size: 0.88rem; color: var(--ink-dim); font-weight: 600; }
.schedule td.t, .schedule thead th:first-child { text-align: left; }
.schedule td.t { font-weight: 600; white-space: nowrap; }
.pill {
  display: inline-block; padding: 5px 10px; border-radius: 6px; font-size: 0.82rem; font-weight: 600;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 32%, transparent);
}
.tkd { --c: #ff7a82; } .kb { --c: #f5b54a; } .lt { --c: #5fd68b; } .mma { --c: #7fb0ff; } .sc { --c: #c79bff; }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-md); margin-top: var(--space-sm); font-size: 0.85rem; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; background: var(--c); }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 0.85fr; gap: clamp(28px, 5vw, 64px); align-items: start; }
.contact-copy .lede { margin-bottom: var(--space-lg); }
.contact-list { max-width: var(--measure); margin-bottom: var(--space-lg); border-top: 1px solid var(--rule); }
.contact-list div { display: grid; grid-template-columns: 7.5rem 1fr; gap: var(--space-sm); padding: var(--space-xs) 0; border-bottom: 1px solid var(--rule); }
.contact-list dt { color: var(--ink-dim); font-size: 0.92rem; }
.contact-list a { text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 4px; }
.contact-list a:hover { color: var(--accent-2); }
.map { position: relative; max-width: var(--measure); border-radius: var(--radius-sm); overflow: hidden; }
.map img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

.contact-form { padding: clamp(20px, 3vw, 32px); display: flex; flex-direction: column; gap: var(--space-sm); }
.contact-form h3 { font-size: 1.6rem; }
.form-note { font-size: 0.85rem; color: var(--ink-dim); margin-top: -8px; }
.contact-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; font-weight: 600; color: var(--ink-soft); }
.contact-form input, .contact-form select, .contact-form textarea {
  font: inherit; font-size: 0.95rem; font-weight: 400; color: var(--ink);
  padding: 11px 13px; border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-brd);
}
.contact-form input:focus-visible, .contact-form select:focus-visible, .contact-form textarea:focus-visible {
  outline: 2px solid var(--accent-2); outline-offset: 0; border-color: transparent;
}
.contact-form textarea { resize: vertical; }

/* ---------- Footer ---------- */
.footer { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter) var(--space-lg); }
.footer-inner { display: flex; flex-wrap: wrap; gap: var(--space-md); align-items: center; justify-content: space-between; padding-top: var(--space-lg); border-top: 1px solid var(--rule); }
.footer-brand { display: flex; align-items: center; gap: var(--space-xs); }
.footer-brand small { color: var(--ink-dim); }
.footer-social { display: flex; align-items: center; gap: var(--space-2xs); }
.social-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-sm); color: var(--ink-soft); border: 1px solid var(--rule); transition: color 0.2s, border-color 0.2s; }
.social-btn:hover { color: var(--ink); border-color: var(--ink-dim); }
.social-btn.is-placeholder { opacity: 0.4; cursor: not-allowed; }
.social-btn.is-placeholder:hover { color: var(--ink-soft); border-color: var(--rule); }
.copyright { max-width: none; color: var(--ink-dim); font-size: 0.82rem; margin-top: var(--space-md); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero, .about-grid, .contact-grid, .program-lead { grid-template-columns: 1fr; }
  .about-media { max-width: 420px; }
  .program-grid { grid-template-columns: repeat(2, 1fr); }
  .tenets ul { justify-content: flex-start; }
  /* opaque on purpose: no backdrop-filter nested inside the nav's own blur */
  .nav-links {
    position: absolute; top: calc(100% + var(--space-xs)); right: 0; left: 0;
    flex-direction: column; align-items: stretch; gap: 4px;
    padding: var(--space-sm); border-radius: var(--radius);
    background: #15141a;
    border: 1px solid var(--glass-brd); box-shadow: var(--shadow);
    opacity: 0; visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
  }
  .nav-links.open { opacity: 1; visibility: visible; }
  .nav-links a:not(.btn) { display: block; padding: 12px 14px; }
  .nav-links .btn { display: flex; margin: 6px 0 0; }
  .nav-toggle { display: flex; }
}
@media (max-width: 560px) {
  .program-grid { grid-template-columns: 1fr; }
  .tenets ul { flex-direction: column; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .brand-text { font-size: 0.95rem; }
  .brand-text small { font-size: 0.68rem; }
  .credentials div, .contact-list div { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- Motion (restrained; STYLE_GUIDE §5) ----------
   Added 2026-11-01 at Darren's request. Rules: opacity + a short rise only, once, never looping;
   the belt stripe draws in under each heading; buttons give press feedback. Nothing is hidden unless
   main.js has run and marked the block (.rv), a 3 s fallback shows everything if it dies, and
   reduced-motion turns all of it off. `translate`/`scale` are used so no block's own transform is touched. */
@media (prefers-reduced-motion: no-preference) {
  /* Hero: plays once on load, as plain CSS. It ends visible, so it cannot leave anything hidden. */
  .hero-copy > *, .hero-media { animation: bm-rise 0.8s var(--ease) backwards; }
  .hero-copy > :nth-child(2) { animation-delay: 0.1s; }
  .hero-copy > :nth-child(3) { animation-delay: 0.2s; }
  .hero-media { animation-delay: 0.15s; }

  .js .rv:not(.is-visible) { opacity: 0; }
  .js:not(.rv-ready) .rv { animation: bm-failsafe 0.01s linear 3s forwards; }
  .js .rv.is-visible { animation: bm-rise 0.7s var(--ease) var(--rv-delay, 0s) backwards; }
  .js .rv.is-instant { animation: none; opacity: 1; }

  /* The belt stripe draws from the left when its heading arrives. */
  .js .section-head:not(.is-visible) h2::after { scale: 0 1; }
  .js .section-head.is-visible h2::after { animation: bm-draw 0.9s var(--ease) 0.25s backwards; }
  .js .section-head.is-instant h2::after { animation: none; }
  .js .section-head h2::after { transform-origin: left center; }

  .btn { transition: background 0.2s, scale 0.12s; }
  .btn:active { scale: 0.98; }
}
@keyframes bm-failsafe { to { opacity: 1; } }
@keyframes bm-rise { from { opacity: 0; translate: 0 14px; } }
@keyframes bm-draw { from { scale: 0 1; } }

/* ---------- Nav background without blur (2026-11-01) ----------
   The nav used backdrop-filter; Safari 27 beta dropped the nav's contents while the page was pulled down. A flat,
   slightly more opaque background looks almost the same over this dark page and cannot be dropped that way. */
.nav::before { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(15, 14, 18, 0.82); }
.nav-wrap.scrolled .nav::before { background: rgba(15, 14, 18, 0.94); }
