/* ==========================================================================
   Tarvin Tai Chi — site styles
   1. Fonts   2. Tokens   3. Base   4. Layout helpers   5. Header & footer
   6. Shared components   7. Home sections   8. The 42 Form   9. Text pages
   ========================================================================== */

/* 1. Fonts — self-hosted (SIL Open Font License, see /assets/fonts) */
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/source-serif-4-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

/* 2. Tokens — change colours, type and spacing here */
:root {
  /* Colour. Green and paper come from the supplied symbol. */
  --color-paper: #F6F3EB;
  --color-surface: #FBFAF6;
  --color-card: #FFFFFF;
  --color-tint: #E8ECE4;
  --color-ink: #262826;
  --color-ink-soft: #4C504A;
  --color-green: #486858;
  --color-green-deep: #334B3F;
  --color-line: #DCD6C8;
  --color-focus: #1F3A2E;

  /* Type */
  --font-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-heading: "Source Serif 4", Georgia, "Times New Roman", serif;
  --text-small: 1rem;
  --text-base: 1.1875rem;
  --text-lead: clamp(1.25rem, 1.15rem + 0.4vw, 1.4rem);
  --text-h3: 1.4rem;
  --text-h2: clamp(1.85rem, 1.5rem + 1.4vw, 2.5rem);
  --text-h1: clamp(2.3rem, 1.7rem + 2.8vw, 3.6rem);
  --leading: 1.65;

  /* Space */
  --space-2xs: 0.375rem;
  --space-xs: 0.625rem;
  --space-s: 1rem;
  --space-m: 1.5rem;
  --space-l: 2.5rem;
  --space-xl: clamp(2.75rem, 2rem + 3vw, 4.5rem);
  --space-section: clamp(4rem, 3rem + 5vw, 7.5rem);

  /* Widths */
  --width-page: 70rem;
  --width-text: 38rem;
  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2.5rem);

  --radius: 6px;
  --radius-pill: 999px;
}

/* 3. Base */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word; /* only breaks a word that can't fit on its own line (very large text) */
}

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 450;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-s);
  text-wrap: balance;
}
h1 { font-size: var(--text-h1); font-weight: 400; letter-spacing: -0.02em; line-height: 1.1; }
h2 { font-size: var(--text-h2); font-weight: 400; }
h3 { font-size: var(--text-h3); }

p, ul, ol { margin: 0 0 var(--space-s); }
p { text-wrap: pretty; }

img { display: block; max-width: 100%; height: auto; }

a {
  color: var(--color-green-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { color: var(--color-ink); text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: 2px;
}
main:focus { outline: none; }

[id] { scroll-margin-top: var(--space-s); }

/* 4. Layout helpers */
.wrap {
  width: 100%;
  max-width: var(--width-page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--space-section); }
.section--surface { background: var(--color-surface); border-block: 1px solid var(--color-line); }
.section--tint { background: var(--color-tint); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-s);
  top: -10rem;
  z-index: 10;
  padding: var(--space-xs) var(--space-s);
  background: var(--color-ink);
  color: var(--color-paper);
  border-radius: var(--radius);
}
.skip-link:focus { top: var(--space-s); color: var(--color-paper); }

/* 5. Header & footer */
.symbol {
  /* Crops the symbol's built-in margin and rings the circle in green. */
  --size: 2.25rem;
  display: inline-block;
  flex: none;
  box-sizing: content-box;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  border: 1.5px solid var(--color-green);
  overflow: hidden;
}
.symbol img {
  /* The circle fills 3/4 of the SVG's square canvas. */
  width: calc(var(--size) * 4 / 3);
  max-width: none;
  margin: calc(var(--size) / -6);
}

.site-header { border-bottom: 1px solid var(--color-line); }
.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs) var(--space-l);
  padding-block: var(--space-s);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--color-ink);
  text-decoration: none;
}
.brand:hover { color: var(--color-ink); }
.brand__name {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  line-height: 1.25;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-m);
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  display: inline-block;
  padding-block: var(--space-xs);
  color: var(--color-ink);
  font-size: 1.0625rem;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--color-green-deep); border-bottom-color: var(--color-line); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--color-green); }


