/* =========================================================================
   QUADROCENTO — Sistema de diseño compartido
   Implementación del design system: pigmentos renacentistas, linen/paper
   grounds, tipografía Inter Display + Inter, paleta bole/ochre/terre.
   ========================================================================= */

/* Fuentes via Google Fonts CDN */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* ── Grounds (canvas, paper, gesso) ─────────────────────── */
  --linen:        #EDE4D2;
  --canvas:       #F4ECDA;
  --paper:        #FAF5E8;
  --gesso:        #FBF8F0;
  --shade:        #E2D6BC;

  /* ── Inks (text, marks) ─────────────────────────────────── */
  --ink:          #1C1410;
  --ink-soft:     #3A2D22;
  --ink-faint:    #6B5A48;
  --ink-ghost:    #8E7E68;

  /* ── Pigmentos renacentistas ─────────────────────────────── */
  --bole:         #7B3A10;
  --bole-deep:    #5C2A0A;
  --bole-wash:    #ECD5BB;

  --sanguine:     #A53A28;
  --sanguine-deep:#7E2B1E;
  --sanguine-wash:#E9C7BD;

  --ochre:        #C68A2B;
  --ochre-deep:   #8E5F18;
  --ochre-wash:   #F0DDB0;

  --terre-verte:  #6B7A55;
  --terre-deep:   #4B5739;
  --terre-wash:   #D8DCC4;

  --lapis:        #2C4A6E;
  --lapis-deep:   #1A2E47;
  --lapis-wash:   #C6D2E0;

  /* ── Semantic colors ─────────────────────────────────────── */
  --bg:           var(--linen);
  --bg-elevated:  var(--canvas);
  --surface:      var(--paper);
  --surface-top:  var(--gesso);
  --divider:      var(--shade);
  --border:       #D4C6A8;
  --border-strong:#A89578;

  --fg:           var(--ink);
  --fg-2:         var(--ink-soft);
  --fg-3:         var(--ink-faint);
  --fg-ghost:     var(--ink-ghost);
  --fg-on-dark:   var(--gesso);

  --accent:       var(--bole);
  --accent-press: var(--bole-deep);
  --accent-wash:  var(--bole-wash);

  --highlight:    var(--ochre);
  --link:         var(--lapis);

  --success:      var(--terre-verte);
  --warning:      var(--ochre-deep);
  --danger:       var(--sanguine-deep);
  --info:         var(--lapis);

  /* ── Tipografía ──────────────────────────────────────────── */
  --display:      'Inter', ui-sans-serif, system-ui, sans-serif;
  --text:         'Inter', ui-sans-serif, system-ui, sans-serif;
  --ui:           'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sans:         var(--ui);
  --mono:         'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Escala tipográfica */
  --t-display-1:  clamp(3.5rem, 6vw + 1rem, 6rem);
  --t-display-2:  clamp(2.75rem, 4vw + 1rem, 4.25rem);
  --t-h1:         2.5rem;
  --t-h2:         2rem;
  --t-h3:         1.5rem;
  --t-h4:         1.25rem;
  --t-h5:         1.0625rem;
  --t-body:       1rem;
  --t-small:      0.875rem;
  --t-caption:    0.75rem;
  --t-overline:   0.6875rem;

  --lh-tight:  1.05;
  --lh-snug:   1.2;
  --lh-normal: 1.5;
  --lh-loose:  1.7;

  --ls-display: -0.015em;
  --ls-tight:   -0.01em;
  --ls-normal:  0;
  --ls-wide:    0.04em;
  --ls-overline:0.14em;

  /* ── Espaciado ──────────────────────────────────────────── */
  --s-1:  4px;
  --s-2:  8px;
  --s-3:  12px;
  --s-4:  16px;
  --s-5:  24px;
  --s-6:  32px;
  --s-7:  48px;
  --s-8:  64px;
  --s-9:  96px;
  --s-10: 128px;

  /* ── Radii ──────────────────────────────────────────────── */
  --r-1: 2px;
  --r-2: 4px;
  --r-3: 6px;
  --r-4: 10px;
  --r-pill: 999px;

  /* ── Sombras (warm umber tint, NEVER neutral black) ──────── */
  --shadow-1: 0 1px 0 rgba(60,40,20,0.06), 0 1px 2px rgba(60,40,20,0.06);
  --shadow-2: 0 1px 0 rgba(60,40,20,0.05), 0 2px 6px rgba(60,40,20,0.08);
  --shadow-3: 0 2px 0 rgba(60,40,20,0.04), 0 8px 20px rgba(60,40,20,0.10);
  --shadow-4: 0 4px 0 rgba(60,40,20,0.04), 0 18px 36px rgba(60,40,20,0.14);
  --shadow-inset: inset 0 1px 0 rgba(255,250,235,0.6), inset 0 -1px 0 rgba(60,40,20,0.05);

  /* ── Motion ──────────────────────────────────────────────── */
  --ease-out:     cubic-bezier(0.2, 0.6, 0.2, 1);
  --ease-in-out:  cubic-bezier(0.4, 0, 0.2, 1);
  --ease-paper:   cubic-bezier(0.32, 0.72, 0.0, 1);
  --dur-fast:     120ms;
  --dur-base:     200ms;
  --dur-slow:     360ms;
  --dur-page:     520ms;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

