/*
 * Vintages Releases - Base CSS
 * Linear-inspired design tokens, reset, layout, and shared components
 */

/* ===== Design Tokens ===== */
:root {
  color-scheme: light;

  /* Brand */
  --color-primary: #722f37;
  --color-primary-dark: #5a252c;
  --color-primary-subtle: rgba(114, 47, 55, 0.08);

  /* Semantic colors */
  --color-secondary: #2c3e50;
  --color-success: #27ae60;
  --color-success-dark: #219a52;
  --color-danger: #c0392b;
  --color-danger-dark: #a93226;
  --color-warning: #f39c12;
  --color-bg-warning: #fff3cd;
  --color-border-warning: #ffc107;
  --color-info: #3498db;
  --color-promo: #8e44ad;
  --color-producer: #2e7d32;
  --color-google: #4285f4;

  /* Text hierarchy */
  --color-text: #1B1B1F;
  --color-text-light: #6B6B76;
  --color-text-muted: #9B9BA4;
  --color-text-inverse: #FFFFFF;

  /* Surfaces */
  --color-bg: #FFFFFF;
  --color-bg-card: #FFFFFF;
  --color-surface: #F7F7F8;
  --color-border: #E8E8EC;
  --color-border-hover: #D0D0D6;
  --color-bg-hover: #F0F0F2;

  /* Flash messages */
  --color-flash-notice-bg: #F0FAF0;
  --color-flash-notice-text: #155724;
  --color-flash-notice-border: #27ae60;
  --color-flash-alert-bg: #FFF0F0;
  --color-flash-alert-text: #721c24;
  --color-flash-alert-border: #c0392b;

  /* Overlays */
  --color-overlay: rgba(0, 0, 0, 0.5);
  --color-overlay-heavy: rgba(0, 0, 0, 0.9);

  /* Typography */
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-logo: 'EB Garamond', serif;
  --font-heading: 'Libre Baskerville', serif;
  --font-size-2xs: 0.7rem;      /* 11.2px */
  --font-size-xs: 0.75rem;      /* 12px */
  --font-size-sm: 0.875rem;     /* 14px */
  --font-size-base: 1rem;       /* 16px */
  --font-size-md: 1.0625rem;    /* 17px */
  --font-size-lg: 1.25rem;      /* 20px */
  --font-size-xl: 1.5rem;       /* 24px */
  --font-size-2xl: 1.875rem;    /* 30px */
  --font-size-3xl: 2.5rem;      /* 40px */

  /* Spacing — relaxed */
  --space-xs: 0.1875rem; /* 3px */
  --space-sm: 0.375rem;  /* 6px */
  --space-md: 0.625rem;  /* 10px */
  --space-lg: 1rem;      /* 16px */
  --space-xl: 1.25rem;   /* 20px */
  --space-2xl: 1.75rem;  /* 28px */
  --space-3xl: 2.5rem;   /* 40px */

  /* Border Radius — hierarchy */
  --radius: 6px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;

  /* Shadows — minimal, only for floating elements */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-float: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-float-up: 0 -2px 8px rgba(0, 0, 0, 0.08);

  /* Layout */
  --max-width: 1600px;
  --max-width-prose: 960px;  /* reading-friendly cap for text/forms; pages with grids use --max-width */
  --sidebar-width: 280px;
  --nav-height: 54px;

  /* Mobile */
  --tap-target-min: 44px;
  --mobile-padding: var(--space-xl);
  --header-height: 54px;

  /* Z-index ladder — preserve order: sticky < header < dropdown < modal < toast */
  --z-sticky: 10;
  --z-sticky-bar: 20;
  --z-nav-overlay: 99;
  --z-header: 100;
  --z-dropdown: 200;
  --z-modal: 1000;
  --z-modal-top: 1001;
  --z-toast: 1100;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-md);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* Libre Baskerville ships only weight 700 — main display headings */
h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 700;
}

/* Subheads use the body family for hierarchical weight + family contrast */
h4, h5, h6 {
  font-family: var(--font-family);
  font-weight: 600;
}

h1 { font-size: var(--font-size-xl); }
h2 { font-size: var(--font-size-lg); }
h3 { font-size: var(--font-size-md); }

h1, h2 {
  text-wrap: balance;
}

.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 — first focusable element on every page. Off-screen until focused. */
.skip-link {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: var(--z-toast);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-weight: 600;
  border-radius: var(--radius);
  transform: translateY(-200%);
  transition: transform 0.15s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--color-text-inverse);
  outline-offset: 2px;
}

.skip-link:hover {
  color: var(--color-text-inverse);
}

