/* Grimório vitoriano digital — UNIX mínimo + ornamento pré-rafaelita pontual */

/* ----- Fonts (locais, sem Google API) ----- */
@font-face {
  font-family: 'Cardo';
  src: url('fonts/Cardo/Cardo-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Cardo';
  src: url('fonts/Cardo/Cardo-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Cardo';
  src: url('fonts/Cardo/Cardo-Italic.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Cinzel';
  src: url('fonts/Cinzel/Cinzel-VariableFont_wght.woff2') format('woff2');
  font-weight: 400 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/JetBrainsMono/webfonts/JetBrainsMono-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}

/* ----- Paleta + escala ----- */
:root {
  /* Base — pergaminho (mantida clara) */
  --bg: #d9cfb4;
  --paper: #efe6d3;
  --ink: #221f18;
  --ink-dim: #847a62;

  /* Acentos — pré-rafaelita/botânico */
  --moss: #4a5c3d;
  --gilt: #a9812f;

  /* Acentos florais */
  --rose-deep: #824d57;
  --rose-dusty: #9c5c5e;
  --rose-blush: #e3d2c8;

  --measure: 75ch;
  --space-1: clamp(0.5rem, 1vw, 0.75rem);
  --space-2: clamp(1rem, 2vw, 1.5rem);
  --space-3: clamp(2rem, 4vw, 3rem);
  --space-4: clamp(4rem, 8vw, 6rem);
  --space-5: clamp(6rem, 12vw, 10rem);
  --font-serif: 'Cardo', 'Palatino Linotype', 'Book Antiqua', serif;
  --font-display: 'Cinzel', 'Georgia', serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
}

/* Paleta única — sem variação dark */

/* ----- Base ----- */
*, *::before, *::after { box-sizing: border-box; }
/* Scroll nativo oculto no documento inteiro — só a fita marca o progresso */
*, *::before, *::after { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; }
html { scroll-behavior: smooth; }
html, body { overflow-x: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.2rem);
  line-height: 1.65;
}
::selection { background: var(--moss); color: var(--paper); }
a { color: var(--moss); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-color: var(--moss); }
:focus-visible { outline: 2px solid var(--moss); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.35; margin: 0 0 var(--space-2); }
h1 { font-size: clamp(2.2rem, 1.4rem + 4vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 1.2rem + 2vw, 2.2rem); }
p { max-width: var(--measure); }

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--ink); color: var(--paper);
  font-family: var(--font-mono); font-size: 0.85rem;
  padding: var(--space-1) var(--space-2); border-radius: 4px;
}
.skip:focus { top: 1rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ----- Fita de marcador (progresso) ----- */
.ribbon {
  position: fixed; right: clamp(0.6rem, 2vw, 1.4rem); top: 50%;
  transform: translateY(-50%); z-index: 60;
  width: 3px; height: 38vh;
  background: color-mix(in srgb, var(--ink-dim) 30%, transparent);
  border-radius: 999px;
}
.ribbon-fill {
  display: block; width: 100%; height: 100%;
  background: var(--moss); border-radius: inherit;
  transform-origin: top; transform: scaleY(0);
}

/* ----- Troca de idioma ----- */
.lang-switch {
  position: fixed; top: 0.9rem; right: clamp(0.8rem, 3vw, 1.6rem); z-index: 70;
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.06em;
  background: color-mix(in srgb, var(--paper) 65%, transparent);
  border: 1px solid color-mix(in srgb, var(--gilt) 55%, transparent);
  border-radius: 999px; padding: 0.35rem 0.8rem; color: var(--ink-dim);
}
.lang-switch [aria-current] { color: var(--ink); }

/* ----- Hero: imagem edge-to-edge + texto abaixo ----- */
.hero { background: var(--bg); }
.hero-figure { margin: 0; }
.hero-figure img {
  display: block; width: 100vw; height: 72vh; height: 72svh; object-fit: cover; object-position: center;
  /* leve correção em direção à paleta, sem duotone: a cor vibrante vive só aqui */
  filter: contrast(1.06) saturate(1.12) sepia(0.1);
  background: var(--ink-dim);
}
.hero-text {
  position: relative;
  background: var(--paper);
  padding: var(--space-5) clamp(1rem, 5vw, 2rem);
  text-align: center;
}
.hero-text > * { position: relative; z-index: 1; margin-inline: auto; }
.hero-text .lede { font-size: clamp(1.15rem, 1rem + 1vw, 1.4rem); }
.hero-meta { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-dim); }
.hero-links { display: flex; gap: var(--space-2); justify-content: center; margin-top: var(--space-3); flex-wrap: wrap; }
.hero-links a {
  font-family: var(--font-mono); font-size: 0.85rem;
  border: 1px solid var(--moss); border-radius: 999px;
  padding: 0.55rem 1.2rem; color: var(--moss);
}
.hero-links a:first-child { background: var(--moss); color: var(--paper); }
.hero-links a:hover { border-color: var(--gilt); text-decoration: none; }
.hero-links a:first-child:hover { background: color-mix(in srgb, var(--moss) 85%, black); }

