/* ═══════════════════════════════════════════════════════
   Light mode theme overrides
   Applied when <html data-theme="light">
   ═══════════════════════════════════════════════════════ */

/* ── Base ────────────────────────────────────────────── */
[data-theme="light"] body {
  background-color: #f7f5f1 !important;
  color: #1c1917 !important;
}

/* Kill the grain overlay in light mode */
[data-theme="light"] .grain::after { opacity: 0.012 !important; }

/* ── Section backgrounds ─────────────────────────────── */
[data-theme="light"] .bg-black,
[data-theme="light"] section.bg-black,
[data-theme="light"] section.py-24.bg-black,
[data-theme="light"] section.py-16.bg-black,
[data-theme="light"] section.py-20.bg-black { background-color: #f7f5f1 !important; }

[data-theme="light"] .bg-zinc-900\/20 { background-color: #efece6 !important; }
[data-theme="light"] .bg-zinc-900\/30 { background-color: #eae7e0 !important; }
[data-theme="light"] .bg-zinc-900\/40 { background-color: #e4e0d8 !important; }

[data-theme="light"] .bg-zinc-900\/50,
[data-theme="light"] .bg-zinc-900\/60,
[data-theme="light"] .bg-zinc-900\/70 {
  background-color: #ffffff !important;
  box-shadow: 0 1px 4px rgba(28,25,23,0.08) !important;
}

[data-theme="light"] .bg-zinc-900 { background-color: #e8e5df !important; }
[data-theme="light"] .bg-zinc-800\/50 { background-color: rgba(28,25,23,0.07) !important; }

/* Hero section — replace dark gradient with warm light gradient */
[data-theme="light"] #hero {
  background: linear-gradient(135deg, #ede9e1 0%, #f7f5f1 50%, #e8e4dc 100%) !important;
}
[data-theme="light"] #hero > div:not(.relative.w-full) {
  display: none !important; /* hide dark gradient overlay divs */
}

/* Keep hero dot grid but dark */
[data-theme="light"] #hero .relative.w-full { position: relative; z-index: 2; }

/* ── Text — solid colours for WCAG-passing contrast on #f7f5f1 ──
 *
 * Stone palette contrast against #f7f5f1:
 *   stone-900 #1c1917 → 14.5:1  ✓ headings
 *   stone-800 #292524 → 11.2:1  ✓ strong secondary
 *   stone-700 #44403c →  7.5:1  ✓ body / descriptions
 *   stone-600 #57534e →  5.3:1  ✓ labels / eyebrows (AA normal text)
 *   stone-500 #78716c →  3.5:1  ✓ large/display text only (AA large)
 *   stone-400 #a8a29e →  2.1:1  ✗ decorative only
 * ─────────────────────────────────────────────────────────────── */
[data-theme="light"] .text-white          { color: #1c1917 !important; } /* 14.5:1 */
[data-theme="light"] .text-white\/80      { color: #292524 !important; } /* 11.2:1 */
[data-theme="light"] .text-white\/70      { color: #44403c !important; } /*  7.5:1 */
[data-theme="light"] .text-white\/60      { color: #44403c !important; } /*  7.5:1 */
[data-theme="light"] .text-white\/50      { color: #57534e !important; } /*  5.3:1 */
[data-theme="light"] .text-white\/40      { color: #57534e !important; } /*  5.3:1 — was 2.0:1 */
[data-theme="light"] .text-white\/30      { color: #78716c !important; } /*  3.5:1 — large text */
[data-theme="light"] .text-white\/20      { color: #a8a29e !important; } /*  2.1:1 — decorative */
[data-theme="light"] .text-white\/5       { color: #d6d3d1 !important; } /*  decorative only   */

/* ── Green accent adjustments for light bg ───────────── */
[data-theme="light"] .text-green-400       { color: #15803d !important; }
[data-theme="light"] .bg-green-400         { background-color: #16a34a !important; }
[data-theme="light"] .bg-green-400\/10     { background-color: rgba(21,128,61,0.1) !important; }
[data-theme="light"] .bg-green-500         { background-color: #15803d !important; }
[data-theme="light"] .hover\:bg-white\/90:hover { background-color: rgba(247,245,241,0.9) !important; }

/* Category badges (purple on light is fine; adjust if needed) */

/* ── Borders & rings ─────────────────────────────────── */
[data-theme="light"] .ring-white\/5  { --tw-ring-color: rgba(28,25,23,0.09)  !important; }
[data-theme="light"] .ring-white\/10 { --tw-ring-color: rgba(28,25,23,0.12)  !important; }
[data-theme="light"] .ring-white\/20 { --tw-ring-color: rgba(28,25,23,0.18)  !important; }
[data-theme="light"] .ring-white\/30 { --tw-ring-color: rgba(28,25,23,0.22)  !important; }
[data-theme="light"] .ring-white\/40 { --tw-ring-color: rgba(28,25,23,0.28)  !important; }
[data-theme="light"] .ring-white\/60 { --tw-ring-color: rgba(28,25,23,0.38)  !important; }

[data-theme="light"] .border-white\/5  { border-color: rgba(28,25,23,0.09)  !important; }
[data-theme="light"] .border-white\/10 { border-color: rgba(28,25,23,0.12)  !important; }
[data-theme="light"] .border-t         { border-top-color: rgba(28,25,23,0.09)  !important; }
[data-theme="light"] .border-y         { border-color: rgba(28,25,23,0.09)  !important; }

/* ── bg-white/* inverts (was subtle light on dark) ─────── */
[data-theme="light"] .bg-white\/5  { background-color: rgba(28,25,23,0.05) !important; }
[data-theme="light"] .bg-white\/10 { background-color: rgba(28,25,23,0.08) !important; }
[data-theme="light"] .bg-white\/20 { background-color: rgba(28,25,23,0.12) !important; }

/* CTA buttons — keep white pill readable on light bg */
[data-theme="light"] .bg-white     { background-color: #1c1917 !important; color: #f7f5f1 !important; }
[data-theme="light"] .text-black   { color: #f7f5f1  !important; }

/* ── Navigation ──────────────────────────────────────── */
[data-theme="light"] #mobile-menu {
  background-color: rgba(247,245,241,0.97) !important;
  border-color: rgba(28,25,23,0.08) !important;
}

/* ── Forms (contact, search) ─────────────────────────── */
[data-theme="light"] .bg-zinc-900\/80 {
  background-color: rgba(28,25,23,0.06) !important;
}
[data-theme="light"] input,
[data-theme="light"] textarea,
[data-theme="light"] select {
  background-color: rgba(28,25,23,0.05) !important;
  color: #1c1917 !important;
  border-color: rgba(28,25,23,0.15) !important;
}
[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder { color: #78716c !important; } /* stone-500, 3.5:1 */

/* ── Footer ──────────────────────────────────────────── */
[data-theme="light"] footer { background-color: #eceae4 !important; border-color: rgba(28,25,23,0.1) !important; }

/* ── Page hero gradients (About, Projects, etc.) ─────── */
[data-theme="light"] .bg-gradient-to-br.from-zinc-900.via-black.to-zinc-900,
[data-theme="light"] section.relative.pt-40 {
  background: linear-gradient(135deg, #ede9e1 0%, #f7f5f1 60%, #e8e4dc 100%) !important;
}
[data-theme="light"] .bg-gradient-to-t { background: transparent !important; }

/* ── Article body ────────────────────────────────────── */
[data-theme="light"] .dc-article { color: rgba(28,25,23,0.82) !important; }
[data-theme="light"] .dc-article h2,
[data-theme="light"] .dc-article h3 { color: #1c1917 !important; border-color: rgba(28,25,23,0.08) !important; }
[data-theme="light"] .dc-article blockquote {
  border-color: #15803d !important;
  background: rgba(21,128,61,0.05) !important;
}
[data-theme="light"] .dc-article hr { border-color: rgba(28,25,23,0.1) !important; }
[data-theme="light"] .dc-article strong { color: #1c1917 !important; }
[data-theme="light"] .dc-article a { color: #15803d !important; }

/* ── Programme pages (inline styled elements) ────────── */
[data-theme="light"] .prog-hero__bg1 {
  background: linear-gradient(135deg, #ede9e1, #f7f5f1, #e8e4dc) !important;
}
[data-theme="light"] .prog-stats,
[data-theme="light"] .prog-step,
[data-theme="light"] .prog-cta { background-color: rgba(28,25,23,0.04) !important; }

/* ── Magic card border glow (stays white — looks fine on light) ─ */

/* ── Reading progress bar ────────────────────────────── */
[data-theme="light"] #progress-bar {
  background: linear-gradient(to right, #15803d, #166534) !important;
}

/* ── Articles listing page — inline-styled elements ─────── */

/* Search/filter bar */
[data-theme="light"] .art-filter-bar {
  background-color: #f7f5f1 !important;
  border-color: rgba(28,25,23,0.1) !important;
}
/* Search input */
[data-theme="light"] #article-search {
  background: rgba(28,25,23,0.06) !important;
  border-color: rgba(28,25,23,0.14) !important;
  color: #1c1917 !important;
}
/* Filter tab buttons */
[data-theme="light"] .filter-tab {
  background: rgba(28,25,23,0.07) !important;
  color: #44403c !important;
  border: 1px solid rgba(28,25,23,0.1) !important;
}

/* Article cards — override inline background */
[data-theme="light"] .article-card {
  background: #ffffff !important;
  border: 1px solid rgba(28,25,23,0.1) !important;
  box-shadow: 0 1px 4px rgba(28,25,23,0.06) !important;
}
[data-theme="light"] .article-card:hover {
  border-color: rgba(28,25,23,0.22) !important;
  box-shadow: 0 4px 16px rgba(28,25,23,0.1) !important;
}
/* Article card thumbnail placeholder */
[data-theme="light"] .article-card > a > div:first-child {
  background: rgba(28,25,23,0.08) !important;
}
/* Title hover colour — green on dark becomes dark-green on light */
[data-theme="light"] .article-card:hover h3 { color: #15803d !important; }

/* Article card inline text colours */
[data-theme="light"] .article-card h3 { color: #1c1917 !important; }
[data-theme="light"] .article-card p  { color: #44403c !important; }
[data-theme="light"] .article-card [style*="color:rgba(255,255,255"] { color: #57534e !important; }
[data-theme="light"] .article-card [style*="color:#fff"] { color: #1c1917 !important; }

/* Bottom CTA section */
[data-theme="light"] .art-cta-section {
  background: #eae7e0 !important;
  border-color: rgba(28,25,23,0.1) !important;
}
[data-theme="light"] .art-cta-card {
  background: #ffffff !important;
  border: 1px solid rgba(28,25,23,0.1) !important;
}
/* CTA card inline text */
[data-theme="light"] .art-cta-card p[style*="color:#fff"],
[data-theme="light"] .art-cta-card p[style*="color:rgba(255,255,255"] { color: #44403c !important; }
[data-theme="light"] .art-cta-card a[style*="color:rgba(255,255,255"],
[data-theme="light"] .art-cta-card a[style*="color:#fff"] { color: #57534e !important; }
/* Newsletter input inside CTA */
[data-theme="light"] .art-cta-card input[type="email"] {
  background: rgba(28,25,23,0.06) !important;
  border-color: rgba(28,25,23,0.14) !important;
  color: #1c1917 !important;
}
/* Subscribe / Contact Us buttons stay inverted (dark bg, light text) */
[data-theme="light"] .art-cta-card button[style*="background:#fff"],
[data-theme="light"] .art-cta-card a[style*="background:#fff"] {
  background: #1c1917 !important;
  color: #f7f5f1 !important;
}
[data-theme="light"] .art-cta-card a[style*="border:1px solid rgba(255"] {
  border-color: rgba(28,25,23,0.2) !important;
  color: #1c1917 !important;
}

/* "No results" empty state */
[data-theme="light"] #no-results p { color: #78716c !important; }

/* ── Single article hero — override dark gradient layers ─── */
[data-theme="light"] .article-hero-section {
  background: linear-gradient(135deg, #ede9e1 0%, #f7f5f1 60%, #e8e4dc 100%) !important;
}
/* Hide the dark absolute gradient divs inside the hero */
[data-theme="light"] .article-hero-section > div.absolute { display: none !important; }
/* But keep the content container visible */
[data-theme="light"] .article-hero-section > div.relative { display: block !important; }
/* Inline gradient overlay on the image div */
[data-theme="light"] .article-hero-section .absolute.inset-0 > div[style*="gradient"] {
  background: none !important;
}
/* Tone down the featured image in light mode */
[data-theme="light"] .article-hero-section img { opacity: 0.08 !important; filter: grayscale(30%); }

/* ── Problem-section image slider ───────────────────────── */
/* Arrows sit outside the image on a dark section bg — just flip ring + text */
[data-theme="light"] #nl-ps-prev,
[data-theme="light"] #nl-ps-next {
  --tw-ring-color: rgba(28,25,23,0.25) !important;
  color: #44403c !important;
}
[data-theme="light"] #nl-ps-prev:hover,
[data-theme="light"] #nl-ps-next:hover {
  color: #1c1917 !important;
  --tw-ring-color: rgba(28,25,23,0.5) !important;
}
/* Dots: active white pill stays readable on both themes */
[data-theme="light"] .nl-ps-dot { background-color: rgba(28,25,23,0.25) !important; }
[data-theme="light"] .nl-ps-dot.bg-white { background-color: #1c1917 !important; }

/* ── DotField — hide canvas in light (JS handles swap) ── */

/* ══════════════════════════════════════════════════════
   Interactive Hover Button — port of MagicUI component
   ══════════════════════════════════════════════════════ */

.nl-ihb {
  position: relative !important;
  overflow: hidden !important;
  /* Neutralise Tailwind's own hover colour transitions so the
     dot animation is the sole visual change on hover          */
  transition: box-shadow 0.3s ease, transform 0.2s ease !important;
}

/* ── Expanding flood-fill (no visible dot at rest) ──── */
.nl-ihb .nl-ihb-fill {
  position: absolute;
  border-radius: 50%;
  width: 0.5rem;
  height: 0.5rem;
  top: 50%;
  left: 1.5rem;            /* fill origin in the left padding */
  transform: translate(-50%, -50%) scale(0);
  transform-origin: center;
  transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              background 0s;
  pointer-events: none;
  z-index: 1;
  background: var(--nl-dot-color);
}
/* Scale large enough to flood even the widest buttons from the left edge */
.nl-ihb:hover .nl-ihb-fill {
  transform: translate(-50%, -50%) scale(220);
}

/* ── Label that slides out ──────────────────────────── */
.nl-ihb .nl-ihb-text-out {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform: translateX(0);
  opacity: 1;
  white-space: nowrap;
  pointer-events: none;
}
.nl-ihb:hover .nl-ihb-text-out {
  transform: translateX(1.75rem);
  opacity: 0;
}

/* ── Label + arrow that slides in ──────────────────── */
.nl-ihb .nl-ihb-text-in {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transform: translateX(-1rem);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
  font-size: inherit;
  font-family: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--nl-in-color);
}
.nl-ihb:hover .nl-ihb-text-in {
  transform: translateX(0);
  opacity: 1;
}

/* ── Variant colour tokens ─────────────────────────── */

/* Primary (white bg → dark dot fills button) */
.nl-ihb--primary {
  --nl-dot-color: #1c1917;
  --nl-in-color:  #f7f5f1;
}
/* Outline (transparent → white dot fills button) */
.nl-ihb--outline {
  --nl-dot-color: rgba(255, 255, 255, 0.95);
  --nl-in-color:  #1c1917;
}

/* Light mode — primary buttons flip to dark bg, so reverse tokens */
[data-theme="light"] .nl-ihb--primary {
  --nl-dot-color: #f7f5f1;
  --nl-in-color:  #1c1917;
}
[data-theme="light"] .nl-ihb--outline {
  --nl-dot-color: #1c1917;
  --nl-in-color:  #f7f5f1;
}

/* Suppress Tailwind's hover:bg-* so they don't fight the dot */
.nl-ihb--primary:hover { background-color: #ffffff !important; }
.nl-ihb--outline:hover { background-color: transparent !important; }
[data-theme="light"] .nl-ihb--primary:hover { background-color: #1c1917 !important; }

/* ══════════════════════════════════════════════════════
   Morphing text — port of MagicUI <MorphingText />
   ══════════════════════════════════════════════════════ */
.nl-morph {
  position: relative;
  width: 100%;
  max-width: 48rem;          /* max-w-screen-md */
  height: 4rem;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  line-height: 1;
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  font-size: clamp(2.75rem, 13vw, 6rem);
  color: #ffffff;
  /* Threshold + tiny blur = gooey morph edges */
  filter: url(#nl-threshold) blur(0.6px);
}
@media (min-width: 768px) { .nl-morph { height: 6rem; } }

.nl-morph-text {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  margin: auto;
  display: inline-block;
  width: 100%;
}
.nl-morph-filters {
  position: fixed;
  height: 0;
  width: 0;
  pointer-events: none;
}
[data-theme="light"] .nl-morph { color: #1c1917; }

/* ══════════════════════════════════════════════════════
   Ripple background — port of MagicUI <Ripple />
   ══════════════════════════════════════════════════════ */
.nl-ripple {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  user-select: none;
  /* Fade the ripple out toward the bottom of the section */
  -webkit-mask-image: linear-gradient(to bottom, white, transparent);
          mask-image: linear-gradient(to bottom, white, transparent);
}
.nl-ripple-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  border-width: 1px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.2), 0 4px 6px -4px rgba(0,0,0,0.2);
  transform: translate(-50%, -50%) scale(1);
  animation: nl-ripple 3s ease infinite;
}
@keyframes nl-ripple {
  0%, 100% { transform: translate(-50%, -50%) scale(1);   }
  50%      { transform: translate(-50%, -50%) scale(0.9); }
}
@media (prefers-reduced-motion: reduce) {
  .nl-ripple-circle { animation: none; }
}
/* Light mode — dark translucent circles instead of white */
[data-theme="light"] .nl-ripple-circle {
  background: rgba(28, 25, 23, 0.04);
  border-color: rgba(28, 25, 23, 0.12) !important;
  box-shadow: 0 10px 15px -3px rgba(28,25,23,0.06), 0 4px 6px -4px rgba(28,25,23,0.06);
}

/* ── Theme toggle button ─────────────────────────────── */
#theme-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 200;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(28,25,23,0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
#theme-toggle:hover {
  transform: scale(1.1);
  border-color: rgba(255,255,255,0.35);
}
#theme-toggle:focus-visible {
  outline: 2px solid #4ade80;
  outline-offset: 3px;
}
[data-theme="light"] #theme-toggle {
  background: rgba(247,245,241,0.85) !important;
  border-color: rgba(28,25,23,0.18) !important;
  box-shadow: 0 4px 20px rgba(28,25,23,0.12) !important;
}
[data-theme="light"] #theme-toggle:hover {
  border-color: rgba(28,25,23,0.35) !important;
}

/* Icon colours */
#theme-toggle .icon-moon { display: block; }
#theme-toggle .icon-sun  { display: none;  }
[data-theme="light"] #theme-toggle .icon-moon { display: none;  }
[data-theme="light"] #theme-toggle .icon-sun  { display: block; }

/* ── View Transitions clip-path animation ────────────── */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 9999; }


/* ── NL logo: white mark in dark mode, black mark in light mode ── */
.nl-logo--light { display: none; }
[data-theme="light"] .nl-logo--dark  { display: none; }
[data-theme="light"] .nl-logo--light { display: block; }
