/* ==========================================================================
   SOPHOLIAGE — GLOBAL THEME
   Botanical / heritage aesthetic per Sopholiage Brand Identity Guide.
   This file is the single source of design tokens for the whole site.
   Import it first, on every page/embed, before any component CSS.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. FONTS
   Primary serif = "the Expert" voice (headers, legal, banner text).
   Body serif = readable, warm, used for all functional UI (forms, buttons,
   labels) so we never fall back to a modern sans-serif per brand constraints.
   Script = "Community" voice, used ONLY for event headers + @handle, per
   guide section 4/5. Never use script for body copy or UI controls.
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;0,700;1,500&family=Lora:ital,wght@0,400;0,500;0,600;1,400&family=Caveat:wght@500;700&family=Montserrat:ital,wght@0,500;0,600;1,500&family=Marcellus&display=swap');

:root {
  /* ---- Color palette (Sopholiage Brand Guide, Section 3) ---- */
  --color-sage:        #96A87F;   /* primary — banner, main foliage */
  --color-sage-dark:    #6E7F5C;  /* hover/active state for sage elements */
  --color-moss:        #4E5D3A;   /* grounding accent, shadow, contrast */
  --color-mauve:       #C48B93;   /* floral accent — sparingly, for warmth */
  --color-mauve-dark:  #A96670;
  --color-tan:         #B8875A;   /* the "human" element — hand illustration */
  --color-cream:       #F2EEDF;   /* canvas / background wash */
  --color-cream-deep:  #E9E2CB;   /* card backgrounds, banded sections */
  --color-ink:         #2E2A22;   /* body text — warm near-black, not pure black */
  --color-ink-soft:    #5B5546;   /* secondary text */
  --color-line:        #C9C0A6;   /* hairline borders, dividers */

  /* Semantic aliases — reference these in components, not raw colors above,
     so a future palette tweak only touches this block. */
  --color-bg:              var(--color-cream);
  --color-bg-raised:       var(--color-cream-deep);
  --color-text:            var(--color-ink);
  --color-text-muted:      var(--color-ink-soft);
  --color-accent:          var(--color-sage);
  --color-accent-strong:   var(--color-moss);
  --color-accent-floral:   var(--color-mauve);
  --color-border:          var(--color-line);
  --color-focus:           var(--color-moss);

  /* Status colors kept in-palette (no neon/synthetic per guide Section 7) */
  --color-success: #6E7F5C;
  --color-warning: #B8875A;
  --color-danger:  #A05A4E;

  /* ---- Typography ---- */
  --font-display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-body:    'Lora', Georgia, 'Times New Roman', serif;
  --font-script:  'Marcellus', serif;
  --font-wordmark: 'Montserrat', sans-serif;
  --font-tabs:    'Marcellus', serif;

  /* Text sizes (not headings). Phones: 1.2x the original 13 / 15 / 17 / 20px. Desktop (1000px+): 1.5x, see below. */
  --fs-xs:   calc(0.8125rem * 1.2);  /* 15.6px */
  --fs-sm:   calc(0.9375rem * 1.2);  /* 18px */
  --fs-base: calc(1.0625rem * 1.2);  /* 20.4px — body text; serif body needs to be generous */
  --fs-md:   calc(1.25rem * 1.2);    /* 24px */
  --fs-lg:   1.625rem;   /* 26px */
  --fs-xl:   2.25rem;    /* 36px */
  --fs-2xl:  3rem;       /* 48px */
  --fs-3xl:  3.75rem;    /* 60px */

  --lh-tight: 1.15;
  --lh-body:  1.65;   /* generous, per serif-body guidance */

  /* ---- Spacing scale (8px base) ---- */
  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
  --space-7: 4.5rem;
  --space-8: 6rem;

  /* ---- Layout ---- */
  --max-width: 1200px;
  --max-width-prose: 68ch;
  --radius-sm: 3px;
  --radius-md: 6px;
  /* Deliberately small/near-zero radii — avoids the generic "SaaS rounded
     card" look; the brand's softness comes from illustration, not chrome. */

  /* ---- Motion ---- */
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-med:  280ms;

  /* ---- Elevation — soft, warm shadow instead of default cool grey ---- */
  --shadow-sm: 0 1px 3px rgba(46, 42, 34, 0.10);
  --shadow-md: 0 4px 16px rgba(46, 42, 34, 0.12);
  --shadow-lg: 0 12px 32px rgba(46, 42, 34, 0.16);
}

