/* ===========================================================
   ISTITUTO BURGO — Sistema de design
   Paleta neutra quente + sans-serif geométrica + serif italic
   Mobile-first
   =========================================================== */

:root {
  /* Paleta — mutável via Tweaks */
  --bg: #f5f1ea;
  --fg: #0a0a0a;
  --fg-soft: #2a2825;
  --muted: #75706a;
  --line: rgba(10, 10, 10, 0.14);
  --line-soft: rgba(10, 10, 10, 0.07);
  --tint: #0a0a0a;
  --tint-ink: #f5f1ea;
  --paper: #ebe5d9;

  /* Tipografia */
  --sans:        "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  --serif:       "Instrument Serif", "Times New Roman", serif;
  --mono:        "JetBrains Mono", ui-monospace, monospace;
  --brand-serif: "Bodoni Moda", "Didot", "Bodoni 72", "Times New Roman", serif;
  --brand-sans:  "Montserrat", ui-sans-serif, system-ui, sans-serif;

  /* Escala fluida — mobile primeiro */
  --display: clamp(38px, 9vw, 110px);
  --h1: clamp(28px, 6vw, 68px);
  --h2: clamp(22px, 4vw, 44px);
  --h3: clamp(18px, 2.5vw, 26px);
  --body: 16px;
  --small: 13px;
  --micro: 11px;

  /* Espaçamento */
  --gutter: 20px;
  --section: clamp(64px, 12vw, 144px);

  /* Easing */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.6, 0, 0.8, 0.2);
}

@media (min-width: 900px) {
  :root {
    --gutter: 40px;
    --body: 17px;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-feature-settings: "ss01", "ss02", "cv11";
  font-size: var(--body);
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color 600ms var(--ease), color 600ms var(--ease);
}

img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

::selection { background: var(--fg); color: var(--bg); }

/* ---------- Type utilities ---------- */
.display, .h1, .h2, .h3 { letter-spacing: -0.02em; line-height: 0.95; font-weight: 500; }
.display {
  font-family: var(--brand-serif);
  font-size: var(--display);
  letter-spacing: -0.015em;
  line-height: 0.92;
  font-weight: 500;
}
.h1 {
  font-family: var(--brand-serif);
  font-size: var(--h1);
  letter-spacing: -0.01em;
  font-weight: 500;
  line-height: 0.98;
}
.h2 { font-size: var(--h2); letter-spacing: -0.025em; line-height: 1.0; }
.h3 { font-size: var(--h3); letter-spacing: -0.015em; line-height: 1.15; }

.serif { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em; }
.display .serif, .h1 .serif {
  font-family: var(--brand-serif);
  font-style: italic;
  font-weight: 400;
}
.mono { font-family: var(--mono); letter-spacing: 0; text-transform: uppercase; font-size: var(--micro); }
.eyebrow {
  font-family: var(--mono);
  font-size: var(--micro);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: "";
  width: 18px; height: 1px;
  background: var(--muted);
  display: inline-block;
}

/* ---------- Layout ---------- */
.wrap { padding-inline: var(--gutter); }
.section { padding-block: var(--section); }
.divider { height: 1px; background: var(--line); width: 100%; }

.grid-12 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gutter);
}
@media (min-width: 700px)  { .grid-12 { grid-template-columns: repeat(8, 1fr); } }
@media (min-width: 1100px) { .grid-12 { grid-template-columns: repeat(12, 1fr); } }

/* ---------- Buttons & links ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-radius: 999px;
  font-size: 14px;
  letter-spacing: -0.005em;
  background: var(--fg);
  color: var(--bg);
  border: 1px solid var(--fg);
  transition: transform 400ms var(--ease), background 250ms ease, color 250ms ease;
  will-change: transform;
}
.btn:hover { background: transparent; color: var(--fg); transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--fg); }
.btn--ghost:hover { background: var(--fg); color: var(--bg); }

.btn .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }

.link-underline {
  position: relative;
  display: inline-block;
  padding-bottom: 2px;
}
.link-underline::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: currentColor;
  transform-origin: right;
  transform: scaleX(1);
  transition: transform 500ms var(--ease);
}
.link-underline:hover::after { transform-origin: left; transform: scaleX(0); animation: lineIn 500ms 500ms var(--ease) forwards; }
@keyframes lineIn { from { transform: scaleX(0); transform-origin: left; } to { transform: scaleX(1); transform-origin: left; } }

/* ---------- Placeholder image ---------- */
.ph {
  position: relative;
  background: var(--paper);
  overflow: hidden;
  isolation: isolate;
}
.ph::before {
  content: "";
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent 0 14px,
    rgba(10,10,10,0.04) 14px 15px
  );
  z-index: 0;
}
.ph__label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  z-index: 1;
  text-align: center;
  padding: 12px;
}
.ph__label::before {
  content: "";
  width: 10px; height: 10px;
  border: 1px solid var(--muted);
  transform: rotate(45deg);
  margin-bottom: 4px;
}

