/* ============================================================
   L01-typography.css — Wave 6 · Typography Elevation
   Additive only. Assumes tokens.css, base.css, polish.css.
   Every rule must justify itself with a visible refinement.
   ============================================================ */

/* ------------------------------------------------------------
   1. Global OpenType defaults — considered glyph substitution
   ------------------------------------------------------------ */
html {
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Fraunces gets its expressive ligature + old-style figure palette.
   Inter Tight also carries liga + contextual alternates. */
.name,
.hero .lede,
.stack-prose,
.services-list li,
.work dt,
.bio .bilingual > div p,
.place .bilingual > div p strong,
ol.tl p,
.page-footer .colophon,
.pull-quote blockquote.pending {
  font-feature-settings: "kern" 1, "liga" 1, "dlig" 1, "calt" 1, "ss01" 1, "onum" 1;
  font-variant-ligatures: common-ligatures discretionary-ligatures contextual;
}

/* ------------------------------------------------------------
   2. True drop cap — .bio bg + en first paragraph
   Fraunces italic, 5 baselines, tucked into 2 lines, gold accent
   ------------------------------------------------------------ */
.bio .bilingual > div[lang="bg"] > p:first-of-type::first-letter,
.bio .bilingual > div[lang="en"] > p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-variation-settings: "opsz" 144, "SOFT" 40, "WONK" 1;
  font-size: 5.2em;          /* ~5 baselines at 1.55 line-height */
  line-height: 0.82;
  float: left;
  margin: 0.04em 0.08em -0.12em -0.02em;
  padding: 0 0.06em 0 0;
  color: var(--accent);
  text-shadow: 0 1px 0 rgba(143, 106, 54, 0.18);  /* subtle ink weight */
  -webkit-font-smoothing: antialiased;
}

/* Tuck into two lines — use initial-letter where supported */
@supports (initial-letter: 2) {
  .bio .bilingual > div[lang="bg"] > p:first-of-type::first-letter,
  .bio .bilingual > div[lang="en"] > p:first-of-type::first-letter {
    -webkit-initial-letter: 2 2;
            initial-letter: 2 2;
    font-size: 1em;           /* sizing governed by initial-letter */
    line-height: 1;
    margin-right: 0.12em;
  }
}

/* English cap gets the warmer WONK italic; Bulgarian stays upright-ish */
.bio .bilingual > div[lang="bg"] > p:first-of-type::first-letter {
  font-style: normal;
  font-variation-settings: "opsz" 144, "SOFT" 30, "WONK" 0;
}

/* ------------------------------------------------------------
   3. Fraunces variable-axis choreography
   ------------------------------------------------------------ */
/* Hero lede — overrides polish.css with fuller display expression */
.hero .lede[lang="bg"] {
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 0;
  letter-spacing: -0.015em;
}
.hero .lede[lang="en"] {
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
  letter-spacing: -0.01em;
}

/* Name h1 — optical-size 144, mild SOFT (20) for sharp capitals */
.page-header .name {
  font-variation-settings: "opsz" 144, "SOFT" 20, "WONK" 0;
}
/* Secondary English name — warmer WONK italic */
.page-header .name [lang="en"] {
  font-variation-settings: "opsz" 144, "SOFT" 80, "WONK" 1;
}

/* Section h2 — opsz 48, SOFT 60: editorial-weight headings */
section > header h2,
article > header h2 {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 48, "SOFT" 60, "WONK" 0;
  font-feature-settings: "kern" 1, "liga" 1, "dlig" 1, "ss01" 1;
}
/* English half of bilingual headings — italic with WONK warmth */
section > header h2 [lang="en"],
article > header h2 [lang="en"] {
  font-style: italic;
  font-variation-settings: "opsz" 48, "SOFT" 80, "WONK" 1;
}

/* Work dt — display face, small-opsz for set copy density */
.work dt {
  font-variation-settings: "opsz" 36, "SOFT" 50, "WONK" 0;
}

/* Pull-quote — already wonky, tighten axis spec */
.pull-quote blockquote.pending {
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
}

/* ------------------------------------------------------------
   4. Tabular figures for times and years
   ------------------------------------------------------------ */
ol.tl time,
.meta,
.work dt .meta,
.page-footer .colophon time,
.header-meta {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1, "kern" 1;
}

/* Old-style figures in running prose — more graceful mid-sentence */
.bio p,
ol.tl p,
.place p,
.stack-prose {
  font-variant-numeric: oldstyle-nums proportional-nums;
}

/* ------------------------------------------------------------
   5. Hanging punctuation — optical edge on lede and bio prose
   ------------------------------------------------------------ */
.hero .lede,
.bio .bilingual > div p,
.pull-quote blockquote.pending,
.place .bilingual > div p {
  hanging-punctuation: first last;
}

/* ------------------------------------------------------------
   6. Real small-caps — header-meta and portrait-caption
   Inter Tight carries c2sc/smcp
   ------------------------------------------------------------ */
.page-header .header-meta,
.portrait-caption {
  font-family: var(--font-body);
  text-transform: none;                    /* let OpenType do it */
  font-variant-caps: all-small-caps;
  font-feature-settings: "smcp" 1, "c2sc" 1, "kern" 1, "tnum" 1;
  letter-spacing: 0.14em;
  font-weight: 500;
}

/* ------------------------------------------------------------
   7. Cyrillic kerning + letter-spacing pass
   Cyrillic optically appears tighter than Latin at same tracking;
   relax it a touch and engage ss01 for stylistic alternates.
   ------------------------------------------------------------ */
.page-header .name [lang="bg"] {
  letter-spacing: -0.008em;
  font-feature-settings: "kern" 1, "liga" 1, "ss01" 1, "locl" 1;
  font-variant-alternates: styleset(1);
}

section > header h2 [lang="bg"],
article > header h2 [lang="bg"] {
  letter-spacing: 0.002em;
  font-feature-settings: "kern" 1, "liga" 1, "ss01" 1, "locl" 1;
}

/* Bulgarian body — locl for Cyrillic Bulgarian forms */
[lang="bg"] {
  font-feature-settings: "kern" 1, "liga" 1, "locl" 1, "calt" 1;
}

/* ------------------------------------------------------------
   8. Italic English secondary — WONK warmth
   ------------------------------------------------------------ */
.stack-prose[lang="en"],
ol.tl p[lang="en"],
.place .bilingual > div[lang="en"] p strong {
  font-variation-settings: "opsz" 36, "SOFT" 90, "WONK" 1;
}

.name-sub [lang="en"],
.contact address[lang="en"] {
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

/* ------------------------------------------------------------
   9. Micro-refinements — orphans, widows, wrap
   ------------------------------------------------------------ */
h1, h2, .lede, .pull-quote blockquote {
  text-wrap: balance;
}
.bio p, .place p, ol.tl p, .stack-prose {
  text-wrap: pretty;
  orphans: 2;
  widows: 2;
}

/* Strong inside bio — preserve feature set (ligatures shouldn't drop) */
.bio p strong, .place p strong, .work dt strong {
  font-feature-settings: inherit;
}
