*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  /* Firefox 64+ / Chromium 121+ honour scrollbar-color natively: thumb gets a
     muted brand-aligned tint, track stays transparent so the page chrome
     reads quietly. Safari and older Chromium ignore the property; their
     default scrollbar is already fine in dark + light modes. */
  scrollbar-color: color-mix(in srgb, var(--line-strong) 70%, transparent) transparent;
  /* Reserve the scrollbar gutter even when content fits — prevents the body
     from jumping rightward when the command palette toggles body{overflow:
     hidden}, or when a viewport-rescale moves the page between "fits" and
     "overflows". Firefox 97+, Chrome 94+, Safari 18+ honour the keyword. */
  scrollbar-gutter: stable;
}

/* Older WebKit + Chromium fall back to ::-webkit-scrollbar — keep it slim
   and quiet so it doesn't fight the cards. The track stays transparent;
   only the thumb is tinted. Chrome 121+ honours scrollbar-color and ignores
   this block, so we don't end up double-styling. */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--line-strong) 65%, transparent);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--brand-secondary) 55%, var(--line-strong));
  background-clip: padding-box;
}

body {
  min-width: 320px;
  /* System UI stack — uses whatever the OS ships (San Francisco, Segoe UI,
     Roboto, PingFang SC, etc.) instead of declaring webfonts we don't load. */
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-feature-settings: "kern";
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--surface-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Tint native form controls (the language <select>, focus highlights,
     ::selection) to the brand so they don't read as system blue. */
  accent-color: var(--brand-secondary);
  caret-color: var(--brand-secondary);
}

/* Explicit ::selection styling so the foreground stays readable against
   the brand-tinted highlight. accent-color sets the highlight background
   but most browsers leave foreground at the user-agent default, which
   can be unreadable on a deep teal/coral. */
::selection {
  background: var(--brand-secondary);
  color: var(--surface-bg);
  text-shadow: none;
}

button,
select,
input {
  font: inherit;
}

button,
select {
  color: inherit;
}

a {
  color: inherit;
}

:root {
  color-scheme: dark light;
  --anchor-offset: 6.75rem;
  --container: 78rem;

  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", Menlo, monospace;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --radius-xs: 0.25rem;
  --radius-s: 0.5rem;
  --radius-m: 0.875rem;
  --radius-l: 1.25rem;

  --surface-bg: #0b0d12;
  --surface-ink: #131722;
  --surface-panel: #1a1f2c;
  --surface-raised: #232a39;
  --text-primary: #f3f5fb;
  --text-muted: #9aa4b6;
  --line-soft: #232a39;
  --line-strong: #4a566a;
  --brand-primary: #ff8158;
  --brand-action: #ef553a;
  --brand-secondary: #34d3c0;
  --brand-tertiary: #f0c66a;
  --brand-cobalt: #8aa9ff;
  --brand-danger: #ff736c;
  --shadow-soft: 0 28px 70px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.02) inset;
  --shadow-tight: 0 12px 32px rgba(0, 0, 0, 0.28);
  --focus-ring: 0 0 0 3px rgba(255, 129, 88, 0.32);
  --tint-cobalt: rgba(138, 169, 255, 0.10);
  --tint-secondary: rgba(52, 211, 192, 0.10);
  --grain-opacity: 0.03;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --surface-bg: #f6f7fb;
    --surface-ink: #ffffff;
    --surface-panel: #eef1f7;
    --surface-raised: #e2e7f0;
    --text-primary: #15171c;
    --text-muted: #525c6b;
    --line-soft: #dde2ec;
    --line-strong: #8693a8;
    --brand-primary: #a8311f;
    --brand-action: #a8311f;
    --brand-secondary: #00665e;
    --brand-tertiary: #7a5808;
    --brand-cobalt: #2c4ec0;
    --brand-danger: #b13027;
    --shadow-soft: 0 24px 60px rgba(20, 24, 38, 0.10);
    --shadow-tight: 0 8px 22px rgba(20, 24, 38, 0.07);
    --focus-ring: 0 0 0 3px rgba(184, 57, 44, 0.24);
    --tint-cobalt: rgba(58, 95, 208, 0.06);
    --tint-secondary: rgba(14, 126, 114, 0.06);
    --grain-opacity: 0.018;
  }
}

:root[data-theme="light"] {
  --surface-bg: #f6f7fb;
  --surface-ink: #ffffff;
  --surface-panel: #eef1f7;
  --surface-raised: #e2e7f0;
  --text-primary: #15171c;
  --text-muted: #525c6b;
  --line-soft: #dde2ec;
  --line-strong: #8693a8;
  --brand-primary: #a8311f;
  --brand-action: #a8311f;
  --brand-secondary: #00665e;
  --brand-tertiary: #7a5808;
  --brand-cobalt: #2c4ec0;
  --brand-danger: #b13027;
  --shadow-soft: 0 24px 60px rgba(20, 24, 38, 0.10);
  --shadow-tight: 0 8px 22px rgba(20, 24, 38, 0.07);
  --focus-ring: 0 0 0 3px rgba(184, 57, 44, 0.24);
  --tint-cobalt: rgba(58, 95, 208, 0.06);
  --tint-secondary: rgba(14, 126, 114, 0.06);
  --grain-opacity: 0.018;
}

:root[data-theme="dark"] {
  --surface-bg: #0b0d12;
  --surface-ink: #131722;
  --surface-panel: #1a1f2c;
  --surface-raised: #232a39;
  --text-primary: #f3f5fb;
  --text-muted: #9aa4b6;
  --line-soft: #232a39;
  --line-strong: #4a566a;
  --brand-primary: #ff8158;
  --brand-action: #ef553a;
  --brand-secondary: #34d3c0;
  --brand-tertiary: #f0c66a;
  --brand-cobalt: #8aa9ff;
  --brand-danger: #ff736c;
  --shadow-soft: 0 28px 70px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.02) inset;
  --shadow-tight: 0 12px 32px rgba(0, 0, 0, 0.28);
  --focus-ring: 0 0 0 3px rgba(255, 129, 88, 0.32);
  --tint-cobalt: rgba(138, 169, 255, 0.10);
  --tint-secondary: rgba(52, 211, 192, 0.10);
  --grain-opacity: 0.03;
}

body {
  /* Single radial highlight + base colour — paint cost is now flat instead
     of the four-layer composite the previous polish stacked on every paint. */
  background:
    radial-gradient(1100px 540px at 80% -8%, rgba(255, 129, 88, 0.10), transparent 62%),
    var(--surface-bg);
}

:root[data-theme="light"] body {
  background:
    radial-gradient(1100px 540px at 80% -8%, rgba(168, 49, 31, 0.06), transparent 62%),
    var(--surface-bg);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) body {
    background:
      radial-gradient(1100px 540px at 80% -8%, rgba(168, 49, 31, 0.06), transparent 62%),
      var(--surface-bg);
  }
}

main section[id] {
  scroll-margin-top: var(--anchor-offset);
}

.container {
  width: min(92vw, var(--container));
  margin: 0 auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  padding: 0.55rem 0.75rem;
  background: var(--text-primary);
  color: var(--surface-bg);
  border-radius: var(--radius-s);
}