/* ---------- Logo (Istituto Burgo) ----------
   The composition NEVER changes; only --logo-size scales it.
   Locked proportions: line weight 1px @ size 1, tracking, gaps.
   ============================================================== */
.logo {
  --logo-size: 1;
  --logo-color: currentColor;
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  color: var(--logo-color);
  font-family: var(--brand-serif);
  text-align: center;
  user-select: none;
  line-height: 1;
}
.logo__top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: calc(10px * var(--logo-size));
}
.logo__top > span:first-child,
.logo__top > span:last-child {
  height: 1px;
  background: currentColor;
  width: 100%;
}
.logo__istituto {
  font-family: var(--brand-serif);
  font-weight: 400;
  font-style: normal;
  font-size: calc(14px * var(--logo-size));
  letter-spacing: calc(0.32em);
  text-indent: calc(0.32em); /* offset so visual center matches optical center */
  padding-inline: calc(2px * var(--logo-size));
  white-space: nowrap;
}
.logo__main {
  font-family: var(--brand-serif);
  font-weight: 500;
  font-style: normal;
  font-size: calc(64px * var(--logo-size));
  letter-spacing: -0.005em;
  line-height: 0.92;
  margin-top: calc(2px * var(--logo-size));
}
.logo__rule {
  height: 1px;
  background: currentColor;
  width: 100%;
  margin-top: calc(4px * var(--logo-size));
}
.logo__tag {
  font-family: var(--brand-sans);
  font-weight: 300;
  font-size: calc(9.5px * var(--logo-size));
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  margin-top: calc(8px * var(--logo-size));
  text-transform: uppercase;
}

/* Stamp version — single-line monogram for tight spaces (still on-brand) */
.logo--mark .logo__top { display: none; }
.logo--mark .logo__rule { display: none; }
.logo--mark .logo__tag { display: none; }

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 900ms var(--ease), transform 900ms var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.is-in { opacity: 1; transform: none; }

