/* =============================================================
   Vesali Editorial — site layer
   Loaded after main.css and editorial.css. It owns the colour and type
   tokens for the whole site, maps the older token names onto them, and
   restyles the shared parts: header, buttons, cards, archive, article,
   CV page and footer.
   Sections: tokens · token aliases · base · kickers and tags · buttons
   · header · cards · archive · article · CV · footer
   ============================================================= */

/* ---------- Tokens ----------
   `html:root` outranks the `:root` colour variables that the old Vesali
   Studio printed, in case that plugin is still active. */
html:root {
  --c-bg: #f7f5ef;          /* ivory paper */
  --c-card: #ffffff;
  --c-surface: #efece3;
  --c-line: #e4e0d4;
  --c-ink: #1c2a22;         /* body text */
  --c-head: #163a28;        /* headlines: deep forest */
  --c-muted: #5d665f;
  --c-forest: #133423;      /* panels */
  --c-forest-2: #1d4631;
  --c-on-forest: #f3f0e6;
  --c-on-forest-muted: #c5cfc6;
  /* Two colours taken from the CSV (csv.lu): its yellow for the action and
     its turquoise for small details. The turquoise is darkened for text. */
  --c-gold: #ffc300;        /* CSV yellow: buttons and accents */
  --c-gold-hover: #f0b400;
  --c-on-gold: #1c2a22;
  --c-turq: #1ec8dc;        /* CSV turquoise: lines, underlines, focus */
  --c-gold-text: #0f6f88;   /* CSV turquoise, darkened for small text on ivory (5.3:1) */
  --c-tag: #e3ebe0;         --c-on-tag: #234a33;
  --c-tag-gold: #e9f5fd;    --c-on-tag-gold: #0a566a;  /* CSV light blue and petrol */

  --f-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --f-text: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --s-kicker: 0.75rem;                                      /* 12 */
  --s-small: clamp(0.875rem, 0.85rem + 0.1vw, 0.9375rem);   /* 14–15 */
  --s-body: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);       /* 16–17 */
  --s-h3: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);           /* 20–24 */
  --s-h2: clamp(2rem, 1.5rem + 1.8vw, 3rem);                /* 32–48 */
  --s-h1: clamp(2.6rem, 1.6rem + 3.4vw, 4.5rem);            /* 42–72 */

  --gutter: clamp(20px, 3vw, 48px);
  --section: clamp(72px, 8vw, 128px);
  --radius: 4px;
  --ease-out: cubic-bezier(.22, .61, .36, 1);
}

html:root[data-theme="dark"] {
  --c-bg: #111a15;
  --c-card: #18241d;
  --c-surface: #1d2b23;
  --c-line: #2a3a31;
  --c-ink: #e6e3da;
  --c-head: #efe9d8;
  --c-muted: #a9b2ab;
  --c-forest: #1a3f2c;     /* a step lighter than the dark ground, so panels and shapes still read */
  --c-forest-2: #24543b;
  --c-gold-text: #39dbee;
  --c-tag: #22382b;         --c-on-tag: #cfe0d2;
  --c-tag-gold: #0d3a46;    --c-on-tag-gold: #bdeef5;
}

/* ---------- Older token names, mapped onto the tokens above ---------- */
html:root,
html:root[data-theme="dark"] {
  --paper: var(--c-bg);
  --paper-2: var(--c-bg);
  --surface: var(--c-card);
  --surface-2: var(--c-surface);
  --ink: var(--c-ink);
  --ink-soft: var(--c-ink);
  --muted: var(--c-muted);
  --navy: var(--c-forest);
  --navy-2: var(--c-forest);
  --action: var(--c-forest);
  --on-action: var(--c-on-forest);
  --teal: var(--c-head);
  --teal-deep: var(--c-head);
  --blue: var(--c-head);
  --yellow: var(--c-gold);
  --gold: var(--c-gold);
  --line: var(--c-line);
  --line-strong: var(--c-line);
  --shadow: none;
  --shadow-sm: none;
  --font-serif: var(--f-display);
  --font-sans: var(--f-text);
  --wrap: 1280px;
  --reading-measure: 68ch;
}

