/* ---------- Site header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
}
/* The header gets a wider container than page content: brand + 7 links + actions
   need ~1150px, more than .wrap's 1180px minus its gutters leaves. */
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-block: 14px; max-width: 1360px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); line-height: 1.1; flex: 0 0 auto; }
.site-header .brand .display { display: block; max-width: 6.8em; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand .display { font-size: 1.22rem; font-weight: 800; }
.site-footer .brand .display, .mobile-nav .brand .display { white-space: nowrap; }
.brand .label { margin-top: 4px; max-width: 30ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1400px) { .site-header .brand .label { display: none; } }
@media (max-width: 1260px) { .site-header .brand { flex: 0 1 auto; min-width: 0; } .site-header .brand-text { min-width: 0; overflow: hidden; } }
@media (max-width: 420px) { .site-header .brand-text { display: none; } }
/* Logo, or the fallback monogram of the name's initials. */
.brand-logo { height: 44px; width: auto; max-width: 180px; object-fit: contain; display: block; flex: 0 0 auto; }
.brand-mark {
  width: 44px; height: 44px; flex: 0 0 auto; border-radius: 13px; position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 1.02rem; letter-spacing: .02em; color: #fff;
  background: linear-gradient(140deg, var(--red) 0%, color-mix(in srgb, var(--red) 50%, var(--cyan)) 70%, var(--cyan) 125%);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--red) 32%, transparent), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .3s var(--ease), border-radius .3s var(--ease);
}
.brand-mark::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(80% 60% at 20% 0%, rgba(255, 255, 255, .35), transparent 60%);
}
a.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.05); border-radius: 50%; }
.mobile-nav .brand .brand-mark, .mobile-nav .brand .brand-logo { height: 38px; }
.mobile-nav .brand .brand-mark { width: 38px; font-size: .9rem; border-radius: 11px; }
.footer-brand { margin-bottom: 2px; }

.nav-desktop { display: flex; align-items: center; gap: 4px; }
.nav-desktop a {
  text-wrap: nowrap; color: var(--ink-soft); text-decoration: none; font-size: .92rem; font-weight: 600;
  padding: 8px 11px; border-radius: 999px; transition: background .2s var(--ease), color .2s var(--ease);
}
.nav-desktop a:hover { color: var(--ink); background: var(--paper-sunk); }
.nav-desktop a.active { color: var(--red); background: var(--red-soft); }