@media (max-width: 40rem) {
  .site-header__inner { flex-direction: column; align-items: flex-start; }
  .site-nav ul { gap: 0 1.1rem; }
}

.site-footer {
  border-top: 1px solid var(--color-line);
  /* Extra bottom space keeps the footer links clear of Netlify's fixed 64px "Powered by Netlify" badge */
  padding-block: var(--space-l) 5rem;
  color: var(--color-ink-soft);
  font-size: var(--text-small);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s) var(--space-l);
}
.site-footer p { margin: 0; }
.site-footer__place { display: flex; align-items: center; gap: var(--space-xs); }
.site-footer .symbol { --size: 1.75rem; }

/* 6. Shared components */
.lede { font-size: var(--text-lead); line-height: 1.55; }

.section-title {
  position: relative;
  padding-top: var(--space-m);
  margin-bottom: var(--space-l);
}
.section-title::before {
  /* A short brush-line of green above each section heading. */
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 2.5rem; height: 2px;
  background: var(--color-green);
}

/* Photo styles — chosen by "photoStyle" in src/_data/site.json */
.photo { margin: 0; position: relative; }

/* "mat": colour photo in a white mount with a hairline border (first proposal, 19 Oct 2026) */
.photos-mat .photo img {
  padding: 0.5rem;
  background: var(--color-card);
  border: 1px solid var(--color-line);
  border-radius: 2px;
}

/* "ink": warm black and white, with a fine green line offset behind */
.photos-ink .section,
.photos-ink .welcome,
.photos-ink .page-intro {
  /* Each section is its own layer, so the line sits behind the photo but above the section colour. */
  position: relative;
  z-index: 0;
}
.photos-ink .photo img {
  filter: grayscale(1) sepia(0.12) contrast(1.06);
}
.photos-ink .photo::before {
  content: "";
  position: absolute;
  /* Offset capped at 16px so enlarged text can't push the line past the screen edge */
  --photo-offset: min(var(--space-s), 16px);
  inset: var(--photo-offset) calc(var(--photo-offset) * -1) calc(var(--photo-offset) * -1) var(--photo-offset);
  border: 1px solid var(--color-green);
  z-index: -1;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-pill);
  background: var(--color-green);
  color: var(--color-paper);
  font-weight: 600;
  text-decoration: none;
  max-width: 100%;
  flex-wrap: wrap;
}
.button:hover { background: var(--color-green-deep); color: #fff; }

.text-link { font-weight: 600; }

.calm-list { list-style: none; padding: 0; border-top: 1px solid var(--color-line); }
.calm-list li {
  position: relative;
  padding: 0.7rem 0 0.7rem 1.75rem;
  border-bottom: 1px solid var(--color-line);
}
.calm-list li::before {
  content: "";
  position: absolute;
  left: 0.15rem; top: 1.3rem;
  width: 0.55rem; height: 0.55rem;
  border: 1.5px solid var(--color-green);
  border-radius: 50%;
}

/* 7. Home sections */
.welcome { padding-block: var(--space-xl) var(--space-section); }
/* minmax(0, 1fr): single-column grids may shrink to the screen even with very large text */
.welcome__inner,
.page-intro__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-l);
  align-items: center;
}
.welcome__text,
.page-intro__text { max-width: var(--width-text); }
.welcome h1 { margin-bottom: var(--space-m); }

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-s) var(--space-m);
  margin-top: var(--space-l);
}

.welcome__photo { justify-self: center; max-width: 18rem; }