.skip-link:focus {
  left: 0.75rem;
  top: 0.75rem;
  outline: 0;
  box-shadow: var(--focus-ring);
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 90;
  width: 100%;
  height: 3px;
  background: transparent;
}

.scroll-progress span {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary), var(--brand-tertiary));
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 70;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(15, 17, 21, 0.9);
  transition: transform 180ms ease, opacity 180ms ease;
}

@supports ((backdrop-filter: blur(16px)) or (-webkit-backdrop-filter: blur(16px))) {
  .site-header,
  .mini-topbar-inner {
    background: rgba(15, 17, 21, 0.78);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  :root[data-theme="light"] .site-header,
  :root[data-theme="light"] .mini-topbar-inner {
    background: rgba(247, 248, 251, 0.82);
  }

  @media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) .site-header,
    :root:not([data-theme="dark"]) .mini-topbar-inner {
      background: rgba(247, 248, 251, 0.82);
    }
  }
}

.site-header.header-hidden {
  transform: translateY(calc(-100% - 0.5rem));
  opacity: 0;
  pointer-events: none;
}

.header-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  align-items: center;
  padding: 0.9rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
  color: var(--text-primary);
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  flex: 0 0 auto;
  color: var(--text-primary);
  /* Cross-document view transitions (Chrome 126+) lift the brand mark out
     of the root crossfade and animate it as a shared element so it morphs
     in place from home → project sub-page instead of fading with the rest
     of the chrome. Browsers without view-transition support ignore the
     property; we already cap @view-transition root duration above. */
  view-transition-name: brand-mark;
}

.brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.brand-mark-field {
  fill: var(--surface-panel);
  stroke: var(--line-strong);
  stroke-width: 1.15;
}

.brand-mark-letter {
  fill: var(--text-primary);
}

.brand-mark-signal {
  fill: var(--brand-secondary);
  stroke: var(--surface-panel);
  stroke-width: 1.2;
}

.brand:hover .brand-mark-field,
.brand:focus-visible .brand-mark-field {
  stroke: var(--brand-secondary);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-copy strong,
.mini-brand {
  font-weight: 850;
}

.brand-copy small {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.nav-list,
.mini-nav-list,
.project-list,
.market-grid,
.clock-list,
.contact-address {
  /* <address> is for the contact info of the nearest article/body. We
     wrap the contact grid so SR users hear "address" semantics. Strip
     the user-agent italic so it doesn't interfere with the brand. */
  font-style: normal;
}

.contact-grid {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list,
.mini-nav-list {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
  /* Snap each nav item to the start so mobile swipes land on a full
     item instead of half-clipping. Proximity instead of mandatory so
     the user can still flick freely without jarring stops. */
  scroll-snap-type: x proximity;
  scroll-padding-inline: 0.5rem;
}

.nav-list a,
.mini-nav-list a {
  scroll-snap-align: start;
}

.nav-list::-webkit-scrollbar,
.mini-nav-list::-webkit-scrollbar {
  display: none;
}

.nav-list a,
.mini-nav-list a,
.mini-top-btn,
.mini-command-btn,
.control-button,
.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-s);
  background: var(--surface-ink);
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.nav-list a,
.mini-nav-list a,
.mini-top-btn,
.mini-command-btn {
  padding: 0.42rem 0.75rem;
  font-size: 0.93rem;
}

.brand:focus-visible,
.nav-list a:focus-visible,
.mini-nav-list a:focus-visible,
.mini-top-btn:focus-visible,
.mini-command-btn:focus-visible,
.control-select:focus-visible,
.control-button:focus-visible,
.primary-action:focus-visible,
.secondary-action:focus-visible,
.contact-tile:focus-visible,
.calendar-day:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

.nav-list a:hover,
.mini-nav-list a:hover,
.mini-top-btn:hover,
.mini-command-btn:hover,
.control-button:hover,
.primary-action:hover,
.secondary-action:hover,
.contact-tile:hover {
  border-color: var(--brand-primary);
}

.nav-list a.is-active,
.mini-nav-list a.is-active {
  border-color: var(--brand-secondary);
  color: var(--brand-secondary);
  background: rgba(26, 160, 168, 0.12);
}

.control-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.control-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.ui-icon,
.section-icon {
  color: var(--brand-primary);
}

.control-select,
.control-button {
  min-height: 2.35rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-s);
  background: var(--surface-ink);
  color: var(--text-primary);
}

.control-select {
  padding: 0.38rem 0.65rem;
}

.control-button {
  padding: 0.38rem 0.72rem;
}

.mini-topbar {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 0.35rem);
  left: 0;
  right: 0;
  z-index: 75;
  padding: 0 0.75rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-130%);
  transition: opacity 180ms ease, transform 180ms ease;
}

.mini-topbar.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.command-open body {
  overflow: hidden;
}

.command-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: start center;
  padding: 12vh var(--space-4) var(--space-4);
  background: rgba(12, 14, 18, 0.46);
}

@supports ((backdrop-filter: blur(16px)) or (-webkit-backdrop-filter: blur(16px))) {
  .command-overlay {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
}

.command-overlay[hidden] {
  display: none;
}

.command-panel {
  width: min(100%, 36rem);
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-m);
  background: var(--surface-ink);
  box-shadow: var(--shadow-soft);
}

.command-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--line-soft);
}

.command-close {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-s);
  background: var(--surface-panel);
  color: var(--text-primary);
  cursor: pointer;
}

.command-search {
  display: block;
  width: calc(100% - 1.5rem);
  min-height: 2.8rem;
  margin: 0.75rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-s);
  background: var(--surface-panel);
  color: var(--text-primary);
  outline: 0;
}

.command-search:focus-visible,
.command-close:focus-visible,
.command-option:focus-visible {
  box-shadow: var(--focus-ring);
}

.command-list {
  max-height: min(46vh, 24rem);
  margin: 0;
  padding: 0 0.55rem 0.55rem;
  overflow: auto;
  list-style: none;
}

.command-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 3rem;
  padding: 0.62rem 0.7rem;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}

.command-option small {
  color: var(--text-muted);
}

.command-option:hover,
.command-option.is-active {
  border-color: var(--line-soft);
  background: var(--surface-panel);
}

.command-empty {
  padding: 0.8rem;
  color: var(--text-muted);
}

.mini-topbar-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--space-2);
  width: min(96vw, var(--container));
  margin: 0 auto;
  padding: 0.45rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-m);
  background: var(--surface-bg);
  box-shadow: var(--shadow-tight);
}

.mini-brand {
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}

.mini-top-btn {
  font: inherit;
}

.mini-command-btn {
  font: inherit;
}

.hero-section {
  position: relative;
  min-height: 62vh;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
  isolation: isolate;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
  opacity: 0.42;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, var(--surface-bg) 0%, rgba(15, 17, 21, 0.94) 56%, rgba(15, 17, 21, 0.42) 100%),
    linear-gradient(0deg, var(--surface-bg) 0%, transparent 38%);
}

:root[data-theme="light"] .hero-scrim {
  background:
    linear-gradient(90deg, var(--surface-bg) 0%, rgba(247, 248, 251, 0.93) 56%, rgba(247, 248, 251, 0.34) 100%),
    linear-gradient(0deg, var(--surface-bg) 0%, transparent 42%);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .hero-scrim {
    background:
      linear-gradient(90deg, var(--surface-bg) 0%, rgba(247, 248, 251, 0.93) 56%, rgba(247, 248, 251, 0.34) 100%),
      linear-gradient(0deg, var(--surface-bg) 0%, transparent 42%);
  }
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-10);
  align-items: end;
  min-height: 62vh;
  padding: 3.4rem 0 2.4rem;
}