/* ---------- Base ---------- */
html { background: var(--c-bg); }
body {
  background: var(--c-bg); color: var(--c-ink);
  font-family: var(--f-text); font-size: var(--s-body); line-height: 1.6;
}
/* editorial.css framed the page as a rounded card on wide screens. */
@media (min-width: 1400px) {
  body { max-width: none; margin: 0; border-radius: 0; }
  .site-header { border-radius: 0; }
}
/* The bottom tab bar is opt-in (filter vesali_show_app_tabs). */
@media (max-width: 760px) {
  body:not(.has-app-tabs) { padding-bottom: 0; }
}
.wrap { width: calc(100% - 2 * var(--gutter)); max-width: var(--wrap); margin-inline: auto; }
h1, h2, h3, h4 { font-family: var(--f-display); color: var(--c-head); }
::selection { background: var(--c-gold); color: var(--c-on-gold); }
:focus-visible { outline: 2px solid var(--c-turq); outline-offset: 3px; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { color: var(--c-head); }

/* ---------- Kickers and tags ---------- */
.hm-kicker {
  margin: 0 0 14px;
  font: 600 var(--s-kicker)/1.4 var(--f-text); letter-spacing: .16em; text-transform: uppercase;
  color: var(--c-gold-text);
}
.hm-kicker--rule::before {
  content: ""; display: inline-block; width: 22px; height: 2px; margin-right: 10px;
  background: var(--c-turq); vertical-align: .3em;
}
.hm-kicker--light { color: var(--c-turq); }
.ed-tag {
  display: inline-block; padding: 3px 8px; border-radius: 2px;
  background: var(--c-tag); color: var(--c-on-tag);
  font: 600 12px/1.3 var(--f-text); letter-spacing: .08em; text-transform: uppercase;
  text-decoration: none;
}
a.ed-tag:hover { background: var(--c-forest); color: var(--c-on-forest); }

/* ---------- Buttons ---------- */
.btn, .hm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  min-height: 48px; padding: 0 22px; border: 0; border-radius: var(--radius);
  background: var(--c-gold); color: var(--c-on-gold);
  font: 600 var(--s-small)/1 var(--f-text); text-decoration: none; cursor: pointer;
  transition: background-color .18s var(--ease-out), transform .18s var(--ease-out);
}
.btn:hover, .hm-btn:hover { background: var(--c-gold-hover); color: var(--c-on-gold); }
.btn:active, .hm-btn:active { transform: scale(.98); }
.btn svg, .hm-btn svg { transition: transform .2s var(--ease-out); }
.btn:hover svg, .hm-btn:hover svg { transform: translateX(3px); }
.btn-primary, .btn-primary:hover { background: var(--c-gold); color: var(--c-on-gold); }
.hm-link {
  display: inline-flex; align-items: center; gap: .45em;
  font: 500 var(--s-small)/1.4 var(--f-text); color: var(--c-head);
  text-decoration: underline; text-decoration-color: var(--c-turq); text-decoration-thickness: 2px; text-underline-offset: .35em;
}
.hm-link svg { transition: transform .2s var(--ease-out); }
.hm-link:hover svg { transform: translateX(3px); }

/* ---------- Header ---------- */
.site-header,
.site-header.is-scrolled {
  position: sticky; top: 0; z-index: 50;
  background: var(--c-bg); box-shadow: none; /* taste-skill-ignore: removes the old shadow */
  border-bottom: 1px solid transparent;
  -webkit-backdrop-filter: none; backdrop-filter: none; /* taste-skill-ignore: removes the old blur */
  transition: border-color .2s;
}
.site-header.is-scrolled { border-bottom-color: var(--c-line); }
.header-inner { min-height: 80px; height: auto; gap: 28px; }
.brand-mark { display: none; }
.brand-name {
  display: inline; font-family: var(--f-display); font-weight: 700;
  font-size: 1.5rem; letter-spacing: -.01em; color: var(--c-head);
}
.nav-list { gap: 26px; }
.nav-list a { font-size: var(--s-small); font-weight: 500; color: var(--c-ink); text-decoration: none; padding: 6px 0; }
.nav-list a:hover { color: var(--c-head); }
.nav-list .current-menu-item > a { color: var(--c-head); }
.nav-list .current-menu-item > a::after { height: 2px; background: var(--c-turq); bottom: -2px; border-radius: 0; }
.header-actions { gap: 6px; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; color: var(--c-head); }
.icon-btn:hover { background: var(--c-surface); }
.theme-toggle, .theme-toggle:hover { background: transparent; color: var(--c-head); transform: none; }
.theme-toggle:hover { background: var(--c-surface); }
.header-cta { min-height: 40px; padding: 0 16px; margin-left: 8px; }
@media (max-width: 760px) {
  .header-inner { min-height: 64px; }
  .brand-name { display: inline; font-size: 1.35rem; }
  .header-cta { display: none; }
  .primary-nav.is-open { background: var(--c-bg); border-bottom: 1px solid var(--c-line); padding: 8px var(--gutter) 24px; }
  .primary-nav .nav-list { flex-direction: column; gap: 0; }
  .nav-list li { border-bottom: 1px solid var(--c-line); }
  .nav-list a { font-size: 18px; min-height: 52px; }
  .nav-list a:hover, .nav-list .current-menu-item > a { background: none; }
}

