/* ============================================================
   ODP — site-specific layer on top of the Catalation design system.
   catalation.css is a verbatim copy of catalation.com/css/style.css and
   must not be edited here; everything ODP needs beyond it lives in this
   file: the ODP lockup, language switcher, a few layouts, the spec page,
   right-to-left and CJK/Arabic adjustments.
   ============================================================ */

/* ---------- Scripts the Catalation faces do not cover ---------- */

:lang(zh) { --font-sans: 'Inter Tight', 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC', 'Microsoft YaHei', system-ui, sans-serif; }
:lang(ja) { --font-sans: 'Inter Tight', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Yu Gothic', Meiryo, system-ui, sans-serif; }
:lang(ar) { --font-sans: 'Noto Sans Arabic', 'Segoe UI', Tahoma, 'Geeza Pro', system-ui, sans-serif; }
:lang(ru) { --font-serif: 'Instrument Serif', Georgia, 'Times New Roman', serif; }

/* No italic serif exists for these scripts: the accent phrase keeps the
   heading face and takes the accent colour instead. */
:lang(zh) .serif, :lang(ja) .serif, :lang(ar) .serif {
  font-family: inherit;
  font-style: normal;
  font-weight: inherit;
  letter-spacing: inherit;
  font-size: 1em !important;
  color: var(--accent);
}
:lang(zh) h1, :lang(zh) h2, :lang(ja) h1, :lang(ja) h2, :lang(ar) h1, :lang(ar) h2,
:lang(zh) .big-quote, :lang(ja) .big-quote, :lang(ar) .big-quote { letter-spacing: 0 !important; }
:lang(zh) .big-quote, :lang(ja) .big-quote, :lang(ar) .big-quote { font-family: var(--font-sans); font-weight: 600; }
:lang(zh) .hero h1, :lang(ja) .hero h1 { line-height: 1.2; }
:lang(ar) .hero h1, :lang(ar) h2 { line-height: 1.35; }
:lang(ar) .eyebrow, :lang(ar) .card-kicker, :lang(ar) .step-num, :lang(ar) .footer-h,
:lang(zh) .eyebrow, :lang(ja) .eyebrow { letter-spacing: 0; }
:lang(ar) .eyebrow, :lang(ar) .card-kicker, :lang(ar) .step-num, :lang(ar) .status,
:lang(ar) .chip, :lang(ar) .footer-h, :lang(ar) .nav-panel h6 { font-family: var(--font-sans); }

html { scroll-padding-top: calc(var(--nav-h) + 16px); }
code { overflow-wrap: anywhere; }

/* ---------- Brand lockup ---------- */

.odp-word {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text-strong);
}
.brand .brand-symbol { width: 25px; height: 25px; }

/* ---------- Nav ---------- */

@media (max-width: 1180px) { .nav-menu > li > a { padding: 0 9px; } }
@media (max-width: 640px) { .nav-right .nav-spec { display: none; } }

.lang { position: relative; }
.lang summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-strong);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: border-color .15s;
}
.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover, .lang[open] summary { border-color: var(--text-strong); }
.lang summary svg { width: 16px; height: 16px; }
.lang ul {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 8px);
  z-index: 120;
  min-width: 184px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.lang li a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-strong);
  font-size: var(--text-sm);
}
.lang li a:hover, .lang li a:focus-visible { background: var(--surface-2); }
.lang li a[aria-current="page"] { color: var(--accent); font-weight: 600; }

/* ---------- Hero ---------- */

.odp-hero h1 { font-size: clamp(40px, 6.4vw, 84px); max-width: 15ch; margin-inline: auto; }
:lang(zh) .odp-hero h1, :lang(ja) .odp-hero h1 { font-size: clamp(34px, 5.2vw, 68px); max-width: 14em; }
:lang(ar) .odp-hero h1, :lang(ru) .odp-hero h1, :lang(de) .odp-hero h1 { font-size: clamp(36px, 5.6vw, 72px); max-width: 18ch; }
.hero-chips { justify-content: center; margin-bottom: 24px; }
.dot-accent { background: var(--accent); }
.odp-hero .hero-shot { max-width: 880px; margin-inline: auto; }
.odp-flow { text-align: left; }
.terminal pre { overflow-x: auto; }
.terminal-bar .status { flex: none; }
.shot-note {
  margin-top: var(--sp-4);
  font-size: var(--text-xs);
  color: var(--muted);
}
.hero-center .shot-note { text-align: center; }