.hero-copy {
  max-width: 50rem;
}

.eyebrow {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1.1rem;
  padding-left: 1.6rem;
  color: var(--brand-primary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1.1rem;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

/* Modern text wrap hints. Headings balance their wrapped lines; body
   copy uses pretty wrapping so the last line never strands on a single
   short word. Chrome 114+ / Safari 17.5+ / FF 121+. Older browsers
   ignore both properties cleanly. */
h1,
h2,
h3,
h4 {
  text-wrap: balance;
}

.hero-lede,
.hero-note,
.hero-profile,
.section-lede,
p.subpage-lede {
  text-wrap: pretty;
}

h1 {
  margin-bottom: 1.1rem;
  max-width: 11ch;
  font-size: clamp(3rem, 8vw, 3.4rem);
  line-height: 0.98;
  font-weight: 900;
}

.site-title span {
  display: block;
}

/* Tighten tracking only on Latin lines — CJK already has natural rhythm
   and negative letter-spacing makes radicals collide. */
:root[lang^="en"] h1,
:root[lang^="fr"] h1,
:root[lang^="de"] h1,
:root[lang^="ru"] h1,
:root[lang^="en"] .site-title span:last-child,
:root[lang="zh-CN"] .site-title span:last-child,
:root[lang="zh-Hant"] .site-title span:last-child,
:root[lang="ja"] .site-title span:last-child,
:root[lang^="fr"] .site-title span:last-child,
:root[lang^="de"] .site-title span:last-child,
:root[lang^="ru"] .site-title span:last-child,
:root[lang^="en"] h2,
:root[lang^="fr"] h2,
:root[lang^="de"] h2,
:root[lang^="ru"] h2 {
  letter-spacing: -0.02em;
}

h2 {
  margin-bottom: 0.85rem;
  font-size: clamp(1.85rem, 4vw, 2.35rem);
  line-height: 1.1;
  font-weight: 850;
}

h3 {
  font-size: 1rem;
  line-height: 1.35;
}

.hero-lede {
  max-width: 45rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-size: 1.15rem;
  line-height: 1.6;
}

.hero-note,
.section-heading p,
.contact-intro,
.market-status {
  color: var(--text-muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: 1.35rem;
}

.primary-action,
.secondary-action {
  padding: 0.78rem 1.15rem;
  font-weight: 700;
  letter-spacing: 0.005em;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.primary-action {
  border-color: transparent;
  background: var(--brand-action);
  color: #fff8ef;
  box-shadow: 0 10px 24px rgba(239, 85, 58, 0.30), 0 1px 0 rgba(255, 255, 255, 0.12) inset;
}

.primary-action:hover,
.primary-action:focus-visible {
  /* Pre color-mix() browsers (older Safari, etc.) get a fallback that still
     reads as a lighter tint of the action colour. */
  background: #ff7058;
  background: color-mix(in srgb, var(--brand-action) 88%, #fff);
  transform: translateY(-1px);
}

:root[data-theme="light"] .primary-action:hover,
:root[data-theme="light"] .primary-action:focus-visible {
  background: #c2493a;
  background: color-mix(in srgb, var(--brand-action) 88%, #fff);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .primary-action:hover,
  :root:not([data-theme="dark"]) .primary-action:focus-visible {
    background: #c2493a;
    background: color-mix(in srgb, var(--brand-action) 88%, #fff);
  }
}

:root[data-theme="light"] .primary-action {
  box-shadow: 0 10px 24px rgba(168, 49, 31, 0.18);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .primary-action {
    box-shadow: 0 10px 24px rgba(168, 49, 31, 0.18);
  }
}

.secondary-action {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--line-strong);
}

.secondary-action:hover,
.secondary-action:focus-visible {
  border-color: var(--brand-primary);
  background: rgba(255, 129, 88, 0.06);
  transform: translateY(-1px);
}

:root[data-theme="light"] .secondary-action,
:root[data-theme="light"] .secondary-action:hover {
  background: rgba(15, 17, 21, 0.02);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .secondary-action,
  :root:not([data-theme="dark"]) .secondary-action:hover {
    background: rgba(15, 17, 21, 0.02);
  }
  :root:not([data-theme="dark"]) .secondary-action:hover {
    background: rgba(168, 49, 31, 0.06);
  }
}

.hero-panel {
  align-self: end;
  max-width: 32rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-m);
  background: rgba(15, 17, 21, 0.88);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

:root[data-theme="light"] .hero-panel {
  background: rgba(255, 255, 255, 0.9);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .hero-panel {
    background: rgba(255, 255, 255, 0.9);
  }
}

.panel-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.panel-topline strong {
  color: var(--brand-tertiary);
}

.hero-profile {
  margin: 0;
  padding: 1rem 1rem 0;
  color: var(--text-primary);
  font-size: 1rem;
}

.hero-metrics {
  display: grid;
  margin: 0;
}

.hero-metrics div {
  /* Stack label over value so long-locale labels (Russian "Исследования",
     German "Forschung") never get squeezed by a fixed-width grid cell. */
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.9rem 1rem 1rem;
  border-top: 1px solid var(--line-soft);
}

.hero-metrics div:first-child {
  border-top: 0;
}

.hero-metrics dt {
  color: var(--brand-secondary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-metrics dd {
  margin: 0;
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.4;
}

.hero-console {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid var(--line-soft);
  background: var(--line-soft);
}

.hero-console div {
  min-width: 0;
  padding: 0.75rem 0.85rem;
  background: var(--surface-panel);
}

.hero-console span,
.hero-console strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-console span {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 850;
}

.hero-console strong {
  margin-top: 0.18rem;
  color: var(--brand-cobalt);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.section-block {
  padding: 4.5rem 0;
}

.section-block + .section-block {
  border-top: 1px solid var(--line-soft);
}

.section-heading {
  max-width: 46rem;
  margin-bottom: 1.6rem;
}

.editorial-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  max-width: none;
}

.section-lede {
  max-width: 36rem;
  align-self: end;
}

.project-grid,
.market-grid,
.time-grid,
.contact-grid,
.calendar-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
}

.market-grid > li {
  min-width: 0;
}

.project-card,
.tool-panel,
.market-item,
.clock-item,
.contact-tile {
  position: relative;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-m);
  background: var(--surface-ink);
  box-shadow: var(--shadow-tight);
}

.project-card {
  min-height: 11.6rem;
  padding: 1.35rem 1.35rem 1.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  justify-content: space-between;
  overflow: hidden;
}

.project-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand-primary) 30%, var(--brand-secondary) 70%, transparent);
  opacity: 0;
  transition: opacity 200ms ease;
}

.project-card:hover::after,
.project-card:focus-within::after {
  opacity: 0.65;
}

.project-card.feature-card {
  background:
    radial-gradient(140% 90% at 0% 0%, rgba(255, 129, 88, 0.16), transparent 55%),
    radial-gradient(140% 110% at 100% 100%, rgba(52, 211, 192, 0.10), transparent 55%),
    var(--surface-ink);
}

:root[data-theme="light"] .project-card.feature-card {
  background:
    radial-gradient(140% 90% at 0% 0%, rgba(168, 49, 31, 0.10), transparent 55%),
    radial-gradient(140% 110% at 100% 100%, rgba(0, 102, 94, 0.06), transparent 55%),
    var(--surface-ink);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .project-card.feature-card {
    background:
      radial-gradient(140% 90% at 0% 0%, rgba(168, 49, 31, 0.10), transparent 55%),
      radial-gradient(140% 110% at 100% 100%, rgba(0, 102, 94, 0.06), transparent 55%),
      var(--surface-ink);
  }
}

.project-index {
  width: fit-content;
  padding: 0.18rem 0.6rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--brand-secondary);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.project-card p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.55;
}

.project-card strong {
  color: var(--text-primary);
  font-size: 1.1rem;
  letter-spacing: -0.012em;
  font-weight: 800;
}

.project-card p {
  font-size: 0.98rem;
}

.project-card .project-card-cta {
  /* Inline CTA on the main page's project list — sub-page projects.css
     defines the same class for the gallery cards (with overlay link).
     Vertical padding bumps the touch target to ≥24px (axe target-size). */
  margin-top: auto;
  padding: 0.45rem 0;
  color: var(--brand-secondary);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  width: fit-content;
  min-height: 1.6rem;
  border-bottom: 1px solid transparent;
  transition: border-color 160ms ease, color 160ms ease;
}

.project-card .project-card-cta:hover,
.project-card .project-card-cta:focus-visible {
  border-bottom-color: var(--brand-secondary);
}

.project-all-link {
  margin: 1.4rem 0 0;
  text-align: right;
}

.project-all-link a {
  color: var(--brand-secondary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 160ms ease;
}

.project-all-link a:hover,
.project-all-link a:focus-visible {
  border-bottom-color: var(--brand-secondary);
}

.split-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-8);
  align-items: start;
}

.sticky-heading {
  position: relative;
}

.tool-panel {
  padding: 1rem;
}

.calendar-tool {
  display: grid;
  gap: var(--space-4);
}

.calendar-main {
  min-width: 0;
}

.calendar-toolbar,
.market-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.calendar-toolbar {
  margin-bottom: var(--space-4);
}

.calendar-month {
  min-width: 8rem;
  text-align: center;
  color: var(--brand-secondary);
  font-family: var(--font-mono);
}

.calendar-date-input {
  min-width: 10.8rem;
}

.calendar-grid-wrap {
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-m);
  background: var(--surface-panel);
}