/* ---------- Cards (homepage, archive, related articles) ---------- */
.ed-card {
  display: flex; flex-direction: column; height: 100%;
  background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius);
  overflow: hidden;
  transition: transform .25s var(--ease-out), border-color .25s;
}
.ed-card:hover { transform: translateY(-4px); border-color: var(--c-gold); }
.ed-card__media { display: block; aspect-ratio: 3 / 2; overflow: hidden; background: var(--c-surface); }
.ed-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s var(--ease-out); }
.ed-card:hover .ed-card__media img { transform: scale(1.04); }
.ed-card__body { display: flex; flex-direction: column; gap: 10px; flex: 1; padding: 20px 22px 22px; }
.ed-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; font-size: 13px; color: var(--c-muted); }
.ed-card__title { margin: 0; font: 700 var(--s-h3)/1.2 var(--f-display); letter-spacing: -.01em; }
.ed-card__title a { color: var(--c-head); text-decoration: none; }
.ed-card__title a:hover { text-decoration: underline; text-decoration-color: var(--c-turq); text-decoration-thickness: 2px; }
.ed-card__excerpt { margin: 0; font-size: var(--s-small); line-height: 1.55; color: var(--c-muted); }
.ed-card__more { display: inline-flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 6px; font-size: 13px; color: var(--c-head); }

/* Picture placeholders (until a picture is chosen). */
.hm-ph {
  position: relative; display: grid; place-items: center;
  width: 100%; height: 100%; min-height: 100%;
  background: var(--c-surface); color: var(--c-gold-text);
}
.hm-ph__mark { display: block; width: 30%; max-width: 120px; height: auto; fill: currentColor; overflow: visible; }
.hm-ph__mark text { font: 700 52px var(--f-display); }
.hm-ph__hint {
  position: absolute; left: 10px; right: 10px; bottom: 10px;
  padding: 6px 8px; background: var(--c-card); color: var(--c-ink);
  font: 400 12px/1.35 var(--f-text);
}

/* ---------- Archive ---------- */
.archive { padding-top: clamp(40px, 5vw, 72px); }
.archive-head { margin-bottom: 28px; max-width: 46rem; }
.archive-head .page-title { font: 700 var(--s-h1)/1.05 var(--f-display); letter-spacing: -.02em; color: var(--c-head); margin: 0; }
.archive-head .journal-lede { margin-top: 14px; color: var(--c-muted); }
.journal-topics { gap: 8px; padding-bottom: 32px; }
.journal-topics a {
  min-height: 36px; padding: 6px 18px; border-radius: 100px;
  background: var(--c-card); border: 1px solid var(--c-line);
  font-size: 13px; color: var(--c-ink);
}
.journal-topics a[aria-current], .journal-topics a:hover { background: var(--c-forest); border-color: var(--c-forest); color: var(--c-on-forest); }
.archive-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.archive-grid .ed-card { flex-direction: column; }
.nav-links { display: flex; gap: 8px; justify-content: center; margin-top: 48px; }
.page-numbers {
  display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 12px;
  border: 1px solid var(--c-line); border-radius: var(--radius); background: var(--c-card);
  color: var(--c-ink); text-decoration: none; font-size: 14px;
}
.page-numbers.current, a.page-numbers:hover { background: var(--c-forest); border-color: var(--c-forest); color: var(--c-on-forest); }
@media (max-width: 1000px) { .archive-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .archive-grid { grid-template-columns: 1fr; gap: 20px; } }

