:root {
  --bg: #FFFCE9;
  --bg-alt: #F5EFD3;
  --text: #2A2017;
  --muted: #6B5F4D;
  --gold: #7D5F22;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Montserrat", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); font-weight: 300; line-height: 1.6; }
a { color: var(--gold); text-decoration: none; }

.nav { position: fixed; inset: 0 0 auto 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; background: transparent; }
.brand { font-family: var(--serif); font-size: 1.4rem; color: var(--text); }
.nav nav a { margin-left: 20px; color: var(--muted); font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; }
.nav nav a:hover { color: var(--text); }

.hero { position: relative; min-height: 100vh; display: grid; place-items: center; overflow: hidden; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: brightness(.45); }
.hero-text { position: relative; text-align: center; padding: 0 24px; }
.hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(2.5rem, 8vw, 5rem); }
.hero p { margin: 8px 0 24px; color: var(--muted); letter-spacing: .15em; text-transform: uppercase; font-size: .9rem; }
.btn { display: inline-block; padding: 12px 28px; border: 1px solid var(--gold); color: var(--gold); letter-spacing: .1em; text-transform: uppercase; font-size: .8rem; transition: .2s; }
.btn:hover { background: var(--gold); color: var(--bg); }

.section { padding: 96px 24px; max-width: 1000px; margin: 0 auto; text-align: center; }
.section.alt { max-width: none; background: var(--bg-alt); }
.section h2 { font-family: var(--serif); font-size: 2.4rem; margin-bottom: 24px; color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.card { padding: 40px 20px; border: 1px solid rgba(201,169,106,.3); }
.card h3 { font-family: var(--serif); font-size: 1.5rem; margin-bottom: 8px; }
.card p { color: var(--muted); }

.footer { padding: 32px; text-align: center; color: var(--muted); font-size: .8rem; }

@media (max-width: 600px) {
  .nav { padding: 12px 16px; }
  .nav nav a { margin-left: 12px; font-size: .7rem; }
  .section { padding: 64px 16px; }
}

/* Header: carrito, cuenta y menú móvil */
.menu-toggle { display: none; background: none; border: 0; color: var(--text); font-size: 1.5rem; cursor: pointer; }
.badge { display: inline-block; min-width: 1.4em; padding: 0 6px; border-radius: 999px; background: var(--gold); color: var(--bg); font-size: .7rem; text-align: center; }
.account-link { border: 1px solid var(--gold); padding: 6px 14px; color: var(--gold) !important; }
@media (max-width: 700px) {
  .menu-toggle { display: block; }
  .nav nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 4px; padding: 16px; background: rgba(255,252,233,.97); --muted: #6B5F4D; --gold: #7D5F22; --text: #2A2017; }
  .nav nav.open { display: flex; }
  .nav nav a { margin: 8px 0; font-size: .85rem; }
}

/* Páginas internas y formularios */
.page { padding-top: 140px; min-height: 80vh; }
.form { display: grid; gap: 16px; max-width: 380px; margin: 0 auto; text-align: left; }
.form label { display: grid; gap: 6px; color: var(--muted); font-size: .85rem; }
.form input { padding: 12px; background: var(--bg-alt); border: 1px solid rgba(201,169,106,.3); color: var(--text); font: inherit; }
.form input:focus { outline: 2px solid var(--gold); }
.form .btn { background: none; cursor: pointer; font-family: inherit; }
.form-error { color: #b3402f; font-size: .85rem; }
.muted { color: var(--muted); }
.btn:disabled { opacity: .6; cursor: wait; }

/* Catálogo y panel admin */
.card-img { width: 100%; aspect-ratio: 4/5; object-fit: contain; margin-bottom: 16px; }
.price { color: var(--gold); margin-top: 8px; }
.admin { max-width: 900px; }
.form.wide { max-width: 560px; margin-bottom: 48px; }
.form textarea { padding: 12px; background: var(--bg-alt); border: 1px solid rgba(201,169,106,.3); color: var(--text); font: inherit; resize: vertical; }
.form .check { display: flex; align-items: center; gap: 10px; }
.form .check input { width: auto; }
.row { display: flex; gap: 12px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; text-align: left; font-size: .9rem; }
.table th, .table td { padding: 12px 8px; border-bottom: 1px solid rgba(201,169,106,.2); }
.table th { color: var(--gold); font-weight: 500; }
.link { background: none; border: 0; color: var(--gold); cursor: pointer; font: inherit; margin-right: 12px; text-decoration: underline; }

/* Catálogo: 20 tarjetas medianas */
#catalogo { max-width: 1200px; }
#product-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
#product-grid .card { padding: 20px 16px; display: flex; flex-direction: column; text-align: center; }
#product-grid .card h3 { font-size: 1.15rem; line-height: 1.25; }
#product-grid .card p { font-size: .85rem; }
#product-grid .card-img { aspect-ratio: 3/4; margin-bottom: 12px; }
#product-grid .price { margin-top: auto; padding-top: 8px; }
.card-empty { min-height: 300px; justify-content: center; border-style: dashed; opacity: .45; }
.card-empty h3 { color: var(--muted); font-size: 1rem; }

/* Banner: serif clásica de capitales romanas, estilo "Roselle" */
.hero h1 { font-family: "Cinzel", var(--serif); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; font-size: clamp(2.2rem, 7vw, 4.6rem); }
.hero h1::first-letter { font-size: 1.25em; }

/* Cabecera transparente: texto claro sobre el banner, oscuro sobre el fondo crema */
.nav.on-hero { --text: #FFFCE9; --muted: #F0E8D0; --gold: #E6C985; }
.nav.on-hero .badge { color: #2A2017; }
.hero { --text: #FFFCE9; --muted: #F0E8D0; --gold: #E6C985; }

/* Sombreado del header (de arriba hacia abajo): solo al inicio de la página */
.nav::before { content: ""; position: absolute; inset: 0 0 -40% 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .35s ease;
  background: linear-gradient(to bottom, rgba(20, 14, 8, .55), rgba(20, 14, 8, 0)); }
.nav.on-hero:not(.scrolled)::before { opacity: 1; }

/* Header: logo a la izquierda, menú centrado, sesión a la derecha, tipografía Cinzel */
.nav nav a, .account-link { font-family: "Cinzel", var(--serif); font-weight: 500; letter-spacing: .1em; font-size: .85rem; }
.account-mobile { display: none; }
@media (min-width: 701px) {
  .nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
  .nav nav { display: flex; align-items: center; gap: 36px; justify-self: center; }
  .nav nav a { margin-left: 0; }
  .nav > .account-link { justify-self: end; }
  .menu-toggle { display: none; }
}
@media (max-width: 700px) {
  .nav > .account-desktop { display: none; }
  .account-mobile { display: block; text-align: center; margin-top: 8px; }
}

/* Banner: solo imagen de fondo y título grande */
.hero { color: var(--text); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 96px 24px 56px; }
.hero-stage { position: relative; z-index: 1; width: 100%; display: flex; justify-content: center; }
.hero-title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; column-gap: .32em; text-align: center;
  font-family: "Cinzel", var(--serif); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; line-height: 1.05;
  font-size: clamp(2.6rem, 9vw, 8.5rem); color: #FFFCE9; text-shadow: 0 2px 28px rgba(0, 0, 0, .55); }
.hero-title span { display: block; }
.hero-title span::first-letter { font-size: 1.22em; }
.hero-text { position: relative; z-index: 1; display: grid; justify-items: center; gap: 16px; text-align: center; }
.hero-text p { margin: 0; }
@media (max-width: 700px) {
  .hero-title { flex-direction: column; align-items: center; font-size: clamp(3rem, 17vw, 5.5rem); }
}

/* Escasez real en tarjetas */
.stock-tag { margin-top: 8px; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: #b3402f; }

/* Subida de imágenes en el admin */
.upload { display: grid; gap: 8px; justify-items: start; }
.upload-label { color: var(--muted); font-size: .85rem; }
.preview { width: 140px; aspect-ratio: 3/4; object-fit: contain; background: var(--bg-alt); border: 1px solid rgba(125,95,34,.3); }
.upload-btn { cursor: pointer; font-family: "Cinzel", var(--serif); }
.thumb { width: 44px; height: 56px; object-fit: contain; display: block; }

/* Icono de carrito */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.cart-link { display: inline-flex; align-items: center; gap: 6px; }
.cart-link .icon { display: block; }
.cart-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
@media (max-width: 700px) { .cart-text { position: static; width: auto; height: auto; clip: auto; } }

/* Buscador */
.search { display: flex; justify-content: center; margin-bottom: 32px; }
.search input { width: min(100%, 420px); padding: 12px 4px; background: transparent; border: 0; border-bottom: 1px solid var(--gold); color: var(--text); font: inherit; font-family: "Cinzel", var(--serif); letter-spacing: .08em; text-align: center; }
.search input::placeholder { color: var(--muted); opacity: .8; }
.search input:focus { outline: none; border-bottom-width: 2px; }

/* Carrusel horizontal paginado */
.carousel { position: relative; display: flex; align-items: center; gap: 8px; }
#product-grid { --per-page: 4; display: flex; gap: 20px; flex: 1; min-width: 0; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 4px 2px 12px; }
#product-grid::-webkit-scrollbar { display: none; }
#product-grid .card { flex: 0 0 calc((100% - 20px * (var(--per-page) - 1)) / var(--per-page)); scroll-snap-align: start; min-height: 0; }
@media (max-width: 1100px) { #product-grid { --per-page: 3; } }
@media (max-width: 800px) { #product-grid { --per-page: 2; } }
@media (max-width: 480px) { #product-grid { --per-page: 1; } }
.car-btn { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--gold); background: transparent; color: var(--gold); font-size: 1.6rem; line-height: 1; cursor: pointer; transition: background .2s, color .2s; }
.car-btn:hover:not(:disabled) { background: var(--gold); color: var(--bg); }
.car-btn:disabled { opacity: .3; cursor: default; }
.car-btn[hidden], .dots[hidden] { display: none; }
@media (max-width: 480px) { .car-btn { width: 36px; height: 36px; } }
.dots { display: flex; justify-content: center; gap: 10px; margin-top: 20px; }
.dot { width: 10px; height: 10px; padding: 0; border-radius: 50%; border: 1px solid var(--gold); background: transparent; cursor: pointer; }
.dot[aria-current] { background: var(--gold); }
.badge[hidden] { display: none; }

/* Botón agregar y página del carrito */
.add-btn { margin-top: 12px; padding: 10px 12px; background: none; font-family: "Cinzel", var(--serif); font-size: .72rem; cursor: pointer; width: 100%; }
.add-btn:disabled { opacity: .5; cursor: not-allowed; }
.cart-empty { display: grid; gap: 20px; justify-items: center; padding: 32px 0; }
.cart-list { list-style: none; display: grid; gap: 4px; max-width: 760px; margin: 0 auto; text-align: left; }
.cart-item { display: grid; grid-template-columns: 64px 1fr auto auto auto; gap: 16px; align-items: center; padding: 16px 0; border-bottom: 1px solid rgba(125,95,34,.25); }
.cart-thumb { width: 64px; height: 80px; object-fit: contain; background: var(--bg-alt); }
.cart-info { display: grid; gap: 2px; }
.qty { display: inline-flex; align-items: center; gap: 10px; border: 1px solid var(--gold); padding: 2px 8px; }
.qty button { background: none; border: 0; color: var(--gold); font-size: 1.2rem; cursor: pointer; padding: 2px 6px; }
.qty button:disabled { opacity: .3; cursor: default; }
.cart-line { min-width: 96px; text-align: right; }
.cart-summary { display: flex; justify-content: space-between; max-width: 760px; margin: 24px auto 8px; font-size: 1.2rem; font-family: "Cinzel", var(--serif); }
@media (max-width: 600px) {
  .cart-item { grid-template-columns: 56px 1fr auto; }
  .cart-item .qty { grid-column: 2; justify-self: start; }
  .cart-item .cart-line { grid-column: 3; grid-row: 1; }
  .cart-item .link { grid-column: 3; justify-self: end; margin: 0; }
}

/* Checkout y pedido */
.checkout { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; max-width: 980px; margin: 0 auto; text-align: left; align-items: start; }
.checkout-form { max-width: none; margin: 0; }
.form select { padding: 12px; background: var(--bg-alt); border: 1px solid rgba(125,95,34,.35); color: var(--text); font: inherit; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.small { font-size: .8rem; }
.checkout-summary { position: sticky; top: 110px; padding: 24px; border: 1px solid rgba(125,95,34,.3); display: grid; gap: 12px; }
.checkout-summary h3 { font-family: "Cinzel", var(--serif); font-weight: 500; }
.sum-list { list-style: none; display: grid; gap: 8px; }
.sum-list li { display: flex; justify-content: space-between; gap: 16px; }
.sum-total { font-family: "Cinzel", var(--serif); font-size: 1.2rem; margin-top: 8px; }
.checkout-btn { display: inline-block; margin-top: 16px; }
#order-root { max-width: 640px; margin: 0 auto; display: grid; gap: 20px; text-align: left; }
.order-head { text-align: center; display: grid; gap: 4px; }
.order-code { font-family: "Cinzel", var(--serif); font-size: clamp(1.8rem, 6vw, 2.6rem); letter-spacing: .12em; color: var(--gold); user-select: all; }
.order-status { display: inline-block; justify-self: center; padding: 4px 14px; border: 1px solid var(--gold); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; }
.pay-box { padding: 24px; background: var(--bg-alt); border-left: 3px solid var(--gold); display: grid; gap: 12px; }
.pay-text { white-space: pre-wrap; }
@media (max-width: 800px) { .checkout { grid-template-columns: 1fr; } .checkout-summary { position: static; order: -1; } .two { grid-template-columns: 1fr; } }

/* Admin: pedidos */
.admin-h { margin-top: 56px; }
.order { border: 1px solid rgba(125,95,34,.3); margin-bottom: 10px; text-align: left; }
.order summary { padding: 14px 16px; cursor: pointer; }
.order-body { padding: 8px 16px 20px; display: grid; gap: 16px; }
.order-info { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: .9rem; }
.order-info dt { color: var(--muted); }
.st { font-style: normal; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px; border: 1px solid var(--gold); }
.st-pendiente_pago { color: #9a6a00; } .st-cancelado { color: #b3402f; } .st-entregado, .st-pagado { color: #2f6b3a; }

/* Buscador en el header: solo la lupa */
.search-toggle { display: inline-flex; align-items: center; background: none; border: 0; padding: 4px; color: var(--muted); cursor: pointer; }
.search-toggle:hover, .search-toggle[aria-expanded="true"] { color: var(--text); }
/* Panel de búsqueda central: fondo difuminado, barra con glow estilo iOS */
.search-bar { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding: 18vh 20px 20px;
  background: rgba(30, 22, 12, .28); 
  --text: #FFFCE9; --muted: rgba(255,252,233,.72); --gold: #F1D79A; animation: s-fade .22s ease; }
.search-bar[hidden] { display: none; }
body.search-open { overflow: hidden; }
.search-panel { width: min(100%, 600px); display: grid; gap: 16px; animation: s-pop .28s cubic-bezier(.2, .9, .3, 1.2); }
.search-field { position: relative; display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 58px; border-radius: 18px;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .5); -webkit-backdrop-filter: blur(24px) saturate(1.3); backdrop-filter: blur(24px) saturate(1.3); color: var(--muted);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .7); }
.search-field:focus-within { background: rgba(255, 255, 255, .18); box-shadow: 0 10px 36px rgba(0, 0, 0, .2), 0 0 0 4px rgba(255, 255, 255, .22), inset 0 1px 0 rgba(255, 255, 255, .8); color: var(--text); }
.search-field input { flex: 1; min-width: 0; height: 100%; background: transparent; border: 0; outline: none; color: var(--text);
  font-family: "Cinzel", var(--serif); font-size: 1.05rem; letter-spacing: .06em; }
.search-field input::placeholder { color: var(--muted); opacity: .7; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-field kbd { font: 500 .68rem var(--sans); letter-spacing: .06em; padding: 4px 8px; border-radius: 6px; background: rgba(255,255,255,.18); color: var(--muted); }
.search-results { padding: 10px; border-radius: 20px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .4); -webkit-backdrop-filter: blur(24px) saturate(1.3); backdrop-filter: blur(24px) saturate(1.3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .2), inset 0 1px 0 rgba(255, 255, 255, .7); }
.search-label { padding: 6px 12px 8px; font: 500 .68rem "Cinzel", var(--serif); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.search-results ul { list-style: none; display: grid; gap: 2px; }
.search-results li button { width: 100%; display: flex; align-items: center; gap: 14px; padding: 8px 12px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; text-align: left; color: var(--text); font: inherit; }
.search-results li button:hover, .search-results li button:focus-visible { background: rgba(255,255,255,.16); outline: none; }
.search-results img { width: 36px; height: 46px; object-fit: contain; }
.s-name { flex: 1; font-family: "Cinzel", var(--serif); font-size: .95rem; letter-spacing: .04em; }
.s-price { color: var(--gold); font-size: .85rem; }
@property --a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes s-spin { to { --a: 360deg; } }
@keyframes s-fade { from { opacity: 0; } }
@keyframes s-pop { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@media (max-width: 700px) { .search-bar { padding-top: 12vh; } .search-field kbd { display: none; } }

/* Botones redondeados */
.btn, .account-link { border-radius: 50px; }
