/* ============================================================
   project-base.css
   Rudbig Interiors - Webzstore migration system - shared CSS infrastructure.
   Design mode: FAITHFUL. Seeds sampled directly from the client
   screenshots (home, contact, modern-kitchen-fitting, Tipton location)
   and the logo.

   HOW UNIQUENESS WORKS (read this before touching anything):
   Class names in this file are STABLE across every client project.
   The DESIGN is unique per project because ONLY the token VALUES in
   the :root SEED block change. Same .btn, .card, .hero-split in every
   repo; a completely different-looking site in every repo.
   To restyle: change token values. NEVER rename a class to restyle.

   ARCHITECTURE (three layers, cascade order does the work):
   1. TOKENS   - the design, in :root. Seeds are overridden per project;
                 ramps derive automatically via relative color syntax.
   2. base     - element defaults + predefined component classes that
                 read tokens (the shared vocabulary).
   3. utilities - small single-purpose modifiers layered on top.
   Layer order (utilities beat components beat base) means no !important.

   Plain ASCII only. No em dashes, smart quotes, or Unicode bullets.
   ============================================================ */

@layer base, components, utilities;

/* ============================================================
   TOKENS
   ============================================================ */
:root {
  /* --- SEEDS: sampled from screenshots (Contact-us.jpg gold band = rgb(182,147,65),
     black header/footer, logo) --- */
  --primary:   oklch(68% 0.108 86);    /* Rudbig gold */
  --secondary: oklch(10% 0.009 55);    /* near-black, warm */
  --accent:    oklch(72% 0.13 70);     /* warm amber, same family as primary */

  --bg:      oklch(100% 0 0);          /* page background: pure white */
  --surface: oklch(98.2% 0.002 90);    /* zebra-striped section background */
  --ink:     oklch(15% 0.01 60);       /* body text */
  --ink-soft: oklch(40% 0.01 60);      /* secondary text */

  /* Two extra project-specific section tints (this project only, used for
     zebra striping on long service/location pages): */
  --tint-cream:     oklch(92.6% 0.025 89);   /* testimonials, alt process band */
  --tint-blue-gray: oklch(93.4% 0.013 252);  /* location "why choose us" band */

  --font-display: "Poppins", system-ui, sans-serif;  /* closest match: rounded geometric sans in headings */
  --font-body:    "Poppins", system-ui, sans-serif;

  --radius-btn:   2px;    /* squared, near-sharp buttons */
  --radius-card:  12px;   /* soft-rounded cards and images */
  --radius-input: 6px;

  --shadow-card: 0 1px 2px oklch(25% 0.02 250 / 0.06),
                 0 8px 24px oklch(25% 0.02 250 / 0.06);

  /* --- DERIVED RAMPS: leave these alone, they follow the seeds --- */
  --primary-050: oklch(from var(--primary) 0.97 calc(c * 0.25) h);
  --primary-100: oklch(from var(--primary) 0.93 calc(c * 0.40) h);
  --primary-200: oklch(from var(--primary) 0.86 calc(c * 0.60) h);
  --primary-600: oklch(from var(--primary) calc(l * 0.90) c h);   /* hover */
  --primary-700: oklch(from var(--primary) calc(l * 0.80) c h);   /* active */
  --on-primary:  oklch(from var(--primary) 0.98 0.01 h);          /* text on primary */

  --accent-600:  oklch(from var(--accent) calc(l * 0.90) c h);
  --on-accent:   oklch(from var(--accent) 0.20 calc(c * 0.4) h);

  --border:      oklch(from var(--ink) 0.88 calc(c * 0.5) h);
  --border-strong: oklch(from var(--ink) 0.78 calc(c * 0.6) h);

  /* --- Spacing scale --- */
  --space-1: 0.25rem;  --space-2: 0.5rem;  --space-3: 0.75rem;
  --space-4: 1rem;     --space-5: 1.5rem;  --space-6: 2rem;
  --space-7: 3rem;     --space-8: 4rem;    --space-9: 6rem;

  /* --- Type scale --- */
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.375rem;
  --text-2xl:  1.75rem;
  --text-3xl:  clamp(2rem, 1.4rem + 2.4vw, 3rem);
  --text-4xl:  clamp(2.5rem, 1.6rem + 3.6vw, 4rem);

  /* --- Container widths --- */
  --container-narrow: 720px;
  --container:        1080px;
  --container-wide:   1280px;
  --gutter:           clamp(1rem, 4vw, 2rem);

  /* --- Motion --- */
  --motion-fast: 160ms;
  --motion-base: 220ms;
  --motion-slow: 320ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* --- Z-index scale --- */
  --z-sticky: 100;
  --z-dropdown: 200;
  --z-overlay-backdrop: 500;
  --z-overlay: 510;
  --z-toast: 600;
}

