/* Frontier: the introduction and the chart. Everything else (sky, bar, type, glass, reveals,
   the page transition) comes from ../assets/css/site.css, so this page lives in the same weather. */

/* ---------- one colour per company, fixed whatever is hidden ----------
   Ten companies is more than colour alone can tell apart (checked with a colour-vision validator),
   so the legend picks one out on hover, the frontier points carry their names, and every dot has a card. */
:root {
  --v-claude: #d0603c; --v-openai: #12976f; --v-gemini: #3f86e8; --v-grok: #7c8494; --v-meta: #8a55d6;
  --v-deepseek: #3446a8; --v-kimi: #2ab7d0; --v-glm: #97a60f; --v-qwen: #e3a71a; --v-mimo: #c2448f;
  --ring: rgba(255, 255, 255, 0.92);   /* the gap around each dot */
  --halo: rgba(241, 244, 248, 0.92);   /* behind the names on the chart */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --v-claude: #dc6a42; --v-openai: #1fa877; --v-gemini: #4d8fe8; --v-grok: #858da0; --v-meta: #9a74e6;
    --v-deepseek: #5566d8; --v-kimi: #22b0c8; --v-glm: #8fa324; --v-qwen: #d9a222; --v-mimo: #d05aa0;
    --ring: #111827; --halo: rgba(14, 20, 34, 0.9);
  }
}
:root[data-theme="dark"] {
  --v-claude: #dc6a42; --v-openai: #1fa877; --v-gemini: #4d8fe8; --v-grok: #858da0; --v-meta: #9a74e6;
  --v-deepseek: #5566d8; --v-kimi: #22b0c8; --v-glm: #8fa324; --v-qwen: #d9a222; --v-mimo: #d05aa0;
  --ring: #111827; --halo: rgba(14, 20, 34, 0.9);
}

/* ---------- introduction ---------- */
/* padding-top, not padding-block: Safari < 15 reads a logical shorthand holding env() or var() as 0, which put the icon under the bar */
.fr-intro { padding-top: calc(env(safe-area-inset-top, 0px) + clamp(116px, 19vh, 196px)); padding-bottom: 0; }
.fr-intro .fr-icon { display: block; width: 76px; height: 76px; margin: 0 0 24px; box-shadow: 0 16px 30px -12px rgba(40, 56, 90, 0.3); }
.fr-name {
  width: fit-content; margin: 0;
  font: 500 clamp(3.4rem, 8.4vw, 6.2rem)/0.95 var(--latin); letter-spacing: 0.005em;
}
.fr-title {
  margin: 18px 0 0; max-width: 40rem;
  font: 500 clamp(1.3rem, 2.4vw, 1.8rem)/1.45 var(--display); color: var(--ink);
  text-wrap: balance; --d: 0.1s;
}
:is([lang="zh-Hans"], [lang="zh-Hant"], [lang="ja"]) .fr-title { font-weight: 600; letter-spacing: 0.08em; }
[lang="ja"] .fr-title, [lang="ja"] .fr-text p { word-break: auto-phrase; }
.fr-text { max-width: 44rem; margin-top: clamp(28px, 4vw, 44px); }
.fr-text p { margin: 0 0 1.05em; color: var(--ink-2); text-wrap: pretty; }
.fr-text .lede { color: var(--ink); max-width: none; --d: 0.18s; }
.fr-text p:nth-child(2) { --d: 0.26s; }
.fr-text .fr-meta { margin-top: 1.6em; font-size: 0.78rem; letter-spacing: 0.06em; color: var(--ink-3); --d: 0.34s; }

/* ---------- the panel ---------- */
.fr-plot { padding-block: clamp(40px, 7vh, 80px) clamp(72px, 12vh, 140px); }
.panel {
  margin: 0;
  padding: clamp(14px, 2.4vw, 28px) clamp(12px, 2.4vw, 30px) clamp(12px, 1.8vw, 22px);
  border-radius: 28px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-hi);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
}
.controls { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 14px 28px; margin-bottom: clamp(10px, 2vw, 20px); }

