/*
 * Sierra Collective — Base Styles
 * Shared across every page. Load before themes.css.
 */

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

/* ── Design tokens (precision theme — default) ── */
:root {
  --bg:           #070604;
  --bg2:          #0d0b08;
  --bg3:          #161310;
  --border:       #242018;
  --border2:      #2e2820;
  --amber:        #c8862e;
  --amber-bright: #e8a840;
  --amber-dim:    #6b4818;
  --text:         #e2dbd0;
  --muted:        #6e6558;
  --green:        #4a8c5c;
  --green-bright: #5daa72;
  --red:          #8c3a2e;
  --red-bright:   #c04030;
  --font-display: 'Anton', sans-serif;
  --font-body:    'Barlow', sans-serif;
  --font-accent:  'Bebas Neue', cursive;
}

/* ── Body ── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body), sans-serif;
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
  cursor: crosshair;
}

/* Film grain overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Nav ── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  height: 64px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
  text-decoration: none;
}
.logo span { color: var(--text); }

.nav-right { display: flex; align-items: center; gap: 8px; }

/* ── Nav dropdown ── */
.nav-dropdown { position: relative; }

.nav-user-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  background: transparent; border: 1px solid var(--border2); border-radius: 2px;
  color: var(--muted); font-family: var(--font-body); font-size: 12px;
  font-weight: 500; letter-spacing: 0.04em; text-transform: none;
  cursor: crosshair; transition: all 0.15s;
}
.nav-user-btn:hover, .nav-user-btn.open { border-color: var(--amber-dim); color: var(--text); }
.nav-user-btn strong { color: var(--text); font-weight: 600; }
.nav-caret { font-size: 9px; opacity: 0.4; transition: transform 0.15s; margin-left: 2px; }
.nav-user-btn.open .nav-caret { transform: rotate(180deg); opacity: 0.8; }

.nav-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 180px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  z-index: 200;
}

.nav-menu-item {
  display: block; width: 100%; padding: 10px 16px;
  font-family: var(--font-body); font-size: 11px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
  background: none; border: none; text-align: left;
  cursor: crosshair; transition: all 0.15s;
}
.nav-menu-item:hover { background: var(--bg3); color: var(--text); }
.nav-menu-item-danger { color: var(--red-bright); }
.nav-menu-item-danger:hover { background: rgba(140,58,46,0.12); color: var(--red-bright); }
.nav-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Announcement banner ── */
.announce-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 48px;
  background: rgba(200,134,46,0.10);
  border-bottom: 1px solid var(--amber-dim);
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: 0.02em;
  position: relative;
}
.announce-banner-text { flex: 1; text-align: center; }
.announce-banner-close {
  background: none; border: none; color: var(--muted);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 6px;
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
}
.announce-banner-close:hover { color: var(--text); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: crosshair;
  text-decoration: none;
  transition: all 0.15s;
  border: none;
  background: none;
  font-family: var(--font-body);
}

.btn-ghost { background: transparent; border: 1px solid var(--border2); color: var(--muted); }
.btn-ghost:hover { border-color: var(--amber-dim); color: var(--amber); }

.btn-primary { background: var(--amber); color: var(--bg); font-weight: 700; }
.btn-primary:hover { background: var(--amber-bright); }
.btn-primary:disabled { opacity: 0.4; cursor: default; }

.btn-danger { border: 1px solid rgba(140,58,46,0.4); color: var(--red-bright); }
.btn-danger:hover { border-color: var(--red-bright); background: rgba(140,58,46,0.1); color: var(--red-bright); }

.btn-success { border: 1px solid rgba(74,140,92,0.4); color: var(--green-bright); }
.btn-success:hover { border-color: var(--green-bright); background: rgba(74,140,92,0.08); color: var(--green-bright); }

.btn-sm { padding: 4px 10px; font-size: 10px; }

/* ── Workflow state badges (shared by every BPMN-backed object) ── */
.wf-state {
  display: inline-block;
  font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 2px 8px; border: 1px solid var(--border2);
  color: var(--muted);
}
.wf-state-draft { color: var(--muted); border-color: var(--border2); }
.wf-state-pending_review { color: var(--amber); border-color: rgba(200,150,60,0.4); }
.wf-state-published { color: var(--green-bright); border-color: rgba(74,140,92,0.4); }
.wf-state-rejected { color: var(--red-bright); border-color: rgba(140,58,46,0.4); }
.wf-state-archived { color: var(--muted); border-color: var(--border2); opacity: 0.7; }