/* ============================================================
   BASE
   ============================================================ */
@layer base {
  *, *::before, *::after { box-sizing: border-box; }

  html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

  body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
  }

  h1, h2, h3, h4 {
    font-family: var(--font-display);
    line-height: 1.15;
    color: var(--ink);
    margin: 0 0 var(--space-4);
    text-wrap: balance;
  }
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
  h3 { font-size: var(--text-2xl); }

  p { margin: 0 0 var(--space-4); max-width: 68ch; }

  a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
  a:hover { color: var(--primary-700); }

  img, picture, svg, video { display: block; max-width: 100%; height: auto; }

  :focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
  }

  .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;
  }
}

/* ============================================================
   COMPONENTS (predefined shared vocabulary)
   ============================================================ */
@layer components {

  /* --- Layout primitives --- */
  .container        { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
  .container-narrow { max-width: var(--container-narrow); }
  .container-wide   { max-width: var(--container-wide); }

  .section { padding-block: var(--space-8); }

  .stack  { display: flex; flex-direction: column; gap: var(--space-4); }
  .inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }

  .grid { display: grid; gap: var(--space-5); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-auto { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

  /* --- Buttons --- */
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
    min-height: 44px; padding: var(--space-3) var(--space-5);
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
    border: 1px solid transparent; border-radius: var(--radius-btn);
    transition: background var(--motion-fast) var(--ease-out),
                color var(--motion-fast) var(--ease-out);
  }
  .btn--primary   { background: var(--primary); color: var(--on-primary); }
  .btn--primary:hover { background: var(--primary-600); }
  .btn--primary:active { background: var(--primary-700); }
  .btn--secondary { background: transparent; color: var(--primary); border-color: var(--border-strong); }
  .btn--secondary:hover { background: var(--primary-050); }
  .btn--ghost     { background: transparent; color: var(--primary); }
  .btn--ghost:hover { background: var(--primary-050); }
  .btn[aria-disabled="true"], .btn:disabled { opacity: 0.5; pointer-events: none; }

  /* --- Cards --- */
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: var(--space-5);
    box-shadow: var(--shadow-card);
  }
  .card-title { margin-bottom: var(--space-2); }
  .card-excerpt { color: var(--ink-soft); }
  .card-cta { display: inline-block; margin-top: var(--space-3); font-weight: 600; color: var(--primary); }

  /* Linked card: whole card clickable, only the title is a real link */
  .card-linked { position: relative; transition: box-shadow var(--motion-base) var(--ease-out); }
  .card-linked .card-link::before { content: ""; position: absolute; inset: 0; z-index: 1; }
  .card-linked .card-tag,
  .card-linked a:not(.card-link) { position: relative; z-index: 2; }
  .card-linked:hover { box-shadow: 0 10px 30px oklch(from var(--ink) l c h / 0.12); }
  .card-linked:hover .card-title .card-link,
  .card-linked:hover .card-cta { color: var(--primary-700); }

  /* --- Forms --- */
  .field { display: flex; flex-direction: column; gap: var(--space-2); }
  .label { font-weight: 600; font-size: var(--text-sm); }
  .input, .textarea, .select {
    width: 100%; min-height: 44px; padding: var(--space-3);
    font: inherit; color: var(--ink); background: var(--bg);
    border: 1px solid var(--border-strong); border-radius: var(--radius-input);
  }
  .input:focus-visible, .textarea:focus-visible, .select:focus-visible { border-color: var(--primary); }
  .field--error .input { border-color: oklch(58% 0.2 25); }
  .field-error { color: oklch(50% 0.2 25); font-size: var(--text-sm); }

  /* --- Header / nav --- */
  .site-header { position: sticky; top: 0; z-index: var(--z-sticky); background: var(--bg); border-bottom: 1px solid var(--border); }
  .nav { display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); min-height: 64px; }
  .nav-list { display: flex; gap: var(--space-5); list-style: none; margin: 0; padding: 0; }
  .nav-dropdown { position: relative; }
  .nav-panel {
    position: absolute; top: 100%; left: 0; z-index: var(--z-dropdown);
    min-width: 240px; padding: var(--space-4); background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    opacity: 0; visibility: hidden; transform: translateY(6px);
    transition: opacity var(--motion-fast) var(--ease-out), transform var(--motion-fast) var(--ease-out);
  }
  .nav-dropdown[data-open="true"] .nav-panel { opacity: 1; visibility: visible; transform: none; }
  .nav-toggle { display: none; }

  /* --- Mobile drawer --- */
  .nav-drawer {
    position: fixed; inset: 0 0 0 auto; width: min(88vw, 360px); z-index: var(--z-overlay);
    background: var(--bg); padding: var(--space-6); transform: translateX(100%);
    transition: transform var(--motion-base) var(--ease-out); overflow-y: auto;
  }
  .nav-drawer[data-open="true"] { transform: none; }
  .nav-backdrop {
    position: fixed; inset: 0; z-index: var(--z-overlay-backdrop);
    background: oklch(0% 0 0 / 0.4); opacity: 0; visibility: hidden;
    transition: opacity var(--motion-base) var(--ease-out);
  }
  .nav-backdrop[data-open="true"] { opacity: 1; visibility: visible; }

  /* --- Sections that share a dark relationship with the page --- */
  .section--dark {
    background: var(--secondary);
    color: oklch(from var(--secondary) 0.96 calc(c * 0.3) h);
  }
  .section--dark h1, .section--dark h2, .section--dark h3 { color: inherit; }

  /* --- Hero --- */
  .hero-split { display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--space-7); align-items: center; }
  .hero-content { display: flex; flex-direction: column; gap: var(--space-5); }
  .hero-media img { border-radius: var(--radius-card); width: 100%; object-fit: cover; }
  .hero-centered { text-align: center; max-width: var(--container-narrow); margin-inline: auto; }

  /* --- Split feature --- */
  .split-feature { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-7); align-items: center; }
  .split-feature.split-feature--image-left .sf-media { order: -1; }
  .sf-content { display: flex; flex-direction: column; gap: var(--space-4); }

  /* --- Stats band --- */
  .stats-band { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-6); text-align: center; }
  .stat-num { font-family: var(--font-display); font-size: var(--text-4xl); color: var(--primary); }

  /* --- CTA banner --- */
  .cta-banner { text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--space-5); }

  /* --- Accordion (one-at-a-time) --- */
  .accordion-item { border-bottom: 1px solid var(--border); }
  .accordion-trigger {
    width: 100%; min-height: 44px; padding: var(--space-4) 0; text-align: left;
    font: inherit; font-weight: 600; background: none; border: 0; cursor: pointer; color: inherit;
    display: flex; justify-content: space-between; align-items: center; gap: var(--space-3);
  }
  .accordion-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--motion-base) var(--ease-out); }
  .accordion-item[data-open="true"] .accordion-panel { grid-template-rows: 1fr; }
  .accordion-panel > div { overflow: hidden; }

  /* --- Tabs --- */
  .tab-list { display: flex; gap: var(--space-2); border-bottom: 1px solid var(--border); }
  .tab { min-height: 44px; padding: var(--space-3) var(--space-4); font: inherit; background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer; }
  .tab[aria-selected="true"] { border-bottom-color: var(--primary); color: var(--primary); font-weight: 600; }
  .tab-panel[hidden] { display: none; }

  /* --- Modal --- */
  .modal-backdrop {
    position: fixed; inset: 0; z-index: var(--z-overlay-backdrop);
    display: grid; place-items: center; padding: var(--gutter);
    background: oklch(0% 0 0 / 0.5); opacity: 0; visibility: hidden;
    transition: opacity var(--motion-base) var(--ease-out);
  }
  .modal-backdrop[data-open="true"] { opacity: 1; visibility: visible; }
  .modal { background: var(--bg); border-radius: var(--radius-card); padding: var(--space-6); max-width: 520px; width: 100%; }

  /* --- Breadcrumb --- */
  .breadcrumb { display: flex; flex-wrap: wrap; gap: var(--space-2); font-size: var(--text-sm); color: var(--ink-soft); list-style: none; padding: 0; }
  .breadcrumb a { color: var(--ink-soft); }

  /* --- Footer --- */
  .site-footer { background: var(--secondary); color: oklch(from var(--secondary) 0.92 calc(c * 0.3) h); padding-block: var(--space-8); }
  .footer-grid { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: var(--space-6); }
  .footer-col a { color: inherit; text-decoration: none; }
  .footer-bottom { margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid oklch(from currentColor l c h / 0.2); display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3); font-size: var(--text-sm); }

  /* --- Prose (blog body) --- */
  .prose { max-width: var(--container-narrow); margin-inline: auto; }
  .prose h2 { margin-top: var(--space-7); }
  .prose img { border-radius: var(--radius-card); margin-block: var(--space-5); }
  .prose ul, .prose ol { padding-left: var(--space-5); }

  /* ============================================================
     PROJECT-SPECIFIC ADDITIONS (Rudbig Interiors only)
     Small structural variants layered on the shared vocabulary above.
     No shared class is renamed; these extend blocks that already exist
     in block-catalog.md.
     ============================================================ */

  /* site-header: dropdown trigger looks like a plain nav link, not a button */
  .nav-link {
    background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer;
    text-decoration: none;
  }
  .nav-list a, .nav-list .nav-link { color: inherit; text-decoration: none; }
  .nav-list a:hover, .nav-list .nav-link:hover { color: var(--primary); }

  /* site-header: two-tier header (utility bar above the nav) */
  .header-utility {
    display: flex; align-items: center; justify-content: flex-end; gap: var(--space-5);
    min-height: 48px; padding-block: var(--space-2);
    border-bottom: 1px solid oklch(from currentColor l c h / 0.12);
    font-size: var(--text-sm);
  }
  .rating-stars { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--primary); }
  .rating-stars svg { width: 16px; height: 16px; fill: var(--primary); }
  .social-links { display: inline-flex; align-items: center; gap: var(--space-2); }
  .social-links a {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 6px;
    background: oklch(from currentColor l c h / 0.12);
    color: inherit; text-decoration: none;
  }

  /* hero-split: image-left variant (Rudbig's hero has photo on the left) */
  .hero-split.hero-split--image-left .hero-media { order: -1; }

  /* btn: dash-prefixed label, matches the screenshots exactly */
  .btn-dash { display: inline-block; width: 14px; border-top: 2px solid currentColor; }
  .btn { text-transform: uppercase; font-size: var(--text-sm); letter-spacing: 0.03em; }
  /* Rudbig's outlined buttons always border in their own text color, not a neutral gray */
  .btn--secondary, .btn--ghost { border-color: currentColor; }
  /* Rudbig uses ghost as the neutral/inherited-color secondary action (white on dark
     sections, ink on light sections) and reserves gold exclusively for --secondary */
  .btn--ghost { color: inherit; }
  .btn--ghost:hover { background: oklch(from currentColor l c h / 0.1); }

  /* feature-grid: filled gold card variant (icon + title + body on primary) */
  .feature-card--filled {
    background: var(--primary); color: var(--on-primary); border: none;
  }
  .feature-card--filled .feature-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; border-radius: 50%; background: var(--bg); margin-bottom: var(--space-3);
  }

  /* service-grid: media-overlay card variant (home "Our Services" cards) */
  .service-card-media { position: relative; overflow: hidden; padding: 0; }
  .service-card-media img { aspect-ratio: 4 / 3; object-fit: cover; }
  .service-card-media .card-overlay {
    position: absolute; inset-inline: 0; bottom: 0; background: var(--primary); color: var(--on-primary);
    padding: var(--space-4);
  }

  /* process-steps: numbered circle badge */
  .step-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 64px; height: 64px; border-radius: 50%;
    background: var(--surface); color: var(--primary);
    font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 700;
    margin-bottom: var(--space-4);
  }
  .section--dark .step-num, .full-bleed.pad-lg .step-num { background: var(--bg); }

  /* testimonial-band: carousel arrow controls */
  .testimonial-nav {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border-strong);
    background: transparent; color: var(--ink); cursor: pointer;
  }

  /* cta-banner: background-image variant with dark overlay for readability */
  .cta-banner--image {
    position: relative; background-size: cover; background-position: center; color: oklch(98% 0.005 90);
  }
  .cta-banner--image::before {
    content: ""; position: absolute; inset: 0; background: oklch(from var(--secondary) l c h / 0.72);
  }
  .cta-banner--image > * { position: relative; z-index: 1; }

  /* contact-panel: contact-info list + form card + map (contact page) */
  .contact-panel { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-7); align-items: start; }
  .contact-info-item { display: flex; flex-direction: column; gap: var(--space-2); padding-block: var(--space-4); border-bottom: 1px solid var(--border); }
  .contact-info-item:last-child { border-bottom: none; }
  .contact-form-card { background: var(--primary); color: var(--on-primary); border-radius: var(--radius-card); padding: var(--space-6); }
  .contact-form-card .input { background: var(--bg); border-color: transparent; }
  .contact-form-card .label { color: inherit; }
  .form-progress { height: 4px; border-radius: 999px; background: oklch(from var(--on-primary) l c h / 0.35); overflow: hidden; margin-block: var(--space-3) var(--space-5); }
  .form-progress > span { display: block; height: 100%; background: var(--on-primary); }
  .map-embed { border-radius: var(--radius-card); overflow: hidden; border: 1px solid var(--border); }
  .map-embed iframe { width: 100%; height: 420px; border: 0; display: block; }

  /* Form submit status messages (contact-panel and any data-multistep-form) */
  .form-message {
    padding: var(--space-3) var(--space-4); border-radius: var(--radius-input); font-size: var(--text-sm);
  }
  .form-success { background: oklch(94% 0.06 150); color: oklch(30% 0.08 150); }
  .form-error   { background: oklch(94% 0.06 25);  color: oklch(35% 0.12 25); }
  .honeypot-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

  /* testimonial-band: reviewer initial avatar (no real photo available) */
  .review-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; border-radius: 50%; margin-inline: auto;
    background: var(--primary-100); color: var(--primary-700);
    font-family: var(--font-display); font-weight: 700; font-size: var(--text-xl);
  }
  .review-meta { color: var(--ink-soft); font-size: var(--text-sm); }
  .review-owner-response { background: var(--bg); border-radius: var(--radius-input); padding: var(--space-3); font-size: var(--text-sm); color: var(--ink-soft); text-align: left; }
}