/* legend: one chip per company, with how far its plan stretches */
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 7px 6px; flex: 1 1 30rem; }
.chip {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: baseline; gap: 0.5em;
  padding: 6px 13px 6px 11px; border-radius: 999px;
  font: 500 0.8rem/1.2 var(--sans); letter-spacing: 0.02em; white-space: nowrap;
  color: var(--ink-2);
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-hi);
  transition: color 0.3s, background-color 0.3s, opacity 0.4s var(--ease), transform 0.4s var(--ease);
}
.chip:hover { color: var(--ink); background: var(--glass-strong); transform: translateY(-1px); }
.chip .sw { align-self: center; width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--ring); transition: background-color 0.3s; }
.chip .vx { font: italic 500 0.92rem/1 var(--latin); letter-spacing: 0.02em; color: var(--ink-3); }
.chip[aria-pressed="false"] { opacity: 0.5; }
.chip[aria-pressed="false"] .sw { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c); }
.chip[aria-pressed="false"] .vn { text-decoration: line-through; text-decoration-color: var(--ink-3); }

/* the frontier on / off, and log / linear, dressed like the language switch */
.switches { display: flex; align-items: center; gap: 10px; flex: none; }
.scale { display: flex; gap: 2px; }
.front-toggle { display: inline-flex; align-items: center; gap: 7px; }
.front-toggle svg { width: 16px; height: 12px; fill: none; stroke: var(--rose); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: stroke 0.3s; }
.front-toggle[aria-pressed="false"] svg { stroke: var(--ink-3); }
.front-toggle[aria-pressed="false"] span { text-decoration: line-through; text-decoration-color: var(--ink-3); }
.front-toggle + .scale { padding-left: 10px; border-left: 1px solid var(--rule); }
.scale button, .front-toggle {
  appearance: none; background: none; border: 0; cursor: pointer;
  min-width: 36px; height: 34px; padding: 0 12px; border-radius: 999px;
  font: 500 0.8rem/1 var(--sans); letter-spacing: 0.04em;
  color: var(--ink-3);
  transition: color 0.3s, background-color 0.3s;
}
.scale button:hover, .front-toggle:hover { color: var(--ink); background: var(--glass); }
.scale button[aria-pressed="true"], .front-toggle[aria-pressed="true"] { color: var(--ink); }
.scale button[aria-pressed="true"]::after {
  content: ""; display: block; width: 4px; height: 4px; margin: 3px auto -7px; border-radius: 50%; background: var(--rose);
}

/* ---------- the chart ---------- */
.chart-wrap { position: relative; }
#chart { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
#chart .grid line { stroke: var(--rule); stroke-width: 1; }
#chart .grid line.base { stroke: var(--rule-strong); }
#chart .grid line.minor { stroke: var(--rule-strong); }
#chart .tick { fill: var(--ink-2); font: italic 500 15px var(--latin); letter-spacing: 0.02em; font-variant-numeric: lining-nums; }
#chart .ttl { fill: var(--ink-3); font: 500 10.5px var(--sans); letter-spacing: 0.14em; text-transform: uppercase; }
#chart .fade-top { stop-color: var(--rose); stop-opacity: 0.1; }
#chart .fade-bottom { stop-color: var(--rose); stop-opacity: 0.015; }
#chart .area { fill: url(#fr-fade); transition: opacity 0.4s var(--ease); }
#chart .front { fill: none; stroke: var(--rose); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; transition: opacity 0.4s var(--ease); }
/* the frontier switched off: just the dots */
#chart.no-front .front, #chart.no-front .area { opacity: 0; }
#chart .chain { fill: none; stroke: var(--c); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transition: opacity 0.4s var(--ease); }
#chart .chain.lit, #chart .chain.near { opacity: 0.7; }
/* r lives here as well as on the attribute, so a dot joining or leaving the frontier eases its size */
#chart .dot { r: 4px; fill: var(--c); stroke: var(--ring); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; transition: opacity 0.4s var(--ease), r 0.35s var(--ease), stroke 0.35s var(--ease); }
#chart .dot.on { r: 5.5px; stroke: var(--ink); stroke-width: 1.5; }
#chart .mute { opacity: 0.13; }
#chart .chain.mute { opacity: 0; }
#chart .off { opacity: 0.06; pointer-events: none; }
#chart .chain.off { opacity: 0; }
#chart .labels { transition: opacity 0.2s; }
/* --o: how far a name has faded in or out while the points slide (set per frame, so no transition then) */
#chart .lbl { opacity: var(--o, 1); font: 11px var(--sans); letter-spacing: 0.01em; paint-order: stroke; stroke: var(--halo); stroke-width: 3.5px; stroke-linejoin: round; transition: opacity 0.4s var(--ease); }
#chart .lbl .m { fill: var(--ink); font-weight: 500; }
#chart .lbl .tr { fill: var(--ink-3); }
#chart .lbl.mute { opacity: calc(var(--o, 1) * 0.18); }
#chart.morphing .lbl { transition: none; }
#chart .cross line { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 4; stroke-linecap: round; }
#chart .ring { fill: none; stroke: var(--c); stroke-width: 1.5; pointer-events: none; }
@media (max-width: 560px) {
  #chart .tick { font-size: 13.5px; }
  #chart .ttl { font-size: 9.5px; letter-spacing: 0.1em; }
  #chart .lbl { font-size: 10px; }
}