.reveal-clip {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1100ms var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal-clip.is-in { clip-path: inset(0 0 0 0); }

/* Stagger of word lines */
.line-mask { overflow: hidden; display: block; }
.line-mask > span {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 1000ms var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
.is-in .line-mask > span, .line-mask.is-in > span { transform: translateY(0); }

/* ---------- Top bar / nav ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px var(--gutter);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line-soft);
  transition: background 400ms var(--ease), border-color 400ms var(--ease);
}
.topbar__brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--fg);
  --logo-size: 0.36;
}
@media (min-width: 700px)  { .topbar__brand { --logo-size: 0.40; } }
@media (min-width: 1100px) { .topbar__brand { --logo-size: 0.46; } }
.topbar__nav { display: none; }
@media (min-width: 900px) {
  .topbar__nav { display: flex; gap: 28px; font-size: 14px; }
  .topbar__nav a { position: relative; padding: 6px 0; opacity: 0.7; transition: opacity 250ms ease; }
  .topbar__nav a:hover, .topbar__nav a.is-active { opacity: 1; }
  .topbar__nav a.is-active::after {
    content: ""; position: absolute; bottom: 0; left: 0;
    width: 100%; height: 1px; background: var(--fg);
  }
}
.topbar__cta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar__cta .btn { white-space: nowrap; flex-shrink: 0; }
.menu-btn {
  width: 40px; height: 40px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.menu-btn span { width: 16px; height: 1px; background: var(--fg); transition: transform 300ms var(--ease); }
.menu-btn.is-open span:nth-child(1) { transform: translateY(3px) rotate(45deg); }
.menu-btn.is-open span:nth-child(2) { transform: translateY(-3px) rotate(-45deg); }
@media (min-width: 900px) { .menu-btn { display: none; } }

.lang-pill {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  display: none;
  white-space: nowrap;
  flex-shrink: 0;
}
@media (min-width: 900px) { .lang-pill { display: inline-flex; } }

/* ---------- Mobile menu overlay ---------- */
.mobile-menu {
  position: fixed;
  inset: 0;             /* cobre 100% da viewport (h-screen)                 */
  z-index: 49;          /* topbar usa z-index: 50, fica acima do overlay     */
  background: var(--bg);
  display: flex;
  flex-direction: column;
  /* 140px = padding generoso que garante o primeiro item abaixo do
     topbar em qualquer dispositivo (header real com Bodoni Moda +
     border + padding chega a ~90-100px em alguns renders).          */
  padding: 140px var(--gutter) var(--gutter);
  transform: translateY(-100%);
  transition: transform 600ms var(--ease);
  overflow-y: auto;     /* fallback para telas muito pequenas                */
}
.mobile-menu.is-open { transform: translateY(0); }
.mobile-menu__list { display: flex; flex-direction: column; gap: 0; margin-top: 0; }
.mobile-menu__item {
  /* clamp(26px, 8vw, 48px) → ~31px em 390px, ~26px em telas menores.
     Mantém todos os 5 itens + rodapé visíveis sem scroll em 667px+.  */
  font-size: clamp(26px, 8vw, 48px);
  letter-spacing: -0.03em;
  line-height: 1.05;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-weight: 500;
  transition: opacity 250ms ease;
}
.mobile-menu__item .num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
  font-weight: 400;
}
.mobile-menu__item:hover { opacity: 0.6; }
.mobile-menu__meta {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Footer ---------- */
.footer {
  background: var(--fg);
  color: var(--bg);
  padding: var(--section) var(--gutter) 32px;
  margin-top: var(--section);
}
.footer__display {
  font-family: var(--brand-serif);
  font-size: clamp(56px, 18vw, 220px);
  letter-spacing: -0.02em;
  line-height: 0.85;
  font-weight: 500;
}
.footer__display .serif { font-style: italic; font-weight: 400; }
.footer__grid {
  margin-top: clamp(40px, 8vw, 80px);
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}
@media (min-width: 700px) { .footer__grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .footer__grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.footer__col h6 {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  opacity: 0.5;
  margin-bottom: 14px;
  font-weight: 400;
}
.footer__col a { display: block; padding: 4px 0; opacity: 0.85; transition: opacity 250ms ease; }
.footer__col a:hover { opacity: 1; }
.footer__base {
  margin-top: 80px;
  padding-top: 24px;
  border-top: 1px solid rgba(245, 241, 234, 0.18);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
  font-size: 12px;
  opacity: 0.6;
}

/* ---------- Page transition ---------- */
.page {
  animation: pageIn 700ms var(--ease) both;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Marquee ---------- */
.marquee {
  overflow: hidden;
  border-block: 1px solid var(--line);
  padding-block: 22px;
}
.marquee__track {
  display: flex;
  gap: 40px;
  white-space: nowrap;
  animation: scroll 9s linear infinite;
  font-size: clamp(15px, 2.8vw, 26px);
  letter-spacing: -0.02em;
  font-weight: 500;
}
.marquee__track span { display: inline-flex; align-items: center; gap: 40px; }
.marquee__track .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fg); display: inline-block; }
@keyframes scroll { to { transform: translateX(-50%); } }

/* ---------- Misc utilities ---------- */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.between { justify-content: space-between; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; } .gap-8 { gap: 32px; }
.muted { color: var(--muted); }
.uppercase { text-transform: uppercase; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.no-mobile { display: none; }
@media (min-width: 900px) { .no-mobile { display: initial; } .only-mobile { display: none; } }

/* Loading bar at top during route change */
.route-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 100;
  background: var(--fg);
  transform-origin: left;
  transform: scaleX(0);
  pointer-events: none;
}
.route-bar.go { animation: routebar 700ms var(--ease) forwards; }
@keyframes routebar {
  0% { transform: scaleX(0); }
  60% { transform: scaleX(0.7); }
  100% { transform: scaleX(1); opacity: 0; }
}
