/* ──────────────────────────────────────────────────────────────────────
   Her Secret World — Design Tokens
   Colors, Typography, Spacing, Shape, Shadow, Motion
   Source of truth: DESIGN.md v2.0
   ────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400;1,500;1,600&family=Nunito:wght@300;400;500;600;700&family=Caveat:wght@400;500;600;700&display=swap');

:root {
  /* ── BASE RGB TRIPLETS ── */
  --rgb-cornflower:    107, 163, 214;
  --rgb-periwinkle:    155, 168, 217;
  --rgb-sky-light:     189, 215, 240;
  --rgb-deep-navy:      26,  46,  74;
  --rgb-midnight:       13,  27,  42;
  --rgb-mint-sage:     125, 201, 168;
  --rgb-golden-sun:    255, 209, 102;
  --rgb-blush-coral:   255, 143, 163;
  --rgb-soft-lilac:    200, 184, 232;
  --rgb-sky-white:     240, 247, 255;
  --rgb-deep-canvas:   234, 242, 251;
  --rgb-lavender-mist: 232, 228, 240;

  /* ── SOLID COLOURS ── */
  --color-cornflower:    rgb(var(--rgb-cornflower));
  --color-periwinkle:    rgb(var(--rgb-periwinkle));
  --color-sky-light:     rgb(var(--rgb-sky-light));
  --color-deep-navy:     rgb(var(--rgb-deep-navy));
  --color-midnight:      rgb(var(--rgb-midnight));
  --color-mint-sage:     rgb(var(--rgb-mint-sage));
  --color-golden-sun:    rgb(var(--rgb-golden-sun));
  --color-blush-coral:   rgb(var(--rgb-blush-coral));
  --color-soft-lilac:    rgb(var(--rgb-soft-lilac));
  --color-sky-white:     rgb(var(--rgb-sky-white));
  --color-deep-canvas:   rgb(var(--rgb-deep-canvas));
  --color-lavender-mist: rgb(var(--rgb-lavender-mist));
  --color-letter-warm:   #FFFDF8;

  /* ── SEMANTIC ── */
  --color-background:      var(--color-sky-white);
  --color-surface:         var(--color-lavender-mist);
  --color-primary:         var(--color-cornflower);
  --color-secondary:       var(--color-periwinkle);
  --color-text-primary:    var(--color-deep-navy);
  --color-text-soft:       #3D5A7A;
  --color-text-ghost:      #4F719E;
  --color-accent-warm:     var(--color-golden-sun);
  --color-accent-heal:     var(--color-mint-sage);
  --color-accent-love:     var(--color-blush-coral);
  --color-border-soft:     rgba(var(--rgb-cornflower), 0.25);
  --color-border-gentle:   rgba(var(--rgb-lavender-mist), 0.80);
  --color-border-warm:     rgba(var(--rgb-golden-sun), 0.25);

  /* ── GRADIENTS ── */
  --gradient-sky:
    radial-gradient(ellipse at 20% 20%, rgba(var(--rgb-periwinkle),  0.18) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(var(--rgb-cornflower),  0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 50%  0%, rgba(var(--rgb-soft-lilac),  0.10) 0%, transparent 50%),
    linear-gradient(160deg, rgb(var(--rgb-sky-white)) 0%, rgb(var(--rgb-deep-canvas)) 50%, rgb(var(--rgb-lavender-mist)) 100%);

  --gradient-hero:
    linear-gradient(135deg, rgb(var(--rgb-sky-white)) 0%, rgb(var(--rgb-sky-light)) 40%, rgb(var(--rgb-lavender-mist)) 100%);

  --gradient-journey:
    linear-gradient(160deg, rgb(var(--rgb-deep-canvas)) 0%, #F0EDF8 50%, #FFF8F0 100%);

  --gradient-letters:
    linear-gradient(150deg, #FFF0F3 0%, rgb(var(--rgb-sky-white)) 60%, #FFF8E8 100%);

  --gradient-strength:
    linear-gradient(140deg, #EAF7F2 0%, rgb(var(--rgb-deep-canvas)) 60%, rgb(var(--rgb-sky-white)) 100%);

  --gradient-button-primary:
    linear-gradient(135deg, rgb(var(--rgb-cornflower)) 0%, rgb(var(--rgb-periwinkle)) 100%);

  --gradient-button-hover:
    linear-gradient(135deg, #5A92C5 0%, #8A97C8 100%);

  --gradient-card-hover:
    linear-gradient(145deg, rgba(var(--rgb-cornflower), 0.08), rgba(var(--rgb-periwinkle), 0.12));

  /* ── TYPOGRAPHY ── */
  --font-display:   'Cormorant Garamond', Georgia, serif;
  --font-body:      'Nunito', 'Segoe UI', sans-serif;
  --font-script:    'Caveat', cursive;

  --text-hero:        clamp(2.25rem, 8vw, 5.5rem);
  --text-display:     clamp(1.875rem, 5.5vw, 3.8rem);
  --text-heading-xl:  clamp(1.5rem, 3.5vw, 2.8rem);
  --text-heading-lg:  clamp(1.25rem, 2.75vw, 2rem);

  --text-body-lg:     1.25rem;
  --text-body:        1.0625rem;
  --text-body-sm:     1rem;
  --text-label:       0.875rem;
  --text-micro:       0.875rem;

  --text-caption:     1.125rem;
  --text-tagline:     1.375rem;
  --text-note:        1rem;

  --leading-tight:    1.2;
  --leading-snug:     1.4;
  --leading-normal:   1.65;
  --leading-relaxed:  1.85;
  --leading-loose:    2.1;

  --tracking-tight:   -0.02em;
  --tracking-normal:    0;
  --tracking-wide:     0.04em;
  --tracking-wider:    0.08em;

  --weight-light:     300;
  --weight-regular:   400;
  --weight-medium:    500;
  --weight-semibold:  600;
  --weight-bold:      700;

  /* ── SPACING ── */
  --space-1:  0.25rem;  --space-2:  0.5rem;   --space-3:  0.75rem;
  --space-4:  1rem;     --space-5:  1.25rem;  --space-6:  1.5rem;
  --space-8:  2rem;     --space-10: 2.5rem;   --space-12: 3rem;
  --space-16: 4rem;     --space-20: 5rem;     --space-24: 6rem;
  --space-32: 8rem;

  --page-padding-x:    clamp(1.5rem, 5vw, 4rem);
  --page-padding-y:    clamp(2rem, 5vh, 4rem);
  --section-gap:       clamp(4rem, 8vw, 8rem);
  --card-padding:      clamp(1.5rem, 3vw, 2.5rem);
  --content-max-width: 68rem;
  --narrow-max-width:  44rem;

  /* ── SHAPE ── */
  --radius-sm:  8px;   --radius-md:  16px;  --radius-lg:  24px;
  --radius-xl:  32px;  --radius-2xl: 48px;
  --radius-pill: 9999px; --radius-circle: 50%;

  /* ── SHADOW ── */
  --shadow-whisper:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 2px 8px rgba(var(--rgb-cornflower), 0.10),
    0 1px 3px rgba(var(--rgb-deep-navy), 0.04);

  --shadow-soft:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 4px 16px rgba(var(--rgb-cornflower), 0.14),
    0 2px 6px rgba(var(--rgb-deep-navy), 0.06);

  --shadow-card:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 8px 32px rgba(var(--rgb-cornflower), 0.20),
    0 2px 8px rgba(var(--rgb-deep-navy), 0.06);

  --shadow-card-hover:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 16px 48px rgba(var(--rgb-cornflower), 0.28),
    0 4px 16px rgba(var(--rgb-deep-navy), 0.10);

  --shadow-float:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 20px 60px rgba(var(--rgb-cornflower), 0.22),
    0 8px 24px rgba(var(--rgb-deep-navy), 0.08);

  --shadow-glow-primary:
    0 0 20px rgba(var(--rgb-cornflower), 0.30),
    0 0 32px rgba(var(--rgb-cornflower), 0.15);

  --shadow-glow-gold:
    0 0 16px rgba(var(--rgb-golden-sun), 0.35),
    0 0 32px rgba(var(--rgb-golden-sun), 0.15);

  --shadow-glow-coral:
    0 0 16px rgba(var(--rgb-blush-coral), 0.30),
    0 0 32px rgba(var(--rgb-blush-coral), 0.12);

  --shadow-inset-soft:
    inset 0 2px 8px rgba(var(--rgb-cornflower), 0.10);

  --shadow-focus-ring:
    0 0 0 3px rgba(var(--rgb-cornflower), 0.18);

  /* ── MOTION ── */
  --ease-gentle:  cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring:  cubic-bezier(0.34, 1.15, 0.64, 1);
  --ease-breath:  cubic-bezier(0.45, 0.05, 0.55, 0.95);
  --ease-fade:    cubic-bezier(0.4, 0, 0.2, 1);

  --duration-instant:  100ms;
  --duration-fast:     200ms;
  --duration-normal:   350ms;
  --duration-slow:     500ms;
  --duration-breathe:  600ms;
  --duration-float:   3000ms;
  --duration-drift:   8000ms;

  /* ── BREAKPOINTS (reference; use media queries) ── */
  --bp-sm:  480px;
  --bp-md:  768px;
  --bp-lg:  1024px;
  --bp-xl:  1280px;
}

/* ── BASE / SEMANTIC TYPOGRAPHY ── */
body {
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, .h1 {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: var(--weight-light);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-primary);
  font-style: italic;
}

h2, .h2 {
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: var(--weight-regular);
  line-height: var(--leading-tight);
  color: var(--color-text-primary);
}

h3, .h3 {
  font-family: var(--font-display);
  font-size: var(--text-heading-xl);
  font-weight: var(--weight-medium);
  line-height: var(--leading-snug);
  color: var(--color-text-primary);
}

h4, .h4 {
  font-family: var(--font-display);
  font-size: var(--text-heading-lg);
  font-weight: var(--weight-medium);
  line-height: var(--leading-snug);
  color: var(--color-text-primary);
}

p {
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
}

.tagline, .script {
  font-family: var(--font-script);
  font-size: var(--text-tagline);
  font-weight: var(--weight-bold);
  color: var(--color-periwinkle);
}

.caption {
  font-family: var(--font-script);
  font-size: var(--text-caption);
  font-weight: var(--weight-medium);
  color: var(--color-text-ghost);
  font-style: italic;
}

.label {
  font-family: var(--font-body);
  font-size: var(--text-label);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-soft);
  text-transform: none;
}

.micro {
  font-family: var(--font-body);
  font-size: var(--text-micro);
  font-weight: var(--weight-regular);
  color: var(--color-text-ghost);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    /* Suppress looping atmospheric motion; preserve transitions so the
       site retains hover affordances, focus rings, and gentle page-load fades. */
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ─────────────────────────────────────────────────────────
   ANIMATIONS
   Atmospheric motion: gentle, slow, well above body-rhythm rates.
   Reduced-motion (system) and html.still-mode (user toggle) both kill
   looping animations. Page-load fade is a one-shot and is preserved.
   ───────────────────────────────────────────────────────── */

/* Soap-bubble float: 4-keypoint path so the motion never reads as a simple
   back-and-forth. With `infinite` (not alternate), 0%==100% loops smoothly.
   Scale variation suggests gentle depth (closer/farther in the air). */
@keyframes bubbleFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25%      { transform: translate(28px, -38px) scale(1.06); }
  50%      { transform: translate(-14px, -8px)  scale(0.94); }
  75%      { transform: translate(-24px, 24px) scale(1.02); }
}

@keyframes pageFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes mascotRockSubtle {
  0%, 100% { transform: rotate(-1deg); }
  50%      { transform: rotate(1deg); }
}

@keyframes mascotRockGentle {
  0%, 100% { transform: rotate(-2deg); }
  50%      { transform: rotate(2deg); }
}

@keyframes eyeBlink {
  0%, 92%, 100% { transform: scaleY(1); opacity: 1; }
  95%           { transform: scaleY(0.05); opacity: 0.2; }
}

/* Realistic soap bubble.
   Body is transparent. Visual comes from three stacked radial gradients
   (specular highlight + secondary highlight + iridescent thin-film rim) plus
   box-shadows for rim depth and a faint outer glow. Per-page styles vary
   position, size, and animation timing only. */
.bubble {
  position: absolute;
  border-radius: 50%;
  background:
    /* Primary specular highlight (the bright spot at upper-left) */
    radial-gradient(
      circle at 30% 28%,
      rgba(255, 255, 255, 0.95) 0%,
      rgba(255, 255, 255, 0.55) 4%,
      transparent 14%
    ),
    /* Secondary smaller highlight */
    radial-gradient(
      circle at 38% 22%,
      rgba(255, 255, 255, 0.5) 0%,
      transparent 7%
    ),
    /* Iridescent rim: pastel pink → blue → green → amber, mimicking
       thin-film interference at the bubble surface */
    radial-gradient(
      circle at 50% 50%,
      rgba(255, 255, 255, 0.04) 0%,
      rgba(255, 255, 255, 0.08) 40%,
      rgba(220, 200, 255, 0.18) 65%,
      rgba(180, 220, 255, 0.30) 80%,
      rgba(200, 255, 220, 0.20) 90%,
      rgba(255, 220, 200, 0.18) 96%,
      rgba(255, 255, 255, 0.10) 100%
    );
  box-shadow:
    inset 0 -3px 8px rgba(120, 160, 220, 0.20),  /* bottom rim shadow */
    inset 0  2px 4px rgba(255, 255, 255, 0.35),  /* top rim brightness */
    0 0 14px rgba(180, 220, 255, 0.20);          /* faint outer glow */
  animation: bubbleFloat 15s ease-in-out infinite;
  will-change: transform;
  pointer-events: none;
}

/* Page-load fade-in. One-shot. Even reduced-motion users get this; it just
   completes in ~0.01ms for them rather than 800ms. */
body {
  opacity: 0;
  animation: pageFadeIn 800ms ease-out 50ms forwards;
}

/* ── Mascot motion utility classes ──
   Pages apply these to mascot <img> elements that should move.
   transform-origin: center bottom anchors rotation at the feet, so the
   rocking feels grounded rather than wobbly. */
.mascot-rock-subtle {
  animation: mascotRockSubtle 5s ease-in-out infinite alternate;
  transform-origin: center bottom;
  will-change: transform;
}

.mascot-rock-gentle {
  animation: mascotRockGentle 6s ease-in-out infinite alternate;
  transform-origin: center bottom;
  will-change: transform;
}

.mascot-eye-blink {
  animation: eyeBlink 5s ease-in-out infinite;
  transform-origin: center center;
}

/* ── Still-mode: user-toggled in nav. Pre-paint class on <html>, runtime
      class also on <html> via atmosphere.js. Kills looping animations only. ── */
html.still-mode .bubble,
html.still-mode .mascot-rock-subtle,
html.still-mode .mascot-rock-gentle,
html.still-mode .mascot-eye-blink {
  animation: none !important;
}

/* ── Still-mode toggle button (injected by /assets/js/atmosphere.js) ── */
.still-mode-toggle {
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
  margin-left: var(--space-2);
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-ghost);
  transition: background var(--duration-fast) var(--ease-gentle),
              color var(--duration-fast) var(--ease-gentle),
              opacity var(--duration-fast) var(--ease-gentle);
  width: 36px;
  height: 36px;
  opacity: 0.65;
  flex-shrink: 0;
}
.still-mode-toggle:hover {
  background: rgba(var(--rgb-sky-white), 0.6);
  color: var(--color-text-primary);
  opacity: 1;
}
.still-mode-toggle:focus-visible {
  outline: 2px solid var(--color-cornflower);
  outline-offset: 2px;
}
.still-mode-toggle.is-active {
  background: rgba(var(--rgb-cornflower), 0.12);
  color: var(--color-cornflower);
  opacity: 1;
}
.still-mode-toggle img,
.still-mode-toggle svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
  display: block;
}

/* Floating variant: used on pages without a .nav-bar (the login page).
   Sits in the top-right corner with a frosted-glass background so Joyce
   can pause motion before entering the site. */
.still-mode-toggle--floating {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: 100;
  width: 44px;
  height: 44px;
  background: rgba(var(--rgb-sky-white), 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--color-border-gentle);
  box-shadow: var(--shadow-whisper);
  opacity: 0.85;
  margin-left: 0;
}
.still-mode-toggle--floating:hover {
  background: rgba(255, 255, 255, 0.95);
  opacity: 1;
}

/* ── Cross-document View Transitions ──
   Modern Chromium gives a default cross-fade between same-origin navigations.
   Safari/Firefox ignore until they ship support. No JS required. */
@view-transition {
  navigation: auto;
}