.calendar-weekdays,
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  /* Reserve the space the populated grid will need (6 rows × 3.65rem + gaps)
     so the rest of the page doesn't shift down when JS injects the 42
     day buttons. This is the dominant CLS contributor under throttled
     mobile profiles. */
  min-height: calc(6 * 3.65rem + 5px);
}

.calendar-weekdays {
  border-bottom: 1px solid var(--line-soft);
}

.calendar-weekdays span {
  padding: 0.55rem 0.25rem;
  color: var(--text-muted);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.calendar-days {
  gap: 1px;
  background: var(--line-soft);
}

.calendar-day {
  min-height: 3.65rem;
  padding: 0.45rem;
  border: 0;
  background: var(--surface-ink);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
}

.calendar-day .num {
  display: block;
  font-weight: 850;
}

.calendar-day .tag {
  display: block;
  margin-top: 0.2rem;
  /* Use the primary text color so the lunar-date / holiday tag passes
     axe color-contrast on every theme + active state. The previous
     --brand-tertiary gold sat just under threshold on some Chrome
     versions (Ubuntu CI flagged it though local Chrome did not). */
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.78;
}

.calendar-day:hover,
.calendar-day:focus-visible {
  background: var(--surface-raised);
}

.calendar-day.is-muted {
  background: var(--surface-panel);
  color: var(--text-muted);
}

.calendar-day.is-today {
  box-shadow: inset 0 0 0 1px var(--brand-secondary);
}

.calendar-day.is-selected {
  background: rgba(26, 160, 168, 0.16);
  box-shadow: inset 0 0 0 2px var(--brand-secondary);
}

.calendar-aside {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  padding: 1.1rem 1.15rem 1rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-m);
  background: var(--surface-panel);
}

.calendar-aside-head {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line-soft);
}

.calendar-aside-title {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.calendar-aside-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--brand-secondary);
  letter-spacing: 0.04em;
}

.calendar-aside-panels {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.calendar-panel {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.calendar-panel h4 {
  margin: 0;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.calendar-panel p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.calendar-list {
  margin: 0.25rem 0 0;
  padding-left: 1.05rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.calendar-list li + li { margin-top: 0.2rem; }

.huangli-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.huangli-label {
  display: inline-flex;
  align-items: center;
  height: 1.4rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  background: rgba(52, 211, 192, 0.12);
  color: var(--brand-secondary);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.huangli-label-ji {
  background: rgba(255, 115, 108, 0.12);
  color: var(--brand-danger);
}

.huangli-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.huangli-tag {
  display: inline-flex;
  align-items: center;
  height: 1.4rem;
  padding: 0 0.55rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--text-primary);
}

.huangli-tag-more {
  /* Counter chip — same shape but muted so it reads as "and X more"
     rather than an extra data point. Hovering shows the full list via
     the title attribute set in renderHuangliTags. */
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  cursor: help;
}

.calendar-aside-source {
  margin: 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line-soft);
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.005em;
}

.market-heading {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  justify-content: space-between;
  max-width: none;
}

.market-controls {
  align-self: flex-start;
  padding: 0.65rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-m);
  background: var(--surface-ink);
}

.market-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  margin-bottom: var(--space-4);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.market-strip strong {
  color: var(--brand-secondary);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.market-strip strong:empty {
  display: none;
}

.market-strip > span:not(#market-updated-at) {
  display: inline-flex;
  align-items: center;
  min-height: 1.45rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface-panel);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  white-space: nowrap;
}

.clock-item,
.contact-tile {
  min-height: 8.4rem;
  padding: 1rem;
}

.market-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
  min-height: 12rem;
  padding: 1.1rem 1.1rem 0.85rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-m);
  background:
    linear-gradient(145deg, rgba(122, 162, 255, 0.06), transparent 52%),
    var(--surface-ink);
  box-shadow: var(--shadow-tight);
  color: inherit;
  font: inherit;
  text-align: left;
  list-style: none;
}

.market-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.market-trend-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: auto;
  width: fit-content;
  padding: 0.32rem 0.6rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.market-trend-toggle:hover,
.market-trend-toggle:focus-visible {
  color: var(--brand-secondary);
  border-color: var(--brand-secondary);
}

.market-trend-toggle:focus-visible {
  outline: 0;
  box-shadow: var(--focus-ring);
}

.market-trend-toggle-icon {
  width: 0.7rem;
  height: 0.7rem;
  transition: transform 200ms ease;
}

.market-item.is-expanded .market-trend-toggle-icon {
  transform: rotate(180deg);
}

/* The trend panel grows the card height smoothly via grid-template-rows
   0fr → 1fr. The inner wrapper carries padding/opacity so there's no
   border/padding pop at the start or end of the transition. */
