/* ==========================================================================
   Components
   ========================================================================== */

/* ---- Header ------------------------------------------------------------ */
.hdr {
  position: fixed; inset: 0 0 auto 0; z-index: var(--z-header);
  color: var(--hdr-fg, var(--c-paper-100));
  transition: transform var(--d-2) var(--ease-out), color var(--d-2) ease;
}
.hdr::before {
  content: ""; position: absolute; inset: 0;
  background: color-mix(in srgb, var(--hdr-bg, var(--c-ink-900)) 72%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--hdr-line, rgba(243,241,236,.1));
  opacity: 0; transition: opacity var(--d-2) ease;
}
.hdr.is-scrolled::before { opacity: 1; }
.hdr.is-hidden { transform: translateY(-100%); }
.hdr[data-tone="light"] { --hdr-fg: var(--c-ink-900); --hdr-bg: var(--c-paper-100); --hdr-line: rgba(10,11,13,.1); }
.hdr__in { position: relative; display: flex; align-items: center; gap: var(--s-6); height: 72px; }
/* Original Aduana Virtual logo, unaltered. It sits on a white plate so its
   dark wordmark stays legible over dark sections without recoloring it. */
.brand {
  display: inline-flex; align-items: center; min-height: 44px; flex: none;
  padding: 8px 14px; border-radius: 6px; background: var(--c-white);
  box-shadow: 0 0 0 1px rgba(10,11,13,.08);
  transition: transform var(--d-1) var(--ease-snap);
}
.brand:active { transform: scale(.97); }
.brand__logo { height: 26px; width: auto; }
@media (max-width: 480px) { .brand { padding: 7px 11px; } .brand__logo { height: 21px; } }
.nav { margin-left: auto; display: flex; align-items: center; gap: clamp(14px, 2vw, 34px); }
.nav__a {
  position: relative; font-size: .9rem; font-weight: 500; opacity: .78; padding: 10px 0;
  transition: opacity var(--d-1) ease;
}
.nav__a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 4px; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right; transition: transform var(--d-2) var(--ease-out);
}
.nav__a:hover, .nav__a[aria-current="page"] { opacity: 1; }
.nav__a:hover::after, .nav__a[aria-current="page"]::after { transform: scaleX(1); transform-origin: left; }
.hdr__tools { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%;
  transition: background var(--d-1) ease, transform var(--d-1) var(--ease-snap);
}
.icon-btn:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.icon-btn:active { transform: scale(.92); }
.kbd { font-family: var(--f-mono); font-size: .7rem; border: 1px solid currentColor; opacity: .5; border-radius: 4px; padding: 1px 5px; margin-left: 6px; }
.menu-btn { display: none; }
@media (max-width: 1023px) {
  .nav { display: none; }
  .hdr__tools { margin-left: auto; }
  .menu-btn { display: inline-grid; }
  .hdr__tools .btn { display: none; }
}

/* Burger morph */
.burger { width: 22px; height: 12px; position: relative; }
.burger span { position: absolute; left: 0; right: 0; height: 1.5px; background: currentColor; transition: transform var(--d-2) var(--ease-out), top var(--d-2) var(--ease-out); }
.burger span:first-child { top: 0; } .burger span:last-child { top: 10px; }
[aria-expanded="true"] .burger span:first-child { top: 5px; transform: rotate(45deg); }
[aria-expanded="true"] .burger span:last-child { top: 5px; transform: rotate(-45deg); }