::selection { background: var(--bole-wash); color: var(--ink); }

body {
  font-family: var(--ui);
  background: var(--linen);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--ink); text-decoration: none; transition: color var(--dur-fast) var(--ease-out); }
a:hover { color: var(--bole); }

button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Tipografía semántica ────────────────────────────────── */
.q-display-1, .q-display-2, .q-h1, .q-h2, .q-h3 {
  font-family: var(--display);
  font-weight: 400;
  color: var(--ink);
  letter-spacing: var(--ls-display);
  line-height: var(--lh-tight);
  margin: 0;
}
.q-display-1 { font-size: var(--t-display-1); font-weight: 300; }
.q-display-2 { font-size: var(--t-display-2); font-weight: 300; }
.q-h1        { font-size: var(--t-h1); font-weight: 500; line-height: var(--lh-snug); }
.q-h2        { font-size: var(--t-h2); font-weight: 500; line-height: var(--lh-snug); }
.q-h3        { font-size: var(--t-h3); font-weight: 500; line-height: var(--lh-snug); }

.q-overline {
  font-family: var(--ui);
  font-size: var(--t-overline);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--ls-overline);
  color: var(--ink-faint);
}

.q-mono {
  font-family: var(--mono);
  font-size: var(--t-small);
  color: var(--ink-soft);
}

.q-rule {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong) 18%, var(--border-strong) 82%, transparent);
  margin: var(--s-5) 0;
}

/* ── Header ──────────────────────────────────────────────── */
#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header {
  display: flex;
  flex-direction: column;
}

.header-top {
  background: var(--paper);
  color: var(--ink);
  padding: 0 var(--s-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  border-bottom: 1px solid var(--border);
  gap: var(--s-6);
}

.header-bottom {
  display: none;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}

.header-logo:hover { color: var(--ink); }

.header-logo img {
  height: 44px;
  width: auto;
  opacity: 1;
  filter: none;
}

.header-logo-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-logo-text {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
  line-height: 1.1;
}

.header-tagline {
  font-family: var(--ui);
  font-size: var(--t-overline);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--ls-overline);
  color: var(--ink-faint);
}

/* ── Navegación principal ────────────────────────────────── */
.header-nav {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  margin-left: var(--s-7);
  margin-right: auto;
}

.nav-link {
  font-family: var(--ui);
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  padding-bottom: 4px;
  border-bottom: 1.5px solid transparent;
  transition: color var(--dur-fast), border-color var(--dur-fast);
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--ink);
}

.nav-link.nav-active,
.nav-link.nav-highlight.nav-active {
  color: var(--ink);
  border-bottom-color: var(--bole);
}

.nav-link.nav-highlight {
  color: var(--ink-soft);
  font-weight: 500;
}

.nav-link.nav-highlight:hover {
  color: var(--ink);
}

/* ── Botón carrito ───────────────────────────────────────── */
.header-cart-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: var(--r-2);
  cursor: pointer;
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: background var(--dur-fast), border-color var(--dur-fast);
  flex-shrink: 0;
  position: relative;
}

.header-cart-btn:hover {
  background: var(--canvas);
  border-color: var(--border-strong);
}

.cart-badge {
  background: var(--bole);
  color: var(--paper);
  border-radius: var(--r-pill);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-left: auto;
}

#cliente-links,
#login-links {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
}

#login-links { display: none; }

#logout-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 4px 0;
  transition: color var(--dur-fast);
}

#logout-btn:hover { color: var(--bole); }

/* ── Footer ──────────────────────────────────────────────── */
#site-footer {
  margin-top: auto;
}

.site-footer {
  background: var(--ink);
  color: var(--gesso);
}

