/* ==========================================================================
   Upohat — Main Stylesheet
   ========================================================================== */

/* Layer order — must match tailwind-build/src/input.css exactly.
   Tailwind v4 emits utilities in @layer utilities; unlayered rules would
   silently beat them. All custom rules live in @layer base/components so
   Tailwind utilities (outline-none, ring, hidden…) can override them. */
@layer theme, base, components, utilities;

/* ── Design Tokens (unlayered: custom properties don't interact with cascade layers) */
:root {
  /* Fonts */
  --font-serif:  'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans:   'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-script: 'Alex Brush', cursive;

  /* Gold palette */
  --gold-50:  #FCF8F1;
  --gold-100: #F6EDDC;
  --gold-200: #EDD8B6;
  --gold-300: #E2BF89;
  --gold-400: #D6A45C;
  --gold-500: #C88E38;
  --gold-600: #B27529;
  --gold-700: #8E5620;
  --gold-800: #74441E;
  --gold-900: #5F381D;

  /* Dark surface palette */
  --color-topbar:  #0A0A0A;
  --color-header:  #111111;
  --color-nav:     #141414;

  /* Page background */
  --color-page-bg: #FBF9F5;

  /* Text */
  --color-text-primary:   #1a1a1a;
  --color-text-secondary: #6b6b6b;
  --color-text-muted:     #9a9a9a;
  --color-text-inverted:  #ffffff;

  /* Border */
  --color-border:       rgba(200, 142, 56, 0.2);
  --color-border-light: rgba(200, 142, 56, 0.1);

  /* Shadows */
  --shadow-card:  0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.3);

  /* Container */
  --container-max: 1420px;
  --container-px:  clamp(1rem, 4vw, 2.5rem);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-base:   250ms ease;
  --transition-slow:   400ms ease;

  /* Border radius */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;
}

/* ── Keyframe animations (unlayered — @keyframes don't interact with cascade layers) */

@keyframes upohat-drawer-in {
  from { transform: translateX(-120vw); opacity: 0; }
  to   { transform: translateX(0);      opacity: 1; }
}
@keyframes upohat-drawer-out {
  from { transform: translateX(0);       opacity: 1; }
  to   { transform: translateX(120vw);   opacity: 0; }
}
@keyframes upohat-backdrop-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes upohat-backdrop-out { from { opacity: 1; } to { opacity: 0; } }

@keyframes upohat-fade-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* upohat-marquee-ltr / upohat-marquee-rtl intentionally removed:
   templates use animate-marquee-ltr / animate-marquee-rtl (Tailwind classes
   defined in tailwind-build/src/input.css). */

