/* Casa Américo — e-commerce design system
   Editorial wine brand, inspired by the 2024 brochure (PDF).
   Cream/marfim background · bordô profundo · dourado · serifa editorial.
*/

:root {
  /* Palette — editorial cream from the brochure, deep blue as the new accent */
  --bg: #f1ead7;          /* warm bone cream (PDF page) */
  --bg-warm: #e6dec5;
  --paper: #f6efde;
  --ink: #0a0f1e;          /* near-black ink */
  --ink-soft: #2a3142;
  --ink-mute: #6c6a5b;
  --line: #c6bea3;
  --line-soft: #ddd3b3;

  /* Primary accent — deep editorial blue + electric secondary */
  --wine: #0e2454;         /* alias kept for legacy class names */
  --wine-deep: #060f2b;
  --wine-bright: #1e4cd3;
  --blue: #0e2454;
  --blue-deep: #060f2b;
  --blue-bright: #2a55e6;
  --blue-soft: #6f8de8;

  --gold: #c79b2e;         /* warm metal kept as secondary accent */
  --gold-soft: #e6c97a;
  --forest: #16213b;
  --clay: #b65b34;

  /* Type */
  --font-display: "Cormorant Garamond", "Cormorant", "EB Garamond", Georgia, serif;
  --font-serif:   "EB Garamond", Georgia, "Times New Roman", serif;
  --font-sans:    "Inter Tight", "Inter", system-ui, -apple-system, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;

  /* Spacing scale */
  --gut: 32px;
  --pad-x: clamp(20px, 4vw, 64px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

/* Subtle paper grain — brochure feel */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.08 0 0 0 0 0.10 0 0 0 0 0.18 0 0 0 0.05 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.6;
  mix-blend-mode: multiply;
  z-index: 9999;
}

/* ===== Framer-style reveal animations ===== */
[data-reveal] {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 1s cubic-bezier(.2,.7,.2,1), transform 1s cubic-bezier(.2,.7,.2,1);
  transition-delay: var(--rd, 0ms);
}
[data-reveal="fade"] { transform: none; }
[data-reveal="left"] { transform: translateX(-48px); }
[data-reveal="right"] { transform: translateX(48px); }
[data-reveal="scale"] { transform: scale(0.94); }
[data-reveal].in {
  opacity: 1;
  transform: none;
}

/* Char-by-char split-text reveal */
.split-line { display: block; overflow: hidden; }
.split-word { display: inline-block; transform: translateY(110%); opacity: 0; transition: transform 1.1s cubic-bezier(.18,.7,.2,1), opacity 1.1s ease; transition-delay: var(--wd, 0ms); }
.in .split-word, .split-line.in .split-word { transform: translateY(0); opacity: 1; }

/* Magnetic hover */
.magnetic { transition: transform .25s cubic-bezier(.2,.7,.2,1); will-change: transform; }

/* Cursor dot — only on fine pointer */
@media (pointer: fine) {
  .cursor-dot {
    position: fixed; left: 0; top: 0; width: 14px; height: 14px; border-radius: 50%;
    background: var(--blue-bright);
    pointer-events: none; z-index: 99998;
    mix-blend-mode: difference;
    transform: translate(-50%, -50%);
    transition: transform .2s ease, width .25s ease, height .25s ease, background .25s ease;
  }
  .cursor-dot.hover { width: 64px; height: 64px; background: var(--blue-soft); mix-blend-mode: normal; opacity: .55; }
}

/* Type scale */
.eyebrow {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.eyebrow .dot {
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--blue);
  vertical-align: 2px;
  margin: 0 10px;
}

.display {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.display em {
  font-style: italic;
  font-weight: 400;
  color: var(--blue);
}

h1.display { font-size: clamp(56px, 8vw, 124px); }
h2.display { font-size: clamp(40px, 5.5vw, 80px); }
h3.display { font-size: clamp(28px, 3vw, 44px); }

.lede {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 56ch;
}

.small-caps {
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--blue);
  color: var(--paper);
}
.btn-primary:hover { background: var(--blue-bright); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-gold {
  background: var(--gold);
  color: var(--ink);
}
.btn-gold:hover { background: var(--gold-soft); }
.btn-blue {
  background: var(--blue-bright);
  color: var(--paper);
}
.btn-blue:hover { background: var(--blue); }
.btn-link {
  background: transparent;
  padding: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  color: var(--ink);
}
.btn-arrow::after {
  content: "→";
  font-size: 14px;
  transform: translateY(-1px);
}

/* Top nav */
.topbar {
  display: flex;
  justify-content: center;
  background: var(--blue-deep);
  color: var(--paper);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 9px var(--pad-x);
  gap: 28px;
  font-weight: 500;
}
.topbar .dot { color: var(--blue-soft); }

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(243, 236, 220, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 18px var(--pad-x);
  gap: 24px;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
}
.nav-links a { position: relative; padding: 4px 0; }
.nav-links a.active::after,
.nav-links a:hover::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 1px; background: var(--blue);
}
.nav-brand {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center;
}
.nav-brand .logo {
  display: block;
  height: 56px; width: auto;
  /* Logo file is white-on-transparent; invert to dark for light backgrounds */
  filter: invert(1) brightness(0);
  transition: filter .3s ease;
}
body.hero-on .nav-brand .logo { filter: none; }
.nav-brand .estd {
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--ink-mute);
  text-transform: uppercase;
  transition: color .3s ease;
}
body.hero-on .nav-brand .estd { color: rgba(255,255,255,0.6); }
/* Legacy crest fallback */
.nav-brand .crest {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.06em;
  line-height: 1;
}
.nav-brand .crest em { font-style: italic; color: var(--blue); }
.nav-actions {
  display: flex; justify-content: flex-end; align-items: center; gap: 14px;
}
.nav-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
  color: var(--ink);
  position: relative;
  transition: all .15s ease;
}
.nav-icon:hover { background: var(--bg-warm); }
.nav-icon .badge {
  position: absolute;
  top: -2px; right: -2px;
  background: var(--blue);
  color: var(--paper);
  font-size: 10px;
  font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* Sections */
section { padding: clamp(56px, 8vw, 120px) var(--pad-x); }
.section-tight { padding: clamp(40px, 6vw, 80px) var(--pad-x); }

.divider {
  display: flex; align-items: center; gap: 14px;
  color: var(--ink-mute);
}
.divider .line { flex: 1; height: 1px; background: var(--line); }
.divider .ornament { font-family: var(--font-display); font-style: italic; }

/* Section header */
.sec-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 32px;
  margin-bottom: 48px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.sec-head .meta { color: var(--ink-mute); font-size: 13px; }

/* Bottle card */
.bottle-card {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color .25s ease;
  overflow: hidden;
}
.bottle-card:hover {
  border-color: var(--blue);
}
.bottle-card .img-wrap {
  aspect-ratio: 3/4;
  background: #ffffff;
  display: flex; align-items: center; justify-content: center;
  padding: 28px 20px 14px;
  position: relative;
  overflow: hidden;
}
.bottle-card .img-wrap img {
  max-height: 100%;
  width: auto;
  object-fit: contain;
  transition: transform .7s cubic-bezier(.2,.7,.2,1);
  transform-origin: 50% 80%;
}
.bottle-card:hover .img-wrap img { transform: scale(1.15) translateY(-6px); }
.bottle-card .tag {
  position: absolute;
  top: 14px; left: 14px;
  background: var(--ink);
  color: var(--paper);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 5px 9px;
  font-weight: 600;
}
.bottle-card .tag.gold { background: var(--gold); color: var(--ink); }
.bottle-card .tag.wine { background: var(--blue); }
.bottle-card .tag.blue { background: var(--blue-bright); }
.bottle-card .body {
  padding: 18px 20px 22px;
  display: flex; flex-direction: column; gap: 10px;
  border-top: 1px solid var(--line-soft);
}
.bottle-card .marca {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.bottle-card .nome {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.05;
  font-weight: 500;
}
.bottle-card .nome em { font-style: italic; color: var(--blue); }
.bottle-card .meta-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 4px;
}
.bottle-card .meta-row .casta {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-soft);
}
.bottle-card .price {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
}
.bottle-card .price .cents { font-size: 16px; vertical-align: 4px; }
.bottle-card .btn-row {
  display: flex; gap: 8px;
  margin-top: 8px;
}
.bottle-card .btn-row .btn { flex: 1; padding: 12px 14px; font-size: 11px; }