.footer-nero {
  background: var(--ink);
  color: var(--gesso);
  padding: var(--s-8) var(--s-6);
}

.footer-content {
  max-width: 1280px;
  margin: 0 auto var(--s-8);
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--s-8);
  padding-bottom: var(--s-8);
  border-bottom: 1px solid rgba(255, 248, 240, 0.1);
}

.footer-brand {
  display: flex;
  flex-direction: column;
}

.footer-logo {
  display: flex;
  align-items: flex-start;
  gap: var(--s-4);
  color: var(--gesso);
  text-decoration: none;
  margin-bottom: var(--s-5);
  transition: opacity var(--dur-fast);
}

.footer-logo:hover {
  opacity: 0.8;
}

.footer-logo svg {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.footer-brand-title {
  font-size: var(--t-h4);
  font-weight: 700;
  font-family: var(--display);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.footer-brand-subtitle {
  font-size: 0.875rem;
  color: rgba(255, 248, 240, 0.65);
  margin-top: var(--s-1);
}

.footer-brand-desc {
  font-size: 0.875rem;
  line-height: 1.6;
  color: rgba(255, 248, 240, 0.7);
  margin-top: auto;
  max-width: 280px;
}

.footer-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--s-8);
}

.footer-section h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--s-4);
  color: var(--gesso);
}

.footer-section nav {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.footer-section a {
  color: rgba(255, 248, 240, 0.7);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 400;
  transition: color var(--dur-fast);
  line-height: 1.5;
}

.footer-section a:hover {
  color: var(--gesso);
}

.footer-social {
  display: flex;
  gap: var(--s-3);
}

.footer-social a {
  display: inline-block;
}

.footer-bottom {
  max-width: 1280px;
  margin: 0 auto;
  text-align: center;
  padding-top: var(--s-6);
}

.footer-copy {
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--ls-overline);
  color: var(--gesso);
  margin-bottom: var(--s-2);
}

.footer-subtitle {
  font-size: 0.75rem;
  color: rgba(255, 248, 240, 0.5);
  font-weight: 400;
  letter-spacing: 0.02em;
  margin: 0;
}

@media (max-width: 768px) {
  .footer-content {
    grid-template-columns: 1fr;
    gap: var(--s-6);
  }

  .footer-sections {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s-6);
  }

  .footer-brand-desc {
    max-width: none;
  }
}

/* ── Layout de páginas interiores ────────────────────────── */
.page-content {
  max-width: 680px;
  margin: 0 auto;
  padding: var(--s-9) var(--s-6) var(--s-10);
  flex: 1;
  width: 100%;
}

.page-hero {
  text-align: center;
  padding: var(--s-9) var(--s-6) var(--s-7);
  max-width: 880px;
  margin: 0 auto;
}

.page-hero-title {
  font-family: var(--display);
  font-size: clamp(2.5rem, 4vw + 1rem, 4rem);
  font-weight: 300;
  line-height: var(--lh-tight);
  letter-spacing: -0.025em;
  margin-bottom: var(--s-4);
  color: var(--ink);
  text-wrap: balance;
}

.page-hero-sub {
  font-family: var(--text);
  font-size: 1.1875rem;
  line-height: var(--lh-loose);
  color: var(--ink-soft);
  max-width: 560px;
  margin: 0 auto;
  text-wrap: pretty;
}

/* ── Botones del design system ───────────────────────────── */
.q-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border: 0;
  border-radius: var(--r-2);
  cursor: pointer;
  padding: 12px 20px;
  transition: background var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-fast);
}

.q-btn-primary {
  background: var(--bole);
  color: var(--gesso);
  box-shadow: var(--shadow-1);
}

.q-btn-primary:hover {
  background: var(--bole-deep);
  box-shadow: var(--shadow-2);
  color: white;
}

.q-btn-primary:active {
  transform: translateY(1px);
  box-shadow: none;
}

.q-btn-secondary {
  background: var(--canvas);
  color: var(--ink);
  border: 1px solid var(--border);
}

.q-btn-secondary:hover {
  background: var(--paper);
  border-color: var(--border-strong);
}

.q-btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 0;
  padding: 12px 8px;
}

.q-btn-ghost:hover {
  color: var(--bole);
}

/* ── Chips / etiquetas ───────────────────────────────────── */
.q-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--terre-wash);
  color: var(--terre-deep);
  letter-spacing: 0;
}