/* ── Base element styles ───────────────────────────────────────────────── */
@layer base {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  /* Prevent WooCommerce price <ins> from showing underline anywhere */
  ins {
    text-decoration: none;
    background: transparent;
  }

  html {
    overflow-x: hidden;
    scroll-behavior: smooth;
  }

  body {
    font-family: var(--font-sans);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text-primary);
    background-color: var(--color-page-bg);
    overflow-x: hidden;
    max-width: 100vw;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  ::selection {
    background-color: rgba(200, 142, 56, 0.2);
    color: #9A6216;
  }

  /* Accessible focus: interactive elements get the gold outline;
     form fields manage their own focus ring via Tailwind utilities
     (focus:ring-2, focus:ring-[…]) so suppress the default outline. */
  :where(a, button, [role="button"], summary, [tabindex]):focus-visible {
    outline: 2px solid var(--gold-500);
    outline-offset: 2px;
  }
  :where(input, textarea, select):focus-visible {
    outline: none;
  }

  img {
    max-width: 100%;
    height: auto;
    display: block;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}

/* ── Component styles ──────────────────────────────────────────────────── */
@layer components {
  /* Container */
  .upohat-container {
    max-width: var(--container-max);
    width: 100%;
    margin-inline: auto;
    padding-inline: var(--container-px);
  }

  /* Site wrapper */
  .upohat-site-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  #upohat-main {
    flex: 1;
  }

  /* Typography helpers */
  .font-serif   { font-family: var(--font-serif); }
  .font-sans    { font-family: var(--font-sans); }
  .font-script  { font-family: var(--font-script); }

  /* Scrollbar (hidden utility) */
  .no-scrollbar::-webkit-scrollbar { display: none; }
  .no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  /* Drawer animations */
  .upohat-drawer-in    { animation: upohat-drawer-in    360ms cubic-bezier(0.16, 1, 0.3, 1) forwards; }
  .upohat-drawer-out   { animation: upohat-drawer-out   320ms cubic-bezier(0.4, 0, 0.2, 1) forwards; }
  .upohat-backdrop-in  { animation: upohat-backdrop-in  300ms ease-out forwards; }
  .upohat-backdrop-out { animation: upohat-backdrop-out 300ms ease-in  forwards; }

  /* Fade-in animation */
  .upohat-fade-in { animation: upohat-fade-in 400ms ease forwards; }

  /* Product description typography (replaces missing @tailwindcss/typography) */
  .upohat-prose {
    color: rgb(71 85 105);
    font-size: 0.75rem;
    line-height: 1.625;
    font-weight: 400;
  }
  @media (min-width: 640px) {
    .upohat-prose { font-size: 0.875rem; }
  }
  .upohat-prose p {
    margin-block: 0.75em;
  }
  .upohat-prose p:first-child { margin-top: 0; }
  .upohat-prose p:last-child  { margin-bottom: 0; }
  .upohat-prose a {
    color: #C88E38;
    text-decoration: underline;
    text-underline-offset: 2px;
  }
  .upohat-prose strong { font-weight: 600; }
  .upohat-prose em     { font-style: italic; }
  .upohat-prose ul {
    list-style: none;
    padding: 0;
    margin-block: 0.75em;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  .upohat-prose ul li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .upohat-prose ul li::before {
    content: '';
    display: inline-block;
    width: 1rem;
    height: 1rem;
    margin-top: 0.125rem;
    flex-shrink: 0;
    background-color: #FAF3E3;
    border-radius: 9999px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23C88E38' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 60%;
  }
  .upohat-prose ol {
    list-style: decimal;
    padding-left: 1.25rem;
    margin-block: 0.75em;
  }
  .upohat-prose ol li { margin-block: 0.25em; }

  /* Screen-reader only */
  .sr-only,
  .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  /* Search form: reset browser defaults */
  .upohat-search-form {
    overflow: hidden;
  }

  .upohat-search-form input[type="search"],
  .upohat-search-form input[type="text"] {
    -webkit-appearance: none;
    appearance: none;
    border: 0;
    outline: 0;
    box-shadow: none;
    background: transparent;
    padding-block: 0;
    margin: 0;
  }

  /* Remove WebKit native search decorations */
  .upohat-search-form input[type="search"]::-webkit-search-cancel-button,
  .upohat-search-form input[type="search"]::-webkit-search-decoration,
  .upohat-search-form input[type="search"]::-webkit-search-results-button,
  .upohat-search-form input[type="search"]::-webkit-search-results-decoration {
    -webkit-appearance: none;
    display: none;
  }

  .upohat-search-form button[type="submit"] {
    margin: 0;
    flex-shrink: 0;
  }
  /* :focus/:focus-visible overrides removed — @layer base :where(input):focus-visible
     handles form field outline suppression globally. */
}

/* ── Utility overrides ─────────────────────────────────────────────────── */
@layer utilities {
  /* max-w-7xl: override Tailwind's default 80rem with the original design's
     1420px container. Placed in @layer utilities so it wins over Tailwind's
     generated rule when upohat.css loads after header-tailwind.css. */
  .max-w-7xl {
    max-width: 1420px;
    width: 100%;
  }
}