/* Desktop: everything except the headings is 1.5x the original sizes (phones use the 1.2x sizes above). Headings use --fs-lg and up, which are left alone. The nav bar and the homepage
   pin their own sizes, so they are unaffected. */
@media (min-width: 1000px) {
  :root {
    --fs-xs:   calc(0.8125rem * 1.5);
    --fs-sm:   calc(0.9375rem * 1.5);
    --fs-base: calc(1.0625rem * 1.5);
    --fs-md:   calc(1.25rem * 1.5);
  }
  .eyebrow { font-size: var(--fs-base); } /* the little label above a heading matches body size */
}

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

/* --------------------------------------------------------------------------
   2. RESET / BASE
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  /* Subtle aged-paper texture wash, per guide Section 6. Swap the data URI
     for a licensed watercolor-paper texture asset when available. */
  background-image:
    radial-gradient(ellipse at top left, rgba(150, 168, 127, 0.06), transparent 60%),
    radial-gradient(ellipse at bottom right, rgba(184, 135, 90, 0.05), transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--color-accent-strong);
  text-decoration-color: var(--color-sage);
  text-underline-offset: 3px;
}
a:hover { color: var(--color-mauve-dark); }

/* Visible keyboard focus everywhere — non-negotiable for accessibility */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   3. TYPOGRAPHY
   -------------------------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--color-ink);
  margin: 0 0 var(--space-3);
  letter-spacing: 0.01em;
}

h1 { font-size: calc(var(--fs-3xl) - 2pt); font-weight: 700; }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-md); font-weight: 600; }

@media (max-width: 640px) {
  h1 { font-size: calc(var(--fs-2xl) - 2pt); }
  h2 { font-size: var(--fs-xl); }
  h3 { font-size: var(--fs-lg); }
}

p {
  margin: 0 0 var(--space-3);
  max-width: var(--max-width-prose);
}

.eyebrow {
  /* Used sparingly — a small kicker label, NOT tracked-out all-caps by
     default (that reads as generic AI-page chrome). Sentence case + a
     hand-drawn leaf glyph ties it back to the brand's illustration world. */
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-script);
  font-size: var(--fs-md);
  color: var(--color-accent-strong);
}

/* Community/event headers — the ONLY place the script font and
   multi-chromatic letter treatment belong, per guide Section 4. */
.event-heading {
  font-family: var(--font-script);
  font-size: var(--fs-2xl);
  line-height: 1;
}
.event-heading .chroma span:nth-child(5n+1) { color: var(--color-sage-dark); }
.event-heading .chroma span:nth-child(5n+2) { color: var(--color-mauve-dark); }
.event-heading .chroma span:nth-child(5n+3) { color: var(--color-tan); }
.event-heading .chroma span:nth-child(5n+4) { color: var(--color-moss); }
.event-heading .chroma span:nth-child(5n+5) { color: var(--color-sage-dark); }

/* @handle styling per guide Section 5 */
.handle {
  font-family: var(--font-script);
  font-size: var(--fs-md);
  color: var(--color-accent-strong);
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}
.handle::before {
  content: '';
  width: 1em;
  height: 1em;
  background: currentColor;
  /* Replace with an inline hand-drawn leaf SVG mask in production */
  mask: radial-gradient(circle at 30% 30%, black 40%, transparent 41%);
  -webkit-mask: radial-gradient(circle at 30% 30%, black 40%, transparent 41%);
}