/* Tasting notes */
.notes {
  display: flex; gap: 14px;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  text-transform: uppercase;
}
.notes span { position: relative; }
.notes span + span::before {
  content: "·";
  margin-right: 14px;
  color: var(--blue);
}

/* Footer */
footer {
  background: var(--blue-deep);
  color: #cfd9f2;
  padding: 80px var(--pad-x) 28px;
  margin-top: 80px;
}
footer a { color: #cfd9f2; }
.foot-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
  gap: 64px;
  padding-bottom: 56px;
  border-bottom: 1px solid rgba(232, 217, 185, 0.2);
}
.foot-grid h4 {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin: 0 0 18px;
  color: var(--blue-soft);
  font-weight: 600;
}
.foot-grid ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.foot-brand .crest { font-family: var(--font-display); font-size: 36px; line-height: 1; }
.foot-brand .crest em { font-style: italic; color: var(--blue-soft); }
.foot-brand .logo {
  display: block;
  height: 90px; width: auto;
  margin-bottom: 18px;
}
.foot-brand p { font-family: var(--font-serif); font-style: italic; color: rgba(207, 217, 242, 0.7); max-width: 36ch; line-height: 1.5; }
.foot-bottom {
  padding-top: 28px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(207, 217, 242, 0.55);
  flex-wrap: wrap; gap: 12px;
}