.nav-actions { display: flex; align-items: center; gap: 12px; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--rule-strong);
  background: var(--paper-raised); color: var(--ink-soft); cursor: pointer; padding: 0; flex: 0 0 auto;
  transition: color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.theme-toggle:hover { color: var(--red); border-color: var(--red); transform: translateY(-2px); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
.lang-switch { display: flex; gap: 4px; font-family: var(--font-body); font-size: .78rem; font-weight: 700; background: var(--paper-sunk); padding: 3px; border-radius: 999px; }
.lang-switch a { text-decoration: none; color: var(--ink-faint); padding: 4px 10px; border-radius: 999px; transition: background .2s var(--ease), color .2s var(--ease); }
.lang-switch a.active { color: #fff; background: var(--red); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-size: .88rem; font-weight: 700;
  padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid var(--rule-strong);
  text-decoration: none; color: var(--ink); background: var(--paper-raised);
  cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.btn:hover { border-color: var(--red); color: var(--red); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn.solid { background: var(--red); border-color: var(--red); color: #fff; box-shadow: var(--shadow-md); }
.btn.solid:hover { background: var(--red); opacity: .92; color: #fff; box-shadow: var(--shadow-lg); }
.btn.small { padding: 7px 13px; font-size: .8rem; border-radius: 8px; }

.nav-toggle { display: none; }

.mobile-nav {
  display: none;
  position: fixed; inset: 0; z-index: 40;
  background: var(--paper); padding: 20px; overflow-y: auto;
}
.mobile-nav.open { display: block; }
.mobile-nav .close-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.mobile-nav a { display: block; padding: 16px 4px; border-bottom: 1px solid var(--rule); text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; }

/* Below 1260px the full nav no longer fits beside the brand and actions. */
@media (max-width: 1260px) {
  .nav-desktop { display: none; }
  .nav-actions .btn.cta-desktop { display: none; }
  .nav-toggle { display: inline-flex; background: var(--paper-raised); border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); padding: 8px 12px; font-family: var(--font-body); font-weight: 700; font-size: .82rem; color: var(--ink); cursor: pointer; }
}

/* ---------- Page head ---------- */
.page-head { padding-block: clamp(40px, 8vw, 76px) 24px; }
.page-head .label { color: var(--red); margin-bottom: 14px; display: block; }
.page-head h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(2.3rem, 6vw, 3.8rem); letter-spacing: -.02em; }
.page-head .dek { max-width: 62ch; font-size: 1.12rem; color: var(--ink-soft); margin-top: 18px; }

section.block { padding-block: clamp(36px, 6vw, 64px); }
section.block .section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
section.block .section-head h2 { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.6rem, 3.4vw, 2.3rem); letter-spacing: -.01em; }
section.block .section-head .label { margin-bottom: 8px; display: block; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--paper-raised); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px 24px;
  box-shadow: var(--shadow-sm); transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card h3, .card h4 { font-weight: 700; font-family: var(--font-display); }
.card p { margin: 8px 0 0; font-size: .95rem; color: var(--ink-soft); }

/* ---------- Hero ---------- */
/* Uses the flipping ink/paper tokens (not --panel/--panel-text, which are a
   deliberately fixed-dark surface used for accent components like the guide
   cards) so the hero — the first, most prominent thing on the page — is the
   part visitors actually see change when they use the light/dark toggle. */
.hero { background: var(--paper-raised); color: var(--ink); position: relative; overflow: hidden; border-bottom: 1px solid var(--rule); }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(50% 60% at 85% 0%, color-mix(in srgb, var(--red) 22%, transparent), transparent 65%),
    radial-gradient(45% 55% at 5% 100%, color-mix(in srgb, var(--cyan) 16%, transparent), transparent 65%);
}
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: clamp(24px, 5vw, 64px); min-height: min(78vh, 620px); position: relative; z-index: 1; }
@media (max-width: 760px) { .hero-grid { grid-template-columns: 1fr; min-height: 0; padding-block: 40px; text-align: center; } }
.hero-left { padding-block: 40px; position: relative; z-index: 2; }
@media (max-width: 760px) { .hero-left { padding-block: 0; } }
.hero-eyebrow {
  font-family: var(--font-body); font-size: .8rem; font-weight: 700; letter-spacing: .02em;
  color: var(--red); background: color-mix(in srgb, var(--red) 16%, transparent);
  display: inline-block; padding: 6px 14px; border-radius: 999px;
}
.hero-name {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(2.6rem, 7vw, 5rem); line-height: 1; margin-top: 18px; letter-spacing: -.02em;
  opacity: 0; transform: translateY(12px); animation: rise .8s var(--ease) .1s forwards;
}
.hero-sub {
  color: var(--ink-soft); font-size: 1.2rem; line-height: 1.55; max-width: 46ch; margin-top: 20px;
  opacity: 0; transform: translateY(12px); animation: rise .8s var(--ease) .25s forwards;
}
@media (max-width: 760px) { .hero-sub { max-width: 48ch; margin-inline: auto; } }
.hero-meta { font-family: var(--font-mono); font-size: .84rem; color: var(--ink-faint); margin-top: 14px; }
.hero-ctas {
  display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px;
  opacity: 0; animation: fade .6s ease .45s forwards;
}
@media (max-width: 760px) { .hero-ctas { justify-content: center; } }
.hero-ctas .btn.solid svg { width: 16px; height: 16px; transition: transform .2s var(--ease); }
.hero-ctas .btn.solid:hover svg { transform: translateX(3px); }
[dir="rtl"] .hero-ctas .btn.solid svg { transform: scaleX(-1); }
[dir="rtl"] .hero-ctas .btn.solid:hover svg { transform: scaleX(-1) translateX(3px); }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }
@keyframes fade { to { opacity: 1; } }

