/* RatioJuris: classical navy and gold, follows the system light/dark setting. */

:root {
  --bg: #0b1120;
  --bg-alt: #0e1628;
  --panel: #121b30;
  --panel-hover: #17223b;
  --line: rgba(212, 175, 55, 0.22);
  --line-soft: rgba(239, 231, 210, 0.08);
  --gold: #d4af37;
  --gold-hi: #f6e7b0;
  --gold-lo: #a8841f;
  --ink: #efe7d2;
  --muted: #9aa3b7;
  --on-gold: #0b1120;
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.8);
  --serif: Georgia, "Times New Roman", Times, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --radius: 14px;
  --container: 1120px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #faf7f0;
    --bg-alt: #f3eee2;
    --panel: #ffffff;
    --panel-hover: #fffdf7;
    --line: rgba(143, 107, 18, 0.25);
    --line-soft: rgba(29, 37, 64, 0.08);
    --gold: #8f6b12;
    --gold-hi: #c9a227;
    --gold-lo: #6b4f0a;
    --ink: #1d2540;
    --muted: #5a6377;
    --on-gold: #ffffff;
    --shadow: 0 18px 40px -26px rgba(29, 37, 64, 0.35);
    color-scheme: light;
  }
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

a { color: var(--gold); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--gold-hi); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.5rem, 2.6vw, 1.9rem); }
h3 { font-size: 1.2rem; }

code { font-family: var(--mono); font-size: 0.88em; background: var(--line-soft); padding: 0.1em 0.35em; border-radius: 5px; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.container { width: min(100% - 2.5rem, var(--container)); margin-inline: auto; }
.container--narrow { --container: 820px; }

.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 100;
  background: var(--gold); color: var(--on-gold); padding: 0.5rem 1rem; border-radius: 8px;
}
.skip-link:focus { top: 1rem; }

/* ── Header ─────────────────────────────────────────── */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }

.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); text-decoration: none; }
.brand .scales { width: 34px; height: 28px; }
.brand__name { font-family: var(--serif); font-size: 1.15rem; letter-spacing: 0.18em; text-transform: uppercase; }

.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.site-nav a {
  color: var(--muted); text-decoration: none; font-size: 0.93rem;
  padding: 0.4rem 0.75rem; border-radius: 999px;
}
.site-nav a:hover, .site-nav a[aria-current] { color: var(--ink); background: var(--line-soft); }
.site-nav__gh { border: 1px solid var(--line); }

@media (max-width: 640px) {
  .site-header__inner { flex-direction: column; align-items: flex-start; padding-block: 0.6rem; }
  .site-nav { margin-left: -0.75rem; }
}

/* ── Scales of justice ─────────────────────────────── */

.scales__stroke { fill: none; stroke: var(--gold); }
.scales__fill { fill: var(--gold); }
.scales--animate .scales__beam { transform-origin: 0 56px; animation: beam 6s ease-in-out infinite; }
.scales--animate .scales__pan--left { animation: pan-left 6s ease-in-out infinite; }
.scales--animate .scales__pan--right { animation: pan-right 6s ease-in-out infinite; }
@keyframes beam { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes pan-left { 0%, 100% { transform: translateY(4.5px); } 50% { transform: translateY(-4.5px); } }
@keyframes pan-right { 0%, 100% { transform: translateY(-4.5px); } 50% { transform: translateY(4.5px); } }

/* ── Buttons ───────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.7rem 1.25rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink); background: transparent;
  text-decoration: none; font-weight: 600; font-size: 0.95rem;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.btn:hover { color: var(--ink); background: var(--line-soft); border-color: var(--gold); transform: translateY(-1px); }
.btn--gold { background: linear-gradient(135deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo)); color: var(--on-gold); border-color: transparent; }
.btn--gold:hover { color: var(--on-gold); background: linear-gradient(135deg, var(--gold-hi), var(--gold)); }
.btn--accent { background: var(--accent); color: #fff; border-color: transparent; }
.btn--accent:hover { color: #fff; background: color-mix(in srgb, var(--accent) 85%, #fff); border-color: transparent; }
.btn--small { padding: 0.45rem 0.9rem; font-size: 0.85rem; }

/* ── Hero ──────────────────────────────────────────── */

.hero {
  position: relative; overflow: hidden; text-align: center;
  padding: clamp(3rem, 8vw, 6rem) 0 clamp(3rem, 7vw, 5rem);
  background:
    radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--gold) 14%, transparent), transparent 60%),
    var(--bg);
  border-bottom: 1px solid var(--line-soft);
}
.hero::before, .hero::after {
  content: ""; position: absolute; top: 18%; bottom: 18%; width: 1px;
  background: linear-gradient(transparent, var(--line), transparent);
}
.hero::before { left: 8%; }
.hero::after { right: 8%; }
.hero__inner { display: flex; flex-direction: column; align-items: center; }
.hero .scales { width: 150px; height: 120px; margin-bottom: 0.5rem; }

