/**
 * 42AI Home Page Redesign — additive overrides
 *
 * Loaded AFTER the inline <style> in public/index.html so these rules win
 * the cascade for matching selectors.
 *
 * Adds:
 *   - Gradient fill + glow halo on the "42AI" wordmark
 *   - One-shot welcome glow around the home search box
 *   - The three Google-style boxes (.three-boxes / .three-box / .three-box-*)
 *   - Theme-aware overrides for .balm-icon and .home-belief-bar
 *
 * All gradients use --hue-1/2/3 from hue-picker.css. With no theme picked,
 * defaults match the existing belief colors.
 *
 * REVERSAL:
 *   1. Remove this <link> from index.html.
 *   2. Restore the original .three-as HTML block (kept commented in
 *      index.html next to the new .three-boxes block).
 *   The page returns to its pre-redesign state.
 */

/* ─── Theme-aware overrides (icons + belief bar swap with the hue picker) ─── */
.balm-icon {
  background: linear-gradient(135deg, var(--hue-1), var(--hue-2), var(--hue-3));
}
.home-belief-bar {
  background: linear-gradient(to right, var(--hue-1), var(--hue-2), var(--hue-3));
}

/* ─── 42AI wordmark — soft gradient text + persistent glow halo ─── */
.home-brand {
  position: relative;
}
.home-brand h1 {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--hue-1) 75%, transparent) 0%,
    color-mix(in srgb, var(--hue-2) 78%, transparent) 50%,
    color-mix(in srgb, var(--hue-3) 72%, transparent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  position: relative;
  isolation: isolate;
  transition: filter 0.3s ease;
}

@keyframes brandGlowOnce {
  0%   { opacity: 0;    transform: scale(0.85); }
  25%  { opacity: 1;    transform: scale(1.03); }
  55%  { opacity: 0.75; transform: scale(1.06); }
  100% { opacity: 0.45; transform: scale(1.04); }
}

.home-brand h1::before {
  content: '';
  position: absolute;
  inset: -26px -38px;
  border-radius: 80px;
  background: radial-gradient(ellipse at center,
    color-mix(in srgb, var(--hue-1) 22%, transparent) 0%,
    color-mix(in srgb, var(--hue-2) 26%, transparent) 28%,
    color-mix(in srgb, var(--hue-3) 20%, transparent) 60%,
    transparent 86%);
  filter: blur(14px);
  pointer-events: none;
  opacity: 0.45;
  transform: scale(1.04);
  animation: brandGlowOnce 2.4s cubic-bezier(.22,.61,.36,1) 0.2s 1 forwards;
  z-index: -1;
  transition: background 0.4s ease;
}
/* Re-bloom on theme change (toggled by hue-picker.js) */
.home-brand h1.theme-bloom::before {
  animation: brandGlowOnce 1.4s cubic-bezier(.22,.61,.36,1) 1 forwards;
}

/* ─── Search box welcome glow — one-shot on page load ─── */
.home-search {
  position: relative;
}
.home-search input {
  position: relative;
  z-index: 1;
}
.home-search-icons {
  z-index: 2;
}

@keyframes searchGlowOnce {
  0%   { opacity: 0;    transform: scale(0.94); }
  30%  { opacity: 0.85; transform: scale(1.01); }
  60%  { opacity: 0.55; transform: scale(1.04); }
  100% { opacity: 0;    transform: scale(1.10); }
}
.home-search::before {
  content: '';
  position: absolute;
  inset: -16px;
  border-radius: 42px;
  background: radial-gradient(ellipse at center,
    color-mix(in srgb, var(--hue-1) 22%, transparent) 0%,
    color-mix(in srgb, var(--hue-2) 26%, transparent) 25%,
    color-mix(in srgb, var(--hue-2) 22%, transparent) 50%,
    color-mix(in srgb, var(--hue-3) 17%, transparent) 70%,
    transparent 85%);
  filter: blur(9px);
  pointer-events: none;
  opacity: 0;
  animation: searchGlowOnce 2.2s cubic-bezier(.22,.61,.36,1) 0.35s 1 forwards;
  z-index: 0;
}

/* ─── Three boxes (replaces the old .three-as row) ─── */
.three-boxes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 960px;
  margin: 36px auto 0;
}