/* ---------- Shift: two-column comparison ---------- */

.odp-shift th, .odp-shift td { width: 50%; }
.odp-shift td { color: var(--body); }
.odp-shift td.y { color: var(--text-strong); font-weight: 500; }
.compare th[scope="col"] { text-align: start; }

/* ---------- Problem ---------- */

.odp-quote { max-width: 30ch; margin-top: var(--sp-16); }

/* ---------- Stack: where ODP fits ---------- */

.layer h3.mono { font-size: var(--text-sm); font-weight: 500; letter-spacing: 0; line-height: 1.5; }
.layer-odp { border-color: var(--accent-line); background: linear-gradient(180deg, var(--accent-soft), transparent 70%), var(--surface); }
.layer-odp h3.mono { font-size: var(--text-xl); font-weight: 600; color: var(--accent); }
@media (max-width: 1023px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid-4 { grid-template-columns: 1fr; } }

/* ---------- Steps: four across ---------- */

.steps.steps-4 { grid-template-columns: repeat(4, 1fr); }
.steps-4 .step-num { color: var(--accent); }
@media (max-width: 1023px) { .steps.steps-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .steps.steps-4 { grid-template-columns: 1fr; } }

/* ---------- Architecture: planes table on ink ---------- */

.section-ink h2 { font-size: var(--text-3xl); letter-spacing: -0.035em; margin-bottom: var(--sp-4); }
.section-ink .checks { margin-top: var(--sp-6); }
.odp-planes { font-size: var(--text-sm); }
.odp-planes th[scope="row"] { color: var(--text-strong); font-weight: 500; text-align: start; }
.odp-planes td { min-width: 0; }

/* ---------- Organization Document ---------- */

.split h2 { font-size: var(--text-3xl); letter-spacing: -0.035em; margin-bottom: var(--sp-4); }
.split h2 .serif { font-size: 1.08em; }
.tiers { margin: var(--sp-8) 0 var(--sp-6); gap: 12px; }
.tier { padding: 20px; }
.tier .card-kicker { color: var(--accent); }
.tier .checks { margin-top: 12px; }
.tier .checks li { font-size: var(--text-sm); }
#protocol .terminal pre { max-height: 640px; font-size: 12.5px; }

/* ---------- Trust: readiness ladder ---------- */