.hero__title {
  font-size: clamp(2.6rem, 8vw, 5rem); letter-spacing: 0.2em; text-transform: uppercase;
  margin: 0 0 0.2em -0.2em;
  background: linear-gradient(110deg, var(--gold) 40%, var(--gold-hi) 50%, var(--gold) 60%) 0 0 / 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 7s ease-in-out infinite;
}
.hero__sub {
  display: flex; align-items: center; gap: 1rem; margin: 0;
  font-family: var(--serif); letter-spacing: 0.45em; text-transform: uppercase; font-size: 0.85rem;
}
.hero__sub::before, .hero__sub::after { content: ""; width: clamp(2rem, 8vw, 6rem); height: 1px; background: var(--line); }

.hallmark {
  font-family: var(--serif); font-style: italic; color: var(--gold); margin: 0;
  text-shadow: 0 0 22px color-mix(in srgb, var(--gold) 35%, transparent);
}
.hallmark--shine {
  position: relative; font-size: clamp(2.6rem, 7vw, 4.4rem); margin: 0.6rem 0 0.8rem;
  background: linear-gradient(110deg, var(--gold) 40%, var(--gold-hi) 50%, var(--gold) 60%) 0 0 / 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 6s ease-in-out infinite 1s;
}
.hallmark--small { font-size: 1.7rem; margin-top: 0.5rem; }
.hallmark__star {
  position: absolute; top: 0.25em; right: -0.55em; width: 0.32em; height: 0.32em;
  background: var(--gold-hi);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  animation: twinkle 5s ease-in-out infinite;
}
@keyframes shine { 0%, 30% { background-position: 100% 0; } 75%, 100% { background-position: 0 0; } }
@keyframes twinkle { 0%, 45%, 100% { transform: scale(0); } 60%, 88% { transform: scale(1); } 75% { transform: scale(0.35); } }

.maxims { position: relative; height: 3.4rem; width: 100%; max-width: 420px; }
.maxims p {
  position: absolute; inset: 0; margin: 0; opacity: 0;
  display: flex; flex-direction: column; align-items: center;
  animation: maxim 12s infinite;
}
.maxims p:nth-child(2) { animation-delay: 3s; }
.maxims p:nth-child(3) { animation-delay: 6s; }
.maxims p:nth-child(4) { animation-delay: 9s; }
.maxims em { font-family: var(--serif); font-size: 1.15rem; }
.maxims span { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.3em; text-transform: uppercase; }
@keyframes maxim { 0% { opacity: 0; } 4%, 21% { opacity: 1; } 25%, 100% { opacity: 0; } }

.hero__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-top: 1.6rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .maxims p:first-child { opacity: 1; }
  .hero__title, .hallmark--shine { color: var(--gold); background: none; }
}

/* ── Sections ──────────────────────────────────────── */

.section { padding: clamp(3rem, 7vw, 5rem) 0; }
.section--tight { padding-block: 2.5rem; }
.section--alt { background: var(--bg-alt); border-block: 1px solid var(--line-soft); }
.section__head { max-width: 640px; margin-bottom: 2rem; }
.eyebrow { color: var(--gold); font-size: 0.78rem; letter-spacing: 0.25em; text-transform: uppercase; margin: 0 0 0.6rem; }

.position { text-align: center; }
.position__quote { font-family: var(--serif); font-size: clamp(1.25rem, 2.6vw, 1.6rem); line-height: 1.5; margin: 0 0 1rem; }

/* ── Product cards ─────────────────────────────────── */