.q-chip-ochre { background: var(--ochre-wash); color: var(--ochre-deep); }
.q-chip-bole  { background: var(--bole-wash); color: var(--bole-deep); }
.q-chip-lapis { background: var(--lapis-wash); color: var(--lapis-deep); }
.q-chip-danger{ background: var(--sanguine-wash); color: var(--sanguine-deep); }

/* ── Formularios ─────────────────────────────────────────── */
.q-field input,
.q-field select,
.q-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  font-family: var(--ui);
  font-size: 14px;
  background: var(--gesso);
  color: var(--ink);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

.q-field input:focus,
.q-field select:focus,
.q-field textarea:focus {
  outline: none;
  border-color: var(--bole);
  box-shadow: 0 0 0 3px var(--bole-wash);
}

.q-field label {
  display: block;
  font-family: var(--ui);
  font-size: var(--t-overline);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--ls-overline);
  color: var(--ink-faint);
  margin-bottom: var(--s-2);
}

/* ── Linen grain texture sutil en body ───────────────────── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(60,40,20,0.04) 0 1px, transparent 1px),
    radial-gradient(circle at 70% 80%, rgba(60,40,20,0.03) 0 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, rgba(60,40,20,0.03) 0 1px, transparent 1px);
  background-size: 7px 7px, 5px 5px, 11px 11px;
  opacity: 0.4;
}

body > * { position: relative; z-index: 2; }

/* ── Hamburger button ────────────────────────────────────── */
.header-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}

.header-hamburger:hover {
  background: var(--canvas);
  border-color: var(--border-strong);
}

.hbg-line {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform var(--dur-base) var(--ease-out),
              opacity var(--dur-base) var(--ease-out),
              width var(--dur-base) var(--ease-out);
  transform-origin: center;
}

/* Hamburger → X cuando open */
.header-hamburger.open .hbg-line:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.header-hamburger.open .hbg-line:nth-child(2) { opacity: 0; width: 0; }
.header-hamburger.open .hbg-line:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ── Menú móvil ──────────────────────────────────────────── */
.mobile-nav {
  display: none; /* Solo existe en móvil */
  background: var(--paper);
  border-top: 1px solid var(--border);
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--dur-slow) var(--ease-out),
              opacity var(--dur-base) var(--ease-out);
  opacity: 0;
}

.mobile-nav.open {
  max-height: 100vh;
  opacity: 1;
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  padding: var(--s-3) 0;
}

.mobile-nav-link {
  display: block;
  padding: var(--s-4) var(--s-5);
  font-family: var(--ui);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background var(--dur-fast), color var(--dur-fast);
  letter-spacing: -0.005em;
}

.mobile-nav-link:last-child { border-bottom: none; }

.mobile-nav-link:hover,
.mobile-nav-link:active {
  background: var(--canvas);
  color: var(--bole);
}

.mobile-nav-footer {
  border-top: 1px solid var(--border);
  padding: var(--s-3) 0 var(--s-4);
  display: flex;
  gap: var(--s-2);
  padding-left: var(--s-5);
  flex-wrap: wrap;
}

.mobile-nav-link-sm {
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-faint);
  text-decoration: none;
  padding: 6px 0;
  transition: color var(--dur-fast);
  background: none;
  border: none;
  cursor: pointer;
}

.mobile-nav-link-sm:hover { color: var(--bole); }

.mobile-logout { color: var(--sanguine-deep); }
.mobile-logout:hover { color: var(--sanguine); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .header-top {
    padding: 0 var(--s-4);
    height: 64px;
    gap: var(--s-3);
  }
  .header-logo img { height: 36px; }
  .header-logo-text { font-size: 1rem; }
  .header-tagline { display: none; }
  .header-nav {
    gap: var(--s-3);
    margin-left: var(--s-4);
  }
  .nav-link { font-size: 13px; }
  .header-cart-btn { padding: 6px 10px; font-size: 12px; }
  .header-actions { gap: var(--s-2); }
  #cliente-links { gap: var(--s-2); }
}

@media (max-width: 560px) {
  /* Ocultar nav del header — el menú móvil lo reemplaza */
  .header-nav    { display: none; }
  #cliente-links { display: none !important; }
  #login-links   { display: none !important; }
  .cart-label    { display: none; }

  /* Mostrar hamburger y menú móvil */
  .header-hamburger { display: flex; }
  .mobile-nav       { display: block; }

  .page-content { padding: var(--s-6) var(--s-4) var(--s-8); }
  .page-hero    { padding: var(--s-7) var(--s-4) var(--s-5); }
}