/* ---- Mobile menu -------------------------------------------------------- */
.menu {
  position: fixed; inset: 0; z-index: var(--z-menu);
  background: var(--c-ink-900); color: var(--c-paper-100);
  display: flex; flex-direction: column; padding: 96px var(--gutter) calc(32px + env(safe-area-inset-bottom));
  clip-path: inset(0 0 100% 0); visibility: hidden;
  transition: clip-path .7s var(--ease-in-out), visibility 0s linear .7s;
}
.menu.is-open { clip-path: inset(0 0 0 0); visibility: visible; transition: clip-path .7s var(--ease-in-out), visibility 0s; }
.menu__list { display: flex; flex-direction: column; gap: 2px; margin-top: auto; margin-bottom: auto; }
.menu__a {
  display: flex; align-items: baseline; gap: 16px; font-size: clamp(2.4rem, 11vw, 4.5rem); font-weight: 600;
  letter-spacing: -.045em; line-height: 1.04; padding: 4px 0;
  transform: translateY(40px); opacity: 0; transition: transform .8s var(--ease-out), opacity .6s ease;
  transition-delay: calc(var(--i) * 60ms + 200ms);
}
.menu__a small { font-family: var(--f-mono); font-size: .75rem; font-weight: 400; letter-spacing: .1em; color: var(--c-ink-300); }
.menu.is-open .menu__a { transform: none; opacity: 1; }
.menu__foot { display: flex; flex-wrap: wrap; gap: 12px; border-top: 1px solid rgba(243,241,236,.14); padding-top: 24px; }
.menu-close { position: absolute; top: 14px; right: var(--gutter); color: var(--c-paper-100); }

/* ---- Buttons ----------------------------------------------------------- */
.btn {
  --btn-bg: var(--fg); --btn-fg: var(--bg);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 24px; border-radius: var(--r-pill);
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 600; font-size: .95rem; letter-spacing: -.005em; white-space: nowrap;
  overflow: hidden; isolation: isolate;
  transition: transform var(--d-1) var(--ease-snap), background var(--d-2) ease, color var(--d-2) ease, box-shadow var(--d-2) ease;
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background: var(--accent); transform: translateY(101%); transition: transform .5s var(--ease-out);
}
.btn:hover::before { transform: none; }
.btn:hover { color: var(--c-white); }
.btn:active { transform: scale(.97); }
.btn .i { transition: transform var(--d-2) var(--ease-out); }
.btn:hover .i--go { transform: translateX(4px); }
.btn:hover .i--out { transform: translate(3px, -3px); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--fg); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn--ghost::before { background: var(--fg); }
.btn--ghost:hover { color: var(--bg); }
.btn--accent { --btn-bg: var(--accent); --btn-fg: var(--c-white); }
.btn--accent::before { background: var(--c-paper-100); }
.btn--accent:hover { color: var(--c-ink-900); }
.btn--sm { min-height: 40px; padding: 0 18px; font-size: .875rem; }
.btn--lg { min-height: 60px; padding: 0 32px; font-size: 1.05rem; }

.link-arrow {
  display: inline-flex; align-items: center; gap: 10px; font-weight: 600; min-height: 44px;
  background: linear-gradient(currentColor, currentColor) 0 calc(100% - 8px) / 0 1px no-repeat;
  transition: background-size var(--d-2) var(--ease-out);
}
.link-arrow:hover { background-size: 100% 1px; }
.link-arrow .i { transition: transform var(--d-2) var(--ease-out); }
.link-arrow:hover .i { transform: translateX(4px); }