.market-trend-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 260ms cubic-bezier(.25,.9,.25,1);
}

.market-trend-panel-inner {
  min-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 200ms ease 60ms;
  display: grid;
  gap: 0.5rem;
  margin: 0 -1.1rem -0.85rem;
  padding: 0;
  border-top: 1px solid transparent;
  background:
    linear-gradient(145deg, rgba(52, 211, 192, 0.08), transparent 60%),
    transparent;
}

.market-trend-panel.is-open {
  grid-template-rows: 1fr;
}

.market-trend-panel.is-open .market-trend-panel-inner {
  opacity: 1;
  padding: 0.85rem 1.1rem;
  border-top-color: var(--line-soft);
}

.market-trend-meta {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.market-symbol,
.market-name,
.clock-city {
  display: block;
  font-weight: 850;
}

.market-symbol {
  color: var(--brand-secondary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0;
}

.market-name {
  color: var(--text-muted);
  line-height: 1.3;
}

.market-chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.45rem;
  max-width: 8rem;
  padding: 0.1rem 0.48rem;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-chip.positive {
  border-color: var(--brand-secondary);
  color: var(--brand-secondary);
}

.market-chip.negative {
  border-color: var(--brand-danger);
  color: var(--brand-danger);
}

.market-chip:empty {
  display: none;
}

.market-health {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.45rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface-panel);
  color: var(--text-muted);
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  white-space: nowrap;
}

.market-health::before {
  content: "";
  display: block;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--text-muted);
}

.market-health.ok {
  color: var(--brand-secondary);
  border-color: var(--brand-secondary);
}

.market-health.ok::before {
  background: var(--brand-secondary);
}

.market-health.fallback {
  color: var(--brand-tertiary);
  border-color: var(--brand-tertiary);
}

.market-health.fallback::before {
  background: var(--brand-tertiary);
}

.market-health.stale {
  color: var(--brand-tertiary);
  border-color: var(--brand-tertiary);
  background: var(--surface-panel);
}

.market-health.stale::before {
  background: var(--brand-tertiary);
}

.market-health.down {
  color: var(--brand-danger);
  border-color: var(--brand-danger);
}

.market-health.down::before {
  background: var(--brand-danger);
}

.market-item strong,
.clock-list time {
  display: block;
  margin-top: 0.65rem;
  color: var(--brand-cobalt);
  font-family: var(--font-mono);
  font-size: 1.24rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.market-item strong {
  margin-top: auto;
  font-size: 1.42rem;
}

/* Legacy .market-card-hint / .market-back-top rules dropped along with the
   3D flip — the new inline trend panel uses .market-trend-toggle + .market-trend-panel. */

.market-sparkline {
  display: block;
  width: 100%;
  height: 4.1rem;
  margin-top: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.market-item small,
.clock-zone {
  display: block;
  margin-top: 0.25rem;
  color: var(--text-muted);
}

.market-trend {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.market-trend.positive {
  color: var(--brand-secondary);
}

.market-trend.negative {
  color: var(--brand-danger);
}

.market-source-line {
  display: flex !important;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  min-height: 1.35rem;
  margin-top: 0;
  padding-top: 0.2rem;
  overflow: hidden;
  border-top: 1px solid var(--line-soft);
  font-size: 0.72rem;
}

.market-source-line span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-source-line .market-health {
  flex: 0 1 auto;
  min-height: 1.25rem;
  padding: 0.05rem 0.38rem;
  overflow: hidden;
  font-size: 0.66rem;
  text-overflow: ellipsis;
}

.market-status {
  min-height: 1.5rem;
  margin: 0 0 var(--space-4);
  color: var(--brand-tertiary);
  font-size: 0.9rem;
}

.market-status:empty {
  display: none;
}

.time-view-toggle {
  display: inline-flex;
  gap: 0.3rem;
  padding: 0.25rem;
  margin-top: 0.6rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface-ink);
}

.time-view-btn {
  display: inline-flex;
  align-items: center;
  height: 1.85rem;
  padding: 0 0.85rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease;
}

.time-view-btn:hover { color: var(--text-primary); }
.time-view-btn:focus-visible { outline: 0; box-shadow: var(--focus-ring); }

.time-view-btn.is-active {
  background: var(--surface-raised);
  color: var(--text-primary);
}

.time-views { position: relative; min-width: 0; }
.time-views > [hidden] { display: none; }

.time-map {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: 1rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-m);
  background:
    radial-gradient(800px 400px at 50% 30%, rgba(122, 162, 255, 0.06), transparent 70%),
    var(--surface-ink);
}

.time-map-svg {
  display: block;
  width: 100%;
  height: auto;
  background: linear-gradient(180deg, rgba(35, 42, 57, 0.6), rgba(11, 13, 18, 0.85));
  border-radius: var(--radius-s);
}

:root[data-theme="light"] .time-map-svg {
  background: linear-gradient(180deg, rgba(214, 220, 232, 0.7), rgba(240, 243, 250, 0.85));
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .time-map-svg {
    background: linear-gradient(180deg, rgba(214, 220, 232, 0.7), rgba(240, 243, 250, 0.85));
  }
}

.time-map-land {
  fill: var(--surface-panel);
  stroke: var(--line-soft);
  stroke-width: 0.6;
}

.time-map-equator {
  stroke: var(--line-soft);
  stroke-width: 0.5;
  stroke-dasharray: 4 4;
  opacity: 0.45;
}

.time-map-pin { fill: var(--brand-primary); stroke: var(--surface-ink); stroke-width: 1.2; }
.time-map-pin-halo { fill: var(--brand-primary); opacity: 0.18; }
.time-map-pin-label {
  fill: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.time-map-legend {
  display: grid;
  /* Wider min so long city names like "San Francisco 09:47" don't truncate
     in en/fr/de/ru. auto-fit shrinks down to one column on phones. */
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.45rem 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.time-map-legend li {
  display: grid;
  grid-template-columns: 0.5rem 1fr auto;
  align-items: baseline;
  gap: 0.55rem;
  min-width: 0;
}

.time-map-legend li > strong {
  /* City name can wrap; previously nowrap was clipping it. */
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--text-primary);
  font-family: inherit;
  font-weight: 700;
  line-height: 1.2;
}

.time-map-legend li > span {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.clock-zone {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.clock-daybar {
  position: relative;
  display: block;
  height: 0.5rem;
  margin-top: 0.9rem;
  overflow: hidden;
  border-radius: 999px;
  /* Background reads as the full day arc: dawn → noon (warm) → dusk (cool). */
  background:
    linear-gradient(90deg,
      rgba(35, 42, 57, 0.95) 0%,
      rgba(94, 105, 128, 0.7) 22%,
      rgba(240, 198, 106, 0.65) 50%,
      rgba(94, 105, 128, 0.7) 78%,
      rgba(35, 42, 57, 0.95) 100%);
  box-shadow: inset 0 0 0 1px var(--line-soft);
}

/* Can't comma-join a selector with an @media — that's invalid CSS and
   was silently dropping the light-theme variant. Split them. */
:root[data-theme="light"] .clock-daybar {
  background:
    linear-gradient(90deg,
      rgba(170, 178, 195, 0.95) 0%,
      rgba(214, 220, 232, 0.85) 22%,
      rgba(240, 198, 106, 0.75) 50%,
      rgba(214, 220, 232, 0.85) 78%,
      rgba(170, 178, 195, 0.95) 100%);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .clock-daybar {
    background:
      linear-gradient(90deg,
        rgba(170, 178, 195, 0.95) 0%,
        rgba(214, 220, 232, 0.85) 22%,
        rgba(240, 198, 106, 0.75) 50%,
        rgba(214, 220, 232, 0.85) 78%,
        rgba(170, 178, 195, 0.95) 100%);
  }
}

.clock-daybar span {
  /* The progress indicator is a thin moving marker: a tiny pill that slides
     along the day-arc background. Width 0 is hidden; JS sets `left`-shifted
     marker via the existing `width: NN%` value, repurposed as the marker x. */
  position: absolute;
  top: 50%;
  left: 0;
  width: 0;
  height: 100%;
  transform: translate(-1px, -50%);
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--text-primary) 90%, var(--text-primary));
  box-shadow: 0 0 0 2px var(--surface-ink);
  transition: width 600ms cubic-bezier(.3,.7,.2,1);
}

/* ── Research journey timeline + "Now" line ── */
.journey-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.8rem;
}

.journey-list::before {
  /* The vertical spine. Sits behind the markers; gradient fades the
     ends out so it doesn't feel like a hard rule. */
  content: "";
  position: absolute;
  top: 0.5rem;
  bottom: 0.5rem;
  left: 0.45rem;
  width: 2px;
  background: linear-gradient(180deg,
    transparent 0,
    var(--line-soft) 6%,
    var(--line-soft) 94%,
    transparent 100%);
  border-radius: 999px;
}

.journey-item {
  position: relative;
  padding: 0.1rem 0 0;
}

.journey-marker {
  position: absolute;
  left: -1.5rem;
  top: 0.35rem;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: var(--surface-bg);
  box-shadow: 0 0 0 2px var(--line-strong) inset, 0 0 0 0.18rem var(--surface-bg);
}

.journey-item.is-current .journey-marker {
  background: var(--brand-primary);
  box-shadow:
    0 0 0 2px var(--brand-primary) inset,
    0 0 0 0.18rem var(--surface-bg),
    0 0 0 0.42rem color-mix(in srgb, var(--brand-primary) 22%, transparent);
}

@supports not (background: color-mix(in srgb, red, blue)) {
  .journey-item.is-current .journey-marker {
    box-shadow:
      0 0 0 2px var(--brand-primary) inset,
      0 0 0 0.18rem var(--surface-bg),
      0 0 0 0.42rem rgba(255, 129, 88, 0.22);
  }
}

.journey-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.journey-period {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.journey-item.is-current .journey-period {
  color: var(--brand-primary);
}

.journey-title {
  font-size: 1.08rem;
  letter-spacing: -0.012em;
  color: var(--text-primary);
  font-weight: 800;
}

.journey-body p {
  margin: 0.1rem 0 0;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 42rem;
}

.now-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 2.2rem 0 0;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--line-soft);
  border-radius: var(--radius-s);
  background: linear-gradient(135deg, rgba(52, 211, 192, 0.06), transparent 60%);
  color: var(--text-primary);
}