/* Utilities */
.hr {
  height: 1px; background: var(--line); border: 0; margin: 0;
}
.center { text-align: center; }
.flex { display: flex; }
.stack { display: flex; flex-direction: column; }
.gap-sm { gap: 12px; }
.gap-md { gap: 24px; }
.gap-lg { gap: 48px; }

/* ============================================================
   MOBILE — hamburger menu, nav drawer, footer + global overrides
   ============================================================ */

/* Hamburger toggle button — hidden on desktop, shown on mobile */
.nav-toggle {
  display: none;
  width: 38px; height: 38px;
  border: 0; background: transparent;
  align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--ink);
  padding: 0;
  position: relative;
}
.nav-toggle span {
  position: absolute; left: 9px; right: 9px; height: 1.5px;
  background: currentColor; transition: transform .3s ease, opacity .25s ease, top .3s ease;
}
.nav-toggle span:nth-child(1) { top: 13px; }
.nav-toggle span:nth-child(2) { top: 18.5px; }
.nav-toggle span:nth-child(3) { top: 24px; }
body.nav-open .nav-toggle span:nth-child(1) { top: 18.5px; transform: rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) { top: 18.5px; transform: rotate(-45deg); }

/* X close button — only rendered inside .nav-links drawer (mobile) */
.nav-close { display: none; }

/* Mobile nav overlay */
.nav-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 15, 30, 0.5);
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
  z-index: 48;
}
body.nav-open .nav-overlay { opacity: 1; pointer-events: all; }

