/* Boxha Boox — legal document shell stylesheet.
   Ported from the approved wrapper preview (warm-gold accent, system-sans, dark/light via
   prefers-color-scheme). Production adaptation: the preview's two-language toggle (buttons +
   [hidden] + inline JS) is replaced server-side — the shell renders exactly one <article> per
   request, and the language switch is two plain anchors (?lang=es / ?lang=en). No JS ships here;
   CSP on the rendered page forbids inline <style> too, hence this external file. */

:root {
  /* warm, brand-derived neutrals + Boxha gold */
  --ground: #FCFBF8;
  --surface: #FFFFFF;
  --ink: #1A1712;
  --ink-soft: #423B31;
  --muted: #6B6357;
  --hairline: #ECE7DE;
  --accent: #B67514;        /* deep gold — AA on light for text/links */
  --accent-bright: #D89A37; /* brand gold — decorative */
  --accent-wash: #F6EEDD;   /* gold tint for the active pill on light */
  --focus: #B67514;

  --measure: 66ch;
  --shell: 46rem;
  --radius: 14px;
  --step--1: 0.8125rem;
  --step-0: 1.0625rem;
  --step-1: 1.2rem;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #15130F;
    --surface: #1E1B16;
    --ink: #EFEAE0;
    --ink-soft: #CFC7B8;
    --muted: #A79E8F;
    --hairline: #2C2822;
    --accent: #E2A648;
    --accent-bright: #E2A648;
    --accent-wash: #2A2318;
    --focus: #E2A648;
  }
}
/* viewer toggle wins in both directions */
:root[data-theme="light"] {
  --ground: #FCFBF8; --surface: #FFFFFF; --ink: #1A1712; --ink-soft: #423B31;
  --muted: #6B6357; --hairline: #ECE7DE; --accent: #B67514; --accent-bright: #D89A37;
  --accent-wash: #F6EEDD; --focus: #B67514;
}
:root[data-theme="dark"] {
  --ground: #15130F; --surface: #1E1B16; --ink: #EFEAE0; --ink-soft: #CFC7B8;
  --muted: #A79E8F; --hairline: #2C2822; --accent: #E2A648; --accent-bright: #E2A648;
  --accent-wash: #2A2318; --focus: #E2A648;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- brand bar ---------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--ground) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.appbar__inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0.7rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand__mark {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--accent-bright), var(--accent));
  color: #1A1712;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.02em;
  box-shadow: 0 1px 0 rgba(255,255,255,0.35) inset;
}
.brand__name { font-weight: 650; font-size: 0.95rem; letter-spacing: -0.01em; }
.brand__name span { color: var(--muted); font-weight: 500; }

/* segmented language switch — two anchors, no JS */
.langswitch {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 999px;
}
.langswitch__opt {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}
.langswitch__opt:hover { color: var(--ink); }
.langswitch__opt.is-active {
  background: var(--accent-wash);
  color: var(--accent);
}

/* ---------- document ---------- */
main { max-width: var(--shell); margin: 0 auto; padding: 0 1.5rem; }
.doc { padding: 3.25rem 0 1rem; }

.eyebrow {
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.9rem;
}
.doc__title {
  font-size: clamp(1.75rem, 1.25rem + 2.2vw, 2.4rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0 0 0.9rem;
  max-width: 22ch;
}
.doc__meta {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: var(--step--1);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin: 0;
}
.doc__meta .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--accent-bright); }
.rule { height: 1px; background: var(--hairline); border: 0; margin: 1.75rem 0 0; }

.doc__body { counter-reset: clause; max-width: var(--measure); }
.doc__body h2 {
  counter-increment: clause;
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  font-size: var(--step-1);
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.3;
  text-wrap: balance;
  margin: 2.5rem 0 0.6rem;
  scroll-margin-top: 5rem;
}
.doc__body h2::before {
  content: counter(clause, decimal-leading-zero);
  flex: none;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-wash);
  padding: 0.2em 0.5em;
  border-radius: 7px;
  transform: translateY(-0.1em);
}
.doc__body p { margin: 0 0 0.9rem; color: var(--ink-soft); }
.doc__body ul { margin: 0 0 0.9rem; padding-left: 0; list-style: none; display: grid; gap: 0.5rem; }
.doc__body li {
  position: relative;
  padding-left: 1.35rem;
  color: var(--ink-soft);
}
.doc__body li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.72em;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-bright);
}
.doc__body a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.doc__body a:hover { border-bottom-color: var(--accent); }

.doc__foot {
  max-width: var(--measure);
  margin-top: 2.75rem;
  padding: 1.5rem 0 3.5rem;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: var(--step--1);
  display: grid;
  gap: 0.3rem;
}
.doc__foot strong { color: var(--ink-soft); font-weight: 600; }
.doc__foot a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.doc__foot a:hover { border-bottom-color: var(--accent); }

/* ---------- index ---------- */
/* Served at the legal path prefix itself: one row per published document type. Rows are plain
   anchors — no JS anywhere on these pages — so the whole row is made clickable by stretching the
   link over the item with an ::after overlay. */
.index__list {
  max-width: var(--measure);
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.75rem;
}
.index__item {
  position: relative;
  display: grid;
  gap: 0.25rem;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  transition: border-color 0.18s ease;
}
.index__item:hover { border-color: var(--accent-bright); }
.index__link {
  color: var(--ink);
  font-size: var(--step-1);
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.index__link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.index__item:hover .index__link { color: var(--accent); }
.index__meta {
  font-size: var(--step--1);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- 404 ---------- */
.notfound { padding: 5rem 0; text-align: left; }
.notfound__actions { margin: 1.5rem 0 0; }
.notfound__back {
  color: var(--accent);
  font-size: var(--step--1);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.notfound__back:hover { border-bottom-color: var(--accent); }
.notfound__code {
  font-family: var(--mono);
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-wash);
  display: inline-block;
  padding: 0.2em 0.6em;
  border-radius: 7px;
  margin: 0 0 1rem;
}

:where(a, button):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
@media (max-width: 640px) {
  .appbar__inner, main { padding-left: 1.15rem; padding-right: 1.15rem; }
  .brand__name span { display: none; }
  .doc { padding-top: 2.5rem; }
}