.hero-right {
  position: relative; height: 100%; min-height: 360px; display: flex; align-items: center; justify-content: center;
  opacity: 0; animation: fade .8s var(--ease) .3s forwards;
}
.hero-right::before, .hero-right::after {
  content: ""; position: absolute; z-index: 0; border-radius: 50%; filter: blur(54px); pointer-events: none;
}
.hero-right::before { width: 62%; aspect-ratio: 1; top: -6%; inset-inline-end: -4%; background: color-mix(in srgb, var(--red) 48%, transparent); opacity: .6; }
.hero-right::after { width: 48%; aspect-ratio: 1; bottom: -6%; inset-inline-start: 2%; background: color-mix(in srgb, var(--cyan) 48%, transparent); opacity: .55; }
.hero-portrait-frame {
  width: 96%; max-width: 480px; aspect-ratio: 4/5; border-radius: 26px 26px 26px 70px; overflow: hidden;
  border: 1px solid var(--rule-strong); background: linear-gradient(160deg, var(--red-soft), var(--cyan-soft));
  position: relative; z-index: 1;
}
[dir="rtl"] .hero-portrait-frame { border-radius: 26px 26px 70px 26px; }
.hero-portrait-frame img {
  width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block;
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 78%, transparent 100%);
}
.hero-tags { position: absolute; top: 16px; inset-inline-end: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 3; }
.hero-tag {
  font-family: var(--font-body); font-weight: 700; font-size: .72rem;
  background: color-mix(in srgb, var(--paper-raised) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: var(--ink); padding: 6px 12px; border-radius: 999px; box-shadow: var(--shadow-sm);
}
@media (max-width: 560px) {
  .hero-right { flex-direction: column; gap: 20px; min-height: 0; padding-block: 12px; }
  .hero-portrait-frame { width: 84%; }
}

/* ---------- Stat row ---------- */
.statrow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
@media (max-width: 700px) { .statrow { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--paper-raised); padding: 24px 18px; }
.stat .n { font-family: var(--font-mono); font-weight: 600; font-size: 2rem; color: var(--red); display: block; }
.stat .l { font-size: .8rem; color: var(--ink-soft); margin-top: 4px; }

/* ---------- Guide card ---------- */
.guide-card {
  background:
    radial-gradient(130% 130% at 100% 0%, color-mix(in srgb, var(--red) 30%, transparent), transparent 60%),
    var(--panel);
  color: var(--panel-text); border-radius: var(--radius); padding: 26px;
  display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; text-decoration: none;
  box-shadow: var(--shadow-md); transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.guide-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.guide-card > * { position: relative; }
.guide-num {
  font-family: var(--font-body); font-weight: 700; font-size: .76rem; letter-spacing: .02em;
  color: var(--panel-text); background: rgba(255,255,255,.12); display: inline-block; padding: 5px 12px; border-radius: 999px; align-self: flex-start;
}
.guide-title { font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; line-height: 1.2; color: var(--panel-text); }
.guide-meta { font-size: .84rem; color: #C3C6E6; }
.guide-sig { font-size: .9rem; color: #D6D9F2; }
.guide-actions { display: flex; gap: 18px; flex-wrap: wrap; }
.guide-actions span, .guide-actions a { font-family: var(--font-body); font-weight: 700; font-size: .82rem; color: var(--cyan-strong); text-decoration: none; }
.guide-actions a:hover { text-decoration: underline; }

/* ---------- Timeline ---------- */
.tl { display: flex; flex-direction: column; position: relative; padding-inline-start: 26px; }
.tl::before { content: ""; position: absolute; inset-inline-start: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--rule-strong); border-radius: 2px; }
.tl-item { position: relative; padding-block-end: 28px; }
.tl-item:last-child { padding-block-end: 0; }
.tl-item::before { content: ""; position: absolute; inset-inline-start: -30px; top: 3px; width: 11px; height: 11px; border-radius: 50%; background: var(--red); border: 3px solid var(--paper); box-shadow: 0 0 0 1px var(--rule-strong); }
.tl-year { font-family: var(--font-mono); font-weight: 600; font-size: .78rem; color: var(--red); }
.tl-title { font-weight: 700; margin-top: 3px; font-family: var(--font-display); font-size: 1.05rem; }
.tl-inst { font-size: .84rem; color: var(--ink-faint); margin-top: 2px; }
.tl-desc { font-size: .92rem; color: var(--ink-soft); margin-top: 5px; }

/* ---------- Global network map ---------- */
/* Always a dark surface (like the guide cards), so the map colours below are
   fixed values rather than theme tokens. */
.netmap {
  --map-cyan: #22D3EE; --map-cyan-deep: #0891B2; --map-ink: #0A0B18; --map-muted: #9FA3C7;
  border: 1px solid var(--rule); border-radius: var(--radius); color: var(--panel-text); padding: clamp(16px, 2.4vw, 26px);
  background:
    radial-gradient(60% 70% at 100% 0%, color-mix(in srgb, var(--red) 18%, transparent), transparent 70%),
    var(--panel);
  box-shadow: var(--shadow-md);
}
.netmap-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 28px; flex-wrap: wrap; margin-bottom: 18px; }
.netmap-hub { display: flex; align-items: center; gap: 10px; margin: 10px 0 0; font-size: .92rem; color: var(--map-muted); max-width: 62ch; }
.netmap-hub strong { color: var(--panel-text); font-family: var(--font-display); }
.netmap-hub-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; background: var(--red); box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 30%, transparent); }
.netmap-stats { display: flex; gap: 10px; margin: 0; }
.netmap-stats > div {
  padding: 8px 16px; border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); min-width: 92px;
}
.netmap-stats dt { font-family: var(--font-body); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--map-muted); }
.netmap-stats dd { margin: 2px 0 0; font-family: var(--font-mono); font-weight: 600; font-size: 1.6rem; line-height: 1.1; color: var(--map-cyan); }