.principles.one-col { grid-template-columns: 1fr; margin-top: var(--sp-8); }
.principles.one-col .principle:nth-child(n) { padding: 18px 0; border-inline-start: 0; }
.readiness .panel-head { font-size: 13px; font-weight: 600; color: var(--text-strong); }
.levels { list-style: none; margin: 0; padding: 8px 16px 12px; }
.levels li {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.levels li:last-child { border-bottom: 0; }
.levels .lvl {
  display: inline-grid;
  place-items: center;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
}
.levels b { display: block; color: var(--text-strong); font-weight: 600; font-size: var(--text-sm); }
.levels small { display: block; color: var(--muted); font-size: var(--text-xs); line-height: 1.5; margin-top: 2px; }

/* ---------- Pilot ---------- */

#pilot .stat span { max-width: 26ch; }

/* ---------- Roadmap ---------- */

.legend { margin: calc(var(--sp-6) * -1) 0 var(--sp-8); }
.milestone .status { white-space: nowrap; }

/* ---------- CTA band (dark in both themes) ---------- */

.cta .eyebrow { color: #2BD4BD; }
.cta .hero-ctas { justify-content: center; }
.cta .btn-secondary { background: transparent; color: #F0F2FF; border-color: #2D2F43; }
.cta .btn-secondary:hover { background: rgba(240, 242, 255, 0.06); border-color: #F0F2FF; }

/* ---------- Footer ---------- */

.odp-footer-grid { grid-template-columns: 1.6fr repeat(3, 1fr); }
.footer-brand p { max-width: 36ch; }
.footer-h {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: var(--sp-4);
}
.by-catalation {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: var(--sp-6);
  padding: 8px 14px 8px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-strong);
  font-size: var(--text-xs);
  font-weight: 500;
  transition: border-color .15s;
}
.by-catalation:hover { border-color: var(--text-strong); }
.cat-symbol { width: 18px; height: 18px; flex: none; color: #01595A; }
:root[data-theme="dark"] .cat-symbol { color: var(--accent); }
/* "ODP." is far narrower than "CATALATION.": a fixed, large outline instead of a full-width one. */
.odp-footer-word { font-size: clamp(120px, 28vw, 340px); letter-spacing: -0.02em; }
@media (max-width: 860px) { .odp-footer-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Root language chooser and 404 ---------- */

.chooser main { min-height: 100vh; display: grid; align-content: center; justify-items: center; gap: var(--sp-6); text-align: center; padding-block: var(--sp-16); }
.chooser h1 { font-size: var(--text-3xl); letter-spacing: -0.035em; max-width: 18ch; }
.chooser .lede { margin-inline: auto; }
.chooser .lang-list { justify-content: center; max-width: 640px; }
.chooser a.chip:hover { border-color: var(--text-strong); }

/* ---------- Specification page ---------- */

.spec-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--sp-16); align-items: start; }
.spec-toc { position: sticky; top: calc(var(--nav-h) + 24px); font-size: var(--text-sm); }
.spec-toc ol { list-style: none; margin: 0; padding: 0; }
.spec-toc a { display: block; padding: 6px 0; color: var(--muted); border-inline-start: 2px solid var(--border); padding-inline-start: 12px; }
.spec-toc a:hover { color: var(--accent); border-color: var(--accent); }
.spec { max-width: 820px; min-width: 0; font-size: var(--text-base); line-height: 1.7; color: var(--body); }
.spec h2 { font-size: var(--text-2xl); letter-spacing: -0.03em; margin: 2.2em 0 .6em; padding-top: .4em; border-top: 1px solid var(--border); }
.spec h3 { font-size: var(--text-lg); margin: 1.8em 0 .5em; }
.spec p, .spec ul, .spec ol, .spec pre, .spec .compare-wrap { margin: 0 0 1.1em; }
.spec ul, .spec ol { padding-inline-start: 1.3em; }
.spec li { margin: .35em 0; }
.spec li > ul { margin: .35em 0 0; }
.spec a { color: var(--accent); border-bottom: 1px solid var(--accent-line); }
.spec a:hover { border-color: var(--accent); }
.spec hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.spec code {
  font-family: var(--font-mono);
  font-size: .86em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-strong);
}
.spec pre {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-text);
  font-size: 12.5px;
  line-height: 1.6;
  overflow-x: auto;
}
.spec pre code { padding: 0; background: none; color: inherit; font-size: inherit; }
.spec-table { font-size: var(--text-sm); }
.spec-table td, .spec-table th { vertical-align: top; text-align: start; }
.spec-table td:first-child { white-space: nowrap; }
.spec .note-box { margin-bottom: 2em; }
@media (max-width: 900px) {
  .spec-layout { grid-template-columns: 1fr; gap: var(--sp-8); }
  .spec-toc { position: static; }
  .spec-table td:first-child { white-space: normal; }
}

/* ---------- Right-to-left (Arabic) ---------- */

[dir="rtl"] .skip-link { left: auto; right: 12px; }
[dir="rtl"] .principle:nth-child(odd) { padding-right: 0; padding-left: 24px; }
[dir="rtl"] .principle:nth-child(even) { padding-left: 0; padding-right: 24px; border-left: 0; border-right: 1px solid var(--border); }
[dir="rtl"] .principles.one-col .principle:nth-child(n) { padding: 18px 0; border-right: 0; }
[dir="rtl"] .link-arrow::after { content: '←'; }
[dir="rtl"] .link-arrow:hover::after { transform: translateX(-3px); }
[dir="rtl"] .big-quote, [dir="rtl"] .lede, [dir="rtl"] .section-head { text-align: right; }
[dir="rtl"] .section-head.center, [dir="rtl"] .hero-center .lede, [dir="rtl"] .section-head.center .lede,
[dir="rtl"] .cta .lede, [dir="rtl"] .chooser .lede { text-align: center; }
[dir="rtl"] .footer-word { direction: ltr; text-align: right; }
@media (max-width: 720px) {
  [dir="rtl"] .principle:nth-child(n) { padding: 18px 0; border-right: 0; }
}