@media (min-width: 52rem) {
  .welcome__inner,
  .page-intro__inner { grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-xl); }
  .welcome__photo { max-width: none; justify-self: end; }
  /* Desktop only: tighter join between the introduction and Classes (two thirds of the usual section spacing) */
  .welcome { padding-bottom: calc(var(--space-section) * 2 / 3); }
  .welcome + .section { padding-top: calc(var(--space-section) * 2 / 3); }
}

/* Classes */
.notice {
  max-width: var(--width-text);
  margin-bottom: var(--space-l);
  padding: var(--space-s) var(--space-m);
  background: var(--color-tint);
  border-left: 3px solid var(--color-green);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.notice p { margin: 0; }
.notice__heading { font-weight: 600; }

.class-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-m);
}
@media (min-width: 48rem) {
  /* Two cards side by side at normal text sizes; they stack when enlarged text needs the room */
  .class-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: var(--space-l); }
}

.class-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-l) var(--space-m) var(--space-m);
  background: var(--color-card);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
}
@media (min-width: 30rem) {
  .class-card { padding-inline: var(--space-l); }
}
.class-card h3 { margin-bottom: var(--space-2xs); }
.class-card__place {
  margin-bottom: var(--space-xs);
  color: var(--color-green-deep);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.class-card__time {
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 1.4rem + 0.8vw, 2rem);
  line-height: 1.2;
  color: var(--color-green-deep);
  margin-bottom: var(--space-m);
  padding-bottom: var(--space-m);
  border-bottom: 1px solid var(--color-line);
}
.class-card__time .keep-together { display: inline-block; max-width: 100%; }
.class-card__note {
  padding: var(--space-s) var(--space-m);
  background: var(--color-tint);
  border-radius: var(--radius);
}
.class-card__map { margin-top: auto; padding-top: var(--space-xs); margin-bottom: 0; }

.expect {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-l);
  align-items: center;
  margin-top: var(--space-xl);
}
.expect__text { max-width: var(--width-text); }
.expect__photo { justify-self: center; max-width: 15rem; order: 2; }
@media (min-width: 48rem) {
  .expect { grid-template-columns: auto minmax(0, 1fr); gap: var(--space-xl); }
  .expect__photo { order: 0; max-width: none; }
}

/* About */
.about {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-l);
  align-items: start;
}
.about__photo { max-width: 14rem; }
.about__text { max-width: var(--width-text); }
@media (min-width: 48rem) {
  .about { grid-template-columns: auto minmax(0, 1fr); gap: var(--space-xl); }
  .about__photo { max-width: none; position: sticky; top: var(--space-l); }
}
.tagline {
  font-family: var(--font-heading);
  font-size: var(--text-lead);
  color: var(--color-green-deep);
  margin-top: calc(var(--space-l) * -0.6);
  margin-bottom: var(--space-m);
}

.disclosure {
  margin-top: var(--space-l);
  border-top: 1px solid var(--color-line);
  border-bottom: 1px solid var(--color-line);
}
.disclosure summary {
  display: flex;
  flex-wrap: wrap; /* the +/− icon moves below the words only when enlarged text needs the room */
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs) var(--space-s);
  min-height: 3rem;
  padding-block: var(--space-s);
  cursor: pointer;
  list-style: none;
  font-family: var(--font-heading);
  font-size: var(--text-h3);
  color: var(--color-ink);
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::after {
  /* Plus that becomes a minus when open */
  content: "";
  flex: none;
  width: 1.75rem; height: 1.75rem;
  border: 1.5px solid var(--color-green);
  border-radius: 50%;
  background:
    linear-gradient(var(--color-green), var(--color-green)) center / 0.75rem 1.5px no-repeat,
    linear-gradient(var(--color-green), var(--color-green)) center / 1.5px 0.75rem no-repeat;
}
.disclosure[open] summary::after {
  background: linear-gradient(var(--color-green), var(--color-green)) center / 0.75rem 1.5px no-repeat;
}
.disclosure summary:hover { color: var(--color-green-deep); }

