/* ANGARIN theme: colors, type and component finish. Loaded after every other stylesheet.
   The other stylesheets only use var(--ag-*); the two themes are defined here.
   Carbón (dark, default) and Champagné (light) switch with [data-theme] on <html> (theme.js).
   Areas that are dark by design (sidebars, heroes, the brand box) use --ag-dark* and --ag-on-dark*,
   which stay dark in both themes. */

@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("/fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("/fonts/cormorant-garamond-latin-600-italic.woff2") format("woff2"); font-weight: 600; font-style: italic; font-display: swap; }

:root, :root[data-theme="carbon"] {
  color-scheme: dark;
  /* Brand palette */
  --ag-carbon: #0B0B0C;
  --ag-graphite: #1A1A1C;
  --ag-gold-base: #C9A24B;
  --ag-cream: #F6EBDD;
  --ag-brown: #4A3326;
  --ag-olive: #4A5A4A;
  --ag-gold-dark: #8A6A22;

  /* Surfaces and text */
  --ag-bg: #0B0B0C;
  --ag-surface: #1A1A1C;
  --ag-surface-2: #141416;
  --ag-surface-3: #26262A;
  --ag-text: #F6EBDD;
  --ag-muted: #B9AC9B;
  --ag-line: rgba(246, 235, 221, .11);
  --ag-line-strong: rgba(246, 235, 221, .24);

  /* Areas dark in both themes */
  --ag-dark: #111113;
  --ag-dark-2: #1C1C1F;
  --ag-on-dark: #F6EBDD;
  --ag-on-dark-muted: #B9AC9B;
  --ag-line-on-dark: rgba(246, 235, 221, .12);
  --ag-line-on-dark-strong: rgba(246, 235, 221, .3);

  /* Gold accent */
  --ag-accent: #C9A24B;
  --ag-accent-hover: #D8B566;
  --ag-accent-text: #D6B160;
  --ag-accent-on-dark: #E2C27A;
  --ag-accent-soft: rgba(201, 162, 75, .14);
  --ag-accent-line: rgba(201, 162, 75, .38);
  --ag-accent-deep: #8A6A22;
  --ag-on-accent: #0B0B0C;

  /* States */
  --ag-success: #9DBB98;
  --ag-success-soft: rgba(122, 150, 118, .18);
  --ag-success-on-dark: #A9C4A5;
  --ag-danger: #E8907F;
  --ag-danger-soft: rgba(232, 144, 127, .14);

  --ag-shadow: 0 18px 44px rgba(0, 0, 0, .42);
  --ag-shadow-soft: 0 8px 24px rgba(0, 0, 0, .28);
  --ag-serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --ag-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

:root[data-theme="champagne"] {
  color-scheme: light;
  --ag-bg: #F6EBDD;
  --ag-surface: #FFFAF3;
  --ag-surface-2: #F1E4D2;
  --ag-surface-3: #E7D6BF;
  --ag-text: #1A1A1C;
  --ag-muted: #67574A;
  --ag-line: rgba(74, 51, 38, .13);
  --ag-line-strong: rgba(74, 51, 38, .26);

  --ag-dark: #1A1A1C;
  --ag-dark-2: #26262A;

  --ag-accent-text: #8A6A22;
  --ag-accent-soft: rgba(201, 162, 75, .18);
  --ag-accent-line: rgba(138, 106, 34, .34);

  --ag-success: #3F5E45;
  --ag-success-soft: rgba(74, 90, 74, .14);
  --ag-danger: #A3392B;
  --ag-danger-soft: rgba(163, 57, 43, .10);

  --ag-shadow: 0 18px 44px rgba(74, 51, 38, .14);
  --ag-shadow-soft: 0 8px 24px rgba(74, 51, 38, .10);
}

/* Type: Inter for reading, Cormorant Garamond for the brand and the titles. */
html { background: var(--ag-bg); }
body { background: var(--ag-bg) !important; color: var(--ag-text); font-family: var(--ag-sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font-family: inherit; }
h1, h2, .serif {
  font-family: var(--ag-serif) !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  /* Cormorant is small on the line: this matches its visual size to Inter. */
  font-size-adjust: .5;
  line-height: 1.12;
}
h1 em, h2 em, h1 span, .hero h1 span { font-style: italic; }
::selection { background: var(--ag-accent-soft); color: var(--ag-text); }

/* The top bar of every page outside the panels takes the page's own color in both themes
   (it used to stay a pale cream, also on carbon). The catalog's stays translucent carbon. */
.topbar { background: color-mix(in srgb, var(--ag-bg) 92%, transparent); border-bottom-color: var(--ag-line); }
.topbar .nav a:hover, .topbar .nav a[aria-current="page"] { background: var(--ag-accent-soft); color: var(--ag-text); }
.catalog-view .topbar { background: rgba(11, 11, 12, .92) !important; }

/* The public home is dark in both themes, so its product cards are too (they were cream,
   with cream text on Carbón). */
.catalog-view .menu-card { background: var(--ag-dark-2); border-color: var(--ag-line-on-dark); color: var(--ag-on-dark); }
.catalog-view .menu-card p { color: var(--ag-on-dark-muted); }
.catalog-view .menu-card-copy strong { color: var(--ag-on-dark); }
.catalog-view .menu-card .product-partner { color: var(--ag-accent-on-dark); }

/* Sign in / create account: the chosen tab is the filled one, in both themes. */
.auth-tabs button { color: var(--ag-muted); cursor: pointer; }
.auth-page .auth-tabs button.active { color: var(--ag-bg); background: var(--ag-text); }

/* Top bar on phones: the logo and the links on one line. Links that only lead home again
   (the logo already does) and the home's "comercio aliado" link (its hero has the same one)
   step aside so the rest fits. */
@media (max-width: 640px) {
  .topbar .container { flex-wrap: nowrap; min-height: 60px; gap: 10px; }
  .topbar .brand { min-height: 40px; padding: 6px 10px; border-radius: 12px; flex: none; }
  .topbar .brand img { width: 112px; max-height: none; }
  .topbar .nav { flex-wrap: nowrap; justify-content: flex-end; min-width: 0; }
  .topbar .nav a { min-height: 40px; display: inline-flex; align-items: center; white-space: nowrap; }
  .topbar .nav a[href="/"]:not(:only-child), .catalog-view .topbar .nav a[href="/alliance.html"] { display: none; }
  /* Lone text links get a finger-sized touch area without moving the text. */
  .ally-cta, .install-back { display: inline-block; padding-block: 10px; }
}
/* Every checkbox of the Libro de Reclamaciones keeps the same size beside its text. */
.complaint-check input { flex: none; }

/* Numbers and labels on gold carry dark text. */
.alliance-steps strong, .cash-alert strong { color: var(--ag-on-accent); }

/* Gold as text takes the tone that reads on each theme's surface. */
.badge.accent, .terms-check a, .link-button:hover { color: var(--ag-accent-text); }

/* Text on the areas that stay dark keeps the light tones in Champagné too. */
.catalog-view .topbar .nav a:hover, .catalog-view .topbar .nav a[aria-current="page"] { background: var(--ag-dark-2); color: var(--ag-on-dark); }
.catalog-view .order-note, .sidebar .admin-nav-label { color: var(--ag-on-dark-muted); }

/* The brand box: the logo on carbon. */
.brand { background: var(--ag-dark) !important; border-color: var(--ag-line-on-dark) !important; }

/* Buttons: gold pills for the main action, outlined pills for the rest. */
.button { border-radius: 999px !important; font-weight: 650; letter-spacing: .005em; transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .12s ease; }
.button:active { transform: translateY(1px); }
.button.primary, .button.client-primary, .button.order-cta {
  background: var(--ag-accent) !important; border-color: var(--ag-accent) !important; color: var(--ag-on-accent) !important;
  box-shadow: 0 10px 24px -12px rgba(201, 162, 75, .7);
}
.button.primary:hover, .button.client-primary:hover, .button.order-cta:hover { background: var(--ag-accent-hover) !important; border-color: var(--ag-accent-hover) !important; }
.button.secondary { background: transparent !important; border: 1px solid var(--ag-line-strong) !important; color: var(--ag-text) !important; }
.button.secondary:hover { border-color: var(--ag-accent) !important; color: var(--ag-accent-text) !important; }
.button[disabled], .button:disabled { opacity: .55; box-shadow: none; }
.link-button { color: var(--ag-accent-text); }

/* Cards: soft surfaces with a fine edge. */
.card, .client-section, .history-disclosure, .account-card, .modal-panel, .order-card, .client-order-card {
  border-radius: 22px;
  border-color: var(--ag-line) !important;
}
.card, .history-disclosure, .modal-panel { box-shadow: var(--ag-shadow-soft); }

/* Forms */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea {
  background-color: var(--ag-surface-2) !important;
  border-color: var(--ag-line-strong) !important;
  color: var(--ag-text) !important;
  border-radius: 14px;
}
input::placeholder, textarea::placeholder { color: var(--ag-muted); opacity: .8; }
/* A field drawn by its wrapper (search): the input inside is bare. */
.client-search input:not([type="checkbox"]):not([type="radio"]):not([type="file"]) { background: transparent !important; border: 0 !important; outline: none !important; }
.client-search:focus-within { border-color: var(--ag-accent) !important; box-shadow: 0 0 0 3px var(--ag-accent-soft); }

/* One page background everywhere; surface-2 is left for wells inside cards. */
.client-main, .app-main { background: var(--ag-bg) !important; }
.merchant-pills { background: transparent !important; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--ag-accent-soft) !important; border-color: var(--ag-accent) !important; }
input:disabled, select:disabled, textarea:disabled { opacity: .7; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ag-accent); }

/* Bottom navigation on phones: the current section in gold. */
.mobile-nav, .client-mobile-nav { background: color-mix(in srgb, var(--ag-surface) 92%, transparent) !important; border-top: 1px solid var(--ag-line) !important; backdrop-filter: blur(14px); }
.mobile-nav a, .mobile-nav button, .client-mobile-nav a, .client-mobile-nav button { color: var(--ag-muted) !important; }
.mobile-nav a.active, .client-mobile-nav a.active { color: var(--ag-accent-text) !important; box-shadow: inset 0 3px var(--ag-accent) !important; }
/* While Mi cuenta is open, it is the section marked in gold. */
.account-overlay-open .mobile-nav a.active, .account-overlay-open .client-mobile-nav a.active { color: var(--ag-muted) !important; box-shadow: none !important; }
.account-overlay-open .mobile-nav [data-account-open], .account-overlay-open .client-mobile-nav [data-account-open] { color: var(--ag-accent-text) !important; box-shadow: inset 0 3px var(--ag-accent) !important; }

/* The admin's six sections at 14 px: each takes the width of its own word. */
.admin-mobile-nav { grid-template-columns: repeat(6, auto) !important; justify-content: space-between; padding-inline: 6px; }
.admin-mobile-nav > * { padding-inline: 4px !important; white-space: nowrap; }

/* Side menus stay carbon in both themes, with the current section in gold. */
.sidebar nav a.active, .client-sidebar nav a.active, .sidebar nav a:hover, .client-sidebar nav a:hover { background: var(--ag-accent-soft) !important; color: var(--ag-accent-on-dark) !important; }
.client-sidebar nav a.active:before { background: var(--ag-accent) !important; }

/* The big public title: the serif is wider, so it gets its own size. */
.public-hero h1 { font-size: clamp(2.6rem, 11vw, 4.6rem) !important; font-size-adjust: none; line-height: 1 !important; }
.public-hero h1 span { color: var(--ag-accent-on-dark); }
.featured-copy h3 { font-family: var(--ag-serif) !important; font-weight: 600 !important; letter-spacing: 0 !important; font-size-adjust: .5; }

/* Buttons inside the areas that stay dark keep light text in both themes. */
.partner-hero .button.secondary, .client-hero .button.secondary, .sidebar .button.secondary {
  color: var(--ag-on-dark) !important; border-color: var(--ag-line-on-dark-strong) !important;
}
.partner-hero .button.secondary:hover, .client-hero .button.secondary:hover { color: var(--ag-accent-on-dark) !important; border-color: var(--ag-accent) !important; }

/* Everything filled with gold carries dark text (checked page by page). */
.public-cart-button, .featured-badge, .featured-button, .location-button, .client-avatar, #cart-fab-count {
  color: var(--ag-on-accent) !important;
}

