:root {
  --bg: #0f1211;
  --surface: #171c1a;
  --raised: #1f2623;
  --ink: #e7e4da;
  --body: #c9c6bd;
  --muted: #8d958f;
  --line: #2b3430;
  --amber: #e8a33d;
  --ok: #8fc29c;
  --bad: #e5484d;
  --sans: 'Schibsted Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: 'Martian Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --pad: clamp(16px, 4.5vw, 64px);
  --eixample: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56'%3E%3Cpath d='M18 5h20l13 13v20L38 51H18L5 38V18z' fill='none' stroke='%232b3430'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-decoration-color: var(--amber); text-underline-offset: 3px; }
a:hover { color: var(--amber); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
[id] { scroll-margin-top: 72px; }
p { margin: 0; }
h1, h2 { margin: 0; font-weight: 500; letter-spacing: -0.03em; }
h1 { font-size: clamp(38px, 4.8vw, 64px); line-height: 1.03; max-width: 15ch; }
h2 { font-size: clamp(28px, 3.2vw, 42px); line-height: 1.08; max-width: 18ch; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.honey { position: absolute; left: -9999px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--amber); color: var(--bg); padding: 8px 12px; z-index: 300; }
.skip:focus { left: 8px; }

.label, .site-nav a, .btn, .tag, .ref, .facts dt, .tick, .opt {
  font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase;
}
.label { color: var(--muted); display: block; }
.muted { color: var(--muted); }

/* Header */
.site-head { position: sticky; top: 0; z-index: 50; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 0 var(--pad); height: 60px; background: var(--bg); border-bottom: 1px solid var(--line); }
.wordmark { font: 600 18px var(--mono); letter-spacing: .01em; text-decoration: none; color: var(--ink); }
.cursor { color: var(--amber); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.site-nav { display: flex; align-items: center; gap: 28px; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--ink); }
.site-nav .nav-contact { color: var(--amber); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 20px; text-decoration: none; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; border-radius: 2px; }
.btn:hover { color: var(--ink); border-color: var(--muted); }
.btn-primary { border-color: var(--amber); color: var(--amber); }
.btn-primary:hover { background: var(--amber); color: var(--bg); border-color: var(--amber); }
.btn-full { width: 100%; margin-top: 16px; }
.btn[disabled] { opacity: .6; cursor: wait; }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); border-bottom: 1px solid var(--line); }
.hero-copy { padding: clamp(48px, 7vw, 96px) var(--pad); border-right: 1px solid var(--line); }
.hero-copy h1 { margin-top: 20px; }
.lede { margin-top: 26px; font-size: 19px; color: var(--body); max-width: 31em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }

/* Terminal / domain check */
.term { background: var(--surface); padding: clamp(24px, 3.5vw, 44px); min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.term-bar, .term-body { border: 1px solid var(--line); }
.term-bar { display: flex; align-items: center; gap: 14px; padding: 9px 14px; background: var(--raised); border-bottom: 0; font: 500 11px var(--mono); color: var(--muted); letter-spacing: .04em; }
.term-bar-r { margin-left: auto; }
.dots { display: flex; gap: 6px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.term-body { background: #0b0e0d; padding: 18px 18px 14px; }
.term-out { margin: 0; font: 400 12.5px/1.8 var(--mono); color: #cfcabd; white-space: pre; overflow-x: auto; min-height: 8em; }
.term-out .dim { color: var(--muted); }
.term-out .ok { color: var(--ok); }
.term-out .warn, .term-out .amb { color: var(--amber); }
.term-out .bad { color: var(--bad); }
.term-out .cmd { color: var(--ink); }
.term-input { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 6px 6px 6px 12px; background: var(--surface); border: 1px dashed var(--amber); border-radius: 2px; font: 500 13px var(--mono); }
.term-input:focus-within { border-style: solid; box-shadow: 0 0 0 3px rgba(232, 163, 61, .15); }
.term-input label { color: var(--ink); white-space: nowrap; font: inherit; text-transform: none; letter-spacing: 0; }
.term-input .ps1 { color: var(--ok); }
.term-input input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--amber); font: inherit; padding: 8px 0; outline: none; caret-color: var(--amber); }
.term-input input::placeholder { color: #8a928d; opacity: 1; animation: blink 1.1s steps(1) infinite; }
.term-input input:focus::placeholder { animation: none; color: #5f6762; }
.term-input input:focus-visible { outline: none; }
.term-input button { background: var(--amber); border: 1px solid var(--amber); color: var(--bg); padding: 8px 14px; cursor: pointer; border-radius: 2px; font: 600 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.term-input button:hover { background: transparent; color: var(--amber); }
.term-input button[disabled] { opacity: .6; cursor: wait; }

.lead { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.lead[hidden] { display: none; }
.lead-text { margin: 6px 0 14px; color: var(--body); font-size: 15px; }
.lead-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lead-fields .full { grid-column: 1 / -1; }

/* Fields */
.field { width: 100%; min-height: 46px; padding: 11px 13px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 2px; font: 400 16px/1.4 var(--sans); }
.field::placeholder { color: #8a928d; }
.field:focus { outline: none; border-color: var(--amber); }
textarea.field { min-height: 128px; resize: vertical; }
select.field { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 38px; }
.tick { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; color: var(--muted); text-transform: none; letter-spacing: .02em; line-height: 1.6; }
.tick input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--amber); flex: none; }
.opt { color: #8a928d; margin-left: 6px; }
.form-legal { margin-top: 14px; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.form-status { margin-top: 12px; font: 400 13px var(--mono); }
.form-status.error { color: var(--bad); }
.form-done { border: 1px solid var(--amber); padding: 22px; }
.form-done strong { display: block; font-weight: 500; font-size: 20px; margin-bottom: 6px; }
.form-done p { color: var(--body); }
.turnstile { margin-top: 14px; }
.turnstile:empty { margin-top: 0; }

/* Eixample divider: Barcelona's chamfered blocks */
.eixample { height: 112px; background: var(--eixample); background-size: 56px 56px; border-bottom: 1px solid var(--line); -webkit-mask-image: linear-gradient(90deg, #000 0%, rgba(0,0,0,.25) 70%, transparent); mask-image: linear-gradient(90deg, #000 0%, rgba(0,0,0,.25) 70%, transparent); }
.eixample-foot { height: 56px; border-top: 1px solid var(--line); border-bottom: 0; -webkit-mask-image: linear-gradient(270deg, #000, transparent 80%); mask-image: linear-gradient(270deg, #000, transparent 80%); }

/* Bands */
.band { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 80px); padding: clamp(56px, 8vw, 104px) var(--pad); border-bottom: 1px solid var(--line); }
.band-head h2 { margin-top: 14px; }
.band-head .muted { margin-top: 20px; max-width: 30em; }
.aside { grid-column: 2; color: var(--muted); font-size: 15px; max-width: 46em; }

/* Levels: stacked, each includes the one below */
.levels { border-top: 1px solid var(--line); }
.level { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 28px; padding: 26px 0; border-bottom: 1px solid var(--line); }
.level-name { font-size: 22px; font-weight: 500; letter-spacing: -0.015em; grid-row: span 2; display: flex; flex-direction: column; gap: 8px; }
.tag { color: var(--amber); }
.level-what { color: var(--body); }
.level-fit { color: var(--muted); font-size: 15px; }
.level-fit .label { display: inline; margin-right: 10px; color: #8a928d; }

/* Incident diagram */
.diagram { margin: 0; align-self: center; font: 400 13px/1.75 var(--mono); color: #cfcabd; background: var(--surface); border: 1px solid var(--line); padding: 28px 30px; overflow-x: auto; }
.diagram .amb { color: var(--amber); }

/* Regulations */
.regs { margin: 0; border-top: 1px solid var(--line); }
.regs > div { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 28px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.regs dt { font-size: 22px; font-weight: 500; letter-spacing: -0.015em; }
.regs dd { margin: 0; color: var(--body); }
.ref { display: block; color: var(--muted); margin-bottom: 4px; }

/* Contact */
.facts { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px 16px; margin: 36px 0 0; font-size: 15px; }
.facts dt { color: var(--muted); padding-top: 3px; }
.facts dd { margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .label { margin-bottom: 8px; }

/* Footer */
.site-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 40px; padding: 28px var(--pad) 40px; color: var(--muted); font-size: 14px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 22px; list-style: none; margin: 0; padding: 0; }
.foot-links a, .link-button { color: var(--muted); text-decoration: none; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.foot-links a:hover, .link-button:hover { color: var(--ink); }

/* Cookie banner */
.cookie-banner { position: fixed; left: 16px; bottom: 16px; right: 16px; max-width: 520px; z-index: 200; background: var(--raised); border: 1px solid var(--line); padding: 18px 20px; }
.cookie-banner p { font-size: 14px; color: var(--body); }
.cookie-actions, .dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.cookie-actions button, .dialog-actions button { flex: 1 1 auto; min-height: 42px; padding: 0 14px; background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: 2px; cursor: pointer; font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.cookie-actions button:hover, .dialog-actions button:hover { border-color: var(--amber); color: var(--amber); }

/* Dialogs */
dialog.legal-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 2px; }
dialog.legal-dialog::backdrop { background: rgba(5, 8, 7, .75); }
.dialog-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 22px; background: var(--surface); border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 20px; max-width: none; letter-spacing: -0.01em; }
.dialog-close { width: 40px; height: 40px; flex: none; background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: 2px; font-size: 20px; cursor: pointer; }
.dialog-body { padding: 20px 22px 26px; font-size: 15px; color: var(--body); }
.dialog-body h3 { margin: 22px 0 6px; color: var(--ink); font-size: 15px; font-weight: 500; }
.dialog-body h3:first-child { margin-top: 0; }
.dialog-body p, .dialog-body ul { margin: 0 0 10px; }
.dialog-body ul { padding-left: 20px; }
.dialog-body strong { color: var(--ink); font-weight: 500; }
.dialog-body .lang-switch { margin-bottom: 16px; }
.dialog-body .updated { margin-top: 20px; font-size: 13px; color: var(--muted); }
.dialog-actions { padding: 0 22px 20px; margin-top: 0; }
.pref-row { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.pref-row strong { display: block; }
.pref-row input { width: 20px; height: 20px; accent-color: var(--amber); flex: none; }
.table-wrap { overflow-x: auto; margin: 8px 0 12px; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-wrap th, .table-wrap td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-wrap th { color: var(--ink); font-weight: 500; }

/* Responsive */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .hero-copy { border-right: 0; border-bottom: 1px solid var(--line); }
  .band { grid-template-columns: 1fr; }
  .aside { grid-column: 1; }
}
@media (max-width: 680px) {
  .site-nav .nav-secondary { display: none; }
  .level, .regs > div { grid-template-columns: 1fr; gap: 6px; }
  .level-name { flex-direction: row; align-items: baseline; gap: 12px; grid-row: auto; }
  .form-grid, .lead-fields { grid-template-columns: 1fr; }
  .term-out, .diagram { font-size: 10.5px; }
  .term-input .ps1, .term-bar-r { display: none; }
  .term-body { padding: 14px 12px 12px; }
  .term-input label::before { content: '$ '; color: var(--ok); }
  .term-input { font-size: 12px; }
  .hero-actions .btn { flex: 1 1 100%; }
  .eixample { height: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