.now-dot {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--brand-secondary);
  /* Soft pulse so it reads as "live" without spinning. Respects
     prefers-reduced-motion via the rule below. */
  box-shadow: 0 0 0 0 rgba(52, 211, 192, 0.4);
  animation: now-pulse 2.4s ease-out infinite;
}

@keyframes now-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(52, 211, 192, 0.4); }
  70%  { box-shadow: 0 0 0 0.65rem rgba(52, 211, 192, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 192, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .now-dot { animation: none; }
}

.now-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-secondary);
}

.now-value {
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--text-primary);
  flex: 1 1 18rem;
  min-width: 0;
}

.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-8);
}

.contact-grid li {
  min-width: 0;
}

.contact-tile {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.2rem 1.2rem 1.25rem;
  color: inherit;
  text-decoration: none;
  overflow: hidden;
}

.contact-tile::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: var(--brand-secondary);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 240ms ease;
}

.contact-tile:hover::after,
.contact-tile:focus-visible::after {
  transform: scaleX(1);
}

.contact-tag {
  width: fit-content;
  padding: 0.18rem 0.6rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--brand-primary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contact-main {
  color: var(--text-primary);
  line-height: 1.35;
  letter-spacing: -0.01em;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.contact-action {
  margin-top: auto;
  color: var(--brand-secondary);
  font-size: 0.92rem;
}

.project-card,
.market-item,
.clock-item,
.contact-tile,
.tool-panel,
.hero-panel {
  transition: transform 200ms cubic-bezier(.2,.7,.1,1), border-color 200ms ease, box-shadow 200ms ease, background-color 200ms ease;
}

.project-card:hover,
.clock-item:hover,
.contact-tile:hover,
.tool-panel:hover,
.hero-panel:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--brand-primary) 55%, var(--line-soft));
  box-shadow: var(--shadow-soft);
}

/* Market cards are no longer buttons — whole-card hover lift would mis-
   suggest clickable and add drift when the inline trend toggle is clicked.
   Only the border colour shifts; the toggle inside has its own focus state. */
.market-item:hover,
.market-item:focus-within {
  border-color: color-mix(in srgb, var(--brand-secondary) 55%, var(--line-soft));
}

@supports not (background: color-mix(in srgb, red, blue)) {
  .project-card:hover,
  .clock-item:hover,
  .contact-tile:hover,
  .tool-panel:hover,
  .hero-panel:hover {
    border-color: var(--brand-primary);
  }
  .market-item:hover,
  .market-item:focus-within {
    border-color: var(--brand-secondary);
  }
}

.site-footer {
  border-top: 1px solid var(--line-soft);
  padding: 1.5rem 0 4rem;
  color: var(--text-muted);
}

.footer-layout {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-8);
  justify-content: space-between;
}

.footer-layout p {
  margin: 0;
}

.footer-layout a {
  color: var(--brand-secondary);
}

.footer-updated {
  opacity: 0.65;
  font-feature-settings: "tnum";
}

.footer-updated time {
  font-family: var(--font-mono);
}

.noscript-tip {
  width: min(92vw, var(--container));
  margin: 1rem auto;
  padding: 0.75rem;
  border: 1px dashed var(--brand-tertiary);
  border-radius: var(--radius-m);
  background: var(--surface-panel);
  color: var(--text-primary);
}

.js-enabled .reveal-section {
  --reveal-p: 1;
  opacity: 1;
  transform: translate3d(0, calc((1 - var(--reveal-p)) * 12px), 0);
  transition: transform 240ms ease;
  transition-delay: var(--reveal-delay, 0ms);
  will-change: transform;
}

.js-enabled .reveal-section.is-visible {
  opacity: 1;
}

::view-transition-group(root) {
  animation-duration: 240ms;
  animation-timing-function: ease;
}

/* Tighter timing for the shared brand-mark so the morph reads as a single
   continuous gesture, not a separate animation layered on top of the root
   crossfade. */
::view-transition-group(brand-mark) {
  animation-duration: 280ms;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Honour reduced-motion: snap both the root and the named brand-mark
   transitions instantly so users who opted out of motion don't see the
   crossfade or the morph. The @view-transition opt-in itself stays — the
   browser still benefits from snapshotting for correctness. */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(root),
  ::view-transition-group(brand-mark) {
    animation-duration: 1ms;
  }
}