/* "Agregar" and similar round icon buttons. */
.product-add-link, .menu-add { border-radius: 50% !important; }

/* Help: WhatsApp keeps a calm olive. */
.help-whatsapp > b { background: var(--ag-olive) !important; color: var(--ag-cream) !important; border-radius: 999px; }
.help-whatsapp > .icon { color: var(--ag-success) !important; }

/* "Apariencia": a small switch. Off is Carbón, on is Champagné. */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer;
}
.theme-toggle .theme-swatch { width: 40px; height: 24px; border-radius: 999px; background: var(--ag-carbon); border: 1px solid var(--ag-accent); position: relative; flex: none; transition: background-color .2s ease; }
.theme-toggle .theme-swatch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ag-accent); transition: transform .2s cubic-bezier(.22, 1, .36, 1); }
.theme-toggle[aria-checked="true"] .theme-swatch { background: var(--ag-cream); }
.theme-toggle[aria-checked="true"] .theme-swatch::after { transform: translateX(16px); }
.theme-toggle:focus-visible { outline: none; }
.theme-toggle:focus-visible .theme-swatch { outline: 2px solid var(--ag-accent); outline-offset: 3px; }
/* In the side menu it is a quiet line above "Mi cuenta", not one more boxed button. */
.sidebar-account-actions button.theme-toggle { padding: 0 13px; border-color: transparent; background: none; color: var(--ag-on-dark-muted); font-weight: 650; }
.sidebar-account-actions button.theme-toggle:hover { border-color: transparent; background: none; color: var(--ag-on-dark); }
@media (prefers-reduced-motion: reduce) { .theme-toggle .theme-swatch, .theme-toggle .theme-swatch::after { transition: none; } }