.teachers {
  list-style: none;
  margin: var(--space-xs) 0 var(--space-m);
  padding: 0;
}
.teachers li {
  position: relative;
  padding: 0 0 var(--space-m) var(--space-l);
  border-left: 1px solid var(--color-line);
  margin-left: 0.4rem;
}
.teachers li:last-child { border-left-color: transparent; padding-bottom: 0; }
.teachers li::before {
  content: "";
  position: absolute;
  left: -0.4rem; top: 0.45rem;
  width: 0.8rem; height: 0.8rem;
  background: var(--color-surface);
  border: 1.5px solid var(--color-green);
  border-radius: 50%;
}
.teachers h3 { font-size: 1.25rem; margin-bottom: var(--space-2xs); }
.teachers p:last-child { margin-bottom: 0; }
.teachers__link { font-size: var(--text-small); }

/* Standalone small links: taller tap area (PL-02); the negative margin keeps the layout unchanged */
.teachers__link a,
.site-footer__links a {
  display: inline-block;
  padding-block: 0.3rem;
  margin-block: -0.3rem;
}

/* Contact */
.contact__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.contact .symbol { --size: 3rem; margin-bottom: var(--space-m); }
.contact .section-title { padding-top: 0; margin-bottom: var(--space-s); }
.contact .section-title::before { display: none; }
.contact p { font-size: var(--text-lead); margin-bottom: var(--space-xs); }
.phone-link {
  display: inline-block;
  padding: var(--space-xs) var(--space-l);
  font-family: var(--font-heading);
  font-size: clamp(2rem, 1.4rem + 3vw, 3.25rem);
  line-height: 1.2;
  max-width: 100%;
  color: var(--color-green-deep);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
  border-radius: var(--radius);
}
.phone-link:hover { color: var(--color-ink); }

/* 8. The 42 Form */
.page-intro { padding-block: var(--space-xl) var(--space-section); }
.page-intro h1 { margin-bottom: var(--space-m); }
.page-intro__photo { justify-self: center; max-width: 20rem; }
@media (min-width: 52rem) {
  .page-intro__photo { justify-self: end; max-width: none; }
}

.movements {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: movement;
}
@media (min-width: 40rem) { .movements { columns: 2; column-gap: var(--space-xl); } }
@media (min-width: 64rem) { .movements { columns: 3; } }
.movements li {
  counter-increment: movement;
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: var(--space-xs);
  padding-block: 0.6rem;
  border-bottom: 1px solid var(--color-line);
  break-inside: avoid;
  line-height: 1.45;
}
.movements li::before {
  content: counter(movement);
  font-family: var(--font-heading);
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--color-green);
  text-align: right;
}

.video-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-m);
}
@media (min-width: 48rem) { .video-links { grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); } }
.video-links a {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  height: 100%;
  padding: var(--space-m);
  background: var(--color-card);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  color: var(--color-ink);
  text-decoration: none;
}
.video-links a:hover { border-color: var(--color-green); }
.video-links__title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  line-height: 1.3;
}
.video-links__where {
  margin-top: auto;
  color: var(--color-green-deep);
  font-weight: 600;
  font-size: var(--text-small);
}
.video-links__where::after { content: " →"; }
.video-links a:hover .video-links__where { text-decoration: underline; }

/* 9. Text pages */
.prose { max-width: calc(var(--width-text) + 2 * var(--gutter)); }
.prose h1 { margin-bottom: var(--space-m); }
.prose h2 { font-size: 1.5rem; font-weight: 450; margin-top: var(--space-l); margin-bottom: var(--space-xs); }
.prose-page { padding-top: var(--space-xl); }

/* Page not found (404.html) */
.not-found { padding-top: var(--space-xl); }
.not-found .actions { margin-top: var(--space-m); }
.not-found__number { font-weight: 400; margin-left: 0.4em; }
