/* ESS Systems — tokens */
:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --ink: #14213d;
  --text: #1c2a44;
  --muted: #56657a;
  --line: #cbd3dc;
  --signal: #f2b705;
  --signal-ink: #3a2b00;
  --tint: #e2e7ee;
  --ok: #1f8a5b;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3rem;
  --step-2: 1.75rem;
  --step-3: clamp(2rem, 4vw, 2.75rem);
  --step-hero: clamp(4rem, 13vw, 9.5rem);

  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius-s: 4px;
  --radius-m: 10px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1726;
    --surface: #17223a;
    --ink: #e8edf5;
    --text: #d9e1ec;
    --muted: #9aa8bc;
    --line: #2a3854;
    --tint: #131d31;
    --ok: #4cc38a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1726;
  --surface: #17223a;
  --ink: #e8edf5;
  --text: #d9e1ec;
  --muted: #9aa8bc;
  --line: #2a3854;
  --tint: #131d31;
  --ok: #4cc38a;
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.1;
  margin: 0 0 0.5em;
}
h2 { font-size: var(--step-3); font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: var(--step-1); font-weight: 700; }
p { margin: 0 0 1em; max-width: 64ch; }

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

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

.skip {
  position: absolute; left: -9999px; top: 8px;
  background: var(--signal); color: var(--signal-ink);
  padding: 8px 12px; z-index: 100;
}
.skip:focus { left: 8px; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 800; font-size: 1.15rem;
  color: var(--ink); text-decoration: none;
}
.brand__mark { width: 26px; height: 26px; fill: var(--ink); }
.brand__mark rect:nth-child(2) { fill: var(--signal); }

.nav { display: flex; align-items: center; gap: 28px; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 600; }
.nav a:hover { color: var(--ink); }
.nav .nav__cta {
  color: var(--signal-ink); background: var(--signal);
  padding: 8px 14px; border-radius: var(--radius-s);
}
.nav .nav__cta:hover { color: var(--signal-ink); filter: brightness(1.05); }

.menu-toggle {
  display: none;
  font: inherit; font-weight: 600; color: var(--ink);
  background: none; border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 6px 12px; cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-block; text-decoration: none; font-weight: 600;
  padding: 13px 20px; border-radius: var(--radius-s);
  border: 2px solid transparent;
}
.btn--primary { background: var(--ink); color: var(--bg); }
.btn--primary:hover { background: color-mix(in srgb, var(--ink) 85%, var(--signal)); }
.btn--ghost { border-color: var(--ink); color: var(--ink); }
.btn--ghost:hover { background: var(--surface); }

/* Hero */
.hero { padding: clamp(48px, 9vw, 112px) 0 clamp(56px, 9vw, 104px); }
.hero__grid {
  display: grid; gap: clamp(40px, 6vw, 72px);
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: center;
}
.hero__title {
  font-size: var(--step-hero);
  font-weight: 800;
  line-height: 0.86;
  letter-spacing: -0.045em;
  margin-bottom: 0.3em;
}
.hero__lead { font-size: var(--step-1); color: var(--muted); max-width: 36ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* Flow panel: the one memorable element */
.flow {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 22px 22px 18px;
  box-shadow: 0 1px 0 var(--line), 12px 12px 0 var(--signal);
}
.flow__head {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; color: var(--ink);
  padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.flow__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); }
.flow__steps { list-style: none; margin: 0; padding: 8px 0 0; position: relative; }
.flow__steps li {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 12px 0; position: relative;
}
.flow__steps li:not(:last-child)::after {
  content: ""; position: absolute; left: 10px; top: 36px; bottom: -10px;
  width: 2px; background: var(--line);
}
.flow__steps strong { display: block; color: var(--ink); font-weight: 600; }
.flow__steps small { color: var(--muted); font-size: var(--step--1); }
.flow__tick {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--ok); background: var(--ok);
  position: relative;
}
.flow__tick::after {
  content: ""; position: absolute; left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid var(--surface); border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.flow__foot {
  margin: 8px 0 0; padding-top: 14px; border-top: 1px dashed var(--line);
  color: var(--muted); font-size: var(--step--1);
}

/* Sequenced reveal, only when JS is on and motion is allowed */
.js .flow__steps li { opacity: 0.35; transition: opacity 0.4s ease; }
.js .flow__steps li .flow__tick { background: transparent; border-color: var(--line); transition: background 0.3s, border-color 0.3s; }
.js .flow__steps li .flow__tick::after { opacity: 0; transition: opacity 0.3s; }
.js .flow__steps li.is-done { opacity: 1; }
.js .flow__steps li.is-done .flow__tick { background: var(--ok); border-color: var(--ok); }
.js .flow__steps li.is-done .flow__tick::after { opacity: 1; }

/* Sections */
.section { padding: clamp(64px, 9vw, 112px) 0; }
.section--tint { background: var(--tint); border-block: 1px solid var(--line); }
.section__head { margin-bottom: 40px; }
.section__head p { color: var(--muted); }

/* Systems: wide rows, not a card grid */
.systems { display: grid; gap: 0; border-top: 2px solid var(--ink); }
.system {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px); align-items: center;
  padding: 40px 0; border-bottom: 1px solid var(--line);
}
.system h3 { font-size: var(--step-2); letter-spacing: -0.01em; }
.system__problem span,
.system__solution span {
  display: block; font-weight: 600; color: var(--ink); font-size: var(--step--1);
}
.system__problem { color: var(--muted); }
.tags { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  font-size: var(--step--1); font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.system__link { font-weight: 600; color: var(--ink); text-decoration-color: var(--signal); text-decoration-thickness: 2px; text-underline-offset: 4px; }

.system__shot {
  width: 100%; aspect-ratio: 16 / 10; border-radius: var(--radius-m);
  border: 1px solid var(--line); object-fit: cover; display: block;
}
.system__shot--empty {
  display: grid; place-items: center;
  color: var(--muted); font-size: var(--step--1); font-weight: 600;
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, color-mix(in srgb, var(--line) 45%, transparent) 14px 15px),
    var(--surface);
  border-style: dashed;
}
.systems__note { margin-top: 32px; color: var(--muted); }
.systems__note a { color: var(--ink); font-weight: 600; }

