/* ==========================================================================
   About page (michaeltsirakis.com/about layout)
   Loads after styles.css and hero-glass.css. Two jobs:
   1. Page layout: split hero with the route map, jump links, section heads,
      a closing "Say hello".
   2. The rust theme: the sections moved here from the home page (journey,
      card deck, skills + polyglot map, education) were built on the blue
      Google palette. body.theme-rust re-points those tokens at rust, with
      warm sand and dark chocolate as the supporting neutrals, and overrides
      the handful of blues that were hard-coded rather than tokenised.
   ========================================================================== */

/* Handwriting face for the dedication under the temple. Self-hosted
   (fonts/), Latin only, no italic cut exists, so it is set upright. */
@font-face {
  font-family: 'Playwrite BE WAL Guides';
  src: url('fonts/playwrite-be-wal-guides-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ---- palette ---- */
body.theme-rust {
  --sand: #b8915c;          /* warm sand, darkened to hold contrast on light */
  --sand-soft: rgba(184, 145, 92, 0.16);
  --chocolate: #4a2c1d;     /* dark chocolate */
  --rust-deep: #8f3a20;

  --google-blue: var(--rust);
  --google-blue-hover: var(--rust-deep);
  --badge-bg: rgba(176, 71, 42, 0.1);
  --badge-text: var(--rust);
  --border-glow: rgba(176, 71, 42, 0.35);
  --shadow-glow: 0 0 35px rgba(176, 71, 42, 0.16);
  --accent-purple: var(--chocolate);
  --accent-cyan: var(--sand);

  --map-bg-unspoken: #eee8df;
  --map-border: rgba(74, 44, 29, 0.24);
  --map-border-active: var(--chocolate);
  --map-outer-stroke: rgba(74, 44, 29, 0.5);
  --map-blue-native: #b0472a;
  --map-blue-fluent: #8a5a3c;
  --map-blue-conv: #c9a46e;
  --map-blue-pan: rgba(184, 145, 92, 0.2);
  --map-blue-pan-hub: #8c6a48;
  --map-glow: drop-shadow(0 6px 18px rgba(176, 71, 42, 0.22));
  --hub-pill-border: rgba(74, 44, 29, 0.18);
}

[data-theme="dark"] body.theme-rust {
  --sand: #d8c09a;
  --sand-soft: rgba(216, 192, 154, 0.14);
  --chocolate: #6b4430;
  --rust-deep: #c2603a;

  --google-blue-hover: #e8915f;
  --badge-bg: rgba(217, 119, 79, 0.16);
  --badge-text: #e8915f;
  --border-glow: rgba(217, 119, 79, 0.45);
  --shadow-glow: 0 0 45px rgba(217, 119, 79, 0.24);
  --accent-purple: var(--sand);
  --accent-cyan: #c9a27a;

  --map-bg-unspoken: #1d1a17;
  --map-border: rgba(216, 192, 154, 0.26);
  --map-border-active: var(--sand);
  --map-outer-stroke: rgba(216, 192, 154, 0.55);
  --map-blue-native: #e07a4a;
  --map-blue-fluent: #d8c09a;
  --map-blue-conv: #9c6b48;
  --map-blue-pan: rgba(216, 192, 154, 0.16);
  --map-blue-pan-hub: #d8c09a;
  --map-glow: drop-shadow(0 8px 22px rgba(224, 122, 74, 0.3));
  --hub-pill-bg: rgba(20, 16, 13, 0.9);
  --hub-pill-border: rgba(216, 192, 154, 0.24);
}


/* ---- hard-coded blues in the moved sections ---- */
.theme-rust .btn-primary {
  background: var(--rust);
  box-shadow: 0 4px 16px rgba(176, 71, 42, 0.3);
}
.theme-rust .btn-primary:hover {
  background: var(--rust-deep);
  box-shadow: 0 6px 22px rgba(176, 71, 42, 0.4);
}
[data-theme="dark"] .theme-rust .btn-primary { background: #b04f2b; }
[data-theme="dark"] .theme-rust .btn-primary:hover { background: #c2603a; }

.theme-rust .gradient-text {
  background: linear-gradient(100deg, #8f2f12 0%, #b0472a 45%, #dc6a35 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
.theme-rust .gradient-text-alt {
  background: linear-gradient(100deg, #4a2c1d 0%, #8c6a48 55%, #b8915c 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
[data-theme="dark"] .theme-rust .gradient-text {
  background-image: linear-gradient(100deg, #d9653a 0%, #e8804f 50%, #f5a66f 100%);
}
[data-theme="dark"] .theme-rust .gradient-text-alt {
  background-image: linear-gradient(100deg, #b8915c 0%, #d8c09a 55%, #efdcbc 100%);
}

/* Card deck. The backs (painting, frame, corner glyphs) stay exactly as on
   the original deck; only the fronts take the warm palette. */
.theme-rust .cards-ambient-glow {
  background: radial-gradient(circle at center, rgba(176, 71, 42, 0.16), rgba(184, 145, 92, 0.1), transparent 70%);
}
.theme-rust .card-face.card-front {
  background: #1a1613;
  box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.75), 0 0 35px rgba(176, 71, 42, 0.14);
}
[data-theme="light"] .theme-rust .card-face.card-front {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.12), 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* Front layout without the tag pills: header, then the claim and its
   one-line proof, and the stat anchored to the foot of the card under a
   hairline, so every card ends on the same baseline. */
.theme-rust .card-face.card-front { justify-content: flex-start; padding: 1.5rem; }
.theme-rust .card-front-header { margin-bottom: 1.5rem; }
.theme-rust .card-front-title {
  font-size: 1.22rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin-bottom: 0.85rem;
}
.theme-rust .card-front-desc {
  flex-grow: 0;
  margin-bottom: 0;
  font-size: 0.86rem;
  line-height: 1.6;
}
.theme-rust .card-stat-box,
[data-theme="light"] .theme-rust .card-stat-box {
  margin: auto 0 0;
  padding: 1rem 0 0;
  background: none;
  border: 0;
  border-top: 1px solid var(--border-subtle);
  border-radius: 0;
}
.theme-rust .card-stat-num {
  font-size: 2rem;
  margin-bottom: 0.3rem;
  background: none;
  -webkit-text-fill-color: currentColor;
  color: var(--rust);
}
.theme-rust .card-stat-label {
  display: block;
  min-height: 2.9em;   /* two lines reserved, so every card's rule lines up */
  line-height: 1.45;
  letter-spacing: 0.06em;
}

@media (max-width: 640px) {
  .theme-rust .card-face.card-front { padding: 1.1rem; }
  .theme-rust .card-front-header { margin-bottom: 1rem; }
  .theme-rust .card-front-title { font-size: 1rem; }
  .theme-rust .card-front-desc { font-size: 0.76rem; -webkit-line-clamp: 4; }
  .theme-rust .card-stat-num { font-size: 1.5rem; }
  [data-theme="light"] .theme-rust .card-face.card-front { box-shadow: 0 12px 28px -8px rgba(0, 0, 0, 0.12); }
}

.theme-rust .card-kicker-pill.highlight-blue { color: var(--rust); border-color: rgba(176, 71, 42, 0.35); }
.theme-rust .card-kicker-pill.highlight-purple { color: var(--chocolate); border-color: rgba(74, 44, 29, 0.3); }
.theme-rust .card-kicker-pill.highlight-cyan { color: var(--sand); border-color: rgba(184, 145, 92, 0.4); }
.theme-rust .card-kicker-pill.highlight-green { color: var(--rust-deep); border-color: rgba(143, 58, 32, 0.3); }
[data-theme="dark"] .theme-rust .card-kicker-pill.highlight-purple { color: var(--sand); border-color: rgba(216, 192, 154, 0.35); }

/* Journey + education tabs and labels */
/* Active tab: near-black on light, white on dark, matching the Say hi pill. */
.theme-rust .journey-tab-pill.active,
.theme-rust .edu-tab-pill.active {
  background: #1d1d1f;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
[data-theme="dark"] .theme-rust .journey-tab-pill.active,
[data-theme="dark"] .theme-rust .edu-tab-pill.active {
  background: #ffffff;
  color: #1d1d1f;
  box-shadow: none;
}

/* Previous / next arrows beside the journey tabs. */
.journey-arrows { display: flex; gap: 0.4rem; }
.journey-arrow {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.journey-arrow:hover:not(:disabled) { background: #1d1d1f; border-color: #1d1d1f; color: #ffffff; }
[data-theme="dark"] .journey-arrow:hover:not(:disabled) { background: #ffffff; border-color: #ffffff; color: #1d1d1f; }
.journey-arrow:active:not(:disabled) { transform: scale(0.94); }
.journey-arrow:disabled { opacity: 0.35; cursor: default; }
.journey-arrow:focus-visible { outline: 2px solid var(--rust); outline-offset: 3px; }
@media (max-width: 768px) {
  .journey-arrow { width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .journey-arrow { transition: none; }
}
/* Small bold label: the deeper rust keeps AA on the light ground. */
.theme-rust .journey-entry-period,
.theme-rust .edu-entry-period { color: var(--rust-deep); }
[data-theme="dark"] .theme-rust .journey-entry-period,
[data-theme="dark"] .theme-rust .edu-entry-period { color: var(--sand); }
.theme-rust .tag-highlight {
  background: var(--badge-bg);
  color: var(--rust);
  border-color: rgba(176, 71, 42, 0.25);
}

/* Skills + polyglot map */
.theme-rust .competency-scroll-item .rw.key.lit { color: var(--rust); }
.theme-rust .polyglot-pill.active { box-shadow: 0 0 18px rgba(176, 71, 42, 0.22); }
.theme-rust .map-hub-marker .hub-pulse-ring { fill: rgba(176, 71, 42, 0.3); }
.theme-rust .level-native { background: rgba(176, 71, 42, 0.14); }
.theme-rust .level-fluent { background: rgba(74, 44, 29, 0.12); }
.theme-rust .level-conv { background: var(--sand-soft); }
.theme-rust .level-pan { color: var(--map-blue-pan-hub); background: var(--sand-soft); }
[data-theme="dark"] .theme-rust .level-fluent { background: var(--sand-soft); }

/* ==========================================================================
   Layout
   ========================================================================== */
.page-about main { position: relative; z-index: 1; }

.about-hero {
  padding: clamp(8rem, 14vw, 11rem) clamp(1.5rem, 5vw, 4.5rem) clamp(4rem, 8vw, 6rem);
}

.about-hero-grid {
  width: min(1240px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(3rem, 8vw, 8rem);
  align-items: start;
}

.about-kicker {
  margin: 0 0 1.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.about-hero-title {
  margin: 0 0 2.5rem;
  font-family: var(--font-sans);
  font-size: clamp(3rem, 5.6vw, 5rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.045em;
  color: var(--text-primary);
}
.about-dot { color: var(--rust); }

.about-hero-para {
  margin: 0;
  max-width: 36rem;
  font-size: 1.08rem;
  line-height: 1.8;
  color: var(--text-secondary);
}
.about-hero-para .about-key { color: var(--rust); font-weight: 600; }

.about-hero-quote {
  margin: 2rem 0 0;
  max-width: 34rem;
  padding-left: 1.1rem;
  border-left: 2px solid var(--sand);
  font-size: 1.15rem;
  font-weight: 550;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--chocolate);
}
[data-theme="dark"] .about-hero-quote { color: var(--sand); }

.about-hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.75rem;
  margin-top: 2.5rem;
}

/* Dark chocolate pill in light mode, warm sand in dark: the two neutrals
   carry the primary action so rust stays the accent. */
.about-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  background: #1d1d1f;
  color: #ffffff;
  font-size: 0.98rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease;
}
.about-pill:hover { background: #3a3a3d; transform: translateY(-1px); }
.about-pill:active { transform: scale(0.97); }
.about-pill:focus-visible { outline: 2px solid var(--rust); outline-offset: 3px; }
/* Same inversion as the home hero pill: near-black on light, white on dark. */
[data-theme="dark"] .about-pill { background: #ffffff; color: #1d1d1f; }
[data-theme="dark"] .about-pill:hover { background: #e4e4e7; }

.about-line-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0 3px;
  border: 0;
  border-bottom: 1.5px solid currentColor;
  background: none;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: gap 0.2s ease, color 0.2s ease;
}
.about-line-link:hover { gap: 0.6rem; color: var(--rust); }
.about-line-link:focus-visible { outline: 2px solid var(--rust); outline-offset: 4px; border-radius: 2px; }

/* The temple sits where Michael's photo does, the route stops under it. */
.about-hero-route { position: sticky; top: 6rem; }
.about-photo { margin: 0; }
.about-photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 1603;
  max-height: 72vh;
  object-fit: cover;
  object-position: center 30%;
  border-radius: 22px;
  background: var(--bg-tertiary);
}
.about-dedication {
  margin: 1.4rem 0 0;
  font-family: 'Playwrite BE WAL Guides', 'Segoe Script', cursive;
  font-size: 0.95rem;
  line-height: 2;
  text-align: center;
  color: var(--text-muted);
}

/* The School of Athens fresco, full width under the journey headline. */
.about-painting {
  width: min(1240px, calc(100% - 2 * clamp(1.5rem, 5vw, 4.5rem)));
  margin: clamp(1rem, 2vw, 1.5rem) auto 0;
}
.about-painting img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 22px;
  background: var(--bg-tertiary);
}

/* ---- jump links ---- */
.about-jump {
  width: min(1240px, calc(100% - 2 * clamp(1.5rem, 5vw, 4.5rem)));
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2.5rem;
  padding: 1.4rem 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}
.about-jump a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}
.about-jump a svg { transition: transform 0.2s ease; }
.about-jump a:hover { color: var(--rust); }
.about-jump a:hover svg { transform: translateY(2px); }

/* ---- section heads: eyebrow left, headline right ---- */
.about-section-head {
  width: min(1240px, calc(100% - 2 * clamp(1.5rem, 5vw, 4.5rem)));
  margin: 0 auto;
  padding: clamp(6rem, 11vw, 9rem) 0 clamp(1.5rem, 3vw, 2.5rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
  gap: 2rem;
  align-items: start;
  scroll-margin-top: 2rem;
}
.about-section-head .about-kicker { margin-top: 0.9rem; }
.about-section-title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(2.1rem, 3.8vw, 3.3rem);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.04em;
  color: var(--text-primary);
}

/* ---- education on the Sylva ground ----
   The ground is black in dark theme (light ink, below) and white in light
   theme (dark ink, the overrides after .edu-card-line). The two schools sit
   still; only the vines scrub with scroll. */
.about-edu-inner { top: 14vh; }
.about-edu .about-kicker { color: rgba(245, 248, 242, 0.85); }
.about-edu .about-section-title {
  color: rgba(245, 248, 242, 0.97);
  text-shadow: 0 2px 18px rgba(6, 10, 6, 0.7);
}

.edu-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  max-width: 980px;
  margin-top: clamp(2rem, 4vw, 3rem);
}
.edu-card {
  padding: 1.6rem 1.7rem;
  border-radius: 20px;
  background: rgba(18, 22, 16, 0.5);
  border: 1px solid rgba(245, 248, 242, 0.14);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.edu-card-period {
  margin: 0 0 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d8c09a;
}
.edu-card-school {
  margin: 0 0 0.75rem;
  font-size: clamp(1.15rem, 1.8vw, 1.4rem);
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: #f5f8f2;
}
.edu-card-line {
  margin: 0 0 0.5rem;
  font-size: 0.94rem;
  line-height: 1.6;
  color: rgba(241, 245, 239, 0.8);
}
.edu-card-line:last-child { margin-bottom: 0; }

/* Light theme: white ground, so dark ink and a pale card. */
[data-theme="light"] .about-edu .about-kicker { color: var(--rust-deep); }
[data-theme="light"] .about-edu .about-section-title {
  color: #1d1d1f;
  text-shadow: none;
}
[data-theme="light"] .edu-card {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(29, 29, 31, 0.1);
  box-shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.25);
}
[data-theme="light"] .edu-card-period { color: var(--rust-deep); }
[data-theme="light"] .edu-card-school { color: #1d1d1f; }
[data-theme="light"] .edu-card-line { color: rgba(29, 29, 31, 0.72); }

/* Phones: no Sylva scene (app.js removes it), so no pinned track either:
   just the heading and the two cards on the plain ground. */
@media (max-width: 768px) {
  .about-edu.living-green-section { height: auto; }
  .about-edu.living-green-section::before { display: none; }
  .about-edu .sylva-pin { position: static; height: auto; overflow: visible; }
  .about-edu .sylva-3d-scene-container { display: none; }
  .about-edu .sylva-overlay { position: static; }
  .about-edu .sylva-top { position: static; padding: clamp(4rem, 14vw, 5.5rem) clamp(1.25rem, 5vw, 2rem); }
  .about-edu .about-kicker { color: var(--rust); }
  .about-edu .about-section-title { color: var(--text-primary); text-shadow: none; }
  .edu-card-grid { grid-template-columns: minmax(0, 1fr); gap: 0.9rem; margin-top: 1.5rem; }
  .edu-card { padding: 1.2rem 1.25rem; }
  .edu-card-line { font-size: 0.86rem; }
}

/* ---- closing ---- */
.about-close {
  width: min(1240px, calc(100% - 2 * clamp(1.5rem, 5vw, 4.5rem)));
  margin: 0 auto;
  padding: clamp(6rem, 12vw, 10rem) 0 clamp(4rem, 8vw, 6rem);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--border-subtle);
}
.about-close-title { margin: 0; }
.about-close-title a {
  font-size: clamp(3rem, 9vw, 7.5rem);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.25s ease;
}
.about-close-title a span { color: var(--rust); }
.about-close-title a:hover { color: var(--rust); }
.about-close-links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1rem;
}

@media (max-width: 900px) {
  .about-hero-grid { grid-template-columns: minmax(0, 1fr); gap: 3.5rem; }
  .about-hero-route { position: static; max-width: 440px; }
  .about-section-head { grid-template-columns: minmax(0, 1fr); gap: 0.25rem; }
  .about-section-head .about-kicker { margin-top: 0; }
}

@media (max-width: 600px) {
  .about-hero { padding-top: 7rem; }
  .about-jump { gap: 0.75rem 1.5rem; }
  .about-close { flex-direction: column; align-items: flex-start; }
  .about-close-links { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .about-pill, .about-line-link, .about-jump a svg { transition: none; }
}

/* "Let's talk" pill in the top bar, in place of the menu button. Same pill
   as the case-study pages (work/work.css), inverted per theme. Unlike there,
   it stays on phones: it is this page's only action in the bar. */
.page-about .case-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  background: #1d1d1f;
  color: #ffffff;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  pointer-events: auto;
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.page-about .case-pill:hover { background: #3a3a3d; transform: translateY(-1px); }
.page-about .case-pill:active { transform: scale(0.98); }
.page-about .case-pill:focus-visible { outline: 2px solid var(--rust); outline-offset: 3px; }
[data-theme="dark"] .page-about .case-pill { background: #ffffff; color: #1d1d1f; }
[data-theme="dark"] .page-about .case-pill:hover { background: #e4e4e7; }
@media (prefers-reduced-motion: reduce) {
  .page-about .case-pill { transition: none; }
}

/* ==========================================================================
   Languages: a Swiss Army knife, one tool per language (replaces the Global
   Polyglot card and India map). The knife is the left half; the heading,
   the key (the real controls) and the story sit on the right. Tools rest
   folded; the chosen one swings out with a leader line to its label card.
   The steel and red are fixed colours (it is an object); text, key and
   panel follow the theme. Driven by about-knife.js.
   ========================================================================== */
.competencies-section .lang-head .about-kicker { margin: 0; color: var(--rust); }
.competencies-section .lang-head .about-section-title { margin-top: 0.8rem; text-wrap: balance; }
.lang-intro { text-wrap: pretty; margin: 1rem 0 0; max-width: 46ch; font-size: 1.05rem; line-height: 1.6; color: var(--text-muted); }

/* Split screen: the knife on the left; heading, key and story stacked on
   the right, so the whole section fits in about one screen. */
.lang-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 1.5rem clamp(2rem, 4.5vw, 4rem);
  align-items: center;
}
.lang-side { display: grid; gap: 1.6rem; align-content: start; }

/* ---- the knife ---- */
.knife { display: block; width: 100%; height: auto; overflow: visible; }
.kt {
  transform-box: view-box;
  transform-origin: 0 0;
  transform: translate(var(--px), var(--py)) rotate(var(--a-closed));
  transition: transform 0.75s cubic-bezier(0.3, 1.25, 0.45, 1);
  cursor: pointer;
}
/* Folded by default. The chosen tool swings open a beat after the last
   one starts folding back, so it reads as close, then open. */
.kt.is-active,
.knife.show-all .kt { transform: translate(var(--px), var(--py)) rotate(var(--a)); }
.kt.is-active { transition-delay: 0.22s; }
.knife.is-waiting .kt { transform: translate(var(--px), var(--py)) rotate(var(--a-closed)); }
.kt * { vector-effect: non-scaling-stroke; }
.kt-steel { fill: url(#k-steel); stroke: #23272b; stroke-width: 2; stroke-linejoin: round; }
.kt-grind { fill: #ffffff; fill-opacity: 0.55; stroke: none; }
.kt-line { fill: none; stroke: #23272b; stroke-width: 1.6; stroke-linecap: round; }
.kt-hole { fill: #6d747b; stroke: #23272b; stroke-width: 1.4; }
.kt-coil { fill: none; stroke: #23272b; stroke-width: 9; stroke-linecap: round; }
.kt-coil-hi { fill: none; stroke: #c9ced3; stroke-width: 5; stroke-linecap: round; }
.kh-red, .kh-red-back { stroke: #23272b; stroke-width: 2.2; }
.kh-red { fill: url(#k-red); }
.kh-red-back { fill: #9c1518; }
.kh-liner { fill: #b7bdc3; stroke: #23272b; stroke-width: 1.6; }
.kh-liner-2 { fill: #d7dbdf; }
.kh-shine { fill: none; stroke: #ffffff; stroke-opacity: 0.55; stroke-width: 5; stroke-linecap: round; }
.kh-shine-soft { stroke-opacity: 0.3; stroke-width: 4; }
.kh-rivet { fill: #dfe3e7; stroke: #23272b; stroke-width: 1.6; }
.kh-ring-out { fill: none; stroke: #23272b; stroke-width: 7; }
.kh-ring-in { fill: none; stroke: #cfd4d9; stroke-width: 3.5; }

/* ---- leader + label card for the open tool ---- */
.kc { pointer-events: none; }
.kc-line { fill: none; stroke: var(--text-secondary); stroke-width: 1.3; vector-effect: non-scaling-stroke; }
.kc-dot { fill: var(--text-primary); }
.kc-line, .kc-dot { opacity: 0; transition: opacity 0.2s ease; }
.kc.is-active .kc-line, .kc.is-active .kc-dot { opacity: 1; transition: opacity 0.35s ease 0.75s; }
.knife.is-waiting .kc-line, .knife.is-waiting .kc-dot { opacity: 0; }

/* Room above and below the drawing for the card on the top/bottom rail. */
.knife-wrap { position: relative; padding-block: 3.2rem; }
.kcard {
  position: absolute;
  left: var(--x); top: var(--y);
  transform: translateY(var(--ty)) translateY(var(--nudge, 0));
  padding: 0.55rem 0.85rem;
  border-radius: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.kcard.is-on { opacity: 1; --nudge: 0px; transition: opacity 0.35s ease 0.75s, transform 0.35s ease 0.75s; }
.kcard.is-rail-top { --ty: -100%; --nudge: 6px; }
.kcard.is-rail-bot { --ty: 0%; --nudge: -6px; }
.kcard.is-rail-top.is-on, .kcard.is-rail-bot.is-on { --nudge: 0px; }
.kcard-head { margin: 0; font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; color: var(--text-primary); }
.kcard-head span { margin-left: 0.35rem; font-weight: 500; color: var(--text-secondary); }
.kcard-sub { margin: 0.15rem 0 0; font-size: 0.8rem; color: var(--text-secondary); }
.kcard-sub b { font-family: var(--font-mono); font-size: 0.68rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--rust); }

/* ---- tool list: the real controls ---- */
.knife-all {
  display: inline-block; margin: 0.9rem 0 0 0.7rem; padding: 0.4rem 0.9rem; border-radius: 999px;
  border: 1px solid var(--border-subtle); background: transparent; color: var(--text-secondary);
  font: inherit; font-size: 0.85rem; cursor: pointer; transition: color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.knife-all:hover, .knife-all[aria-pressed="true"] { color: var(--text-primary); border-color: var(--text-secondary); }
.knife-all:active { transform: scale(0.97); }
.knife-all:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }

/* ---- key: the diagram's legend, and the real controls ---- */
.lang-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; align-items: start; }
.lang-group-label { margin: 0 0 0.5rem; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary); }
.lang-list { display: grid; gap: 0.15rem; }
.lang-btn {
  display: flex; align-items: baseline; gap: 0.6rem; width: 100%;
  padding: 0.45rem 0.7rem; border-radius: 12px; border: 1px solid transparent; background: transparent;
  color: var(--text-primary); font: inherit; font-size: 0.98rem; font-weight: 600; text-align: left; cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.lang-btn span { margin-left: auto; font-weight: 400; font-size: 0.88rem; color: var(--text-secondary); }
.lang-btn:hover { background: var(--bg-tertiary); }
.lang-btn:active { transform: scale(0.98); }
.lang-btn:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }
.lang-btn[aria-selected="true"] { background: var(--text-primary); color: var(--bg-primary); }
.lang-btn[aria-selected="true"] span { color: var(--bg-primary); opacity: 0.72; }

/* ---- story panel ---- */
.lang-panel {
  padding: clamp(1.5rem, 3vw, 2.2rem);
  border-radius: 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  min-height: 13.5rem;
}
.lang-panel-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; }
.lang-level { margin: 0; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rust); }
.lang-where { margin: 0; font-size: 0.85rem; color: var(--text-secondary); }
.lang-where::before { content: "\00B7"; margin-right: 1rem; }
.lang-name { margin: 0.8rem 0 0; font-size: clamp(1.7rem, 2.6vw, 2.2rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
.lang-script { display: block; margin-top: 0.3rem; font-size: 1.15rem; font-weight: 500; letter-spacing: 0; color: var(--text-secondary); }
.lang-story { margin: 0.9rem 0 0; font-size: 1.05rem; line-height: 1.65; color: var(--text-muted); max-width: 44ch; }
.lang-panel.is-swapping > * { animation: lang-in 0.45s ease both; }
@keyframes lang-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 860px) {
  .lang-stage { grid-template-columns: minmax(0, 1fr); }
  .lang-panel { min-height: 0; }
  /* Single column: heading, knife, story, then the key, so a tap shows
     its result right under the drawing. */
  .lang-art, .lang-side { display: contents; }
  .lang-head { order: 0; }
  .knife-wrap { order: 1; }
  .lang-panel { order: 3; }
  .lang-tools { order: 4; }
}
/* Phones: a tighter label card. */
@media (max-width: 600px) {
  .kcard { padding: 0.4rem 0.65rem; border-radius: 10px; }
  .kcard-head { font-size: 0.88rem; }
  .kcard-sub { font-size: 0.72rem; }
}
/* Narrow phones: keep the key in two columns to save scroll; the script
   already shows on the card and in the story. */
@media (max-width: 420px) {
  .lang-tools { gap: 1rem 0.75rem; }
  .lang-btn span { display: none; }
  .knife-all { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .kt, .kc-line, .kc-dot, .kcard { transition: none !important; }
  .lang-panel.is-swapping > * { animation: none; }
}
