/*
  Identidad «Documental» de Liuhe Tanglang Quan (ADR 0011).
  Shared by the website (static/kungfu/) and the print pieces
  (projects/kungfu/print/). Pages build on these variables and classes only.

  Draft mode: put class="boceto" on <html> (or, on the sample page, on a
  block). Photo, logo and video slots then show their description, and
  missing data shows as «Falta: …». Without it, slots become quiet paper
  blocks and missing data disappears.
*/

/* ---------- Fonts (self-hosted, SIL OFL; see fonts/*-ofl.txt) ---------- */

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/source-serif-4-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/source-serif-4-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/source-serif-4-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/source-serif-4-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Only 六合螳螂拳龙口张道锦. Any other Han character falls back to the system. */
@font-face {
  font-family: "Noto Serif SC";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/noto-serif-sc-500-subset.woff2") format("woff2");
  unicode-range: U+516D, U+53E3, U+5408, U+5F20, U+62F3, U+8782, U+87B3, U+9053, U+9526, U+9F99;
}

/* ---------- Variables ---------- */

:root {
  /* Colour: paper, ink and one accent (green). Contrast on --papel in the sample page. */
  --papel: #F3F4F0;
  --tinta: #1A1F1C;
  --tinta-suave: #3D4541;
  --gris: #565F5A;
  --linea: #C9CEC8;
  --verde: #2F5D46;
  --verde-oscuro: #1F4231;
  --hueco: #E6E8E2;
  --blanco: #FFFFFF;

  /* Type. Source Serif 4 carries everything; the Han subset sits in the
     stack so 六合螳螂拳龙口张道锦 never fall to a system font. */
  --serif: "Source Serif 4", "Noto Serif SC", Georgia, serif;
  --han: "Noto Serif SC", serif;

  /* Type scale (rem, 1rem = 16px). Steps from the classic 15-18-21-26-32-40-48. */
  --t-0: 0.9375rem; /* 15px: notes, readings, slot descriptions */
  --t-1: 1.125rem;  /* 18px: body text, lead, button */
  --t-2: 1.3125rem; /* 21px: brand name, «Martes y jueves», h3 */
  --t-3: 1.625rem;  /* 26px: h2 on mobile */
  --t-4: 2rem;      /* 32px: h2 on desktop, characters */
  --t-5: 2.5rem;    /* 40px: schedule hours */
  --t-6: 3rem;      /* 48px: title on desktop */
  --t-titulo: var(--t-4); /* 32px on mobile, --t-6 from 60em */

  /* Space (rem). */
  --e-1: 0.25rem; /*  4px */
  --e-2: 0.5rem;  /*  8px */
  --e-3: 1rem;    /* 16px: page gutter on mobile */
  --e-4: 1.5rem;  /* 24px */
  --e-5: 2.5rem;  /* 40px: between blocks */
  --e-6: 4rem;    /* 64px: between sections */

  --measure: 66ch;  /* longest text line */
  --radius: 2px;
}

@media (min-width: 60em) {
  :root {
    --t-titulo: var(--t-6);
  }
}

/* ---------- Base ---------- */

html {
  background: var(--papel);
  color: var(--tinta);
  font-family: var(--serif);
  font-size: 100%;
  font-synthesis: none; /* real italic only; never a slanted or fake-bold face */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-size: var(--t-1);
  line-height: 1.55;
}

h1,
h2,
h3 {
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
}

h1 {
  font-size: var(--t-titulo);
  line-height: 1.12;
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 60;
}

h2 {
  font-size: var(--t-3);
}

@media (min-width: 60em) {
  h2 {
    font-size: var(--t-4);
  }
}

h3 {
  font-size: var(--t-2);
}

p,
li {
  max-width: var(--measure);
  text-wrap: pretty;
}

em,
i {
  font-style: italic;
}

/* Han characters only (lang="zh-Hans"). Romanised words such as taolu
   carry no lang: they keep the serif and their italic. */
:lang(zh-Hans),
:lang(zh-Hant) {
  font-family: var(--han);
  font-style: normal;
  font-weight: 500;
}

a {
  color: var(--verde);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--verde-oscuro);
}

:focus-visible {
  outline: 2px solid var(--verde-oscuro);
  outline-offset: 2px;
}

/* ---------- Text roles ---------- */

/* Subtitle under the title. */
.lead {
  font-size: var(--t-1);
  line-height: 1.5;
  color: var(--tinta-suave);
}

/* Small secondary text: the course, a source, a date. */
.note {
  font-size: var(--t-0);
  line-height: 1.45;
  color: var(--gris);
}

/* The schedule figures: «21:00–22:30». */
.hours {
  font-size: var(--t-5);
  line-height: 1.1;
  font-weight: 600;
  font-variant-numeric: lining-nums tabular-nums;
  font-variation-settings: "opsz" 60;
  white-space: nowrap;
}

/* Text for screen readers only: the spoken form of «21:00–22:30», set beside
   the figures, which carry aria-hidden="true" (guide §9). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The one action: «Ven a probar». A link that looks like a button. */
