/* ============================================================
   R BRAGA ENGENHARIA — tokens, base, utilities
   ============================================================ */

:root {
  /* accent is overridable by Tweaks */
  --accent: #185FA5;
  --accent-ink: #0E3F70;       /* darker accent for text on light */
  --accent-soft: color-mix(in oklab, var(--accent) 12%, white);
  --accent-line: color-mix(in oklab, var(--accent) 28%, white);

  /* structural gray (secondary) */
  --steel: #5F5E5A;

  /* light theme surfaces */
  --bg:        #F4F6F8;
  --surface:   #FFFFFF;
  --surface-2: #EEF1F4;
  --ink:       #14181E;
  --ink-2:     #41464E;
  --ink-3:     #6B7178;
  --hair:      #DDE2E7;        /* hairline borders */
  --hair-2:    #E7EBEF;
  --grid-line: rgba(20, 24, 30, 0.045);

  /* type */
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 22px;

  /* spacing rhythm */
  --pad-x: clamp(20px, 5vw, 88px);
  --sec-y: clamp(64px, 8vw, 132px);
  --maxw: 1200px;

  /* shadows — soft, technical, never flashy */
  --sh-sm: 0 1px 2px rgba(20,24,30,.05), 0 1px 1px rgba(20,24,30,.04);
  --sh-md: 0 2px 4px rgba(20,24,30,.04), 0 8px 24px rgba(20,24,30,.06);
  --sh-lg: 0 4px 8px rgba(20,24,30,.05), 0 24px 56px rgba(20,24,30,.10);

  --ease: cubic-bezier(.22,.61,.36,1);
}

[data-theme="dark"] {
  --accent-ink: color-mix(in oklab, var(--accent) 58%, white);
  --accent-soft: color-mix(in oklab, var(--accent) 22%, #0E1116);
  --accent-line: color-mix(in oklab, var(--accent) 42%, #0E1116);
  --steel: #9A9892;

  --bg:        #0D1014;
  --surface:   #14181E;
  --surface-2: #1B2027;
  --ink:       #ECEEF1;
  --ink-2:     #AEB4BC;
  --ink-3:     #7C828B;
  --hair:      #262C34;
  --hair-2:    #21262E;
  --grid-line: rgba(255,255,255,0.035);

  --sh-sm: 0 1px 2px rgba(0,0,0,.4);
  --sh-md: 0 2px 4px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.45);
  --sh-lg: 0 4px 8px rgba(0,0,0,.35), 0 28px 64px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: "cv05" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* page wrapper: root stays transparent (host force-styles the root element);
   theme bg + text live on CHILD layers so var() resolves correctly */
.page { position: relative; min-height: 100vh; isolation: isolate; }
.page__bg {
  position: absolute; inset: 0; z-index: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  transition: background-color .4s var(--ease);
}
.page__content {
  position: relative; z-index: 1;
  color: var(--ink);
  transition: color .4s var(--ease);
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.02em; text-wrap: balance; line-height: 1.07; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; }

/* ---------- layout helpers ---------- */
.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad-x); width: 100%; }
.section { padding-block: var(--sec-y); position: relative; }

/* ---------- shared atoms ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 500;
}
.eyebrow::before {
  content: "";
  width: 18px; height: 1.5px;
  background: var(--accent);
  display: inline-block;
}

.h2 { font-size: clamp(28px, 4vw, 46px); }
.h2 + .lede { margin-top: 18px; max-width: 56ch; }
.lede { font-size: clamp(16px, 1.4vw, 19px); color: var(--ink-2); line-height: 1.55; }

/* mono micro label */
.mono-tag {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  text-transform: uppercase;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 560; letter-spacing: -0.01em;
  padding: 13px 22px; border-radius: var(--r-md);
  border: 1px solid transparent; cursor: pointer;
  transition: transform .18s var(--ease), background .2s var(--ease),
              box-shadow .2s var(--ease), border-color .2s var(--ease), color .2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 1px 2px rgba(20,24,30,.12), 0 6px 18px color-mix(in oklab, var(--accent) 30%, transparent);
}
.btn-primary:hover { box-shadow: 0 2px 4px rgba(20,24,30,.14), 0 12px 28px color-mix(in oklab, var(--accent) 40%, transparent); transform: translateY(-1px); }
.btn-ghost {
  background: var(--surface); color: var(--ink);
  border-color: var(--hair);
  box-shadow: var(--sh-sm);
}
.btn-ghost:hover { border-color: var(--accent-line); color: var(--accent-ink); transform: translateY(-1px); }
.btn svg { width: 17px; height: 17px; }

/* ---------- reveal animation ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  will-change: opacity, transform;
}
[data-reveal].in { opacity: 1; transform: none; }
[data-reveal][data-delay="1"] { transition-delay: .07s; }
[data-reveal][data-delay="2"] { transition-delay: .14s; }
[data-reveal][data-delay="3"] { transition-delay: .21s; }
[data-reveal][data-delay="4"] { transition-delay: .28s; }
[data-reveal][data-delay="5"] { transition-delay: .35s; }

/* reveal disabled (tweak off) */
[data-reveal-off] [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- image placeholders (labeled) ---------- */
.ph {
  position: relative;
  background-color: var(--surface-2);
  background-image: repeating-linear-gradient(
    -45deg,
    transparent, transparent 10px,
    color-mix(in oklab, var(--ink) 5%, transparent) 10px,
    color-mix(in oklab, var(--ink) 5%, transparent) 11px
  );
  border: 1px solid var(--hair);
  border-radius: var(--r-md);
  display: flex; align-items: flex-end;
  overflow: hidden;
}
.ph__tag {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: 6px;
  padding: 6px 10px;
  margin: 12px;
}

/* focus visibility */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

::selection { background: color-mix(in oklab, var(--accent) 26%, transparent); }
