/* ============================================================
   VPS Infrastructure — Engineering Case Study
   Design tokens → base → layout → components
   No frameworks, no build step, no external requests.
   ============================================================ */

/* ---------- Tokens (dark is the primary design) ---------- */
:root {
  /* surfaces */
  --bg:            #0b0e13;
  --bg-alt:        #0e1219;
  --surface:       #12171f;
  --surface-2:     #161c26;
  --surface-3:     #1b2230;
  --line:          #222a37;
  --line-soft:     #1a212c;

  /* text */
  --text:          #e6ebf2;
  --text-2:        #a7b2c2;
  --text-3:        #74808f;

  /* accents */
  --accent:        #52d0b0;   /* operational / primary */
  --accent-dim:    #2f7a68;
  --accent-bg:     rgba(82, 208, 176, .10);
  --warn:          #e3b341;   /* in progress */
  --warn-bg:       rgba(227, 179, 65, .10);
  --plan:          #7d9ec9;   /* planned */
  --plan-bg:       rgba(125, 158, 201, .10);
  --focus:         #7fd6ff;

  /* type */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* metrics */
  --wrap: 1160px;
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 16px;
  --pad-section: clamp(3.5rem, 7vw, 6.5rem);
}

/* Light theme for users who prefer it. Same structure, inverted surfaces. */
@media (prefers-color-scheme: light) {
  :root {
    --bg:        #f7f8fa;
    --bg-alt:    #eef1f5;
    --surface:   #ffffff;
    --surface-2: #f4f6f9;
    --surface-3: #eaeef3;
    --line:      #d9dfe7;
    --line-soft: #e6eaf0;

    --text:      #131922;
    --text-2:    #4a5568;
    --text-3:    #6b7688;

    --accent:     #0f7a63;
    --accent-dim: #0f7a63;
    --accent-bg:  rgba(15, 122, 99, .09);
    --warn:       #8a6100;
    --warn-bg:    rgba(138, 97, 0, .09);
    --plan:       #3a608f;
    --plan-bg:    rgba(58, 96, 143, .09);
    --focus:      #1063a8;
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.62;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { line-height: 1.18; margin: 0; letter-spacing: -0.018em; font-weight: 640; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -0.01em; }
.small { font-size: .82em; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: .6rem 1rem; transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 4vw, 2.25rem);
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, background .2s ease;
}
.site-header.is-stuck { border-bottom-color: var(--line); }

.header-inner {
  display: flex; align-items: center; gap: 1.25rem;
  min-height: 62px;
}

.brand { display: flex; align-items: center; gap: .65rem; color: var(--text); flex: 0 0 auto; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; flex: 0 0 auto;
  background: linear-gradient(145deg, var(--accent), var(--accent-dim));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}
.brand-text { display: flex; flex-direction: column; }
.brand-title { font-weight: 640; font-size: .95rem; letter-spacing: -0.01em; }
.brand-sub { font-size: .72rem; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; }

.site-nav { margin-left: auto; }
.site-nav ul { display: flex; gap: .2rem; }
.site-nav a {
  display: block; padding: .42rem .62rem; border-radius: var(--r-sm);
  color: var(--text-2); font-size: .855rem; white-space: nowrap;
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.site-nav a.is-active { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }

.header-cta { margin-left: .35rem; flex: 0 0 auto; }

/* language selector — EN | PT */
.lang-switch {
  display: flex; align-items: center; gap: .1rem;
  flex: 0 0 auto; margin-left: -.55rem;
}
.lang-btn {
  padding: .3rem .42rem; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-3); cursor: pointer;
  font: inherit; font-size: .78rem; font-weight: 600;
  letter-spacing: .06em; line-height: 1;
}
.lang-btn:hover { color: var(--text-2); background: var(--surface-2); }
.lang-btn.is-active { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.lang-sep { color: var(--line); font-size: .78rem; user-select: none; }

/* mobile menu button */
.nav-toggle {
  display: none; margin-left: auto;
  width: 40px; height: 36px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); cursor: pointer; padding: 0;
}
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 16px; height: 1.5px; background: currentColor;
  margin-inline: auto; position: relative; border-radius: 2px;
}
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -5px; }
.nav-toggle-bars::after  { top: 5px; }