/* Opt into cross-document view transitions (Chrome 126+). Navigating
   between the home page and /projects/ sub-pages now gets a smooth
   crossfade instead of a hard cut, with no JS work. Browsers without
   support just ignore the rule. */
@view-transition {
  navigation: auto;
}

@media (min-width: 48rem) {
  .header-layout {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .header-actions {
    align-items: flex-end;
  }

  .nav-list {
    justify-content: flex-end;
  }

  h1 {
    font-size: 5.25rem;
  }

  h2 {
    font-size: 3rem;
  }

  .hero-lede {
    font-size: 1.24rem;
  }

  .hero-layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(22rem, 0.62fr);
  }

  .editorial-heading {
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.55fr);
    align-items: end;
  }

  .project-grid,
  .market-grid,
  .contact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-panels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-panel:nth-child(2) {
    border-top: 0;
    padding-top: 0;
  }

  .time-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contact-layout {
    grid-template-columns: minmax(15rem, 0.35fr) minmax(0, 0.65fr);
  }
}

@media (min-width: 64rem) {
  .header-actions {
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
  }

  h1 {
    font-size: 6rem;
  }

  .split-section {
    grid-template-columns: minmax(16rem, 0.34fr) minmax(0, 0.66fr);
  }

  .sticky-heading {
    position: sticky;
    top: var(--anchor-offset);
  }

  .project-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .market-grid,
  .time-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .project-grid .feature-card {
    grid-column: auto;
  }

  #calendar .split-section {
    grid-template-columns: minmax(13rem, 0.24fr) minmax(0, 0.76fr);
  }

  .calendar-tool {
    grid-template-columns: minmax(0, 1fr) minmax(17rem, 0.58fr);
    align-items: stretch;
  }

  .calendar-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .calendar-grid-wrap {
    flex: 1;
    min-height: 0;
  }

  /* Aside height tracks the calendar column so both columns bottom-align;
     panels scroll internally when content exceeds available space. */
  .calendar-aside {
    align-self: stretch;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .calendar-aside-panels {
    flex: 1;
    overflow: auto;
    padding-right: 0.25rem;
  }

  .calendar-aside-source {
    flex-shrink: 0;
  }

  .market-heading {
    flex-direction: row;
    align-items: flex-start;
  }
}