@keyframes boxFadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes iconBreath {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes soonPulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

.three-box {
  position: relative;
  background: #f3f4f6;
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 22px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 150px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  opacity: 0;
  animation: boxFadeUp 0.55s cubic-bezier(.22,.61,.36,1) forwards;
  transition: transform 0.28s cubic-bezier(.22,.61,.36,1),
              box-shadow 0.28s ease,
              background 0.28s ease,
              border-color 0.28s ease;
}
.three-box:nth-child(1) { animation-delay: 0.05s; }
.three-box:nth-child(2) { animation-delay: 0.15s; }
.three-box:nth-child(3) { animation-delay: 0.25s; }

/* Animated gradient bar at the bottom, slides in on hover */
.three-box::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--hue-1), var(--hue-2), var(--hue-3));
  background-size: 200% 100%;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.45s cubic-bezier(.22,.61,.36,1);
}
/* Soft radial accent that fades in on hover */
.three-box::before {
  content: '';
  position: absolute;
  top: -40%; right: -30%;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle,
    color-mix(in srgb, var(--hue-2) 12%, transparent) 0%,
    color-mix(in srgb, var(--hue-3) 7%, transparent) 40%,
    transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.three-box:hover {
  background: #fff;
  border-color: #e5e7eb;
  transform: translateY(-4px);
  box-shadow: 0 10px 28px -8px rgba(0,0,0,0.10),
              0 4px 10px -4px rgba(0,0,0,0.06);
}
.three-box:hover::after {
  transform: scaleX(1);
  animation: gradientShift 3.5s ease infinite;
}
.three-box:hover::before {
  opacity: 1;
}

.three-box.disabled { cursor: not-allowed; }
.three-box.disabled:hover {
  transform: translateY(-2px);
  background: #f9fafb;
}

.three-box-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.02);
  position: relative;
  transition: transform 0.35s cubic-bezier(.22,.61,.36,1),
              box-shadow 0.35s ease;
}
.three-box-icon::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--hue-1) 50%, transparent),
    color-mix(in srgb, var(--hue-2) 55%, transparent),
    color-mix(in srgb, var(--hue-3) 50%, transparent));
  background-size: 200% 200%;
  filter: blur(1px);
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: -1;
}
.three-box-icon svg {
  width: 22px;
  height: 22px;
  stroke: #0a0a0a;
  stroke-width: 1.6;
  fill: none;
  transition: stroke 0.3s ease,
              transform 0.5s cubic-bezier(.22,.61,.36,1);
}
.three-box:hover .three-box-icon {
  transform: scale(1.08) rotate(-3deg);
  animation: iconBreath 2.6s ease-in-out infinite;
  box-shadow: 0 4px 14px -2px color-mix(in srgb, var(--hue-2) 30%, transparent),
              0 0 0 1px rgba(0,0,0,0.03);
}
.three-box:hover .three-box-icon::before {
  opacity: 1;
  animation: gradientShift 3.5s ease infinite;
}
.three-box:hover .three-box-icon svg {
  transform: rotate(6deg);
}

.three-box-soon {
  position: absolute;
  top: 18px;
  right: 18px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: #555;
  background: rgba(255,255,255,0.85);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  padding: 4px 9px;
  border-radius: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid #f0f0f0;
  animation: soonPulse 2.4s ease-in-out infinite;
}

.three-box-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 19px;
  color: #0a0a0a;
  margin-bottom: 8px;
  letter-spacing: -0.015em;
  transition: letter-spacing 0.3s cubic-bezier(.22,.61,.36,1);
}
.three-box:hover .three-box-title {
  letter-spacing: 0em;
}
.three-box-sub {
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 400;
  font-size: 13px;
  color: #555;
  line-height: 1.45;
  max-width: 220px;
  transition: color 0.3s ease;
}
.three-box:hover .three-box-sub {
  color: #0a0a0a;
}

/* ─── Responsive — stack to one column on small screens ─── */
@media (max-width: 760px) {
  .three-boxes {
    grid-template-columns: 1fr;
    max-width: 480px;
  }
}

/* ─── Mobile fixes (≤600px) ─── */
/* All edits below this block are mobile-only. To revert mobile changes
   without touching desktop, delete from here down to end of file. */
@media (max-width: 600px) {

  /* Fix broken calc() in the inline #home-view rule (missing spaces around +).
     Without this, strict browsers (mobile Chrome) reject the padding
     declaration entirely and the brand row hides behind the fixed nav. */
  #home-view {
    padding-top: calc(var(--nav-h) + 20px);
  }

  /* Hide the hue picker on mobile — too much top-bar clutter alongside the
     hamburger, brand, font picker, and account button. Theme choice still
     persists for desktop users (localStorage.42ai_hue is unchanged). */
  .hue-picker-wrap {
    display: none !important;
  }

  /* Hide the three info boxes on mobile — the home screen is cluttered enough. */
  .three-boxes {
    display: none;
  }
  .three-box {
    padding: 15px 16px 14px;
    min-height: 0;       /* sized by content, not a 200px floor */
    border-radius: 14px;
  }
  .three-box-icon {
    width: 38px;
    height: 38px;
    margin-bottom: 9px;
  }
  .three-box-icon svg {
    width: 20px;
    height: 20px;
  }
  .three-box-title {
    font-size: 17px;
    margin-bottom: 6px;
  }
  .three-box-sub {
    font-size: 12.5px;
    max-width: none;
  }
  .three-box-soon {
    top: 14px;
    right: 14px;
    padding: 3px 8px;
    font-size: 8.5px;
  }

  /* Results-view tab bar — allow horizontal scroll on overflow instead of
     clipping the rightmost tabs (Thoughts / Chat / Outcomes). */
  .tab-bar {
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tab-bar::-webkit-scrollbar {
    display: none;
  }
  .tab-links {
    flex-wrap: nowrap;
    padding: 0 4px;
  }

  /* Shrink the brand-glow halo on small screens so it doesn't bleed past
     the nav into the URL-bar area. */
  .home-brand h1::before {
    inset: -16px -24px;
    filter: blur(10px);
  }
}
