@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap');

:root {
  /* ---------- Color: warm paper, not dark mode ---------- */
  --paper: #FAF6ED;
  --paper-raised: #FFFFFF;
  --paper-sunken: #F1EBDC;
  --ink: #211E1A;
  --ink-dim: #6B6459;
  --ink-faint: #A69E8F;
  --line: #E4DCC8;
  --line-strong: #D2C6A8;

  --amber: #E8A33D;
  --amber-deep: #C97F1E;
  --amber-wash: #FBF0DC;

  --teal: #2C7A7B;
  --teal-deep: #205C5D;
  --teal-wash: #E4F1EE;

  --danger: #B0473B;
  --danger-wash: #F8E7E3;

  --radius-sm: 4px;
  --radius-md: 8px;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: 48px; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0 0 0.4em;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

p { max-width: 62ch; }

a { color: var(--teal-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.7em 1.3em;
  transition: transform 0.1s ease, background 0.15s ease, box-shadow 0.15s ease;
}
button:active { transform: translateY(1px); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.btn-primary { background: var(--amber); color: var(--ink); }
.btn-primary:hover { background: var(--amber-deep); color: #fff; }
.btn-primary:disabled { background: var(--line); color: var(--ink-faint); cursor: not-allowed; }

.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); background: var(--paper-sunken); }

.btn-danger { background: transparent; color: var(--danger); border: 1.5px solid var(--danger); }
.btn-danger:hover { background: var(--danger-wash); }

.btn-sm { padding: 0.45em 0.9em; font-size: 0.85rem; }

input, textarea {
  width: 100%;
  background: var(--paper-raised);
  border: 1.5px solid var(--line-strong);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 0.75em 0.9em;
  font-family: var(--font-body);
  font-size: 0.95rem;
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input:focus, textarea:focus { border-color: var(--teal); }

label { display: block; font-size: 0.85rem; color: var(--ink-dim); margin-bottom: 0.4em; font-weight: 500; }
.field { margin-bottom: 1.2em; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 480px; margin: 0 auto; padding: 0 20px; }

.muted { color: var(--ink-dim); }
.mono { font-family: var(--font-mono); }

/* ---------- Header ---------- */
header.site-header {
  border-bottom: 1.5px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(250, 246, 237, 0.94);
  backdrop-filter: blur(6px);
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  max-width: 1080px;
  margin: 0 auto;
  gap: 12px;
}
.logo {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--ink);
  display: flex; align-items: center; gap: 9px;
  flex-shrink: 0;
}
.logo:hover { text-decoration: none; }
.logo .mark {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 0.75rem; font-weight: 600; color: var(--paper);
  flex-shrink: 0;
}

.nav-actions { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
.nav-actions .cart-btn {
  position: relative; background: var(--ink); color: var(--paper);
  border: none; display: flex; align-items: center; gap: 6px;
}
.nav-actions .cart-btn:hover { background: var(--teal-deep); }
.cart-count {
  position: absolute; top: -7px; right: -7px;
  background: var(--amber); color: var(--ink);
  font-size: 0.68rem; font-weight: 700;
  width: 19px; height: 19px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--paper);
}

/* ---------- Hero ---------- */
.hero { padding: 52px 20px 36px; }
.hero-eyebrow {
  font-size: 0.8rem; color: var(--teal-deep); font-weight: 600;
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.hero-eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }
.hero h1 { font-size: clamp(2rem, 5vw, 2.9rem); max-width: 15ch; color: var(--ink); }
.hero p { color: var(--ink-dim); font-size: 1.05rem; max-width: 46ch; }

/* ---------- Category tabs ---------- */
.tabs { display: flex; gap: 8px; padding: 0 20px; max-width: 1080px; margin: 0 auto 24px; flex-wrap: wrap; }
.tab {
  background: var(--paper-raised);
  border: 1.5px solid var(--line-strong);
  color: var(--ink-dim);
  padding: 0.5em 1.05em;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
}
.tab.active { color: var(--paper); border-color: var(--ink); background: var(--ink); }

/* ---------- Product grid: ticket-stub cards ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  padding: 0 20px;
  max-width: 1080px;
  margin: 0 auto 44px;
}

.ticket {
  background: var(--paper-raised);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ticket:hover {
  transform: translateY(-2px) rotate(-0.3deg);
  box-shadow: 0 8px 0 -4px var(--line-strong), 0 10px 20px -8px rgba(33, 30, 26, 0.18);
}

.ticket-body { padding: 18px 18px 14px; flex-grow: 1; }
.ticket-emoji { font-size: 1.7rem; margin-bottom: 8px; display: block; }
.ticket-body h3 { font-size: 1rem; margin-bottom: 0.25em; color: var(--ink); }
.ticket-body p { color: var(--ink-dim); font-size: 0.85rem; margin: 0; }

.ticket-perforation {
  position: relative;
  height: 0;
  border-top: 2px dashed var(--line-strong);
  margin: 0 0;
}
.ticket-perforation::before, .ticket-perforation::after {
  content: '';
  position: absolute; top: -9px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--paper);
  border: 1.5px solid var(--line-strong);
}
.ticket-perforation::before { left: -10px; }
.ticket-perforation::after { right: -10px; }

.ticket-stub {
  background: var(--paper-sunken);
  padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.price { color: var(--amber-deep); font-weight: 700; font-family: var(--font-display); font-size: 1.15rem; }

/* ---------- Callout ---------- */
.callout {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius-md);
  padding: 26px 24px;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px;
}
.callout h3 { color: var(--paper); margin-bottom: 4px; font-size: 1.15rem; }
.callout p { color: #CFC8B8; margin: 0; font-size: 0.9rem; }
.callout .btn-primary:hover { background: #fff; color: var(--ink); }

/* ---------- Cart drawer ---------- */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(33, 30, 26, 0.45);
  display: none; z-index: 100;
}
.drawer-overlay.open { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 400px; max-width: 92vw;
  background: var(--paper-raised); border-left: 1.5px solid var(--line-strong);
  transform: translateX(100%); transition: transform 0.22s ease;
  z-index: 101; display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-header { padding: 18px 22px; border-bottom: 1.5px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.drawer-header h3 { margin: 0; font-size: 1.15rem; }
.drawer-body { padding: 16px 22px; overflow-y: auto; flex-grow: 1; }
.drawer-footer { padding: 18px 22px; border-top: 1.5px solid var(--line); }
.cart-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.cart-item-name { font-size: 0.9rem; font-weight: 500; }
.cart-item-controls { display: flex; align-items: center; gap: 8px; }
.qty-btn { background: var(--paper-sunken); border: 1.5px solid var(--line-strong); color: var(--ink); width: 28px; height: 28px; padding: 0; border-radius: 4px; font-size: 0.95rem; }
.icon-btn { background: transparent; border: none; color: var(--ink-dim); padding: 4px; font-size: 1.1rem; }
.icon-btn:hover { color: var(--danger); }

/* ---------- Auth / forms pages ---------- */
.card {
  background: var(--paper-raised);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 30px;
}
.page-section { padding: 44px 0; }
.error-text { color: var(--danger); font-size: 0.88rem; margin-top: 8px; min-height: 1.2em; }
.success-box { background: var(--teal-wash); border: 1.5px solid var(--teal); color: var(--teal-deep); padding: 13px 16px; border-radius: var(--radius-sm); font-size: 0.9rem; }

/* ---------- Orders ---------- */
.order-row {
  background: var(--paper-raised); border: 1.5px solid var(--line-strong); border-radius: var(--radius-md);
  padding: 16px 20px; margin-bottom: 12px;
}
.order-row-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.status-badge {
  font-size: 0.72rem; font-weight: 600; padding: 4px 11px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.02em;
}
.status-pending_payment, .status-quoted, .status-pending_quote { background: var(--amber-wash); color: var(--amber-deep); }
.status-paid, .status-accepted { background: var(--teal-wash); color: var(--teal-deep); }
.status-delivered { background: var(--ink); color: var(--paper); }
.status-cancelled, .status-refunded, .status-declined { background: var(--danger-wash); color: var(--danger); }

.code-box {
  background: var(--paper-sunken); border: 1.5px dashed var(--amber-deep); border-radius: var(--radius-sm);
  padding: 14px 16px; font-family: var(--font-mono); font-size: 1rem; letter-spacing: 0.5px;
  margin-top: 10px; word-break: break-all; color: var(--ink);
}

.quote-box {
  background: var(--paper-sunken); border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 13px 16px; margin-top: 10px;
}

/* ---------- Tables (admin) ---------- */
table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-dim); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: var(--paper-sunken); }

.tabbar { display: flex; gap: 4px; border-bottom: 1.5px solid var(--line); margin-bottom: 20px; }
.tabbar button { background: none; border: none; border-radius: 0; color: var(--ink-dim); padding: 10px 16px; border-bottom: 2px solid transparent; font-weight: 500; }
.tabbar button.active { color: var(--ink); border-bottom-color: var(--amber-deep); }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--ink); border: none; color: var(--paper);
  padding: 12px 22px; border-radius: 999px; font-size: 0.9rem; font-weight: 500;
  z-index: 200; opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
  box-shadow: 0 6px 20px rgba(33, 30, 26, 0.25);
}
.toast.show { opacity: 1; }

footer { text-align: center; padding: 40px 20px; color: var(--ink-faint); font-size: 0.82rem; }

.hidden { display: none !important; }

@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; }
  .hero { padding: 40px 20px 28px; }
  .callout { flex-direction: column; align-items: flex-start; }
  .callout > a, .callout > button { width: 100%; }
}