@media (max-width: 46rem) {
  :root {
    --anchor-offset: 9rem;
  }

  body {
    font-size: 15px;
  }

  .container {
    width: min(94vw, var(--container));
  }

  /* Calendar aside on mobile: tighter rhythm + smaller chip/list sizing
     so the aside doesn't add 800+ px below the grid. */
  .calendar-aside {
    padding: 0.95rem 1rem 0.85rem;
    gap: 0.85rem;
  }
  .calendar-aside-head {
    padding-bottom: 0.7rem;
  }
  .calendar-aside-title {
    font-size: 1rem;
  }
  .calendar-aside-panels {
    gap: 0.55rem;
  }
  /* The script wraps each .calendar-panel's content in a <details> for
     mobile so users can collapse sub-sections instead of scrolling a
     1300+px column. */
  .calendar-panel-disclosure {
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-s);
    background: var(--surface-ink);
  }
  .calendar-panel-disclosure > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    list-style: none;
  }
  .calendar-panel-disclosure > summary::-webkit-details-marker { display: none; }
  .calendar-panel-disclosure > summary::after {
    content: "+";
    color: var(--brand-secondary);
    font-family: var(--font-mono);
    font-size: 1rem;
    transition: transform 180ms ease;
  }
  .calendar-panel-disclosure[open] > summary::after {
    content: "−";
  }
  .calendar-panel-disclosure > summary h4 {
    margin: 0;
  }
  .calendar-panel-disclosure > :not(summary) {
    padding: 0 0.75rem 0.75rem;
  }
  .calendar-panel h4 {
    font-size: 0.66rem;
  }
  .calendar-panel p {
    font-size: 0.88rem;
  }
  .calendar-list {
    font-size: 0.82rem;
  }
  .huangli-group {
    gap: 0.3rem;
  }
  .huangli-tag {
    height: 1.3rem;
    font-size: 0.72rem;
  }
  .calendar-aside-source {
    padding-top: 0.7rem;
    font-size: 0.72rem;
  }
  /* Map: legend is plenty already, but pin labels at this size start
     stacking — give the SVG a bit more breathing room. */
  .time-map {
    padding: 0.75rem;
  }

  .header-layout {
    gap: var(--space-3);
    padding: 0.65rem 0;
  }

  .brand-mark {
    width: 2.35rem;
    height: 2.35rem;
  }

  .brand-copy small {
    max-width: 15rem;
  }

  .control-bar {
    align-items: center;
  }

  .nav-list {
    /* On phones the horizontal-scroll layout silently clips long-locale
       labels (Japanese, Russian, German). Let items wrap so every tab is
       reachable without an invisible swipe gesture. */
    gap: 0.3rem;
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .nav-list a {
    padding: 0.42rem 0.6rem;
    font-size: 0.88rem;
  }

  .mini-nav-list {
    /* The condensed top bar still scrolls — there's no room to wrap inside
       the floating pill — but at least give every item a fair min-width. */
    gap: 0.25rem;
  }

  .mini-nav-list a {
    padding: 0.32rem 0.55rem;
    font-size: 0.85rem;
  }

  .control-bar > .control-label {
    width: auto;
  }

  .control-bar .control-select {
    max-width: min(12.5rem, 100%);
  }

  .control-bar .control-button {
    flex: 1 1 8.4rem;
  }

  .hero-section,
  .hero-layout {
    min-height: auto;
  }

  .hero-layout {
    padding: 3.25rem 0 2.5rem;
  }

  .hero-canvas {
    display: none;
  }

  .hero-scrim {
    background:
      linear-gradient(90deg, var(--surface-bg) 0%, var(--surface-bg) 64%, transparent 100%),
      linear-gradient(180deg, var(--surface-bg) 0%, transparent 54%, var(--surface-bg) 100%);
  }

  h1 {
    max-width: 8ch;
    font-size: 3.15rem;
  }

  h2 {
    font-size: 2rem;
  }

  .hero-panel {
    display: none;
  }

  .section-block {
    padding: 3.25rem 0;
  }

  .calendar-toolbar {
    align-items: stretch;
  }

  .calendar-toolbar > .control-label {
    flex: 1 0 100%;
  }

  .calendar-toolbar .control-button,
  .calendar-date-input,
  .calendar-month {
    flex: 1 1 8.5rem;
  }

  .calendar-day {
    min-height: 3.15rem;
    padding: 0.35rem;
  }

  .market-controls {
    width: 100%;
  }

  .mini-topbar {
    padding: 0 0.45rem;
  }

  .mini-topbar-inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .mini-top-btn {
    display: none;
  }

  .mini-command-btn {
    max-width: 7rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* The mini-topbar is a single horizontal pill — wrapping breaks its grid,
   and long-locale nav labels overflow on tablet widths. Hide the inline
   nav-list below desktop and let the command palette button (already
   present in the pill) cover quick-jump duty. */
@media (max-width: 63.99rem) {
  .mini-topbar-inner > nav {
    display: none;
  }

  .mini-topbar-inner {
    grid-template-columns: auto 1fr auto auto;
    justify-content: space-between;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none;
    animation: none;
  }

  .project-card:hover,
  .clock-item:hover,
  .contact-tile:hover,
  .tool-panel:hover,
  .hero-panel:hover,
  .js-enabled .reveal-section {
    transform: none;
  }

  .market-trend-panel,
  .market-trend-panel.is-open {
    transition: none;
  }
  .market-trend-panel-inner {
    transition: none;
  }
  .market-trend-toggle-icon {
    transition: none;
  }
}

/* ═════════════════════════════════════════════════════════════════════
   Print stylesheet — ink-friendly text, hide interactive UI, show URLs.
   Researchers commonly print pages to read offline, so the goal here is
   "readable monograph", not "screenshot of the live page".
   ═════════════════════════════════════════════════════════════════════ */
@media print {
  :root {
    /* Force ink-saving palette regardless of dark/light user preference. */
    --surface-bg: #ffffff;
    --surface-ink: #ffffff;
    --surface-panel: #ffffff;
    --text-primary: #000000;
    --text-secondary: #1f1f1f;
    --text-muted: #444444;
    --line-soft: #bcbcbc;
    --line-strong: #888888;
    --brand-primary: #000000;
    --brand-secondary: #000000;
  }

  html, body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  /* Hide everything that's noise on paper. */
  .site-header,
  .site-footer,
  .mini-topbar,
  .scroll-progress,
  .command-button,
  .command-overlay,
  .hero-canvas,
  .hero-scrim,
  .hero-actions,
  .control-select,
  .header-controls,
  .header-actions,
  .market-controls,
  .market-trend-toggle,
  .market-trend-panel,
  .calendar-controls,
  .time-controls,
  .time-map-card,
  .reveal-section,
  .skip-link {
    display: none !important;
  }

  /* Re-show sections that were hidden by reveal-section. */
  section, .section-block {
    display: block !important;
    page-break-inside: avoid;
    break-inside: avoid;
    box-shadow: none !important;
    border: none !important;
    padding: 0.5rem 0 !important;
    margin: 0 0 1rem !important;
  }

  /* Open every <details>/<summary> + custom disclosure. */
  details,
  .calendar-panel-disclosure {
    /* CSS can't open <details>, but it can show the content as if open. */
  }
  details > summary,
  .calendar-panel-disclosure > summary {
    list-style: none;
    cursor: default;
  }
  details > *:not(summary),
  .calendar-panel-disclosure > *:not(summary) {
    display: block !important;
  }

  /* Show URL after links so paper readers know where each link goes.
     Skip anchors (#…) and mailto: to avoid clutter. */
  a[href^="http"]::after,
  a[href^="/"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #444;
    word-break: break-all;
  }
  a[href^="#"]::after,
  a[href^="mailto:"]::after,
  .brand a::after,
  .breadcrumb a::after {
    content: "";
  }

  /* Typography for paper. */
  body {
    font-size: 11pt;
    line-height: 1.5;
    max-width: 100%;
  }
  h1 { font-size: 24pt; page-break-after: avoid; }
  h2 { font-size: 16pt; page-break-after: avoid; }
  h3 { font-size: 13pt; page-break-after: avoid; }
  p, li { orphans: 3; widows: 3; }

  /* Cards print as bordered blocks, not flashy panels. */
  .project-card,
  .project-resource,
  .contact-tile,
  .market-item,
  .clock-item,
  .tool-panel,
  .hero-panel,
  .journey-item {
    background: #ffffff !important;
    border: 1px solid #888 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    padding: 0.5rem !important;
  }

  /* Containers shouldn't add margin runs on paper. */
  .container {
    max-width: 100%;
    padding: 0 0.5cm;
  }
}

/* ═════════════════════════════════════════════════════════════════════
   prefers-contrast: more — punch up borders and lower-opacity text so
   the page still reads cleanly when the OS / browser is asking for a
   higher-contrast UI (Windows High Contrast, Safari Increase Contrast,
   etc). Subtle changes only — the design tokens stay in charge of the
   visual identity, this just nudges anything that's already close to
   the threshold over the line.
   ═════════════════════════════════════════════════════════════════════ */
@media (prefers-contrast: more) {
  :root {
    --line-soft: var(--line-strong);
  }

  .footer-updated,
  .calendar-day .tag {
    opacity: 1;
  }

  .market-trend-toggle,
  .project-card,
  .market-item,
  .clock-item,
  .contact-tile,
  .tool-panel {
    border-width: 2px;
  }

  a:not(.brand):not(.contact-tile):not(.project-card-link):not(.project-resource) {
    text-decoration: underline;
    text-underline-offset: 0.18em;
  }
}

/* ═════════════════════════════════════════════════════════════════════
   prefers-reduced-data — respect Save-Data / data-saver preferences.
   Suppress the decorative hero canvas + softer hover transitions so we
   don't burn bandwidth on visuals the user has explicitly opted out of.
   We can't skip the market-data / calendar API fetches from CSS, but at
   least the visual cost is honest.
   ═════════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-data: reduce) {
  .hero-canvas,
  .hero-scrim {
    display: none;
  }

  .hero-section {
    /* The canvas was carrying the dark backdrop; restore it via tokens. */
    background: var(--surface-bg);
  }

  .project-card,
  .market-item,
  .clock-item,
  .contact-tile,
  .tool-panel,
  .hero-panel {
    /* Drop the radial gradient feature-cards; flat saves a paint pass. */
    background: var(--surface-ink);
  }
}

/* ═════════════════════════════════════════════════════════════════════
   prefers-reduced-transparency — kill the backdrop-filter blur effects
   on sticky surfaces so users with reduced-transparency preferences
   (motion-sensitive, macOS Reduce Transparency, vestibular conditions)
   get solid backgrounds. Chrome 118+, Safari 17.4+ understand this
   query; older browsers ignore (still get the blur).
   ═════════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-transparency: reduce) {
  .site-header,
  .mini-topbar-inner,
  .command-overlay {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--surface-bg);
  }
}

/* ═════════════════════════════════════════════════════════════════════
   forced-colors — Windows High Contrast mode (and similar OS-forced
   palettes) overrides most colour properties with system tokens like
   CanvasText / LinkText / ButtonText. Our brand colours get blown
   away regardless, so this block opts in to the right system tokens
   for the focus ring + the calendar tag text, and makes sure
   transparent borders we rely on for layout stay visible.
   ═════════════════════════════════════════════════════════════════════ */
@media (forced-colors: active) {
  *:focus-visible {
    outline: 2px solid CanvasText;
    outline-offset: 3px;
    box-shadow: none;
  }

  .calendar-day .tag,
  .footer-updated {
    /* opacity tricks are invisible under forced-colors — bring the
       text back to the system text colour. */
    color: CanvasText;
    opacity: 1;
  }

  .project-card,
  .market-item,
  .clock-item,
  .contact-tile,
  .tool-panel,
  .hero-panel {
    /* Borders we set to transparent for design get forced opaque under
       forced-colors anyway; explicit ButtonText keeps them readable. */
    border-color: ButtonText;
  }
}