/* ---------- Article ---------- */
.vesali-article { background: var(--c-bg); }
.paper { width: min(100% - 2 * var(--gutter), 1180px); padding-top: 8px; background: transparent; }
.ed-article-head { position: relative; margin: 0 0 8px; }
.ed-article-head__text { max-width: 46rem; padding: 24px 0 8px; }
.ed-article-head .paper-title { margin: 12px 0 0; font: 700 var(--s-h1)/1.06 var(--f-display); letter-spacing: -.02em; color: var(--c-head); max-width: 20ch; }
.ed-article-head .paper-dek { margin: 16px 0 0; font-size: 1.125rem; line-height: 1.55; color: var(--c-muted); max-width: 40rem; }
.ed-article-head.has-cover { min-height: clamp(360px, 46vw, 560px); display: flex; align-items: flex-end; overflow: hidden; border-radius: var(--radius); background: var(--c-forest); }
.ed-article-head__cover { position: absolute; inset: 0; margin: 0; }
.ed-article-head__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* A dark scrim under the title keeps it readable on any photograph. */
.ed-article-head.has-cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10, 24, 16, 0) 30%, rgba(10, 24, 16, .82) 100%); /* taste-skill-ignore: neutral scrim for text on a photo */
}
.ed-article-head.has-cover .ed-article-head__text { position: relative; z-index: 1; padding: 0 clamp(24px, 4vw, 48px) clamp(24px, 4vw, 44px); }
.ed-article-head.has-cover .paper-title { color: #fff; font-size: clamp(2rem, 1.2rem + 2.4vw, 3.25rem); max-width: 26ch; }
.ed-article-head.has-cover .paper-dek { color: #e5e9e3; }
.ed-article-head.has-cover .ed-tag { background: var(--c-gold); color: var(--c-on-gold); }
.paper-inner { max-width: none; padding: 0; }
.paper-head { margin: 0; }
.paper-byline { display: flex; align-items: center; justify-content: flex-start; padding: 20px 0; margin: 0 0 32px; border-bottom: 1px solid var(--c-line); font-size: 13px; color: var(--c-muted); }
.paper-byline img { border-radius: 50%; }
.paper-layout { display: grid; grid-template-columns: 64px minmax(0, 46rem) minmax(200px, 1fr); gap: 40px; align-items: start; margin-top: 0; }
.paper-rail { grid-column: 1; grid-row: 1; position: sticky; top: 100px; padding: 0; border: 0; }
.rail-inner { display: grid; gap: 8px; }
.rail-btn { width: 56px; min-height: 56px; border: 1px solid var(--c-line); border-radius: var(--radius); background: var(--c-card); color: var(--c-head); font-size: 12px; }
.rail-btn:hover { border-color: var(--c-gold); color: var(--c-head); background: var(--c-card); }
.paper-body { grid-column: 2; grid-row: 1; font-family: var(--f-text); font-size: calc(1.0625rem + var(--reader-adjustment)); line-height: 1.75; color: var(--c-ink); max-width: 46rem; }
.paper-body h2, .paper-body h3 { font-family: var(--f-display); color: var(--c-head); line-height: 1.2; margin: 2em 0 .6em; }
.paper-body h2 { display: block; font-weight: 700; font-size: 1.75rem; border: 0; padding: 0; background: none; text-decoration: none; }
.paper-body h2::before, .paper-body h2::after { content: none; }
.paper-body a { color: var(--c-head); text-decoration-color: var(--c-turq); text-decoration-thickness: 2px; }
.paper-body blockquote, .paper-body .wp-block-quote, .paper-body .wp-block-pullquote {
  position: relative; margin: 2em 0; padding: 4px 0 4px 56px; border: 0;
  font: italic 400 1.5rem/1.45 var(--f-display); color: var(--c-head);
}
.paper-body blockquote::before, .paper-body .wp-block-quote::before {
  content: "\201C"; position: absolute; left: 0; top: -10px;
  font: 700 4.5rem/1 var(--f-display); color: var(--c-gold);
}
.paper-body blockquote cite { display: block; margin-top: 10px; font: 400 var(--s-small) var(--f-text); color: var(--c-muted); }
.paper-body figure img { border-radius: var(--radius); }
.paper-body figcaption { font: italic 400 var(--s-small) var(--f-display); color: var(--c-muted); }
.paper-toc { grid-column: 3; grid-row: 1; position: sticky; top: 100px; padding: 20px 22px; background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius); }
.paper-toc__title { margin: 0 0 12px; font: 600 var(--s-kicker)/1.4 var(--f-text); letter-spacing: .14em; text-transform: uppercase; color: var(--c-gold-text); }
.paper-toc__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 14px; line-height: 1.4; }
.paper-toc__list a { color: var(--c-ink); text-decoration: none; }
.paper-toc__list a:hover { color: var(--c-head); text-decoration: underline; text-decoration-color: var(--c-turq); }
.paper-foot { border: 0; }
.related { padding-top: var(--section); }
.related .section-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 24px; }
.related .section-title { margin: 0; font: 700 var(--s-h2)/1.1 var(--f-display); color: var(--c-head); }
.related .head-line { display: none; }
.reader-tools { min-height: 52px; }
@media (max-width: 1100px) {
  .paper-layout { grid-template-columns: 64px minmax(0, 1fr); }
  .paper-toc { grid-column: 2; grid-row: 2; position: static; }
}
@media (max-width: 760px) {
  .paper { width: 100%; }
  .ed-article-head { margin: 0 var(--gutter); }
  .ed-article-head.has-cover { margin: 0; border-radius: 0; min-height: 420px; }
  .paper-inner { padding: 0 var(--gutter); margin-top: 0; border-radius: 0; background: transparent; }
  .paper-layout { display: block; }
  .paper-rail { position: static; margin-top: 32px; }
  .rail-inner { display: flex; gap: 8px; justify-content: flex-start; }
  .paper-toc { margin-top: 28px; }
  .paper-body { font-size: calc(1.0625rem + var(--reader-adjustment)); }
}

