@import "tailwindcss";

/* Safe area for notch devices */
@supports (padding: max(0px)) {
  .safe-area-pad {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
}

/* Prevent double-tap zoom on interactive elements */
input, button, a, select, textarea { touch-action: manipulation; }

/* Prevent text size adjustment on orientation change */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* iOS Safari zooms the viewport on focus for any <input>/<select>/<textarea>
   whose effective font-size is < 16px and never zooms back out. Force 16px
   on mobile widths so rate fields, promo codes, etc., stay zoom-stable. */
@media (max-width: 768px) {
  input, select, textarea { font-size: 16px; }
}

/* Smooth momentum scrolling for overflow containers */
.scroll-touch { -webkit-overflow-scrolling: touch; }

/* Visible focus ring for keyboard users on every focusable element. Earlier
   only two components had their own focus-visible style; everything else
   relied on the browser default, which Tailwind sometimes suppresses. */
@layer base {
  :focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 4px;
  }
}

/* Premium fonts: Inter + Playfair Display, self-hosted via @fontsource. The
   actual @font-face rules are imported in layout.tsx so the bundler can
   inline + preload them; the @theme tokens below pick up the resulting
   font families without a render-blocking external @import. */

@theme {
  /* Premium Dark Palette — warm luxury tones */
  --color-primary: #c9a96e;
  --color-primary-dark: #a8893f;
  --color-primary-light: #dfc68a;
  --color-secondary: #1a1a1e;
  --color-accent: #e07a5f;
  --color-background: #0f0f11;
  --color-surface: #18181b;
  --color-surface-light: #27272a;
  --color-text: #f4f4f5;
  /* #a1a1aa on surface failed WCAG AA for normal body text (4.2:1).
     #b4b4bc lifts it to ~5.1:1, which is AA-pass. */
  --color-text-muted: #b4b4bc;

  /* Gold / luxury tokens */
  --color-gold: #c9a96e;
  --color-gold-light: #dfc68a;
  --color-rose: #e07a5f;
  --color-verified: #60a5fa;
  --color-vip: #fbbf24;

  /* Typography */
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  /* Shadows */
  --shadow-glow: 0 0 20px rgba(201, 169, 110, 0.15);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-elevated: 0 8px 40px rgba(0, 0, 0, 0.5);
}

/* Base layer overrides */
@layer base {
  body {
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  h1, h2, h3 {
    font-family: var(--font-heading);
    letter-spacing: -0.01em;
  }

  /* Smooth scroll */
  html {
    scroll-behavior: smooth;
  }

  /* R17 C.3: bottom-nav (md:hidden) overlays the bottom 64 px on mobile.
     Reserve scroll padding so anchor links don't scroll the target
     heading behind the nav. md+ has no bottom-nav, so 0. */
  @media (max-width: 767px) {
    html {
      scroll-padding-bottom: calc(5rem + env(safe-area-inset-bottom));
    }
  }

  /* Custom scrollbar */
  ::-webkit-scrollbar {
    width: 6px;
  }
  ::-webkit-scrollbar-track {
    background: var(--color-background);
  }
  ::-webkit-scrollbar-thumb {
    background: var(--color-surface-light);
    border-radius: 3px;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
  }

  /* Selection color */
  ::selection {
    background-color: rgba(201, 169, 110, 0.3);
    color: var(--color-text);
  }
}

/* Utility classes */
@layer utilities {
  .font-heading {
    font-family: var(--font-heading);
  }
  .font-body {
    font-family: var(--font-body);
  }
  .text-gold {
    color: var(--color-gold);
  }
  .bg-gold {
    background-color: var(--color-gold);
  }
  .shadow-glow {
    box-shadow: var(--shadow-glow);
  }
  .shadow-card {
    box-shadow: var(--shadow-card);
  }
  .shadow-elevated {
    box-shadow: var(--shadow-elevated);
  }
  .gradient-gold {
    background: linear-gradient(135deg, var(--color-gold), var(--color-gold-light));
  }
  .gradient-dark {
    background: linear-gradient(180deg, transparent, var(--color-background));
  }

  /* R17 D.3: safe-area utilities so future components can use
     `pb-safe`/`pt-safe`/`pl-safe`/`pr-safe` instead of inline calc().
     Composes with `max(...)` so the iOS notch/home indicator never
     swallows interactive UI. */
  .pb-safe {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
  .pt-safe {
    padding-top: max(1rem, env(safe-area-inset-top));
  }
  .pl-safe {
    padding-left: max(1rem, env(safe-area-inset-left));
  }
  .pr-safe {
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  .mb-safe {
    margin-bottom: env(safe-area-inset-bottom);
  }
  .bottom-safe {
    bottom: env(safe-area-inset-bottom);
  }
}

/* Blog post content — prose-like typography */
[data-blog-content] p {
  margin-bottom: 1.25rem;
  line-height: 1.75;
  color: var(--color-text-muted);
}
[data-blog-content] h2 {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  scroll-margin-top: 5rem;
}
[data-blog-content] h3 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
  scroll-margin-top: 5rem;
}
[data-blog-content] a {
  color: var(--color-primary);
  text-decoration: none;
}
[data-blog-content] a:hover {
  text-decoration: underline;
}
[data-blog-content] strong {
  color: var(--color-text);
}
[data-blog-content] ul,
[data-blog-content] ol {
  margin-top: 1rem;
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  color: var(--color-text-muted);
}
[data-blog-content] ul {
  list-style-type: disc;
}
[data-blog-content] ol {
  list-style-type: decimal;
}
[data-blog-content] li {
  margin-bottom: 0.5rem;
}
[data-blog-content] blockquote {
  border-left: 3px solid var(--color-primary);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--color-text-muted);
  font-style: italic;
}
[data-blog-content] code {
  color: var(--color-primary);
  background: var(--color-surface-light);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
}
[data-blog-content] pre {
  background: var(--color-surface-light);
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
}
[data-blog-content] img {
  border-radius: 0.5rem;
  margin: 1.5rem 0;
}
[data-blog-content] hr {
  margin: 2rem 0;
  border-color: var(--color-surface-light);
}
[data-blog-content] table {
  width: 100%;
  color: var(--color-text-muted);
  margin: 1rem 0;
}
[data-blog-content] th {
  color: var(--color-text);
  border-bottom: 1px solid var(--color-surface-light);
  padding: 0.5rem;
  text-align: left;
}
[data-blog-content] td {
  border-bottom: 1px solid var(--color-surface-light);
  padding: 0.5rem;
}

/* Availability pulse glow animation */
@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4);
  }
  50% {
    box-shadow: 0 0 8px 2px rgba(74, 222, 128, 0.25);
  }
}

/* Light mode overrides — toggled via .light-mode on <html> */
html.light-mode {
  --color-background: #f5f5f5;
  --color-surface: #ffffff;
  --color-surface-light: #e8e8ed;
  --color-text: #18181b;
  --color-text-muted: #52525b;
  --color-secondary: #f0f0f4;
  --shadow-glow: 0 0 20px rgba(201, 169, 110, 0.1);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-elevated: 0 8px 40px rgba(0, 0, 0, 0.12);
}