/* ---- Chips / filters --------------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: var(--r-pill); font-size: .875rem; font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--fg);
  transition: background var(--d-1) ease, color var(--d-1) ease, box-shadow var(--d-1) ease;
}
.chip:hover { box-shadow: inset 0 0 0 1px var(--fg); }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); box-shadow: none; }
.chip__n { font-family: var(--f-mono); font-size: .72rem; opacity: .6; }

.search {
  position: relative; display: flex; align-items: center; min-height: 52px;
  border-bottom: 1px solid var(--line-strong); transition: border-color var(--d-2) ease;
}
.search:focus-within { border-color: var(--fg); }
.search .i { position: absolute; left: 0; opacity: .6; }
.search input {
  width: 100%; border: 0; background: transparent; padding: 14px 8px 14px 34px; font-size: 1.05rem; outline: none;
}
.search input::placeholder { color: var(--muted); }
.search input:focus-visible { outline: none; }

/* ---- Inner page hero --------------------------------------------------- */
.phero { padding-top: clamp(150px, 18vw, 260px); padding-bottom: clamp(64px, 8vw, 128px); overflow: hidden; }
.phero__k { display: flex; justify-content: space-between; align-items: end; gap: var(--s-6); flex-wrap: wrap; margin-bottom: var(--s-7); }
.phero__title { max-width: 14ch; }
.phero__lead { margin-top: var(--s-6); }
.phero__code {
  position: absolute; right: calc(var(--gutter) * -0.5); bottom: -0.18em; font-family: var(--f-mono);
  font-size: clamp(6rem, 22vw, 22rem); line-height: 1; letter-spacing: -.08em; color: var(--fg); opacity: .045;
  pointer-events: none; user-select: none; white-space: nowrap;
}
.crumbs { display: flex; gap: 10px; font-family: var(--f-mono); font-size: var(--t-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.crumbs a:hover { color: var(--fg); }

/* ---- Feature tiles (bento) --------------------------------------------- */
.bento { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); grid-template-columns: repeat(6, 1fr); }
.tile {
  position: relative; background: var(--bg); padding: clamp(24px, 3vw, 44px); min-height: 320px;
  display: flex; flex-direction: column; gap: var(--s-5); overflow: hidden; isolation: isolate;
  transition: background var(--d-2) ease;
}
.tile::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(520px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 10%, transparent), transparent 55%);
  opacity: 0; transition: opacity var(--d-2) ease;
}
.tile:hover::after { opacity: 1; }
.tile__n { font-family: var(--f-mono); font-size: var(--t-xs); letter-spacing: .12em; color: var(--muted); display: flex; justify-content: space-between; }
.tile__icon { width: 56px; height: 56px; color: var(--fg); }
.tile__icon .i { width: 56px; height: 56px; stroke-width: 1; }
.tile h3 { font-size: var(--t-l); font-weight: 600; letter-spacing: var(--tr-head); line-height: 1.02; margin-top: auto; }
.tile p { color: var(--muted); max-width: 30em; }
.tile__go { position: absolute; top: clamp(24px, 3vw, 44px); right: clamp(24px, 3vw, 44px); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--line-strong); transition: background var(--d-2) ease, color var(--d-2) ease, transform var(--d-2) var(--ease-out); }
.tile:hover .tile__go { background: var(--fg); color: var(--bg); transform: rotate(-45deg); }
.tile--a { grid-column: span 4; min-height: 440px; }
.tile--b { grid-column: span 2; }
.tile--c { grid-column: span 2; }
.tile--d { grid-column: span 4; }
@media (max-width: 899px) {
  .bento { grid-template-columns: 1fr; }
  .tile--a, .tile--b, .tile--c, .tile--d { grid-column: auto; min-height: 280px; }
}

