/* Roxabi — shared styles. Vanilla CSS, no preprocessor. */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img, svg, canvas { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }

/* ── Layout ───────────────────────────────────────────── */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--s-lg); }
.prose { max-width: var(--maxw-prose); }
section { padding-block: var(--s-2xl); }
.section-label {
  font-family: var(--font-mono); font-size: .75rem; font-weight: 500;
  letter-spacing: .15em; text-transform: uppercase; color: var(--accent);
  margin-bottom: var(--s-md);
}

/* ── Typography ───────────────────────────────────────── */
h1, h2, h3 { line-height: 1.1; letter-spacing: -.03em; font-weight: 800; }
h1 { font-size: clamp(2.25rem, 6vw, 4rem); font-weight: 900; letter-spacing: -.04em; }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.25rem); }
h3 { font-size: 1.25rem; font-weight: 600; letter-spacing: -.02em; }
p { color: var(--text-muted); }
.lead { font-size: 1.125rem; color: var(--text-muted); }
strong { color: var(--text); font-weight: 600; }
code, .mono { font-family: var(--font-mono); }

/* ── Nav ──────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; gap: var(--s-lg); height: 60px; }
.nav-inner > *, .nav-actions > * { display: flex; align-items: center; }
.brand { gap: var(--s-sm); font-weight: 800; letter-spacing: -.02em; font-size: 1.05rem; line-height: 1; }
.brand svg, .brand img { width: 26px; height: 26px; }
.nav-links { gap: var(--s-lg); margin-left: var(--s-md); }
.nav-links a { display: inline-flex; align-items: center; line-height: 1; color: var(--text-muted); font-size: .925rem; font-weight: 500; transition: color var(--dur) var(--ease); }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: var(--s-xs); margin-left: auto; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border: 1px solid transparent; border-radius: var(--r-md); background: transparent;
  color: var(--text-muted); cursor: pointer; transition: all var(--dur) var(--ease);
}
.icon-btn:hover { color: var(--text); background: var(--surface); border-color: var(--border); }
.icon-btn svg { width: 18px; height: 18px; }
.lang-toggle {
  font-family: var(--font-mono); font-size: .75rem; font-weight: 600; letter-spacing: .05em;
  width: auto; padding-inline: var(--s-sm); gap: 2px;
}
.lang-toggle .on { color: var(--accent); }
.lang-toggle .sep { color: var(--text-dim); }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: var(--s-sm);
  font-weight: 600; font-size: .95rem; padding: 10px 18px; border-radius: var(--r-md);
  border: 1px solid transparent; cursor: pointer; transition: all var(--dur) var(--ease);
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--accent-on); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--glow-accent); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-hi); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn svg { width: 16px; height: 16px; }
.btn .star-count { font-family: var(--font-mono); font-size: .8rem; color: var(--text-muted); }

/* ── Badge / eyebrow ──────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: var(--s-sm);
  font-family: var(--font-mono); font-size: .75rem; letter-spacing: .02em;
  color: var(--text-muted); padding: 5px 12px; border: 1px solid var(--border-hi);
  border-radius: var(--r-full); background: var(--surface);
}
.badge .dot { width: 6px; height: 6px; border-radius: var(--r-full); background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* ── Hero ─────────────────────────────────────────────── */
.hero { position: relative; overflow: hidden; padding-block: clamp(64px, 12vw, 140px); text-align: center; }
#hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .18; z-index: 0; pointer-events: none; }
/* Light mode: the dark fluid shader reads as grey smudges on the cream ground.
   Hide it and use a warm amber radial coming in from the right (from the middle). */
:root[data-theme="light"] #hero-bg { display: none; }
:root[data-theme="light"] .hero { background: radial-gradient(ellipse 100% 120% at 100% 50%, rgba(217,119,6,.12), transparent 70%); }
.hero::after { /* vignette to keep text legible over shader */
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse 70% 60% at 50% 45%, transparent 30%, var(--bg) 90%);
}
.hero .wrap { position: relative; z-index: 2; }
.hero h1 { margin-block: var(--s-lg) var(--s-md); }
.hero .lead { font-size: 1.25rem; max-width: 620px; margin-inline: auto; }
.hero .sub { color: var(--accent); font-weight: 600; }
.hero-cta { display: flex; gap: var(--s-md); justify-content: center; margin-top: var(--s-xl); flex-wrap: wrap; }

/* ── Code block (always dark terminal) ────────────────── */
.code {
  background: var(--code-bg); color: var(--code-text); border: 1px solid var(--border);
  border-radius: var(--r-lg); font-family: var(--font-mono); font-size: .875rem; line-height: 1.6;
  text-align: left; overflow: hidden; box-shadow: var(--shadow-md);
}
.code-head { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.code-head .d { width: 11px; height: 11px; border-radius: var(--r-full); background: var(--border-hi); }
.code-head .name { margin-left: var(--s-sm); font-size: .75rem; color: var(--code-muted); }
.code pre { padding: var(--s-lg); overflow-x: auto; margin: 0; }
.code .k { color: var(--code-keyword); }
.code .s { color: var(--code-string); }
.code .c { color: var(--code-muted); }
.hero .code { max-width: 640px; margin: var(--s-xl) auto 0; }

/* ── Grid / cards ─────────────────────────────────────── */
.grid { display: grid; gap: var(--s-lg); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--s-lg); transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.card:hover { border-color: var(--border-hi); }
.card h3 { margin-bottom: var(--s-sm); }
.card p { font-size: .95rem; }
.card .icon { width: 32px; height: 32px; color: var(--accent); margin-bottom: var(--s-md); }
.pillar .num { font-family: var(--font-mono); color: var(--accent); font-size: .8rem; }

/* Project cards (portfolio) */
a.proj-card { display: block; }
a.proj-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.proj-card .top { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-md); }
.proj-card .tag { font-family: var(--font-mono); font-size: .7rem; color: var(--text-dim); border: 1px solid var(--border); border-radius: var(--r-full); padding: 3px 10px; }
.proj-card .tag.live { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.proj-card .arrow { color: var(--accent); transition: transform var(--dur) var(--ease); }
a.proj-card:hover .arrow { transform: translateX(3px); }

/* Stat cards */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s-md); }
.stat { text-align: center; padding: var(--s-lg); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--panel); }
.stat .n { font-size: 1.75rem; font-weight: 900; color: var(--accent); font-family: var(--font-mono); }
.stat .l { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }

/* ── Final CTA band ───────────────────────────────────── */
.cta-band { text-align: center; position: relative; overflow: hidden; border-top: 1px solid var(--border); }
.cta-band::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 60% 80% at 50% 0%, rgba(240,180,41,.10), transparent 70%); pointer-events: none; }
.cta-band .wrap { position: relative; }
.cta-band h2 { margin-bottom: var(--s-md); }
.cta-band .hero-cta { margin-top: var(--s-xl); }

/* ── Footer ───────────────────────────────────────────── */
.footer { border-top: 1px solid var(--border); padding-block: var(--s-2xl) var(--s-xl); color: var(--text-muted); }
.footer-top { display: flex; flex-wrap: wrap; gap: var(--s-xl); justify-content: space-between; }
.footer-links { display: flex; gap: var(--s-xl); flex-wrap: wrap; }
.footer-col { display: flex; flex-direction: column; gap: var(--s-sm); }
.footer-col .h { color: var(--text); font-weight: 600; font-size: .85rem; margin-bottom: 2px; }
.footer-col a { color: var(--text-muted); font-size: .9rem; transition: color var(--dur) var(--ease); }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { margin-top: var(--s-xl); padding-top: var(--s-lg); border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: var(--s-md); justify-content: space-between; font-size: .85rem; }
.footer .mono-note { font-family: var(--font-mono); font-size: .75rem; color: var(--text-dim); }

/* ── Constitution / article layout ────────────────────── */
.doc-hero { border-bottom: 1px solid var(--border); text-align: center; padding-block: var(--s-2xl); }
.doc-hero .meta { font-family: var(--font-mono); font-size: .75rem; color: var(--text-dim); margin-top: var(--s-md); }
.constitution { display: grid; grid-template-columns: 220px 1fr; gap: var(--s-2xl); align-items: start; }
.toc { position: sticky; top: 80px; font-size: .85rem; display: flex; flex-direction: column; gap: 6px; border-left: 1px solid var(--border); padding-left: var(--s-md); }
.toc a { color: var(--text-muted); padding: 2px 0; border-left: 2px solid transparent; margin-left: calc(-1 * var(--s-md) - 2px); padding-left: var(--s-md); transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--accent); font-weight: 600; border-left-color: var(--accent); }
.toc .t { color: var(--text); font-weight: 600; margin-top: var(--s-md); font-size: .8rem; }
.titre { margin-top: var(--s-2xl); }
.titre > .label { font-family: var(--font-mono); font-size: .75rem; letter-spacing: .15em; text-transform: uppercase; color: var(--accent); }
.titre > h2 { margin-top: var(--s-xs); margin-bottom: var(--s-lg); }
.article { padding: var(--s-lg) 0; border-top: 1px solid var(--border); }
.article h3 { margin-bottom: var(--s-sm); }
.article h3 .a-num { color: var(--accent); font-family: var(--font-mono); font-size: .85rem; margin-right: var(--s-sm); }
.article p + p { margin-top: var(--s-md); }
.preamble { font-size: 1.05rem; }
.preamble p { color: var(--text); }
.laws { list-style: none; counter-reset: law; padding: 0; display: grid; gap: var(--s-md); }
.laws li { counter-increment: law; padding-left: 2.5rem; position: relative; color: var(--text-muted); }
.laws li::before { content: counter(law, upper-roman); position: absolute; left: 0; top: 0; font-family: var(--font-mono); color: var(--accent); font-size: .85rem; font-weight: 600; }

/* ── Project detail page ──────────────────────────────── */
.proj-hero { border-bottom: 1px solid var(--border); padding-block: var(--s-2xl); }
.proj-hero .kicker { display: flex; align-items: center; gap: var(--s-md); margin-bottom: var(--s-md); }
.proj-hero .units { font-family: var(--font-mono); font-size: .8rem; color: var(--text-muted); }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s-md); margin-top: var(--s-xl); }
.meta-grid .m { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-md); background: var(--panel); }
.meta-grid .m .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); font-family: var(--font-mono); }
.meta-grid .m .v { color: var(--text); font-weight: 600; margin-top: 4px; }
.feature-list { list-style: none; padding: 0; display: grid; gap: var(--s-md); }
.feature-list li { padding-left: 1.75rem; position: relative; color: var(--text-muted); }
.feature-list li::before { content: ""; position: absolute; left: 0; top: .55em; width: 8px; height: 8px; background: var(--accent); border-radius: 2px; transform: rotate(45deg); }

/* ── Reveal animation (AI_Animation idiom, authored) ──── */
[data-reveal] { opacity: 0; transform: translateY(12px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
[data-reveal].in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 820px) {
  .nav-links { display: none; }
  .constitution { grid-template-columns: 1fr; }
  .toc { display: none; }
}
.portfolio-note { font-family: var(--font-mono); font-size: .8rem; color: var(--text-dim); margin-top: var(--s-lg); }