.mobile-nav { border-top: 1px solid var(--line); background: var(--bg); }
.mobile-nav ul { padding: .5rem clamp(1.1rem, 4vw, 2.25rem) 1rem; }
.mobile-nav a {
  display: block; padding: .68rem .2rem; color: var(--text-2);
  border-bottom: 1px solid var(--line-soft); font-size: .95rem;
}
.mobile-nav a:hover { color: var(--text); text-decoration: none; }

/* ============================================================
   Buttons / badges / chips
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.15rem; border-radius: var(--r);
  font-size: .93rem; font-weight: 560; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { text-decoration: none; background: var(--surface-3); transform: translateY(-1px); }
.btn-primary {
  background: var(--accent); color: #06231d; border-color: transparent; font-weight: 620;
}
@media (prefers-color-scheme: light) { .btn-primary { color: #ffffff; } }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: .42rem .75rem; font-size: .84rem; }
.arrow { font-size: .9em; opacity: .8; }

.badge {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .2rem .6rem; border-radius: 999px;
  font-size: .74rem; font-weight: 600; letter-spacing: .02em;
  white-space: nowrap; border: 1px solid;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok   { color: var(--accent); background: var(--accent-bg); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.badge-wip  { color: var(--warn);   background: var(--warn-bg);   border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.badge-plan { color: var(--plan);   background: var(--plan-bg);   border-color: color-mix(in srgb, var(--plan) 30%, transparent); }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips li {
  font-family: var(--mono); font-size: .74rem; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--line-soft);
  padding: .22rem .55rem; border-radius: var(--r-sm);
}
.chips-lg li { font-size: .82rem; padding: .35rem .7rem; font-family: var(--font); }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  padding-block: clamp(3.5rem, 9vw, 6.5rem) clamp(3rem, 6vw, 5rem);
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(90ch 40ch at 12% -18%, var(--accent-bg), transparent 62%),
    var(--bg);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(70ch 34ch at 50% 0%, #000, transparent 75%);
  -webkit-mask-image: radial-gradient(70ch 34ch at 50% 0%, #000, transparent 75%);
}
.hero > .wrap { position: relative; z-index: 1; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--mono); font-size: .78rem; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--line);
  padding: .3rem .75rem; border-radius: 999px; margin-bottom: 1.6rem;
}
.eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
  animation: pulse 2.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

.hero h1 {
  font-size: clamp(2.1rem, 5.6vw, 3.5rem);
  letter-spacing: -0.032em;
  max-width: 18ch;
  margin-bottom: 1.35rem;
}
.lede {
  font-size: clamp(1.02rem, 1.5vw, 1.15rem);
  color: var(--text-2); max-width: 68ch;
}
.lede strong { color: var(--text); font-weight: 600; }

.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }

.hero-facts {
  display: grid; gap: 1px; margin: 3rem 0 0;
  grid-template-columns: repeat(auto-fit, minmax(min(215px, 100%), 1fr));
  background: var(--line-soft);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden;
}
.fact { background: var(--surface); padding: 1.25rem 1.3rem; }
.fact dt {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-3); margin-bottom: .5rem;
}
.fact dd { margin: 0 0 .45rem; font-size: 1.15rem; font-weight: 620; letter-spacing: -0.01em; color: var(--text); }
.fact dd.mono { font-size: .78rem; font-weight: 500; line-height: 1.5; color: var(--accent); }
.fact p { font-size: .85rem; color: var(--text-2); }

.hero-note {
  margin-top: 1.5rem; font-size: .9rem; color: var(--text-2);
  border-left: 2px solid var(--warn); padding-left: .95rem;
  max-width: 78ch;
}
.hero-note strong { color: var(--warn); }

/* ============================================================
   Section scaffolding
   ============================================================ */