/* ── Common page layout ── */
.breadcrumb {
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 28px;
}
.breadcrumb a { color: var(--amber); text-decoration: none; }
.breadcrumb a:hover { color: var(--amber-bright); }
.breadcrumb .sep { margin: 0 8px; opacity: 0.4; }

.page-header { margin-bottom: 48px; padding-bottom: 40px; border-bottom: 1px solid var(--border); }
.page-header-eyebrow { font-size: 10px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--amber); margin-bottom: 10px; }
.page-header h1 { font-family: var(--font-display); font-size: 42px; letter-spacing: 0.02em; text-transform: uppercase; margin-bottom: 10px; }
.page-header p { font-size: 13px; font-weight: 300; color: var(--muted); }

.section-label { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.section-label-num { font-family: var(--font-accent); font-size: 13px; letter-spacing: 0.1em; color: var(--amber-dim); }
.section-label-text { font-size: 10px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Common form elements ── */
.field { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 10px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 2px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  padding: 10px 14px;
  transition: border-color 0.15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--amber-dim); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.6; }
textarea { resize: vertical; min-height: 96px; }
select { cursor: crosshair; }
select option { background: var(--bg2); }

.save-status { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--green-bright); display: none; }
.save-status.error { color: var(--red-bright); }

/* ── Card ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border2);
  padding: 32px;
  margin-bottom: 20px;
  position: relative;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 2px; height: 100%;
  background: var(--border2);
}
.card-eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; color: var(--amber-dim); margin-bottom: 8px; }
.card h2 { font-family: var(--font-display); font-size: 20px; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 6px; }
.card .card-sub { font-size: 12px; font-weight: 300; color: var(--muted); margin-bottom: 28px; }

/* ── A11y primitives ── */
.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;
}

.skip-link {
  position: absolute;
  top: -60px;
  left: 8px;
  padding: 10px 16px;
  background: var(--amber);
  color: var(--bg);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  border-radius: 2px;
  z-index: 1000;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 8px;
  outline: 2px solid var(--amber-bright);
  outline-offset: 2px;
}

:focus-visible {
  outline: 2px solid var(--amber-bright);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Toast (ui.js) ── */
.ui-toasts {
  position: fixed;
  top: 84px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10000;
  max-width: calc(100vw - 48px);
  pointer-events: none;
}
.ui-toast {
  pointer-events: auto;
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--border2);
  border-left-width: 3px;
  padding: 12px 18px;
  font-family: var(--font-body), sans-serif;
  font-size: 13px;
  line-height: 1.5;
  max-width: 420px;
  cursor: crosshair;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  animation: uiToastIn 0.18s ease both;
}
.ui-toast--info    { border-left-color: var(--amber); }
.ui-toast--success { border-left-color: var(--green); }
.ui-toast--error   { border-left-color: var(--red); }
.ui-toast--warn    { border-left-color: var(--amber-dim); }
.ui-toast--leaving { animation: uiToastOut 0.3s ease both; }

@keyframes uiToastIn {
  from { transform: translateX(24px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes uiToastOut {
  to   { transform: translateX(24px); opacity: 0; }
}

/* ── Confirm modal (ui.js) ── */
.ui-confirm {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.ui-confirm__scrim {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.72);
}
.ui-confirm__panel {
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--border2);
  max-width: 440px;
  width: 100%;
  padding: 24px 24px 20px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.7);
}
.ui-confirm__message {
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  margin: 0 0 20px;
}
.ui-confirm__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.ui-confirm__cancel,
.ui-confirm__ok {
  font-family: var(--font-body), sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 18px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--muted);
  cursor: crosshair;
  transition: all 0.15s;
}
.ui-confirm__cancel:hover { color: var(--text); border-color: var(--amber-dim); }
.ui-confirm__ok {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--bg);
}
.ui-confirm__ok:hover { background: var(--amber-bright); border-color: var(--amber-bright); }
.ui-confirm__ok--danger {
  background: var(--red);
  border-color: var(--red);
  color: var(--text);
}
.ui-confirm__ok--danger:hover { background: var(--red-bright); border-color: var(--red-bright); }