/* Entrada única: fade + leve deslocamento, nunca repete */
html.js .hero-text { opacity: 0; transform: translateY(16px); }
html.js body.ready .hero-text { opacity: 1; transform: none; transition: opacity 0.9s ease, transform 0.9s ease; }
html.js .hero-figure { opacity: 0; }
html.js body.ready .hero-figure { opacity: 1; transition: opacity 1.1s ease; }

/* ----- Seções fluidas ----- */
.section { padding: var(--space-4) clamp(1rem, 5vw, 2rem); border-top: 1px solid color-mix(in srgb, var(--gilt) 28%, transparent); }
.section:nth-of-type(odd) { background: var(--paper); }
.section:nth-of-type(even) { background: var(--bg); }
.container { width: min(100%, 72rem); margin-inline: auto; }
.container > p, .container > dl { max-width: var(--measure); }
.kicker { font-family: var(--font-mono); font-size: 0.78rem; color: var(--moss); letter-spacing: 0.1em; margin: 0 0 var(--space-1); }

/* Revelação "tinta": mancha que se expande, uma única vez */
html.js .ink-reveal {
  opacity: 0; transform: translateY(14px);
  clip-path: inset(22% 14% 22% 14% round 24px);
}
html.js .ink-reveal.ink-in {
  opacity: 1; transform: none; clip-path: inset(0 0 0 0);
  transition: clip-path 1s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.7s ease, transform 0.8s ease;
}

/* ----- Stack: mono domina, sem linhas ----- */
.stack-grid {
  display: grid; grid-template-columns: repeat(12, 1fr);
  gap: var(--space-2); margin-top: var(--space-3); max-width: none;
}
.stack-group { grid-column: span 4; padding-top: var(--space-1); }
.stack-group h3 { font-family: var(--font-mono); font-weight: 400; font-size: 0.85rem; color: var(--moss); letter-spacing: 0.08em; }
.stack-group ul { list-style: none; margin: 0; padding: 0; font-family: var(--font-mono); font-size: 0.92rem; }
.stack-group li { display: flex; align-items: baseline; gap: 0.55rem; padding: 0.35rem 0; }
.stack-group li::before {
  content: ""; flex: none; align-self: center;
  width: 0.55em; height: 0.55em;
  background: var(--rose-dusty); opacity: 0.85;
  border-radius: 0 70% 0 70%; transform: rotate(-14deg);
}
.stack-group h3 { display: flex; align-items: center; gap: 0.6rem; }
.stack-group h3 .title-branch { flex: 1 1 0; min-width: 0; height: 1.1rem; }
.stack-group li span { color: var(--ink-dim); font-size: 0.75rem; margin-left: 0.5rem; }

/* ----- Casos: transparentes, crista em SVG ----- */
.cases { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--space-3); margin-top: var(--space-3); }
.case { grid-column: span 6; background: transparent; padding: 0 0 var(--space-1); }
.case-crest { display: flex; align-items: center; justify-content: center; gap: 0.5rem; width: min(280px, 85%); margin: 0 auto var(--space-2); }
.crest-branch { flex: 1 1 0; min-width: 0; height: auto; }
.crest-branch-r { transform: scaleX(-1); }
.crest-rose { flex: none; width: 1.9rem; height: 1.9rem; background: var(--rose-deep);
  -webkit-mask: url('images/rose.svg') no-repeat center / contain;
  mask: url('images/rose.svg') no-repeat center / contain; }
.case-meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--rose-dusty); margin: 0 0 var(--space-1); }
.case h3 { margin-bottom: var(--space-2); color: var(--rose-deep); }
.case dl { margin: 0 0 var(--space-2); display: grid; gap: var(--space-2); }
.case dl > div { display: grid; gap: 0.25rem; }
.case dt { font-family: var(--font-mono); font-size: 0.75rem; color: var(--rose-dusty); letter-spacing: 0.08em; }
.case dd { margin: 0; }
.case-stack { font-family: var(--font-mono); font-size: 0.8rem; color: var(--moss); }
.case-link { font-family: var(--font-mono); font-size: 0.85rem; border-bottom: 1px solid var(--moss); }
.case-link:hover { color: var(--ink); border-color: var(--gilt); text-decoration: none; }