/* --------------------------------------------------------------------------
   4. LAYOUT PRIMITIVES
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.section {
  padding-block: var(--space-7);
}
.section--tight { padding-block: var(--space-5); }

.section--banded {
  background-color: var(--color-bg-raised);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.stack > * + * { margin-top: var(--space-3); }
.stack-lg > * + * { margin-top: var(--space-5); }

.grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

@media (max-width: 640px) {
  .container { padding-inline: var(--space-3); }
  .section { padding-block: var(--space-5); }
}

/* --------------------------------------------------------------------------
   5. BUTTONS
   Ribbon/banner-inspired shape cues (subtle notch), not a rounded pill —
   ties back to the logo's banner motif without being literal/kitsch.
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.75em 1.5em;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard),
              transform var(--duration-fast) var(--ease-standard);
  line-height: 1;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  background-color: var(--color-accent-strong);
  color: var(--color-cream);
}
.btn--primary:hover { background-color: var(--color-sage-dark); color: var(--color-cream); }

.btn--secondary {
  background-color: transparent;
  border-color: var(--color-accent-strong);
  color: var(--color-accent-strong);
}
.btn--secondary:hover { background-color: var(--color-accent-strong); color: var(--color-cream); }

.btn--floral {
  background-color: var(--color-mauve);
  color: var(--color-cream);
}
.btn--floral:hover { background-color: var(--color-mauve-dark); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn--block { width: 100%; }

/* --------------------------------------------------------------------------
   6. CARDS
   Used for product tiles, class tiles, service tiles. Deliberately no
   drop-shadow-everywhere SaaS-kit sameness — a hairline border does most of
   the separation, shadow only appears on hover/interaction.
   -------------------------------------------------------------------------- */
.card {
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow var(--duration-med) var(--ease-standard),
              border-color var(--duration-med) var(--ease-standard);
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-sage);
}
.card__media {
  aspect-ratio: 4 / 3;
  background-color: var(--color-cream-deep);
  overflow: hidden;
}
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__body { padding: var(--space-3) var(--space-4) var(--space-4); }
.card__title { font-family: var(--font-display); font-size: var(--fs-md); margin-bottom: 0.25em; }
.card__meta { font-size: var(--fs-xs); color: var(--color-text-muted); }
.card__price { font-weight: 600; color: var(--color-moss); }

/* Inventory state badges */
.badge {
  display: inline-block;
  font-size: var(--fs-xs);
  padding: 0.25em 0.65em;
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.badge--instock   { background: rgba(110,127,92,0.15); color: var(--color-success); }
.badge--low       { background: rgba(184,135,90,0.18); color: var(--color-warning); }
.badge--soldout   { background: rgba(160,90,78,0.15);  color: var(--color-danger); }

/* --------------------------------------------------------------------------
   7. FORMS
   Booking intake, checkout, registration all share these. Serif body font
   throughout per brand constraint — sizes bumped slightly for legibility.
   -------------------------------------------------------------------------- */
.field { margin-bottom: var(--space-4); }

.field label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-ink);
  margin-bottom: 0.4em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  padding: 0.7em 0.85em;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-bg);
  color: var(--color-ink);
  transition: border-color var(--duration-fast) var(--ease-standard);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--color-accent-strong);
  outline: none; /* :focus-visible rule above still applies for keyboard nav */
}

.field textarea { min-height: 120px; resize: vertical; }
.field-hint { font-size: var(--fs-xs); color: var(--color-text-muted); margin-top: 0.35em; }
.field-error { font-size: var(--fs-xs); color: var(--color-danger); margin-top: 0.35em; }
.field.has-error input,
.field.has-error select,
.field.has-error textarea { border-color: var(--color-danger); }

/* --------------------------------------------------------------------------
   8. MODAL (used by class Quick View, cart drawer, etc.)
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(46, 42, 34, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-med) var(--ease-standard);
}
.modal-overlay.is-open { opacity: 1; pointer-events: auto; }

.modal {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px);
  transition: transform var(--duration-med) var(--ease-standard);
}
.modal-overlay.is-open .modal { transform: translateY(0); }

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
.modal__close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--fs-lg);
  line-height: 1;
  color: var(--color-text-muted);
  padding: 0.2em 0.4em;
}
.modal__body { padding: var(--space-4); }

/* --------------------------------------------------------------------------
   9. UTILITIES
   -------------------------------------------------------------------------- */
.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;
}
.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }

/* Lowercase Montserrat treatment for the "Sopholiage" wordmark wherever it
   appears as text (not the logo image, which already has its own type
   baked in). */
.wordmark {
  font-family: var(--font-wordmark);
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: 0.01em;
}
