/* ═══════════════════════════════════════════════════════════════════════════
   BloomCard — main.css
   Layout, typography, theme variables, and global foundations.
   Aesthetic: warm editorial lifestyle — cream, terracotta, dusty sage.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Custom Properties ──────────────────────────────────────────────────── */
:root {
  /* ── Warm palette ── */
  --color-cream:        #faf7f2;
  --color-linen:        #f5efe6;
  --color-warm-taupe:   #ede6d9;
  --color-sand:         #e3d9ca;
  --color-terracotta:   #c4622d;
  --color-clay:         #e07b4a;
  --color-clay-light:   #f0a07a;
  --color-clay-muted:   rgba(196, 98, 45, 0.12);
  --color-sage:         #7a9e7e;
  --color-sage-light:   #a8c5a0;
  --color-sage-muted:   rgba(122, 158, 126, 0.15);

  /* ── Text ── */
  --color-text-rich:    #2d1f14;
  --color-text-body:    #4a3427;
  --color-text-medium:  #6b5344;
  --color-text-muted:   #9c7b68;
  --color-text-faint:   #b8a498;

  /* ── Borders & surfaces ── */
  --color-border:       #ddd5c8;
  --color-border-light: #ece6dd;
  --color-surface:      #f0e9de;
  --color-white:        #ffffff;

  /* ── Typography ── */
  --font-display:  'Lora', Georgia, 'Times New Roman', serif;
  --font-body:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Fluid scale using clamp(min, preferred, max) */
  --text-xs:    clamp(0.6875rem, 0.65rem + 0.2vw,  0.75rem);
  --text-sm:    clamp(0.8125rem, 0.78rem + 0.2vw,  0.875rem);
  --text-base:  clamp(1rem,      0.95rem + 0.3vw,  1.0625rem);
  --text-md:    clamp(1.125rem,  1.05rem + 0.4vw,  1.25rem);
  --text-lg:    clamp(1.25rem,   1.1rem  + 0.8vw,  1.5rem);
  --text-xl:    clamp(1.5rem,    1.2rem  + 1.5vw,  2rem);
  --text-2xl:   clamp(1.875rem,  1.4rem  + 2.4vw,  2.625rem);
  --text-3xl:   clamp(2.25rem,   1.6rem  + 3.5vw,  3.5rem);
  --text-hero:  clamp(2.5rem,    1.8rem  + 4.5vw,  4.5rem);

  /* ── 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;

  /* ── Layout ── */
  --max-width:       1180px;
  --content-width:   720px;
  --gutter:          clamp(1rem, 4vw, 2.5rem);

  /* ── Radii ── */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   14px;
  --radius-xl:   24px;
  --radius-pill: 999px;

  /* ── Shadows ── */
  --shadow-sm:    0 1px 4px rgba(45, 31, 20, 0.08);
  --shadow-md:    0 4px 16px rgba(45, 31, 20, 0.12);
  --shadow-lg:    0 8px 32px rgba(45, 31, 20, 0.15);
  --shadow-warm:  0 4px 20px rgba(196, 98, 45, 0.18);

  /* ── Transitions ── */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-fast:   120ms;
  --duration-normal: 240ms;
  --duration-slow:   400ms;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  background-color: var(--color-cream);
  color: var(--color-text-body);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.7;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Accessibility ───────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  padding: var(--space-2) var(--space-6);
  background: var(--color-terracotta);
  color: var(--color-white);
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
  z-index: 9999;
  transition: top var(--duration-fast);
}

.skip-link:focus {
  top: var(--space-2);
}

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

/* ── Links & Elements ────────────────────────────────────────────────────── */
a {
  color: inherit;
  text-decoration: none;
}

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

ul, ol {
  list-style: none;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

::selection {
  background: rgba(196, 98, 45, 0.2);
  color: var(--color-text-rich);
}

/* ── Typography Scale ────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-text-rich);
  letter-spacing: -0.01em;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl);  }
h4 { font-size: var(--text-lg);  }

p {
  font-size: var(--text-base);
  color: var(--color-text-body);
  line-height: 1.75;
}

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

.container-narrow {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ── Main Content ────────────────────────────────────────────────────────── */
main {
  flex: 1;
}

/* ── Loading ─────────────────────────────────────────────────────────────── */
.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  gap: var(--space-4);
}

.loading-bloom {
  font-size: 2.5rem;
  animation: bloom-spin 2s linear infinite;
  color: var(--color-clay);
}

.loading-text {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--color-text-muted);
}

@keyframes bloom-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Page fade-in ────────────────────────────────────────────────────────── */
@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-enter {
  animation: page-enter var(--duration-slow) var(--ease-out) both;
}

/* ── Section spacing ─────────────────────────────────────────────────────── */
.section {
  padding-block: var(--space-16);
}

.section + .section {
  padding-top: 0;
}

.section-heading {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--color-text-rich);
  margin-bottom: var(--space-2);
}

.section-subheading {
  font-size: var(--text-base);
  color: var(--color-text-medium);
  margin-bottom: var(--space-8);
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: var(--space-8);
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* ── Tag / Label ─────────────────────────────────────────────────────────── */
.category-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.2em 0.7em;
  background: var(--color-clay-muted);
  color: var(--color-terracotta);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast);
  border: 1px solid rgba(196, 98, 45, 0.18);
}

.category-tag:hover {
  background: var(--color-terracotta);
  color: var(--color-white);
}

.category-tag.sage {
  background: var(--color-sage-muted);
  color: var(--color-sage);
  border-color: rgba(122, 158, 126, 0.2);
}

.category-tag.sage:hover {
  background: var(--color-sage);
  color: var(--color-white);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.65em 1.6em;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.03em;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  text-decoration: none;
  border: 1.5px solid transparent;
}

.btn-primary {
  background: var(--color-terracotta);
  color: var(--color-white);
  border-color: var(--color-terracotta);
}

.btn-primary:hover {
  background: #b0561f;
  border-color: #b0561f;
  box-shadow: var(--shadow-warm);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--color-terracotta);
  border-color: var(--color-terracotta);
}

.btn-secondary:hover {
  background: var(--color-clay-muted);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-medium);
  border-color: var(--color-border);
}

.btn-ghost:hover {
  color: var(--color-text-rich);
  border-color: var(--color-sand);
  background: var(--color-linen);
}

/* ── Divider ─────────────────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--color-border-light);
  margin-block: var(--space-10);
}

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}

.breadcrumb-item {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.breadcrumb-item a {
  color: var(--color-terracotta);
  transition: opacity var(--duration-fast);
}

.breadcrumb-item a:hover {
  opacity: 0.7;
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--color-border);
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-linen);
}

::-webkit-scrollbar-thumb {
  background: var(--color-sand);
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-linen);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-clay-light);
}

/* ── Responsive: fluid gutter ────────────────────────────────────────────── */
@media (max-width: 640px) {
  :root {
    --space-16: 3rem;
    --space-20: 4rem;
    --space-24: 4.5rem;
  }
}