.button {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 var(--e-4);
  background: var(--verde);
  color: var(--blanco);
  font-size: var(--t-1);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  border-radius: var(--radius);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.button:hover {
  background: var(--verde-oscuro);
  color: var(--blanco);
}

/* ---------- Brand ---------- */

/*
  .marca: the name and its gloss, always together (guide §1).
    <p class="marca">
      <span class="marca__name">Liuhe Tanglang Quan</span>
      <span class="marca__gloss">la mantis de las seis armonías</span>
    </p>
  The school seal goes first, small (<img class="marca__seal">), never
  instead of the name (ADR 0012). Where it is not set yet,
  <span class="hueco hueco--logo" data-describe="…"></span> in its place.
*/
.marca {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  column-gap: var(--e-3);
  margin: 0;
  line-height: 1.25;
}

.marca:has(> .marca__seal),
.boceto .marca:has(> .hueco--logo) {
  grid-template-columns: auto minmax(0, 1fr);
}

.marca > .marca__seal,
.marca > .hueco--logo {
  grid-row: 1 / span 2;
}

.marca__name,
.marca__gloss {
  grid-column: -2 / -1;
}

/* Beside a seal, name and gloss stay together, centred on it. */
.marca > .marca__name {
  align-self: end;
}

.marca > .marca__gloss {
  align-self: start;
}

.marca__name {
  font-size: var(--t-2);
  font-weight: 600;
  color: var(--tinta);
  white-space: nowrap;
}

.marca__gloss {
  font-size: var(--t-0);
  font-style: italic;
  color: var(--gris);
}

.marca__seal {
  display: block;
  width: 3rem;
  height: 3rem;
  object-fit: contain;
}

/*
  .caracteres: 六合螳螂拳 with its reading, never one without the other.
    <span class="caracteres">
      <span class="caracteres__han" lang="zh-Hans">六合螳螂拳</span>
      <span class="caracteres__reading">Liùhé Tángláng Quán</span>
    </span>
  Horizontal by default; .caracteres--vertical sets them top to bottom with
  the reading in a thin column beside them. Size with --han-size.
*/
.caracteres {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--e-1);
  line-height: 1;
}

.caracteres__han {
  font-family: var(--han);
  font-size: var(--han-size, var(--t-4));
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--verde);
  white-space: nowrap;
}

.caracteres__reading {
  font-size: var(--t-0);
  font-style: italic;
  line-height: 1.3;
  color: var(--gris);
  white-space: nowrap;
}

.caracteres--vertical {
  flex-direction: row;
  gap: var(--e-1);
}

.caracteres--vertical > .caracteres__han,
.caracteres--vertical > .caracteres__reading {
  writing-mode: vertical-rl;
}

.caracteres--vertical > .caracteres__han {
  line-height: 1;
}

.caracteres--vertical > .caracteres__reading {
  font-size: 0.8125rem; /* 13px: the smallest that still reads sideways */
}

/* ---------- Slots and missing data ---------- */

/*
  .hueco: where a photo, the logo or the video will go.
    <div class="hueco" data-describe="Aplicación por parejas, plano medio, luz del pabellón"></div>
  or the description inside, in an element:
    <div class="hueco"><p>Foto de clase</p><p>Aplicación por parejas…</p></div>
  Photo 3:2 by default; .hueco--video 16:9; .hueco--logo a small square.
  Published: a paper block with the characters, no notice text; the logo slot
  disappears. Draft (.boceto): the description on --hueco, dashed border.
*/
.hueco {
  container-type: inline-size;
  display: grid;
  place-items: center;
  align-content: center;
  gap: var(--e-2);
  box-sizing: border-box;
  aspect-ratio: 3 / 2;
  width: 100%;
  overflow: hidden;
  background: var(--papel);
  border: 1px solid var(--linea);
  font-size: 0; /* bare text inside never shows when published */
}

.hueco > * {
  display: none;
}

.hueco::before {
  content: "六合螳螂拳";
  content: "六合螳螂拳" / ""; /* decoration: not read aloud */
  font-family: var(--han);
  font-weight: 500;
  font-size: 12cqi;
  letter-spacing: 0.08em;
  line-height: 1;
  color: var(--linea);
  white-space: nowrap;
}

/* The reading goes with the characters, here too (guide §1). */
.hueco::after {
  content: "Liùhé Tángláng Quán";
  content: "Liùhé Tángláng Quán" / "";
  font-family: var(--serif);
  font-size: max(var(--t-0), 3cqi);
  font-style: italic;
  line-height: 1.3;
  color: var(--gris);
  white-space: nowrap;
}

.hueco--video {
  aspect-ratio: 16 / 9;
}

.hueco--logo {
  display: none;
}

.boceto .hueco {
  align-content: center;
  gap: var(--e-1);
  padding: var(--e-3);
  background: var(--hueco);
  border: 1px dashed var(--gris);
  font-size: var(--t-0);
  line-height: 1.4;
  color: var(--tinta-suave);
  text-align: center;
}

.boceto .hueco::before,
.boceto .hueco::after {
  content: none;
}

.boceto .hueco > * {
  display: block;
  margin: 0;
  max-width: 34ch;
}

.boceto .hueco > :first-child:not(:only-child) {
  font-weight: 600;
}

.boceto .hueco[data-describe]::after {
  content: attr(data-describe);
  max-width: 34ch;
  font-family: inherit;
  font-size: inherit;
  font-style: normal;
  line-height: inherit;
  color: inherit;
  white-space: normal;
}

.boceto .hueco--logo {
  display: grid;
  aspect-ratio: 1;
  width: 5.5rem; /* 88px: room for a four-line description at 13px */
  padding: var(--e-1);
  font-size: 0.8125rem;
  line-height: 1.2;
}

/*
  .falta: a fact we do not have yet, in place of the text.
    <span class="falta">dirección del pabellón</span>
  Draft: a green mark «Falta: dirección del pabellón». Published: hidden.
*/
.falta {
  display: none;
}

.boceto .falta {
  display: inline;
  padding: 0 0.3em;
  border: 1px dashed var(--verde);
  border-radius: var(--radius);
  color: var(--verde-oscuro);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.boceto .falta::before {
  content: "Falta: ";
  font-weight: 600;
}

/* ---------- Print ---------- */

@media print {
  html {
    background: var(--blanco);
  }
}