@media (max-width: 880px) {
  :root { --pad-x: 20px; }

  /* Prevent off-canvas drawers (cart, filters, nav) from triggering page-level
     horizontal scroll. Their fixed-position bounding boxes extend past the
     viewport when closed via translateX. */
  html, body { overflow-x: clip; }

  /* ===== Top bar ===== */
  .topbar {
    font-size: 9px; letter-spacing: 0.16em;
    padding: 8px 16px;
    gap: 12px;
    flex-wrap: nowrap; overflow: hidden;
    white-space: nowrap;
  }
  .topbar > span { overflow: hidden; text-overflow: ellipsis; }
  .topbar .dot { flex-shrink: 0; }

  /* ===== Nav ===== */
  .nav-inner {
    grid-template-columns: auto 1fr auto;
    padding: 12px 16px;
    gap: 12px;
  }
  .nav-toggle { display: inline-flex; }
  .nav-brand { gap: 4px; }
  .nav-brand .logo { height: 40px; }
  .nav-brand .estd { font-size: 8px; letter-spacing: 0.2em; }
  .nav-actions { gap: 4px; }
  .nav-icon { width: 36px; height: 36px; }
  /* Hide search + account on mobile, keep cart */
  .nav-actions .nav-icon[aria-label="Procurar"],
  .nav-actions .nav-icon[aria-label="Conta"] { display: none; }

  /* Mobile nav drawer */
  .nav-links {
    position: fixed; inset: 0;
    width: 100%; height: 100vh; height: 100dvh;
    max-width: 100%;
    background: var(--paper);
    display: flex; flex-direction: column; align-items: stretch;
    padding: 88px 28px 28px;
    gap: 0;
    transform: translateX(-100%);
    transition: transform .4s cubic-bezier(.2,.7,.2,1);
    z-index: 49;
    overflow: hidden;
    font-size: 16px;
    letter-spacing: 0.1em;
  }

  /* X close button inside the drawer — top-right, above the nav bar */
  .nav-close {
    display: inline-flex;
    position: fixed;
    top: 14px; right: 16px;
    width: 44px; height: 44px;
    align-items: center; justify-content: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    color: var(--ink);
    cursor: pointer;
    z-index: 60;
    opacity: 0;
    transform: scale(0.85) rotate(-45deg);
    transition: opacity .25s ease, transform .35s cubic-bezier(.2,.7,.2,1);
    pointer-events: none;
  }
  body.nav-open .nav-close {
    opacity: 1; pointer-events: auto;
    transform: scale(1) rotate(0deg);
    transition-delay: .15s;
  }
  .nav-close:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

  /* When menu is open, hide the hamburger (we use the X instead) */
  body.nav-open .nav-toggle { opacity: 0; pointer-events: none; }
  body.nav-open .nav-links { transform: translateX(0); }
  .nav-links a {
    width: 100%;
    padding: clamp(12px, 2.4vh, 22px) 0;
    border-bottom: 1px solid var(--line-soft);
    font-family: var(--font-display);
    font-size: clamp(22px, 5.8vw, 32px);
    font-weight: 400;
    letter-spacing: 0.01em;
    text-transform: none;
    color: var(--ink);
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
  }
  .nav-links a::before {
    content: "→";
    font-family: var(--font-display); font-style: italic;
    font-size: 22px; color: var(--blue);
    opacity: 0; transform: translateX(-8px);
    transition: opacity .25s ease, transform .25s ease;
    order: 2;
  }
  body.nav-open .nav-links a { animation: navItemIn .5s cubic-bezier(.2,.7,.2,1) both; }
  body.nav-open .nav-links a:nth-of-type(1) { animation-delay: .08s; }
  body.nav-open .nav-links a:nth-of-type(2) { animation-delay: .14s; }
  body.nav-open .nav-links a:nth-of-type(3) { animation-delay: .20s; }
  body.nav-open .nav-links a:nth-of-type(4) { animation-delay: .26s; }
  body.nav-open .nav-links a:nth-of-type(5) { animation-delay: .32s; }
  .nav-links a:hover::before, .nav-links a:active::before { opacity: 1; transform: translateX(0); }
  .nav-links a::after { display: none; }
  .nav-links a.active { color: var(--blue); font-style: italic; }
  .nav-links a.active::before { opacity: 1; transform: translateX(0); }

  @keyframes navItemIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Bottom signature inside the full-screen menu */
  .nav-links::after {
    content: "Casa Américo · Serra da Estrela";
    display: block;
    margin-top: auto;
    padding-top: 20px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-mute);
    text-align: left;
    border-top: 0;
    flex-shrink: 0;
  }

  /* When the drawer is open, lock body scroll */
  body.nav-open { overflow: hidden; }

  /* Hide overlay when full-screen drawer is used (drawer itself covers everything) */
  body.nav-open .nav-overlay { opacity: 0; pointer-events: none; }

  /* Sticky nav stays clean over hero on mobile */
  body.hero-on .nav { background: var(--ink); }

  /* ===== Buttons ===== */
  .btn { padding: 13px 18px; font-size: 12px; letter-spacing: 0.1em; }

  /* ===== Footer ===== */
  footer { padding: 56px 20px 24px; margin-top: 56px; }
  .foot-grid {
    grid-template-columns: 1fr;
    gap: 36px;
    padding-bottom: 36px;
  }
  .foot-grid h4 { margin-bottom: 12px; }
  .foot-brand .logo { height: 64px; margin-bottom: 14px; }
  .foot-brand p { max-width: none; font-size: 15px; }
  .foot-bottom {
    flex-direction: column; align-items: flex-start;
    gap: 10px; padding-top: 24px;
    font-size: 10px;
  }

  /* ===== Generic display type scale ===== */
  h1.display { font-size: clamp(40px, 11vw, 64px); }
  h2.display { font-size: clamp(32px, 8.5vw, 52px); }
  h3.display { font-size: clamp(24px, 6vw, 36px); }
  .lede { font-size: 16px; line-height: 1.55; }

  /* ===== Section header ===== */
  .sec-head {
    grid-template-columns: 1fr;
    gap: 16px; margin-bottom: 32px;
    padding-bottom: 18px;
  }
  .sec-head .meta { font-size: 12px; }

  section { padding: clamp(48px, 9vw, 72px) var(--pad-x); }

  /* ===== Bottle card (shared) ===== */
  .bottle-card .img-wrap { padding: 20px 14px 8px; }
  .bottle-card .body { padding: 14px 14px 18px; gap: 8px; }
  .bottle-card .nome { font-size: 19px; }
  .bottle-card .price { font-size: 22px; }
  .bottle-card .price .cents { font-size: 13px; }
  .bottle-card .btn-row { flex-direction: column; gap: 6px; }
  .bottle-card .btn-row .btn { padding: 11px 12px; font-size: 10.5px; }

  /* ===== Cart drawer — full width on mobile ===== */
  .cart-drawer { width: 100%; max-width: 100%; }
  .cart-head { padding: 22px 20px 16px; }
  .cart-head .display { font-size: 26px !important; }
  .cart-line { padding: 16px 20px; grid-template-columns: 70px 1fr; gap: 12px; }
  .cart-info h4 { font-size: 16px; }
  .cart-price { font-size: 16px; }
  .cart-totals { padding: 20px; }
  .cart-totals .row.total { font-size: 18px; }
  .cart-upsell { padding: 14px 20px; }
}

@media (max-width: 480px) {
  .topbar { font-size: 8.5px; gap: 10px; padding: 7px 14px; }
  .topbar .dot { font-size: 9px; }

  .nav-inner { padding: 10px 14px; gap: 8px; }
  .nav-brand .logo { height: 36px; }
  .nav-brand .estd { font-size: 7.5px; letter-spacing: 0.18em; }

  /* If both topbar messages don't fit, hide the second */
  .topbar > span:last-child { display: none; }
}