/* ============================================================
   UTILITIES (single-purpose modifiers, win the cascade)
   ============================================================ */
@layer utilities {
  .full-bleed { width: 100vw; margin-inline: calc(50% - 50vw); border-radius: 0; }
  .text-center { text-align: center; }
  .text-left   { text-align: left; }
  .mx-auto { margin-inline: auto; }
  .pad-sm { padding-block: var(--space-6); }
  .pad-lg { padding-block: var(--space-9); }
  .gap-lg { gap: var(--space-6); }
  .hidden { display: none; }
  /* Layers beat specificity: without this, a components-layer display rule
     (e.g. .stack{display:flex}) on the same element wins over the browser's
     default [hidden]{display:none} UA rule. Utilities is the last layer, so
     this always wins and the native hidden attribute always works. */
  [hidden] { display: none; }

  .reveal { opacity: 0; transform: translateY(16px); transition: opacity var(--motion-slow) var(--ease-out), transform var(--motion-slow) var(--ease-out); }
  .reveal[data-revealed="true"] { opacity: 1; transform: none; }

  /* Rudbig-only zebra-striping tints (project-specific section backgrounds) */
  .tint-surface   { background: var(--surface); }
  .tint-cream     { background: var(--tint-cream); }
  .tint-blue-gray { background: var(--tint-blue-gray); }

  /* Rudbig footer uses 3 columns (brand, services, quick links), not 4 */
  .footer-grid--3 { grid-template-columns: 1.5fr 1fr 1fr; }
}

/* ============================================================
   RESPONSIVE (desktop-first, consolidated, largest to smallest)
   ============================================================ */
@media (max-width: 900px) {
  .footer-grid, .footer-grid--3 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .contact-panel { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .nav-list { display: none; }
  .nav-toggle { display: inline-flex; }
  .hero-split, .split-feature { grid-template-columns: 1fr; }
  /* Mobile reorder rule: title, image, content, CTA */
  .hero-split .hero-media { order: -1; }
  .split-feature .sf-media { order: -1; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .footer-grid, .footer-grid--3 { grid-template-columns: 1fr; }
  .header-utility { justify-content: center; flex-wrap: wrap; gap: var(--space-3); }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@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;
  }
  .reveal { opacity: 1; transform: none; }
}