.products { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

.product {
  --accent: var(--gold);
  position: relative; display: flex; flex-direction: column; gap: 0.8rem;
  padding: 1.6rem; border-radius: var(--radius); overflow: hidden;
  background: var(--panel); border: 1px solid var(--line-soft); box-shadow: var(--shadow);
}
.product::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--accent);
}
.product::after {
  content: ""; position: absolute; width: 260px; height: 260px; right: -110px; top: -130px; border-radius: 50%;
  background: radial-gradient(color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
  pointer-events: none;
}
.product__top { display: flex; align-items: center; gap: 0.9rem; }
.product__icon {
  flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 14%, var(--panel)); color: var(--accent);
  font-family: var(--serif); font-size: 1.6rem; overflow: hidden;
}
.product__icon img { width: 100%; height: 100%; object-fit: contain; }
.product__name { margin: 0; font-size: 1.45rem; }
.product__kind { margin: 0; color: var(--muted); font-size: 0.85rem; }
.product__tagline { margin: 0; font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: var(--accent); }
.product__summary { margin: 0; color: var(--muted); }
.product__design { margin: 0; font-size: 0.88rem; }
.product__design span {
  display: inline-block; margin-right: 0.5rem; padding: 0.05rem 0.5rem; border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); color: var(--accent);
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
}
.product__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: auto; padding-top: 0.4rem; }
.product__legal {
  display: flex; flex-wrap: wrap; gap: 1rem; padding-top: 0.9rem;
  border-top: 1px solid var(--line-soft); font-size: 0.88rem;
}
.product__legal a { color: var(--muted); text-decoration: none; }
.product__legal a:hover { color: var(--accent); }

.no-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; }
.no-chips span {
  padding: 0.2rem 0.65rem; border-radius: 999px; font-size: 0.78rem;
  border: 1px solid var(--line); color: var(--ink);
}
.no-chips--small span { font-size: 0.72rem; padding: 0.12rem 0.55rem; color: var(--muted); }

/* ── Generic cards ─────────────────────────────────── */

.cards { display: grid; gap: 1rem; margin: 1.5rem 0 2rem; }
.cards--2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.cards--3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.card {
  display: flex; flex-direction: column; gap: 0.35rem; padding: 1.3rem;
  border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line-soft);
  color: var(--ink); text-decoration: none;
}
.card--link { transition: border-color 0.2s, transform 0.2s, background 0.2s; }
.card--link:hover { color: var(--ink); border-color: var(--line); background: var(--panel-hover); transform: translateY(-2px); }
.card__eyebrow { color: var(--gold); font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; }
.card__title { font-family: var(--serif); font-weight: 400; font-size: 1.15rem; overflow-wrap: anywhere; }
.card__text { color: var(--muted); font-size: 0.92rem; }

/* ── Live repositories ─────────────────────────────── */

.repo-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.repo {
  display: flex; flex-direction: column; gap: 0.3rem; padding: 1rem 1.1rem;
  border-radius: 12px; border: 1px solid var(--line-soft); background: var(--panel);
  color: var(--ink); text-decoration: none; transition: border-color 0.2s;
}
.repo:hover { color: var(--ink); border-color: var(--line); }
.repo__name { font-weight: 600; text-transform: capitalize; }
.repo__desc {
  color: var(--muted); font-size: 0.88rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.repo__meta { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: auto; padding-top: 0.3rem; color: var(--muted); font-size: 0.78rem; }
.repo__lang::before {
  content: ""; display: inline-block; width: 0.55rem; height: 0.55rem; margin-right: 0.35rem;
  border-radius: 50%; background: var(--gold);
}

/* ── Doctrine and callout ──────────────────────────── */

.doctrine { display: grid; gap: 0.25rem; }
.doctrine p {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem;
  margin: 0; padding: 1rem 0; border-bottom: 1px solid var(--line-soft);
}
.doctrine em { font-family: var(--serif); font-size: 1.15rem; color: var(--gold); }
.doctrine span { color: var(--muted); }
@media (max-width: 600px) { .doctrine p { grid-template-columns: 1fr; gap: 0.2rem; } }

.callout {
  text-align: center; padding: clamp(2rem, 5vw, 3rem);
  border: 1px solid var(--line); border-radius: calc(var(--radius) + 6px);
  background: radial-gradient(ellipse at top, color-mix(in srgb, var(--gold) 10%, transparent), transparent 70%), var(--panel);
}
.callout .muted { max-width: 560px; margin-inline: auto; }

/* ── Legal documents ───────────────────────────────── */

.doc-hero {
  --accent: var(--gold);
  padding: 2.5rem 0 1.8rem; border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, transparent), transparent);
}
.doc-hero h1 { margin-top: 1rem; }
.doc-hero__meta { color: var(--muted); margin: 0; font-size: 0.92rem; }