/* Steps (a real sequence) */
.steps {
  list-style: none; margin: 0; padding: 0; counter-reset: step;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px;
}
.steps li { counter-increment: step; border-top: 2px solid var(--ink); padding-top: 16px; }
.steps li::before {
  content: counter(step);
  display: block; font-family: var(--font-display); font-weight: 800;
  font-size: 2.25rem; color: var(--signal); line-height: 1; margin-bottom: 10px;
  -webkit-text-stroke: 1px var(--ink);
}
.steps p { color: var(--muted); margin: 0; }

/* About */
.about { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.about__photo {
  aspect-ratio: 1; border-radius: var(--radius-m);
  background: var(--ink); color: var(--signal);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 4rem;
}
.about__photo img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }

/* Contact */
.section--ink { background: #14213d; color: #d9e1ec; }
.section--ink h2 { color: #ffffff; }
.contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: start; }
.contact__list { list-style: none; margin: 0; padding: 0; border-top: 1px solid #2f3e5e; }
.contact__list a {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px 0; border-bottom: 1px solid #2f3e5e;
  text-decoration: none; color: #ffffff; font-weight: 600;
}
.contact__list a span { color: #9aa8bc; font-weight: 400; }
.contact__list a:hover { color: var(--signal); }

/* Footer */
.footer { padding: 24px 0; color: var(--muted); font-size: var(--step--1); border-top: 1px solid var(--line); }
.footer__inner { display: flex; justify-content: space-between; gap: 16px; }
.footer a { color: var(--muted); }

/* Responsive */
@media (max-width: 900px) {
  .hero__grid, .system, .contact { grid-template-columns: minmax(0, 1fr); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow { box-shadow: 0 1px 0 var(--line), 8px 8px 0 var(--signal); margin-right: 8px; }
}
@media (max-width: 720px) {
  .menu-toggle { display: inline-block; }
  .nav {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 16px;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 12px 0; }
  .nav .nav__cta { text-align: center; margin-top: 8px; }
  .about { grid-template-columns: minmax(0, 1fr); }
  .about__photo { width: 140px; font-size: 2.75rem; }
}
@media (max-width: 480px) {
  .steps { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .flow__steps li,
  .js .flow__steps li .flow__tick,
  .js .flow__steps li .flow__tick::after { transition: none; }
}

/* Modo de edição (#admin) */
.admin-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 16px; margin-bottom: 24px;
  border: 2px dashed var(--signal); border-radius: var(--radius-m);
  background: var(--surface);
}
.admin-bar[hidden] { display: none; }
.admin-bar .btn { font: inherit; font-weight: 600; cursor: pointer; }
.admin-bar__status { margin: 0; color: var(--muted); font-size: var(--step--1); flex-basis: 100%; }
.admin-bar__status:empty { display: none; }

.system__remove {
  display: block; margin-top: 14px;
  font: inherit; font-size: var(--step--1); font-weight: 600;
  color: #b42318; background: none; border: 1px solid currentColor;
  border-radius: var(--radius-s); padding: 4px 10px; cursor: pointer;
}

.admin-dialog {
  width: min(560px, calc(100vw - 32px));
  border: 1px solid var(--line); border-radius: var(--radius-m);
  background: var(--surface); color: var(--text); padding: 24px;
}
.admin-dialog::backdrop { background: rgb(15 23 38 / 0.55); }
.admin-form { display: grid; gap: 14px; }
.admin-form h2 { font-size: var(--step-2); margin: 0; }
.admin-form label { display: grid; gap: 6px; font-weight: 600; color: var(--ink); }
.admin-form small { font-weight: 400; color: var(--muted); }
.admin-form input,
.admin-form textarea {
  font: inherit; font-weight: 400; color: var(--text);
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-s); padding: 10px 12px; width: 100%;
}
.admin-form__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.admin-form__actions .btn { font: inherit; font-weight: 600; cursor: pointer; }