/* Suppress focus ring on programmatic <main> focus from skip link */
main:focus {
  outline: none;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:visited {
  color: color-mix(in srgb, var(--color-primary) 65%, var(--color-text-muted) 35%);
}

a:hover {
  text-decoration: none;
  color: var(--color-primary-dark);
}

/* ===== Focus — global keyboard focus indicator ===== */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ===== Layout ===== */
.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-2xl);
  flex: 1;
  width: 100%;
}

/* Reading-width container — wrap text-heavy page content (privacy, terms,
   contact form, etc.) so prose stays readable inside the wider .main-content. */
.prose-container {
  max-width: var(--max-width-prose);
  margin: 0 auto;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  min-height: var(--tap-target-min);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  line-height: 1.5;
  white-space: nowrap;
}

a.btn,
input[type="submit"].btn,
button.btn {
  color: var(--color-text-inverse);
  font-family: inherit;
  font-size: var(--font-size-sm);
  line-height: 1.5;
  box-sizing: border-box;
}

.btn:hover {
  background: var(--color-primary-dark);
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  color: var(--color-text-light);
  border: 1px solid var(--color-border);
}

a.btn-secondary,
input[type="submit"].btn-secondary,
button.btn-secondary {
  color: var(--color-text-light);
}

.btn-secondary:hover {
  background: var(--color-surface);
  border-color: var(--color-border-hover);
  color: var(--color-text);
}

.btn-success {
  background: var(--color-success);
  border-color: transparent;
}

.btn-success:hover {
  background: var(--color-success-dark);
}

.btn-danger {
  background: transparent;
  color: var(--color-danger);
  border: 1px solid color-mix(in srgb, var(--color-danger) 30%, transparent);
}

a.btn-danger,
button.btn-danger {
  color: var(--color-danger);
}

.btn-danger:hover {
  background: var(--color-danger);
  color: var(--color-text-inverse);
  border-color: var(--color-danger);
}

.btn-small {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-xs);
  min-height: 0;
}

@media (hover: none) and (pointer: coarse) {
  .btn-small {
    min-height: var(--tap-target-min);
    padding: var(--space-sm) var(--space-lg);
  }
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
  min-width: var(--tap-target-min);
  min-height: var(--tap-target-min);
  background: transparent;
  color: var(--color-text-light);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

a.btn-icon,
button.btn-icon {
  color: var(--color-text-light);
}

.btn-icon:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

.btn-icon.btn-danger {
  color: var(--color-danger);
  background: transparent;
  border: none;
}

.btn-icon.btn-danger:hover {
  background: color-mix(in srgb, var(--color-danger) 10%, transparent);
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

/* ===== Flash Messages ===== */
.flash {
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius);
  margin-bottom: var(--space-xl);
  font-size: var(--font-size-base);
  border-left: 3px solid;
}

.flash-notice {
  background: var(--color-flash-notice-bg);
  color: var(--color-flash-notice-text);
  border-left-color: var(--color-flash-notice-border);
}

.flash-alert {
  background: var(--color-flash-alert-bg);
  color: var(--color-flash-alert-text);
  border-left-color: var(--color-flash-alert-border);
}

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.filter-group-labeled {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.filter-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-filter,
.source-filter {
  display: flex;
  gap: var(--space-xs);
}

.filter-btn {
  padding: 4px var(--space-md);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text-light);
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
}

.filter-btn:hover {
  background: var(--color-surface);
  border-color: var(--color-border-hover);
  color: var(--color-text);
  text-decoration: none;
}

.filter-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text-inverse);
}

.filter-btn.active:hover {
  background: var(--color-primary-dark);
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  margin-top: var(--space-2xl);
}

.page-info {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

/* ===== Upgrade Prompts ===== */
.upgrade-banner {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-lg) var(--space-xl);
  margin-bottom: var(--space-xl);
}

.upgrade-banner p {
  margin: 0;
  color: var(--color-text-light);
  font-size: var(--font-size-sm);
}

.upgrade-prompt a {
  color: var(--color-primary);
  font-size: var(--font-size-sm);
}

/* ===== Copy Link Button ===== */
a.copy-link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text-muted);
  transition: all 0.15s;
}

a.copy-link-btn svg {
  pointer-events: none;
}

a.copy-link-btn:hover {
  background: var(--color-surface);
  color: var(--color-primary);
  border-color: var(--color-border-hover);
  text-decoration: none;
}

/* ===== Sold Out Indicators ===== */
.sold-out-badge {
  display: inline-block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-muted);
}

.sold-out-info {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* ===== Utilities ===== */
.is-hidden {
  display: none !important;
}

/* ===== Reduced Motion =====
   Honour the OS-level prefers-reduced-motion setting by collapsing
   transitions/animations to a near-instant duration. Using
   0.01ms (rather than `none`) preserves transitionend/animationend
   events that some controllers rely on. */
@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;
  }
}