.breadcrumb { display: flex; flex-wrap: wrap; gap: 0.5rem; font-size: 0.85rem; color: var(--muted); }
.breadcrumb a { color: var(--muted); }

.product-chip { display: inline-flex; align-items: center; gap: 0.75rem; margin-top: 1.25rem; }
.product-chip__icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; overflow: hidden;
  background: color-mix(in srgb, var(--accent) 16%, var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent); font-family: var(--serif); font-size: 1.3rem;
}
.product-chip__icon img { width: 100%; height: 100%; object-fit: contain; }
.product-chip__text { display: flex; flex-direction: column; line-height: 1.3; }
.product-chip__text span { color: var(--muted); font-size: 0.85rem; }

.doc-tabs { display: flex; gap: 0.25rem; margin-top: 1.4rem; border-bottom: 1px solid var(--line-soft); }
.doc-tabs a {
  padding: 0.55rem 1rem; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.92rem;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.doc-tabs a:hover { color: var(--ink); }
.doc-tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }

.doc-body { padding-block: 2rem 4rem; }
.lede { font-size: 1.15rem; color: var(--muted); margin-top: 0; }

.glance {
  margin: 0 0 2.2rem; padding: 1.4rem 1.6rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel);
}
.glance__title { font-size: 0.8rem; font-family: var(--sans); letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); }
.glance__list { margin: 0 0 1rem; padding-left: 1.2rem; }
.glance__list li { margin-bottom: 0.35rem; }
.glance__list li::marker { content: "◆  "; color: var(--gold); font-size: 0.7em; }

.prose { counter-reset: section; }
.prose h2 {
  counter-increment: section; margin-top: 2.4rem; padding-top: 1.2rem;
  border-top: 1px solid var(--line-soft); font-size: 1.45rem; scroll-margin-top: 90px;
}
.prose h2::before { content: "§ " counter(section) "  "; color: var(--gold); font-size: 0.85em; }
.prose--plain h2::before { content: none; }
.prose h3 { margin-top: 1.5rem; font-size: 1.12rem; scroll-margin-top: 90px; }
.prose li { margin-bottom: 0.4rem; }
.link-list { padding-left: 1.2rem; }

.table-wrap { overflow-x: auto; margin: 1rem 0 1.5rem; border: 1px solid var(--line-soft); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th, td { text-align: left; vertical-align: top; padding: 0.8rem 1rem; border-bottom: 1px solid var(--line-soft); }
th { font-size: 0.75rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--gold); font-weight: 600; background: var(--panel); }
tr:last-child td { border-bottom: 0; }

.register td:first-child { border-left: 3px solid var(--accent); }
.register__name { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.register__name img { border-radius: 7px; }
.register__docs { white-space: nowrap; }
.register__docs a { margin-right: 0.8rem; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.55rem 1.5rem; margin: 1rem 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; } .facts dd { margin-bottom: 0.5rem; } }

.faq details { border: 1px solid var(--line-soft); border-radius: 12px; padding: 0.2rem 1.1rem; margin-bottom: 0.6rem; background: var(--panel); }
.faq summary { cursor: pointer; padding: 0.75rem 0; font-weight: 600; }
.faq details[open] summary { color: var(--gold); }

/* ── Footer ────────────────────────────────────────── */

.site-footer { border-top: 1px solid var(--line-soft); background: var(--bg-alt); padding-top: 3rem; }
.site-footer__grid { display: grid; gap: 2rem; grid-template-columns: 2fr repeat(3, 1fr); }
@media (max-width: 760px) { .site-footer__grid { grid-template-columns: 1fr 1fr; } .site-footer__brand { grid-column: 1 / -1; } }
.site-footer__title { font-family: var(--sans); font-size: 0.75rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { margin-bottom: 0.4rem; }
.plain-list a { color: var(--muted); text-decoration: none; font-size: 0.92rem; overflow-wrap: anywhere; }
.plain-list a:hover { color: var(--ink); }
.site-footer__base {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem;
  margin-top: 2.5rem; padding: 1.2rem 0 1.6rem; border-top: 1px solid var(--line-soft);
  color: var(--muted); font-size: 0.82rem;
}
.site-footer__base p { margin: 0; }