/* ---------- CV page ---------- */
.vesali-cv-page { background: var(--c-bg); }
.vesali-cv-page, .vesali-cv-page * { --font-mono: var(--f-text); }
.cv-hero {
  background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius);
  box-shadow: none; /* taste-skill-ignore: removes the old shadow */
  border-top: 3px solid var(--c-gold);
}
.cv-hero::before, .cv-hero::after { display: none; }
.cv-kicker, .cv-index__label { font-family: var(--f-text); font-weight: 600; letter-spacing: .16em; color: var(--c-gold-text); }
.cv-status span { background: var(--c-turq); box-shadow: none; }
.cv-hero h1 { font-family: var(--f-display); color: var(--c-head); }
.cv-role { font-family: var(--f-text); font-weight: 500; letter-spacing: 0; color: var(--c-gold-text); }
.cv-index a { font-family: var(--f-text); }
.cv-index a:hover, .cv-index a[aria-current] { color: var(--c-head); background: var(--c-tag-gold); }
.cv-index__track span { background: var(--c-turq); }
.cv-section__head h2 { font-family: var(--f-display); color: var(--c-head); }
.cv-section__number, .cv-publications li::before { font-family: var(--f-text); color: var(--c-gold-text); }
.cv-rule { background: var(--c-line); }
.cv-entry time { font-family: var(--f-text); font-weight: 600; color: var(--c-gold-text); }
.cv-entry h3 { font-family: var(--f-display); color: var(--c-head); }
.cv-entry--compact, .cv-entry-grid .cv-entry, .cv-toolkit > * { background: var(--c-card); border-color: var(--c-line); box-shadow: none; } /* taste-skill-ignore: removes old shadows */
.cv-timeline .cv-entry::before { border-color: var(--c-head); background: var(--c-bg); }

/* ---------- Footer ---------- */
.site-footer { padding: 56px 0 24px; border-top: 1px solid var(--c-line); background: var(--c-bg); color: var(--c-ink); }
.sf-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 32px; align-items: start; }
.sf-wordmark { font: 700 1.6rem/1.1 var(--f-display); color: var(--c-head); text-decoration: none; }
.sf-brand p { margin: 8px 0 0; max-width: 26rem; font-size: var(--s-small); color: var(--c-muted); }
.sf-head { margin: 0 0 12px; font: 600 var(--s-kicker)/1.4 var(--f-text); letter-spacing: .14em; text-transform: uppercase; color: var(--c-gold-text); }
.sf-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: var(--s-small); }
.sf-list a { color: var(--c-ink); text-decoration: none; }
.sf-list a:hover { color: var(--c-head); text-decoration: underline; text-decoration-color: var(--c-turq); }
.sf-top {
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid var(--c-line); border-radius: 50%; color: var(--c-head);
}
.sf-top svg { transform: rotate(-90deg); }
.sf-top:hover { border-color: var(--c-gold); background: var(--c-card); }
.sf-bottom { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--c-line); font-size: 13px; color: var(--c-muted); }
.sf-bottom p { margin: 0; }
@media (max-width: 900px) {
  .sf-grid { grid-template-columns: 1fr 1fr; }
  .sf-brand { grid-column: 1 / -1; }
  .sf-top { grid-column: 1 / -1; }
}

/* ---------- Skip link: fully hidden until focused ---------- */
.skip-link:not(:focus) { padding: 0; clip-path: inset(50%); }
.skip-link:focus { top: 12px; padding: 12px 18px; border-radius: var(--radius); background: var(--c-forest); color: var(--c-on-forest); }