.section { padding-block: var(--pad-section); border-bottom: 1px solid var(--line); }
.section-alt { background: var(--bg-alt); }

.section-head { max-width: 72ch; margin-bottom: clamp(2rem, 4vw, 3rem); }
.section-kicker {
  font-family: var(--mono); font-size: .76rem; letter-spacing: .06em;
  color: var(--text-3); text-transform: uppercase; margin-bottom: .7rem;
}
.section-head h2 {
  font-size: clamp(1.6rem, 3.4vw, 2.25rem);
  letter-spacing: -0.026em; margin-bottom: .85rem;
}
.section-lede { color: var(--text-2); font-size: 1.02rem; }

/* ============================================================
   Architecture diagram (pure HTML/CSS)
   ============================================================ */
.diagram {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(1.1rem, 3vw, 2.25rem);
}
.flow { display: flex; flex-direction: column; align-items: stretch; }
.flow-col { display: flex; justify-content: center; }

.node {
  display: flex; flex-direction: column; gap: .18rem;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r); padding: .8rem 1rem;
  min-width: 0;
}
.node-kind {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-3);
}
.node-name { font-weight: 620; font-size: .98rem; letter-spacing: -0.012em; }
.node-desc { font-size: .82rem; color: var(--text-2); line-height: 1.45; }

.node-net { background: var(--surface-3); text-align: center; align-items: center; min-width: 220px; }
.node-ssh   { border-left: 2px solid var(--plan); }
.node-proxy { border-left: 2px solid var(--accent); background: var(--surface-3); }
.node-app   { border-left: 2px solid var(--line); }
.node-agent, .node-timer { border-left: 2px solid var(--warn); }

.node-row {
  display: grid; gap: .7rem;
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
}

.flow-link {
  display: flex; justify-content: center; gap: 3rem;
  position: relative; padding-block: 1.35rem;
}
.flow-link::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0;
  width: 1px; background: linear-gradient(var(--line), var(--accent-dim));
}
.flow-link.flow-split::before { background: linear-gradient(var(--accent-dim), var(--line)); }
.flow-label {
  position: relative; z-index: 1;
  font-family: var(--mono); font-size: .72rem; color: var(--text-3);
  background: var(--surface); padding: .1rem .55rem; border-radius: 999px;
  border: 1px solid var(--line-soft); align-self: center;
}

.zone {
  border: 1px dashed var(--line); border-radius: var(--r-lg);
  padding: 1rem; width: 100%;
  display: flex; flex-direction: column; gap: .7rem;
}
.zone-title {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-3);
}
.zone-title.mono { text-transform: none; letter-spacing: 0; }
.zone-foot { font-family: var(--mono); font-size: .72rem; color: var(--text-3); }
.zone-edge { background: color-mix(in srgb, var(--surface) 60%, transparent); }
.zone-host { background: color-mix(in srgb, var(--surface) 45%, transparent); border-style: solid; }
.zone-docker { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.zone-net { border-color: var(--accent-dim); background: var(--accent-bg); }
.zone-systemd { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }

.callout-grid {
  display: grid; gap: 1rem; margin-top: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
}
.callout {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 1.15rem 1.25rem;
}
.callout h3 { font-size: .98rem; margin-bottom: .45rem; }
.callout p { font-size: .9rem; color: var(--text-2); }

/* ============================================================
   Service cards
   ============================================================ */
.card-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr));
}
.card {
  display: flex; flex-direction: column; gap: .7rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.4rem;
  transition: border-color .18s ease, transform .18s ease;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); transform: translateY(-2px); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.card-top h3 { font-size: 1.08rem; }