/* ----- Contato minimalista ----- */
.contact-list { list-style: none; margin: var(--space-3) 0 0; padding: 0; font-family: var(--font-mono); font-size: 0.95rem; }
.contact-list li { display: flex; align-items: baseline; gap: 0.55rem; padding: var(--space-1) 0; max-width: var(--measure); }
.contact-list li::before {
  content: ""; flex: none; align-self: center;
  width: 0.55em; height: 0.55em;
  background: var(--rose-dusty); opacity: 0.85;
  border-radius: 0 70% 0 70%; transform: rotate(-14deg);
}

/* ----- Footer ----- */
.site-footer { padding: var(--space-3) clamp(1rem, 5vw, 2rem) var(--space-4); background: var(--paper); /* herda a cor do último panel (contato) */ }
.site-footer p { font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-dim); margin: 0; max-width: none; text-align: center; }

/* ----- Easter egg: rosa secreta no canto do hero ----- */
.hero-figure { position: relative; }
.rose-secret {
  position: absolute; top: 0.9rem; left: 0.9rem; z-index: 5;
  background: transparent; border: none; border-radius: 50%;
  padding: 0.35rem; cursor: pointer; opacity: 0.25;
  transition: opacity 0.3s ease;
}
.rose-secret .secret-rose { display: block; width: 1.9rem; height: 1.9rem; background: var(--paper);
  -webkit-mask: url('images/rose.svg') no-repeat center / contain;
  mask: url('images/rose.svg') no-repeat center / contain;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.rose-secret:hover, .rose-secret:focus-visible { opacity: 1; }
.rose-secret:hover .secret-rose { filter: drop-shadow(0 0 8px rgba(239, 230, 211, 0.85)); }
.rose-secret:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }
.rose-secret[aria-expanded="true"] { opacity: 1; }
.rose-secret[aria-expanded="true"] .secret-rose { transform: rotate(14deg) scale(1.1); }
.terminal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 80;
  width: min(26rem, calc(100vw - 2rem));
  background: #14110c; color: #d9cfb4;
  border: 1px solid var(--gilt); border-radius: 8px;
  font-family: var(--font-mono); font-size: 0.82rem;
  box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.terminal header { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0.8rem; border-bottom: 1px solid #3a3222; color: #a89a78; font-size: 0.72rem; }
.terminal header button { background: none; border: none; color: inherit; font-size: 1.1rem; cursor: pointer; line-height: 1; }
.term-out { min-height: 12rem; max-height: 20rem; overflow-y: auto; padding: 0.8rem; white-space: pre-wrap; }
.term-out .in { color: #6b8a52; }
.term-out .err { color: #a8493a; }
#termForm { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.8rem 0.8rem; }
#termForm .prompt { color: #6b8a52; }
#termIn { flex: 1; background: none; border: none; color: inherit; font: inherit; outline: none; }

/* ----- Voltar ao topo (rosa) ----- */
.to-top {
  position: fixed; right: clamp(0.8rem, 3vw, 1.6rem); bottom: clamp(0.8rem, 3vw, 1.6rem); z-index: 70;
  width: 2.8rem; height: 2.8rem; border-radius: 50%;
  background: color-mix(in srgb, var(--paper) 65%, transparent);
  border: 1px solid color-mix(in srgb, var(--gilt) 55%, transparent);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.to-top-icon {
  width: 1.4rem; height: 1.4rem;
  background: var(--moss);
  -webkit-mask: url('images/rose.svg') no-repeat center / contain;
  mask: url('images/rose.svg') no-repeat center / contain;
}
.to-top:hover { border-color: var(--moss); }
.to-top[hidden] { display: none; }

/* ----- Responsivo ----- */
@media (max-width: 1024px) {
  .stack-grid, .cases { grid-template-columns: repeat(8, 1fr); }
  .stack-group { grid-column: span 4; }
  .case { grid-column: span 8; }
  .hero-figure img { height: 60vh; height: 60svh; }
}
@media (max-width: 600px) {
  body { font-size: 1rem; }
  .ribbon { right: 0; left: 0; top: 0; width: 100%; height: 3px; transform: none; border-radius: 0; }
  .ribbon-fill { transform-origin: left; }
  .hero-figure img { height: 48vh; height: 48svh; }
  .hero-text { padding: var(--space-4) clamp(1rem, 5vw, 2rem); }
  .stack-grid, .cases { grid-template-columns: 1fr; }
  .stack-group, .case { grid-column: 1 / -1; }
  .section { padding: var(--space-4) clamp(1rem, 5vw, 2rem); }
  .terminal { width: calc(100vw - 2rem); }
}
@media (min-width: 1440px) {
  .container { width: min(100%, 80rem); }
}

/* ----- Movimento reduzido: desliga tinta, fita e entrada ----- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js .hero-text, html.js .hero-figure, html.js .ink-reveal { opacity: 1; transform: none; clip-path: none; transition: none; }
  .rose-secret .secret-rose { transition: none; }
}