/* ── Consent banner (consent.js) ── */
.sc-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9000;
  background: var(--bg2);
  border-top: 1px solid var(--amber-dim);
  padding: 18px 24px;
  transform: translateY(calc(100% + 8px));
  transition: transform 0.24s ease;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
}
.sc-consent.is-visible { transform: translateY(0); }

.sc-consent__inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
}
.sc-consent__title {
  font-family: var(--font-accent), sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--amber);
  margin: 0 0 4px;
}
.sc-consent__copy p {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  margin: 0;
}
.sc-consent__copy a {
  color: var(--amber);
  border-bottom: 1px solid var(--amber-dim);
  text-decoration: none;
}
.sc-consent__copy a:hover { color: var(--amber-bright); }

.sc-consent__categories {
  grid-column: 1 / -1;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sc-consent__row {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 10px;
  align-items: baseline;
  color: var(--text);
  font-size: 13px;
  cursor: crosshair;
}
.sc-consent__row strong { font-weight: 600; color: var(--amber); }
.sc-consent__row span { color: var(--muted); line-height: 1.45; }
.sc-consent__row input[type="checkbox"] {
  accent-color: var(--amber);
  cursor: crosshair;
  transform: translateY(2px);
}

.sc-consent__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.sc-consent__actions .btn {
  /* Equal weight — CCPA dark-pattern rules. All three primary buttons
     share one style; btn-primary is only applied on the save action
     inside the customize submenu. */
  font-size: 12px;
  padding: 9px 16px;
}

/* Footer Do-Not-Sell-or-Share link */
.sc-dnsmpi-link,
.sc-consent-prefs-link {
  color: var(--muted);
  text-decoration: none;
}
.sc-dnsmpi-link:hover,
.sc-consent-prefs-link:hover {
  color: var(--amber);
}
.sc-dnsmpi-ack { color: var(--green-bright); font-size: 12px; }

@media (max-width: 720px) {
  .sc-consent__inner { grid-template-columns: 1fr; }
  .sc-consent__actions { justify-content: flex-start; }
}

/* ── Cart drawer (cart-drawer.js) ── */
.cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 9500;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0.2s;
}
.cart-drawer.is-open { visibility: visible; opacity: 1; }
.cart-drawer__scrim {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.72);
}
.cart-drawer__panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 100%);
  background: var(--bg2);
  border-left: 1px solid var(--border2);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.24s ease;
  box-shadow: -8px 0 32px rgba(0,0,0,0.5);
}
.cart-drawer.is-open .cart-drawer__panel { transform: translateX(0); }

.cart-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.cart-drawer__header h3 {
  font-family: var(--font-display), sans-serif;
  font-size: 20px;
  letter-spacing: 0.02em;
  margin: 0;
  text-transform: uppercase;
  color: var(--text);
}
.cart-drawer__close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: crosshair;
}
.cart-drawer__close:hover { color: var(--amber); }

.cart-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px;
}
.cart-drawer__item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.cart-drawer__item-img {
  width: 64px;
  height: 64px;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display), sans-serif;
  color: var(--amber-dim);
}
.cart-drawer__item-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-drawer__item-title { font-size: 13px; color: var(--text); font-weight: 600; }
.cart-drawer__item-variant { font-size: 11px; color: var(--muted); }
.cart-drawer__item-qty { font-size: 11px; color: var(--muted); margin-top: 2px; }
.cart-drawer__item-price {
  color: var(--amber);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.cart-drawer__footer {
  padding: 14px 20px 20px;
  border-top: 1px solid var(--border);
}
.cart-drawer__subtotal-row {
  display: flex;
  justify-content: space-between;
  margin: 10px 0;
  font-size: 14px;
  color: var(--text);
}
.cart-drawer__subtotal-row strong {
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}
.cart-drawer__subtotal-note { font-size: 11px; color: var(--muted); margin: 4px 0 12px; }
.cart-drawer__checkout { width: 100%; justify-content: center; margin-bottom: 6px; }
.cart-drawer__continue { width: 100%; justify-content: center; }

body.cart-drawer-open { overflow: hidden; }

/* ── Responsive ── */
@media (max-width: 600px) {
  nav { padding: 0 24px; }
}