.card-role {
  font-family: var(--mono); font-size: .78rem; color: var(--accent);
  margin-top: -.35rem;
}
.card p:not(.card-role) { font-size: .92rem; color: var(--text-2); }
.card .chips { margin-top: auto; padding-top: .3rem; }
.card-wide { grid-column: 1 / -1; }

/* ============================================================
   Security layers
   ============================================================ */
.layer-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr));
}
.layer {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.35rem;
}
.layer h3 {
  display: flex; align-items: baseline; gap: .6rem;
  font-size: 1.02rem; margin-bottom: .9rem;
  padding-bottom: .8rem; border-bottom: 1px solid var(--line-soft);
}
.layer-num { font-family: var(--mono); font-size: .78rem; color: var(--accent); }
.layer-open { border-color: color-mix(in srgb, var(--warn) 32%, var(--line)); background: var(--surface); }
.layer-open .layer-num { color: var(--warn); }

.ticks { display: flex; flex-direction: column; gap: .6rem; }
.ticks li {
  position: relative; padding-left: 1.4rem;
  font-size: .91rem; color: var(--text-2);
}
.ticks li::before {
  content: ""; position: absolute; left: 0; top: .52em;
  width: 8px; height: 8px; border-radius: 2px;
  background: var(--accent-bg);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}
.ticks-open li::before { background: var(--warn-bg); box-shadow: inset 0 0 0 1.5px var(--warn); }
.ticks strong { color: var(--text); }
.two-col { columns: 2; column-gap: 2.5rem; display: block; }
.two-col li { break-inside: avoid; margin-bottom: .75rem; }

/* ============================================================
   Panels / split / notices
   ============================================================ */
.split {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
}
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.5rem;
  display: flex; flex-direction: column; gap: .8rem;
}
.panel-kicker {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .07em;
  text-transform: uppercase; color: var(--accent);
}
.panel h3 { font-size: 1.1rem; }
.panel p { font-size: .93rem; color: var(--text-2); }
.panel-note {
  font-size: .87rem !important; color: var(--text-3) !important;
  border-left: 2px solid var(--line); padding-left: .9rem;
}

.notice {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r); padding: 1.3rem 1.4rem;
}
.notice h3 { font-size: 1.02rem; margin-bottom: .5rem; }
.notice p { font-size: .92rem; color: var(--text-2); }
.notice-tag {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .07em;
  text-transform: uppercase; color: var(--accent); margin-bottom: .55rem !important;
}
.notice-warn { border-left-color: var(--warn); margin-top: 1rem; }
.notice-warn .notice-tag { color: var(--warn); }
.notice-warn strong { color: var(--text); }
.notice-key { border-left-color: var(--warn); }
.notice-key .notice-tag { color: var(--warn); }

/* validated failure test */
.proof {
  margin-top: 1rem;
  background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: var(--r-lg); padding: 1.5rem;
}
.proof-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.proof-head h3 { font-size: 1.08rem; }
.steps {
  display: grid; gap: .6rem;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
}
.steps li {
  display: flex; align-items: center; gap: .6rem;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: .65rem .8rem;
  font-size: .88rem; color: var(--text-2);
}
.step-n {
  flex: 0 0 auto; width: 21px; height: 21px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-bg); color: var(--accent);
  font-family: var(--mono); font-size: .72rem; font-weight: 700;
}
.proof-note { margin-top: 1.1rem; font-size: .89rem; color: var(--text-3); }

/* ============================================================
   Backup / DR
   ============================================================ */
.status-split {
  display: grid; gap: 1rem; margin-bottom: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
}
.status-col {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.5rem;
}
.status-col h3 { margin-bottom: 1rem; }
.status-done { border-top: 2px solid var(--accent); }
.status-planned { border-top: 2px solid var(--warn); }