/* ---- Book object ------------------------------------------------------- */
.book { perspective: 1400px; }
.book__obj {
  position: relative; transform-style: preserve-3d; border-radius: 2px 6px 6px 2px;
  transform: rotateY(var(--ry, -18deg)) rotateX(var(--rx, 4deg));
  transition: transform .9s var(--ease-out);
  box-shadow: var(--shadow-book);
}
.book__obj img { border-radius: 2px 6px 6px 2px; width: 100%; aspect-ratio: 792 / 1024; object-fit: cover; background: var(--c-ink-700); }
.book__obj::before { /* spine light */
  content: ""; position: absolute; inset: 0 auto 0 0; width: 7%; z-index: 1; border-radius: 2px 0 0 2px;
  background: linear-gradient(90deg, rgba(0,0,0,.35), rgba(255,255,255,.18) 45%, rgba(0,0,0,.08));
}
.book__obj::after { /* page block */
  content: ""; position: absolute; top: 1.5%; bottom: 1.5%; right: -14px; width: 14px;
  background: repeating-linear-gradient(90deg, #e9e5dc 0 1px, #d9d4c8 1px 2px);
  transform: rotateY(90deg); transform-origin: left; border-radius: 0 2px 2px 0;
}
.book:hover .book__obj { --ry: -6deg; --rx: 0deg; }

/* ---- Video card -------------------------------------------------------- */
.vcard { display: flex; flex-direction: column; gap: 14px; }
.vcard__media {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--r-2); background: var(--c-ink-700);
}
.vcard__media img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.02); transition: transform 1s var(--ease-out), filter var(--d-3) ease; filter: grayscale(.35) contrast(1.05); }
.vcard:hover .vcard__media img { transform: scale(1.07); filter: none; }
.vcard__play {
  position: absolute; left: 16px; bottom: 16px; width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; background: var(--c-paper-100); color: var(--c-ink-900);
  transition: transform var(--d-2) var(--ease-snap), background var(--d-2) ease;
}
.vcard:hover .vcard__play { transform: scale(1.1); background: var(--c-brand-500); color: var(--c-white); }
.vcard__tag { position: absolute; top: 14px; left: 14px; font-family: var(--f-mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; padding: 6px 10px; border-radius: var(--r-pill); background: rgba(10,11,13,.7); color: var(--c-paper-100); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.vcard__meta { display: flex; justify-content: space-between; gap: 12px; font-family: var(--f-mono); font-size: var(--t-xs); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.vcard h3 { font-size: 1.15rem; line-height: 1.3; font-weight: 600; letter-spacing: -.01em; text-wrap: balance; }
.vcard__btn { text-align: left; display: flex; flex-direction: column; gap: 14px; width: 100%; }
.vcard iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---- Dialog ------------------------------------------------------------ */
.dlg { border: 0; padding: 0; max-width: min(1100px, calc(100vw - 24px)); width: 100%; max-height: calc(100dvh - 24px); background: var(--c-paper-100); color: var(--c-ink-900); border-radius: var(--r-2); overflow: auto; }
.dlg::backdrop { background: rgba(10,11,13,.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.dlg[open] { animation: dlg-in .6s var(--ease-out); }
.dlg[open]::backdrop { animation: fade-in .4s ease; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(30px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }
.dlg__close { position: sticky; top: 12px; float: right; margin: 12px 12px 0 0; z-index: 2; background: var(--c-paper-100); }

/* ---- Command palette --------------------------------------------------- */
.pal { max-width: 680px; margin-top: 12vh; background: var(--c-ink-800); color: var(--c-paper-100); --fg: var(--c-paper-100); --muted: var(--c-ink-300); --line: rgba(243,241,236,.12); --line-strong: rgba(243,241,236,.3); --bg: var(--c-ink-800); }
.pal .search { margin: 8px 20px 0; }
.pal__list { list-style: none; margin: 0; padding: 8px 8px 12px; max-height: 56vh; overflow: auto; }
.pal__group { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--c-ink-300); padding: 16px 12px 6px; }
.pal__a { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 6px; min-height: 48px; }
.pal__a[aria-selected="true"], .pal__a:hover { background: rgba(243,241,236,.08); }
.pal__a .i { opacity: .7; }
.pal__a small { margin-left: auto; font-family: var(--f-mono); font-size: .7rem; color: var(--c-ink-300); text-transform: uppercase; letter-spacing: .08em; }
.pal__empty { padding: 24px 12px; color: var(--c-ink-300); }
.pal__foot { border-top: 1px solid rgba(243,241,236,.1); padding: 12px 20px; font-family: var(--f-mono); font-size: .7rem; color: var(--c-ink-300); display: flex; gap: 18px; }

/* ---- Share ------------------------------------------------------------- */
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.share .icon-btn { box-shadow: inset 0 0 0 1px var(--line-strong); }

/* ---- Toast ------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: var(--z-dialog); transform: translate(-50%, 30px); opacity: 0;
  background: var(--c-ink-900); color: var(--c-paper-100); padding: 12px 20px; border-radius: var(--r-pill);
  font-size: .9rem; pointer-events: none; transition: transform var(--d-2) var(--ease-out), opacity var(--d-2) ease;
  box-shadow: var(--shadow-float);
}
.toast.is-on { transform: translate(-50%, 0); opacity: 1; }

/* ---- WhatsApp float ---------------------------------------------------- */
.wa {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: var(--z-float);
  display: inline-flex; align-items: center; gap: 0; height: 56px; padding: 0 16px; border-radius: var(--r-pill);
  background: var(--c-paper-100); color: var(--c-ink-900); box-shadow: var(--shadow-float);
  font-weight: 600; font-size: .9rem; overflow: hidden;
  transition: gap var(--d-2) var(--ease-out), transform var(--d-2) var(--ease-out), opacity var(--d-2);
}
.wa .i { width: 24px; height: 24px; color: #128c4a; }
.wa span { max-width: 0; white-space: nowrap; overflow: hidden; transition: max-width .5s var(--ease-out); }
.wa:hover, .wa:focus-visible { gap: 10px; }
.wa:hover span, .wa:focus-visible span { max-width: 200px; }
.wa.is-hidden { transform: translateY(120%); opacity: 0; }

/* ---- Forms ------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: .875rem; font-weight: 600; }
.field input, .field textarea, .field select {
  width: 100%; min-height: 52px; padding: 14px 16px; border-radius: var(--r-1);
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--fg);
  transition: border-color var(--d-1) ease, box-shadow var(--d-1) ease;
}
.field textarea { min-height: 160px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--fg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 35%, transparent); }
.field__hint { font-size: .8125rem; color: var(--muted); }
.field__err { font-size: .8125rem; color: var(--accent-text); min-height: 1.2em; }
.field [aria-invalid="true"] { border-color: var(--accent-text); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px; border-radius: var(--r-pill); box-shadow: inset 0 0 0 1px var(--line-strong); }
.seg label { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border-radius: var(--r-pill); font-weight: 600; font-size: .9rem; cursor: pointer; transition: background var(--d-2) ease, color var(--d-2) ease; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + label { background: var(--fg); color: var(--bg); }
.seg input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---- Footer ------------------------------------------------------------ */
.ftr { padding-top: var(--s-10); padding-bottom: calc(var(--s-6) + env(safe-area-inset-bottom)); overflow: hidden; }
.ftr__grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--s-7) var(--col-gap); }
.ftr h2 { font-family: var(--f-mono); font-size: var(--t-xs); font-weight: 400; letter-spacing: var(--tr-label); text-transform: uppercase; color: var(--muted); margin-bottom: var(--s-4); }
.ftr ul { list-style: none; padding: 0; display: grid; gap: 2px; }
.ftr li a { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; opacity: .85; transition: opacity var(--d-1); }
.ftr li a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }
.ftr__word {
  font-size: clamp(2.2rem, 10.4vw, 12.4rem); font-weight: 700; letter-spacing: -.06em; line-height: .82; padding-bottom: .04em;
  margin-top: var(--s-10); white-space: nowrap; display: flex; justify-content: space-between; gap: .2em; user-select: none;
  background: linear-gradient(180deg, var(--fg) 30%, color-mix(in srgb, var(--fg) 15%, transparent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ftr__base { display: flex; flex-wrap: wrap; gap: 12px 32px; justify-content: space-between; border-top: 1px solid var(--line); margin-top: var(--s-6); padding-top: var(--s-5); font-size: .8125rem; color: var(--muted); }
@media (max-width: 899px) { .ftr__grid { grid-template-columns: 1fr 1fr; } .ftr__grid > :first-child { grid-column: 1 / -1; } }

/* ---- Curtain (page transition fallback) -------------------------------- */
.curtain { position: fixed; inset: 0; z-index: var(--z-curtain); background: var(--c-ink-900); transform: translateY(100%); pointer-events: none; transition: transform .5s var(--ease-in-out); }
.curtain.is-on { transform: none; }

/* ---- Accordion (details) ----------------------------------------------- */
.acc { border-top: 1px solid var(--line); }
.acc details { border-bottom: 1px solid var(--line); }
.acc summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 20px; cursor: pointer; padding: 26px 0; font-size: var(--t-m); font-weight: 500; letter-spacing: -.015em; min-height: 44px; }
.acc summary::-webkit-details-marker { display: none; }
.acc summary .plus { width: 36px; height: 36px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line-strong); position: relative; transition: transform var(--d-2) var(--ease-out), background var(--d-2); }
.acc summary .plus::before, .acc summary .plus::after { content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 1.5px; background: currentColor; transform: translate(-50%, -50%); }
.acc summary .plus::after { transform: translate(-50%, -50%) rotate(90deg); transition: transform var(--d-2) var(--ease-out); }
.acc details[open] .plus { transform: rotate(180deg); }
.acc details[open] .plus::after { transform: translate(-50%, -50%) rotate(0deg); }
.acc__body { padding: 0 0 28px; max-width: 46em; color: var(--muted); }
.acc__body > * + * { margin-top: 12px; }