/* the card that follows the pointer */
.tip {
  position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none;
  min-width: 190px; max-width: min(260px, 90%);
  padding: 12px 16px 12px; border-radius: 18px;
  font-size: 0.8rem; line-height: 1.5;
  background: var(--glass-strong);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-hi);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
}
.tip p { margin: 0; }
.tip-h { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 0.25em; margin-bottom: 8px !important; color: var(--ink); }
.tip-h i { align-self: center; width: 8px; height: 8px; margin-right: 4px; border-radius: 50%; background: var(--c); }
.tip-h b { font-weight: 600; }
.tip-h span { color: var(--ink-3); }
/* the plan, on its own line under the name, lined up with it */
.tip-h:has(+ .tip-s) { margin-bottom: 2px !important; }
.tip-s { margin-bottom: 8px !important; padding-left: calc(12px + 0.25em); color: var(--ink-3); font-size: 0.76rem; letter-spacing: 0.02em; }
.tip dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; margin: 0; }
.tip dt { color: var(--ink-3); }
.tip dd { margin: 0; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.tip dd small { margin-left: 0.5em; font: italic 500 0.88rem/1 var(--latin); color: var(--ink-3); }
.tip-f { margin-top: 8px !important; padding-top: 8px; border-top: 1px solid var(--rule); color: var(--rose-ink); font-size: 0.76rem; letter-spacing: 0.04em; }
.tip-f::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border: 1.5px solid var(--rose); border-radius: 2px; transform: rotate(45deg) translateY(-1px); }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 560px) {
  .panel { border-radius: 22px; }
  .chip { padding: 5px 11px 5px 9px; font-size: 0.76rem; }
}

/* ---------- output speed table, below the chart ---------- */
.speed-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-bottom: 14px; }
.speed-title { margin: 0; font: 500 1.25rem/1.3 var(--display); color: var(--ink); }
.speed-scroll { overflow-x: auto; }
.speed-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.speed-table th, .speed-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.speed-table th { font-weight: 500; font-size: 0.8rem; color: var(--ink-3); }
.speed-table th:last-child, .speed-table td:last-child { text-align: right; }
.sp-dot { display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; background: var(--c); vertical-align: middle; box-shadow: 0 0 0 2px var(--ring); }
.sp-none { color: var(--ink-3); text-align: center; padding: 18px 12px; }
.tier-pick { flex-wrap: wrap; }
.fr-speed { padding-block: clamp(8px, 2vw, 20px) 0; }

/* ---------- switching language ----------
   The text swaps inside a view transition. The page behind stays put; each section is its own layer that glides to its new
   position and height while its words dissolve (the sections and pictures are named by script just for the moment, see lang.js). */
:root.lang-vt [data-vt] { view-transition-name: none; }
:root.lang-vt::view-transition-group(*) { animation-duration: 0.8s; animation-timing-function: cubic-bezier(0.22, 0.8, 0.2, 1); }
:root.lang-vt::view-transition-old(*), :root.lang-vt::view-transition-new(*) { height: 100%; object-fit: none; object-position: 0 0; } /* a section that changes height is moved, never stretched */
:root.lang-vt::view-transition-old(*) { animation: lang-out 0.5s linear both; }   /* same length, linear, added up (plus-lighter): what is the same in both stays solid, only the words dissolve */
:root.lang-vt::view-transition-new(*) { animation: lang-in 0.5s linear both; }
/* the words of a section: the old ones go first, then the new ones arrive (pictures are their own layers, so they stay solid) */
:root.lang-vt::view-transition-old(*.sec) { animation: lang-out 0.24s ease-in both; }
:root.lang-vt::view-transition-new(*.sec) { animation: lang-in 0.46s ease-out 0.2s both; }
:root.lang-vt::view-transition-old(root), :root.lang-vt::view-transition-new(root) { animation: none; }
/* the frosted header keeps its frosting: a layer in the transition can't see through to the sections moving under it by itself */
:root.lang-vt:has(header.solid)::view-transition-group(*.bar) { -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%); }
@keyframes lang-out { to { opacity: 0; } }
@keyframes lang-in { from { opacity: 0; } }