.pipeline-wrap {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.5rem; margin-bottom: 1.5rem;
}
.pipeline-head {
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: 1.2rem;
}
.pipeline-head h3 { font-size: 1.08rem; }
.pipeline {
  display: grid; gap: .55rem;
  grid-template-columns: repeat(auto-fit, minmax(min(158px, 100%), 1fr));
}
.pipe-node {
  display: flex; flex-direction: column; gap: .2rem;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: .8rem .9rem;
  position: relative;
}
.pipe-i {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-3);
}
.pipe-t { font-weight: 600; font-size: .93rem; }
.pipe-d { font-size: .8rem; color: var(--text-3); line-height: 1.45; }
.pipe-gate {
  border-color: color-mix(in srgb, var(--warn) 42%, transparent);
  background: var(--warn-bg);
}
.pipe-gate .pipe-i, .pipe-gate .pipe-t { color: var(--warn); }

/* ============================================================
   AI method loop
   ============================================================ */
.loop { margin-bottom: 1.5rem; }
.loop-steps {
  display: grid; gap: .8rem;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  counter-reset: loop;
}
.loop-step {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.25rem;
  display: flex; flex-direction: column; gap: .4rem;
  position: relative;
}
.loop-n {
  font-family: var(--mono); font-size: .74rem; color: var(--accent);
  letter-spacing: .05em;
}
.loop-step h3 { font-size: 1rem; }
.loop-step p { font-size: .88rem; color: var(--text-2); }
.loop-gate { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: var(--surface-2); }
.loop-reject {
  font-size: .8rem !important; color: var(--warn) !important;
  font-family: var(--mono); margin-top: auto; padding-top: .3rem;
}

.quote {
  margin: 0 0 1.5rem; padding: 1.6rem 1.75rem;
  background: var(--surface-2); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: var(--r);
}
.quote p {
  font-size: clamp(1.05rem, 2.2vw, 1.35rem); font-weight: 560;
  letter-spacing: -0.015em; margin-bottom: .7rem;
}
.quote footer { font-size: .89rem; color: var(--text-3); }

.boundaries {
  margin-top: 1rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.5rem;
}
.boundaries h3 { font-size: 1rem; margin-bottom: 1rem; }
.boundaries-note { margin-top: 1.1rem; font-size: .89rem; color: var(--text-2); max-width: 80ch; }

/* ============================================================
   Validation stories
   ============================================================ */
.stories {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
}
.story {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.5rem;
  display: flex; flex-direction: column; gap: .8rem;
}
.story-tag {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent);
}
.story h3 { font-size: 1.1rem; }
.story p { font-size: .92rem; color: var(--text-2); }
.story-out {
  margin-top: auto; padding-top: .9rem; border-top: 1px solid var(--line-soft);
  font-size: .89rem !important;
}
.story-out strong { color: var(--text); }

.code { position: relative; }
.code pre {
  margin: 0; overflow-x: auto;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r); padding: .95rem 1rem;
}
.code code {
  font-family: var(--mono); font-size: .8rem; line-height: 1.7;
  color: var(--text-2); white-space: pre;
}
.copy-btn {
  position: absolute; top: .5rem; right: .5rem;
  font-family: var(--font); font-size: .72rem;
  padding: .25rem .55rem; border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--line); cursor: pointer;
  opacity: 0; transition: opacity .15s ease, color .15s ease;
}
.code:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { color: var(--text); }
.copy-btn.is-copied { color: var(--accent); border-color: var(--accent-dim); opacity: 1; }

.verified-list {
  margin-top: 1.5rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.5rem;
}
.verified-list h3 { font-size: 1rem; margin-bottom: 1.1rem; }

/* ============================================================
   Status table
   ============================================================ */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); }