.netmap-body { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.netmap-body.no-map { grid-template-columns: 1fr; }
@media (max-width: 900px) { .netmap-body { grid-template-columns: minmax(0, 1fr); } }

.netmap-canvas {
  position: relative; border-radius: 14px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .07);
  background:
    radial-gradient(circle, rgba(255, 255, 255, .06) 1px, transparent 1.3px) 0 0 / 16px 16px,
    radial-gradient(90% 90% at 50% 40%, #121633, #080914);
}
.netmap-svg { width: 100%; height: auto; display: block; aspect-ratio: 16 / 9; }
.netmap-land path {
  fill: rgba(255, 255, 255, .075); stroke: rgba(255, 255, 255, .16); stroke-width: .6px; vector-effect: non-scaling-stroke;
  stroke-linejoin: round; transition: fill .25s var(--ease), stroke .25s var(--ease);
}
.netmap-land path.is-practice { fill: color-mix(in srgb, var(--map-cyan) 30%, transparent); stroke: var(--map-cyan); stroke-width: 1px; cursor: pointer; }
.netmap-land path.is-practice.is-hover { fill: color-mix(in srgb, var(--map-cyan) 50%, transparent); }
.netmap-land path.is-practice.is-active { fill: color-mix(in srgb, var(--red) 55%, transparent); stroke: #fff; stroke-width: 1.4px; }
.netmap.has-is-active .netmap-land path.is-practice:not(.is-active) { fill: color-mix(in srgb, var(--map-cyan) 16%, transparent); }

.netmap-arcs path {
  fill: none; stroke: var(--map-cyan); stroke-width: 1.4px; vector-effect: non-scaling-stroke; stroke-linecap: round; opacity: .75;
  stroke-dasharray: 1; stroke-dashoffset: 0;
  transition: stroke-dashoffset 1.3s var(--ease) calc(var(--i, 0) * 110ms), opacity .25s, stroke .25s;
}
.netmap.arcs-pending .netmap-arcs path { stroke-dashoffset: 1; }
.netmap.has-is-active .netmap-arcs path { opacity: .25; }
.netmap-arcs path.is-hover { opacity: 1; stroke-width: 2px; }
.netmap-arcs path.is-active { opacity: 1; stroke: #fff; stroke-width: 2.2px; }

.netmap-hubmark .core { fill: var(--red); stroke: #fff; stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.netmap-hubmark .pulse { fill: var(--red); transform-box: fill-box; transform-origin: center; animation: netmap-pulse 2.4s ease-out infinite; }
.netmap-hubmark text {
  fill: #fff; font-family: var(--font-body); font-weight: 700;
  paint-order: stroke; stroke: rgba(8, 9, 20, .85); stroke-width: 3px; vector-effect: non-scaling-stroke;
}
.netmap-hubmark[data-node-id] { cursor: pointer; }
@keyframes netmap-pulse { from { transform: scale(1); opacity: .6; } to { transform: scale(3.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .netmap-hubmark .pulse { animation: none; opacity: 0; } }

.netmap-marker { cursor: pointer; }
.netmap-marker .glow { opacity: 0; transition: opacity .25s var(--ease); }
.netmap-marker .dot {
  fill: var(--map-cyan); stroke: var(--map-ink); stroke-width: 2px; vector-effect: non-scaling-stroke;
  transform-box: fill-box; transform-origin: center; transition: transform .25s var(--ease), fill .25s var(--ease);
}
.netmap-marker text { fill: var(--map-ink); font-family: var(--font-mono); font-weight: 700; pointer-events: none; }
.netmap-marker.is-hover .glow, .netmap-marker.is-active .glow { opacity: 1; }
.netmap-marker.is-hover .dot { transform: scale(1.18); }
.netmap-marker.is-active .dot { fill: var(--red); stroke: #fff; transform: scale(1.25); }
.netmap-marker.is-active text { fill: #fff; }

.netmap-legend {
  position: absolute; inset-inline-start: 12px; bottom: 10px; display: flex; gap: 14px; flex-wrap: wrap;
  font-family: var(--font-body); font-size: .72rem; font-weight: 600; color: var(--map-muted);
  background: rgba(8, 9, 20, .6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); padding: 6px 12px; border-radius: 999px;
}
.netmap-legend span { display: inline-flex; align-items: center; gap: 6px; }
.netmap-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.netmap-legend .lg-hub { background: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 30%, transparent); }
.netmap-legend .lg-country { background: color-mix(in srgb, var(--map-cyan) 45%, transparent); border: 1px solid var(--map-cyan); border-radius: 3px; }
@media (max-width: 520px) { .netmap-legend { position: static; margin: 8px; border-radius: 10px; } }

.netmap-hint { font-size: .82rem; color: var(--map-muted); margin: 0 0 10px; }
.netmap-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
/* Desktop: the list takes the map's height (height:0 + min-height:100% keeps it
   from stretching the grid row) and scrolls if there are many countries. */
@media (min-width: 901px) {
  .netmap-body:not(.no-map) { align-items: stretch; }
  .netmap-body:not(.no-map) .netmap-side { height: 0; min-height: 100%; display: flex; flex-direction: column; }
  .netmap-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-inline-end: 4px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
}
.netmap-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--panel-text);
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .07);
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.netmap-item.is-hover { background: rgba(34, 211, 238, .1); border-color: rgba(34, 211, 238, .45); transform: translateX(2px); }
[dir="rtl"] .netmap-item.is-hover { transform: translateX(-2px); }
.netmap-item.is-active { background: color-mix(in srgb, var(--red) 28%, transparent); border-color: var(--red); }
.netmap-num {
  width: 28px; height: 28px; flex: 0 0 auto; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; font-size: .78rem; background: var(--map-cyan); color: var(--map-ink);
}
.netmap-item.is-active .netmap-num { background: var(--red); color: #fff; }
.netmap-item-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.netmap-item-text .t { font-family: var(--font-display); font-weight: 700; font-size: .95rem; }
.netmap-item-text .b {
  font-size: .74rem; color: var(--map-muted); margin-top: 2px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.netmap-talks {
  display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; padding: 3px 9px; border-radius: 999px;
  font-family: var(--font-mono); font-size: .72rem; font-weight: 600; background: rgba(255, 255, 255, .08); color: var(--map-cyan);
}
.netmap-talks svg { width: 13px; height: 13px; }
.netmap-chev { width: 16px; height: 16px; flex: 0 0 auto; opacity: .45; }
[dir="rtl"] .netmap-chev { transform: scaleX(-1); }

.node-panel { margin-top: 16px; display: none; padding: 16px 18px; background: var(--panel-soft); border-radius: var(--radius-sm); font-size: .92rem; color: #D3D6F2; border-inline-start: 3px solid var(--red); }
.node-panel.open { display: block; animation: talk-in .35s var(--ease) both; }
.node-panel .t { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: var(--panel-text); }
.node-panel .b { font-family: var(--font-mono); font-size: .74rem; color: #67E8F9; margin-top: 4px; display: block; }

/* ---------- Video carousel ---------- */
.carousel-nav { display: flex; gap: 6px; }
.carousel-btn {
  width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--rule-strong);
  background: var(--paper-raised); color: var(--ink); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0; transition: color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.carousel-btn:hover { color: var(--red); border-color: var(--red); transform: translateY(-2px); }
.carousel-btn svg { width: 16px; height: 16px; }
.carousel {
  display: flex; gap: 18px; overflow-x: auto; scroll-snap-type: x proximity; padding-block-end: 6px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel-item { scroll-snap-align: start; flex: 0 0 auto; width: 280px; }
@media (max-width: 640px) { .carousel-item { width: 230px; } }
.video-card {
  display: block; text-decoration: none; color: inherit; border-radius: var(--radius); overflow: hidden;
  background: var(--paper-raised); border: 1px solid var(--rule); box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.video-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.video-card-thumb { position: relative; aspect-ratio: 16/9; background: var(--panel); overflow: hidden; }
.video-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-card-play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  transition: transform .25s var(--ease);
}
.video-card-play svg { width: 52px; height: 52px; }
.video-card:hover .video-card-play { transform: scale(1.08); }
.video-card-body { padding: 14px 16px; }
.video-card-body .t {
  font-weight: 700; font-size: .92rem; line-height: 1.35; font-family: var(--font-body);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.video-card-body .s { font-size: .76rem; color: var(--ink-faint); margin-top: 8px; font-family: var(--font-mono); }

/* ---------- Book card ---------- */
.book-card { display: flex; gap: 22px; align-items: flex-start; padding: 22px; }
@media (max-width: 480px) { .book-card { flex-direction: column; align-items: center; text-align: center; } }

.book-cover {
  width: 122px; height: 172px; flex: 0 0 auto; border-radius: 8px 14px 14px 8px; overflow: hidden;
  position: relative; box-shadow: var(--shadow-md);
  background: linear-gradient(155deg, var(--red) 0%, color-mix(in srgb, var(--red) 45%, var(--cyan)) 55%, var(--cyan) 130%);
  display: flex; align-items: center; justify-content: center;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
[dir="rtl"] .book-cover { border-radius: 14px 8px 8px 14px; }
.book-card:hover .book-cover { transform: perspective(700px) rotateY(-10deg) translateY(-3px); box-shadow: var(--shadow-lg); }
[dir="rtl"] .book-card:hover .book-cover { transform: perspective(700px) rotateY(10deg) translateY(-3px); }
.book-cover.v2 { background: linear-gradient(155deg, var(--cyan-strong) 0%, color-mix(in srgb, var(--cyan) 45%, var(--red)) 55%, var(--red) 130%); }
.book-cover img { width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 1; }
.book-cover-spine { position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 9px; background: rgba(0, 0, 0, .22); z-index: 2; }
[dir="rtl"] .book-cover-spine { inset-inline-start: auto; inset-inline-end: 0; }
.book-cover-icon { width: 36px; height: 36px; color: rgba(255, 255, 255, .55); }
.book-cover-stamp {
  position: absolute; bottom: 10px; inset-inline: 14px; text-align: center;
  font-family: var(--font-body); font-weight: 700; font-size: .56rem; letter-spacing: .07em;
  color: rgba(255, 255, 255, .88); text-transform: uppercase;
}
.book-card-body { flex: 1 1 auto; min-width: 0; }
.book-card-body h4 { font-size: 1.18rem; line-height: 1.3; margin-top: 8px; }
.book-card-meta { font-size: .86rem; }
.book-card-chapter { font-style: italic; color: var(--ink-faint); }
.book-status { font-family: var(--font-body); font-weight: 700; font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; padding: 3px 10px; border-radius: 999px; background: var(--paper-sunk); color: var(--ink-soft); display: inline-block; margin-bottom: 8px; }
.book-status.forth { color: var(--red); background: var(--red-soft); }
.book-links { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 480px) { .book-links { justify-content: center; } }

/* ---------- Media card ---------- */
.media-card { border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: var(--paper-raised); text-decoration: none; color: inherit; display: block; box-shadow: var(--shadow-sm); transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.media-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.media-thumb { aspect-ratio: 16/9; background: var(--panel); position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.media-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.media-thumb::before { content: ""; width: 0; height: 0; border-style: solid; border-width: 10px 0 10px 16px; border-color: transparent transparent transparent #fff; position: relative; z-index: 1; filter: drop-shadow(var(--shadow-sm)); }
[dir="rtl"] .media-thumb::before { border-width: 10px 16px 10px 0; border-color: transparent #fff transparent transparent; }
.media-tag { position: absolute; top: 12px; inset-inline-start: 12px; font-family: var(--font-body); font-weight: 700; font-size: .68rem; background: var(--red); color: #fff; padding: 4px 11px; border-radius: 999px; letter-spacing: .02em; z-index: 2; }
.media-body { padding: 14px 16px; }
.media-body .t { font-weight: 700; font-size: .95rem; font-family: var(--font-display); }
.media-body .s { font-size: .82rem; color: var(--ink-faint); margin-top: 4px; }

/* ---------- Resource card ---------- */
.resource-card { border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px 22px; background: var(--paper-raised); box-shadow: var(--shadow-sm); transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.resource-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.resource-type { font-family: var(--font-body); font-weight: 700; font-size: .7rem; color: var(--cyan-strong); background: var(--cyan-soft); text-transform: uppercase; letter-spacing: .04em; padding: 4px 11px; border-radius: 999px; display: inline-block; }
.resource-card h4 { margin-top: 10px; font-family: var(--font-display); }
.resource-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.resource-tags span { font-family: var(--font-body); font-weight: 600; font-size: .7rem; background: var(--paper-sunk); border-radius: 999px; padding: 3px 10px; color: var(--ink-faint); }
.placeholder-flag { font-family: var(--font-body); font-weight: 600; font-size: .74rem; color: var(--red); margin-top: 12px; display: block; }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 26px; }
.filters select, .filters input[type="text"] {
  font-family: var(--font-body); font-size: .88rem; font-weight: 600; padding: 9px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--rule-strong); background: var(--paper-raised); color: var(--ink); box-shadow: var(--shadow-sm);
}

/* ---------- Forms ---------- */
.form-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 20px; }
.form-field label { font-family: var(--font-body); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .74rem; color: var(--ink-faint); }
.form-field input, .form-field select, .form-field textarea {
  font-family: var(--font-body); font-size: 1rem; padding: 12px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--rule-strong); background: var(--paper-raised); color: var(--ink); width: 100%;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft);
}
.form-field .errorlist { list-style: none; margin: 4px 0 0; padding: 0; color: var(--red); font-size: .82rem; }
.alert-success {
  border-radius: var(--radius); background: var(--cyan-soft); padding: 16px 20px; margin-bottom: 24px;
  border-inline-start: 4px solid var(--cyan-strong); box-shadow: var(--shadow-sm);
}

/* ---------- Table (publications) ---------- */
.twrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--rule); }
table.pub-table { border-collapse: collapse; width: 100%; min-width: 620px; font-size: .92rem; }
table.pub-table th { text-align: start; font-family: var(--font-body); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: .72rem; color: var(--ink-faint); background: var(--paper-sunk); padding-block: 12px; padding-inline: 16px; }
table.pub-table td { padding-block: 16px; padding-inline: 16px; border-top: 1px solid var(--rule); vertical-align: top; color: var(--ink-soft); }
table.pub-table tr:hover td { background: var(--paper-sunk); }
table.pub-table td strong { color: var(--ink); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule); padding-block: 44px 60px; }
.site-footer .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 700px) { .site-footer .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.site-footer a { overflow-wrap: anywhere; }
.site-footer .display { font-size: 1.3rem; }
.site-footer a { color: var(--ink-soft); text-decoration: none; display: block; margin-top: 9px; font-size: .9rem; font-weight: 600; }
.site-footer a:hover { color: var(--red); }
.site-footer .label { margin-bottom: 8px; }
.footer-bottom { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--rule); font-size: .82rem; color: var(--ink-faint); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* ---------- Article / rich text content ---------- */
.article-body { font-size: 1.08rem; line-height: 1.75; max-width: 68ch; }
.article-body h2 { font-size: 1.5rem; margin-top: 1.6em; margin-bottom: .5em; }
.article-body h3 { font-size: 1.2rem; margin-top: 1.4em; margin-bottom: .5em; }
.article-body p { margin: 0 0 1.1em; }
.article-body ul, .article-body ol { margin: 0 0 1.1em; padding-inline-start: 1.4em; }
.article-body li { margin-bottom: .4em; }
.article-body a { color: var(--red); text-decoration: underline; }
.article-body blockquote { border-inline-start: 3px solid var(--red); margin: 1.4em 0; padding-inline-start: 1.1em; color: var(--ink-soft); font-style: italic; }
.article-body img { border-radius: var(--radius-sm); max-width: 100%; height: auto; margin-block: 1.2em; }
.article-body strong { font-weight: 700; color: var(--ink); }
.article-card { display: block; text-decoration: none; color: inherit; }
.article-cover { aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: var(--paper-sunk); box-shadow: var(--shadow-sm); }
.article-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.article-card:hover .article-cover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.article-cover { transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.article-card .article-title { margin-top: 14px; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; }
.article-card .article-meta { font-size: .8rem; color: var(--ink-faint); margin-top: 6px; }
.article-card .article-excerpt { font-size: .92rem; color: var(--ink-soft); margin-top: 8px; }

/* ---------- Video grid ---------- */
.video-card { display: block; text-decoration: none; color: inherit; }
.video-thumb { aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: var(--panel); position: relative; box-shadow: var(--shadow-sm); transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-thumb .play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(0deg, rgba(0,0,0,.35), rgba(0,0,0,0) 55%);
}
.video-thumb .play::before {
  content: ""; width: 56px; height: 56px; border-radius: 50%; background: rgba(255,255,255,.92);
  box-shadow: var(--shadow-md);
}
.video-thumb .play::after {
  content: ""; position: absolute; width: 0; height: 0; border-style: solid; border-width: 11px 0 11px 18px;
  border-color: transparent transparent transparent var(--red); margin-inline-start: 4px;
}
.video-card:hover .video-thumb { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.video-card .video-title { margin-top: 14px; font-weight: 700; font-family: var(--font-display); font-size: 1rem; }
.video-card .video-meta { font-size: .8rem; color: var(--ink-faint); margin-top: 4px; }
.video-embed { position: relative; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); background: var(--panel); }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Talk card ---------- */
.talk-card {
  display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden;
  background: var(--paper-raised); border: 1px solid var(--rule); box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.talk-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.talk-card[hidden] { display: none; }
.carousel-item.talk-card { width: 320px; }
@media (max-width: 640px) { .carousel-item.talk-card { width: 260px; } }
.talk-media { position: relative; aspect-ratio: 16/10; background: var(--panel); overflow: hidden; }
.talk-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s var(--ease); }
.talk-card:hover .talk-media img { transform: scale(1.04); }
.talk-media::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(10, 11, 24, .45) 0%, rgba(10, 11, 24, 0) 38%);
}
/* Placeholder: dark panel, brand glows tinted per talk type, a faint dot grid
   and a mic with "broadcast" rings — reads as intentional, not missing. */
.talk-media.is-placeholder {
  --glow: var(--red);
  display: flex; align-items: center; justify-content: center; color: #fff;
  background:
    radial-gradient(70% 90% at 100% 0%, color-mix(in srgb, var(--glow) 55%, transparent), transparent 62%),
    radial-gradient(60% 80% at 0% 100%, color-mix(in srgb, var(--cyan) 30%, transparent), transparent 60%),
    radial-gradient(circle, rgba(255, 255, 255, .09) 1px, transparent 1.4px) 0 0 / 14px 14px,
    var(--panel);
}
.talk-media.tp-invited { --glow: var(--cyan-strong); }
.talk-media.tp-workshop { --glow: #D97706; }
.talk-media.tp-conference { --glow: color-mix(in srgb, var(--red) 55%, var(--cyan)); }
.talk-ph-ring {
  position: relative; z-index: 1; width: 64px; height: 64px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .28);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 0 0 12px rgba(255, 255, 255, .05), 0 0 0 26px rgba(255, 255, 255, .03);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.talk-card:hover .talk-ph-ring { transform: scale(1.06); box-shadow: 0 0 0 16px rgba(255, 255, 255, .06), 0 0 0 34px rgba(255, 255, 255, .035); }
.talk-ph-ring svg { width: 28px; height: 28px; }
.talk-ph-year {
  position: absolute; bottom: 8px; inset-inline-end: 14px; z-index: 1;
  font-family: var(--font-mono); font-weight: 600; font-size: 2.1rem; line-height: 1; color: rgba(255, 255, 255, .14);
}
.talk-type {
  position: absolute; top: 12px; inset-inline-start: 12px; z-index: 2;
  font-family: var(--font-body); font-weight: 700; font-size: .68rem; letter-spacing: .02em;
  background: var(--red); color: #fff; padding: 4px 11px; border-radius: 999px; box-shadow: var(--shadow-sm);
}
.talk-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1 1 auto; }
.talk-date { font-family: var(--font-mono); font-size: .74rem; font-weight: 600; color: var(--red); }
.talk-title {
  font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; line-height: 1.35; margin-top: 6px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.talk-event { font-size: .86rem; color: var(--ink-soft); margin: 8px 0 0; }
.talk-place { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--ink-faint); margin: 6px 0 0; }
.talk-place svg { width: 14px; height: 14px; flex: 0 0 auto; color: var(--cyan-strong); }
.talk-link {
  margin-top: auto; padding-top: 14px; align-self: flex-start; display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-body); font-weight: 700; font-size: .82rem; color: var(--red); text-decoration: none;
}
.talk-link svg { width: 14px; height: 14px; transition: transform .2s var(--ease); }
.talk-link:hover svg { transform: translate(2px, -2px); }
[dir="rtl"] .talk-link svg { transform: scaleX(-1); }
[dir="rtl"] .talk-link:hover svg { transform: scaleX(-1) translate(2px, -2px); }
.talk-enter { animation: talk-in .45s var(--ease) both; }
@keyframes talk-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Talk filter (Impact page) ---------- */
.talk-filter {
  display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 22px; border-radius: var(--radius);
  background: var(--paper-sunk); border: 1px dashed var(--rule-strong); color: var(--ink-soft); font-size: .92rem;
  transition: background .25s var(--ease), border-color .25s var(--ease);
}
.talk-filter.is-active { background: var(--red-soft); border: 1px solid color-mix(in srgb, var(--red) 35%, transparent); color: var(--ink); }
.talk-filter-status { display: flex; align-items: center; gap: 10px; min-width: 0; }
.talk-filter-pin {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper-raised); color: var(--cyan-strong); box-shadow: var(--shadow-sm);
  transition: background .25s var(--ease), color .25s var(--ease);
}
.talk-filter.is-active .talk-filter-pin { background: var(--red); color: #fff; }
.talk-filter-pin svg { width: 16px; height: 16px; }
.talk-filter strong { color: var(--red); font-family: var(--font-display); }
.talk-filter-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 999px; background: var(--red); color: #fff; font-family: var(--font-mono); font-size: .72rem; font-weight: 600;
  margin-inline-start: 4px; vertical-align: 1px;
}
.talk-filter-reset {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: var(--font-body); font-weight: 700; font-size: .82rem; color: var(--ink);
  background: var(--paper-raised); border: 1px solid var(--rule-strong); border-radius: 999px; padding: 8px 16px;
  box-shadow: var(--shadow-sm); transition: color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
.talk-filter-reset[hidden] { display: none; }
.talk-filter-reset svg { width: 15px; height: 15px; transition: transform .45s var(--ease); }
.talk-filter-reset:hover { color: var(--red); border-color: var(--red); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.talk-filter-reset:hover svg { transform: rotate(-200deg); }
.node-panel-link {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 12px;
  font-family: var(--font-body); font-weight: 700; font-size: .82rem; color: #67E8F9; text-decoration: none;
}
.node-panel-link:hover { text-decoration: underline; }

/* ---------- Tool card ---------- */
.tool-card { display: flex; gap: 20px; align-items: flex-start; }
@media (max-width: 480px) { .tool-card { flex-direction: column; } }
.tool-icon {
  width: 72px; height: 72px; flex: 0 0 auto; border-radius: 18px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper-raised); border: 1px solid var(--rule-strong); box-shadow: var(--shadow-md);
  transition: transform .3s var(--ease);
}
.tool-card:hover .tool-icon { transform: rotate(-4deg) scale(1.04); }
.tool-icon img { width: 100%; height: 100%; object-fit: contain; padding: 10px; display: block; }
.tool-icon.is-empty {
  border: 0; color: #fff;
  background: linear-gradient(145deg, var(--red) 0%, color-mix(in srgb, var(--red) 45%, var(--cyan)) 60%, var(--cyan) 130%);
}
.tool-icon.is-empty svg { width: 32px; height: 32px; }
.tool-body { flex: 1 1 auto; min-width: 0; }
.card .tool-users {
  display: inline-flex; align-items: flex-start; gap: 7px; margin-top: 12px; padding: 6px 12px;
  border-radius: 10px; background: var(--cyan-soft); color: var(--ink-soft); font-size: .8rem;
}
.tool-users svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 2px; color: var(--cyan-strong); }

/* ---------- Video search + playlist chips ---------- */
.video-search {
  display: flex; align-items: center; gap: 10px; padding-block: 6px; padding-inline: 16px 6px; max-width: 640px;
  background: var(--paper-raised); border: 1px solid var(--rule-strong); border-radius: 999px; box-shadow: var(--shadow-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.video-search:focus-within { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.video-search > svg { width: 18px; height: 18px; color: var(--ink-faint); flex: 0 0 auto; }
.video-search input {
  flex: 1 1 auto; min-width: 0; border: 0; outline: none; background: transparent; color: var(--ink);
  font-family: var(--font-body); font-size: .95rem; padding: 8px 0;
}
.video-search .btn { border-radius: 999px; padding: 9px 18px; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
@media (max-width: 640px) {
  .chip-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; padding-block-end: 4px; }
  .chip-row::-webkit-scrollbar { display: none; }
}
.chip {
  display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; white-space: nowrap;
  font-family: var(--font-body); font-weight: 600; font-size: .84rem; text-decoration: none; color: var(--ink-soft);
  background: var(--paper-raised); border: 1px solid var(--rule-strong); border-radius: 999px; padding-block: 7px; padding-inline: 14px 8px;
  transition: color .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.chip:hover { color: var(--red); border-color: var(--red); }
.chip-count {
  font-family: var(--font-mono); font-size: .7rem; font-weight: 600; min-width: 22px; text-align: center;
  padding: 2px 6px; border-radius: 999px; background: var(--paper-sunk); color: var(--ink-faint);
}
.chip.active { background: var(--red); border-color: var(--red); color: #fff; }
.chip.active .chip-count { background: rgba(255, 255, 255, .2); color: #fff; }
.chip-desc { margin-top: 14px; color: var(--ink-soft); max-width: 70ch; }
.results-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 20px; padding-block: 10px; border-top: 1px solid var(--rule); font-size: .9rem; color: var(--ink-soft);
}
.results-bar strong { color: var(--ink); font-family: var(--font-mono); }
.results-bar a { color: var(--red); font-weight: 700; text-decoration: none; font-size: .85rem; }
.results-bar a:hover { text-decoration: underline; }
#library .grid { margin-top: 26px; }
.empty-note { grid-column: 1 / -1; padding: 28px; text-align: center; color: var(--ink-soft); background: var(--paper-sunk); border-radius: var(--radius); }
.empty-note[hidden] { display: none; }

/* ---------- Book link icon ---------- */
.book-links .btn .ext { width: 13px; height: 13px; opacity: .7; }
[dir="rtl"] .book-links .btn .ext { transform: scaleX(-1); }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.reveal.in { opacity: 1; transform: translateY(0); }