.status-table { width: 100%; border-collapse: collapse; background: var(--surface); min-width: 480px; }
.status-table th, .status-table td { text-align: left; padding: .85rem 1.25rem; }
.status-table thead th {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-3); font-weight: 500;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.status-table tbody tr { border-bottom: 1px solid var(--line-soft); }
.status-table tbody tr:last-child { border-bottom: 0; }
.status-table tbody th { font-weight: 500; font-size: .93rem; color: var(--text); }
.status-table tbody td { width: 1%; white-space: nowrap; }
.status-foot { margin-top: 1.2rem; font-size: .92rem; color: var(--text-2); max-width: 80ch; }

/* ============================================================
   Docs / CTA / footer
   ============================================================ */
.doc-grid {
  display: grid; gap: .7rem;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
}
.doc {
  display: flex; flex-direction: column; gap: .2rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: .95rem 1.1rem;
  color: var(--text);
  transition: border-color .15s ease, background .15s ease;
}
.doc:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: var(--surface-2); }
.doc-name { font-family: var(--mono); font-size: .88rem; color: var(--accent); }
.doc-desc { font-size: .85rem; color: var(--text-2); }

.cta {
  margin-top: 2rem; padding: 1.75rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1.75rem;
  flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.cta h3 { font-size: 1.05rem; margin-bottom: .5rem; }
.cta p { font-size: .92rem; color: var(--text-2); max-width: 70ch; }

.site-footer { padding-block: 2.25rem; background: var(--bg); }
.footer-inner {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1.25rem; flex-wrap: wrap;
}
.footer-inner p { font-size: .84rem; color: var(--text-3); max-width: 68ch; }
.footer-inner a { font-family: var(--mono); font-size: .82rem; }

/* ============================================================
   Reveal animation (progressive enhancement)
   ============================================================ */
.js .reveal {
  opacity: 0; transform: translateY(14px);
  transition: opacity .5s ease, transform .5s ease;
}
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ============================================================
   Responsive
   ============================================================ */
/* Portuguese section names are longer: buy the desktop nav some room
   before it has to collapse, and collapse it a little earlier. */
html[lang="pt-BR"] .site-nav a { padding-inline: .5rem; font-size: .83rem; }

@media (max-width: 1290px) {
  html[lang="pt-BR"] .site-nav { display: none; }
  html[lang="pt-BR"] .header-cta { margin-left: auto; }
  html[lang="pt-BR"] .nav-toggle { display: block; margin-left: .35rem; }
}

/* The full nav needs ~1165px of header width; below that it used to
   overflow the wrap instead of collapsing. Collapse before it does. */
@media (max-width: 1170px) {
  .site-nav { display: none; }
  .header-cta { margin-left: auto; }
  .nav-toggle { display: block; margin-left: .35rem; }
}

@media (max-width: 720px) {
  html { scroll-padding-top: 76px; }
  .header-inner { gap: .6rem; }
  .lang-switch { margin-left: 0; }
  .brand-sub { display: none; }
  .header-cta span { display: none; }
  .header-cta { padding: .42rem .55rem; }
  .two-col { columns: 1; }
  .flow-link { padding-block: 1.05rem; gap: 1.25rem; }
  .zone { padding: .8rem; }
  .diagram { padding: 1rem; }
  .cta { flex-direction: column; align-items: flex-start; }
  .cta .btn { width: 100%; justify-content: center; }
  .hero-actions .btn { width: 100%; justify-content: center; }
  .copy-btn { opacity: 1; }
}

/* Below this the wordmark cannot share the bar with the controls; the mark
   stays as the home link and keeps its accessible name from aria-label. */
@media (max-width: 330px) {
  .brand-text { display: none; }
}

@media (max-width: 420px) {
  .header-inner { gap: .35rem; }
  .lang-switch { gap: 0; }
  .lang-btn { padding: .28rem .24rem; }
  .node-net { min-width: 0; width: 100%; }
  .flow-link.flow-split { flex-direction: column; align-items: center; gap: .4rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}

@media print {
  .site-header, .nav-toggle, .copy-btn, .hero::after { display: none !important; }
  body { background: #fff; color: #000; }
  .section { break-inside: avoid; }
}
