/* ═══════════════════════════════════════════════════════════════
   HOME PAGE — css/home.css
   Loaded only on index.html. All selectors scoped to body.home.
   Light-first design: hero/stats/subscribe all use theme variables.
   ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ───────────────────────────────────────────── */
:root {
  --home-max: 1100px;
  --home-narrow: 680px;
  --home-section-py: 80px;
  --home-card-radius: 16px;
  --home-card-gap: 16px;
  --home-font-display: "Space Grotesk", var(--font-sans);
  --home-font-serif: "Playfair Display", Georgia, serif;
  --hero-bg: #0a0a0c;
  --hero-ink: #fcfdff;
  --hero-muted: rgba(252,253,255,0.6);
  --hero-hairline: rgba(255,255,255,0.08);
  --hero-surface: rgba(255,255,255,0.04);
}

.home .content {
  max-width: var(--home-max);
}

/* ═══════════════════════════════════════════════════════════════
   HERO — Resend-inspired dark, serif display, left-aligned
   ═══════════════════════════════════════════════════════════════ */
.home-hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background: var(--hero-bg);
  overflow: hidden;
  padding: 120px 24px 96px;
}

.home-hero-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 60% 50% at 70% 60%, rgba(232,69,14,0.06), transparent),
    radial-gradient(ellipse 80% 40% at 30% 100%, rgba(255,255,255,0.02), transparent);
}

/* grid decoration lines — subtle white on dark */
.home-hero-grid-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.home-hero-grid-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.04) 0,
    rgba(255,255,255,0.04) 4px,
    transparent 4px,
    transparent 12px
  );
}
.home-hero-grid-line:first-child { left: 25%; }
.home-hero-grid-line:last-child  { right: 25%; }

/* ── Hero content — left-aligned ─────────────────────────────── */
.home-hero-content {
  position: relative;
  z-index: 1;
  text-align: left;
  color: var(--hero-ink);
  max-width: var(--home-max);
  width: 100%;
  margin: 0 auto;
}

.home-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--hero-muted);
  border: 1px solid var(--hero-hairline);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  margin-bottom: 40px;
  background: var(--hero-surface);
  transition: border-color 0.25s ease;
}
.home-hero-badge:hover {
  border-color: rgba(255,255,255,0.16);
}
.home-hero-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: hero-pulse 2.4s ease-in-out infinite;
}
@keyframes hero-pulse { 50% { opacity: .3; } }

.home-hero-title {
  font-family: var(--home-font-serif);
  font-size: clamp(48px, 9vw, 96px);
  font-weight: 400;
  line-height: 1.0;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--hero-ink);
}
.home-hero-title em {
  font-style: italic;
  color: var(--accent);
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: unset;
  background-clip: unset;
}

.home-hero-subtitle {
  font-size: 18px;
  line-height: 1.7;
  color: var(--hero-muted);
  margin: 32px 0 0;
  max-width: 48ch;
}

/* typed line */
.home-typed-wrap {
  margin: 32px 0 48px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--hero-muted);
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}
.home-typed-prefix {
  color: #22c55e;
  font-weight: 600;
}
#typed-output .typed-cursor {
  color: var(--accent);
}

/* entry cards — dark glass surface */
.home-hero-entries {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 560px;
}

.home-entry {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 24px;
  border: 1px solid var(--hero-hairline);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--hero-ink);
  background: var(--hero-surface);
  transition: transform var(--duration-normal) var(--ease-out),
              border-color var(--duration-normal),
              background var(--duration-normal);
  position: relative;
  overflow: hidden;
}
.home-entry::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
}
.home-entry:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
}
.home-entry:hover::before { transform: scaleX(1); }

.home-entry-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--hero-muted);
}
.home-entry-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--hero-ink);
}
.home-entry-desc {
  font-size: 13px;
  color: var(--hero-muted);
  line-height: 1.5;
}

.home-entry--biz {
  border-color: rgba(232,69,14,0.2);
  background: rgba(232,69,14,0.04);
}
.home-entry--biz .home-entry-kicker {
  color: var(--accent);
}
.home-entry--biz:hover {
  border-color: rgba(232,69,14,0.35);
  background: rgba(232,69,14,0.08);
}

/* ── Hero → Content transition gradient ──────────────────────── */
.home-hero::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  z-index: 1;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════
   STATS BAR — light, subtle background
   ═══════════════════════════════════════════════════════════════ */
.home-stats {
  background: var(--bg-2);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 40px 24px;
}

.home-stats-inner {
  max-width: var(--home-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  text-align: center;
}

.home-stat-num {
  display: block;
  font-family: var(--home-font-display);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--ink);
  line-height: 1.1;
}
.home-stat-num--text {
  font-size: clamp(20px, 3vw, 28px);
}
.home-stat-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   SECTION CONTAINER
   ═══════════════════════════════════════════════════════════════ */
.home-section {
  padding: var(--home-section-py) 24px;
}
.home-section--compact {
  padding-top: 0;
  padding-bottom: 40px;
}
.home-section--alt {
  background: var(--bg-2);
}

.home-section-inner {
  max-width: var(--home-max);
  margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════════
   BENTO GRID — "What's Here" 2×2
   ═══════════════════════════════════════════════════════════════ */
.home-bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--home-card-gap);
  margin-top: 24px;
}

.home-bento-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  text-decoration: none;
  color: var(--ink);
  position: relative;
  overflow: hidden;
  transition: transform var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out),
              border-color var(--duration-normal);
}
.home-bento-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
}
.home-bento-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}
.home-bento-card:hover::before {
  transform: scaleX(1);
}

.home-bento-icon {
  font-size: 28px;
  line-height: 1;
}

.home-bento-card strong {
  font-family: var(--home-font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.home-bento-card p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════════
   TUTORIAL GRID — 3-column cards
   ═══════════════════════════════════════════════════════════════ */
.home-tutorial-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--home-card-gap);
  margin-top: 24px;
}

.home-tut-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  text-decoration: none;
  color: var(--ink);
  position: relative;
  overflow: hidden;
  transition: transform var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out),
              border-color var(--duration-normal);
}
.home-tut-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
}
.home-tut-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}
.home-tut-card:hover::before {
  transform: scaleX(1);
}

.home-tut-card--featured {
  grid-column: span 2;
  grid-row: span 2;
  padding: 32px;
}
.home-tut-card--featured .home-tut-title {
  font-size: 22px;
}
.home-tut-card--featured .home-tut-desc {
  font-size: 15px;
  max-width: 48ch;
}

.home-tut-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  width: fit-content;
}

.home-tut-title {
  font-family: var(--home-font-display);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -.01em;
  margin: 0;
}

.home-tut-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
  flex: 1;
}

.home-tut-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-2);
  margin-top: auto;
}

/* ═══════════════════════════════════════════════════════════════
   DUAL COLUMN — News + TIL side by side
   ═══════════════════════════════════════════════════════════════ */
.home-dual {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
}

.home-dual-main,
.home-dual-side {
  min-width: 0;
}

/* ═══════════════════════════════════════════════════════════════
   SUBSCRIBE CTA — subtle accent tint, light
   ═══════════════════════════════════════════════════════════════ */
.home-subscribe {
  position: relative;
  background: var(--bg-2);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 72px 24px;
  text-align: center;
  overflow: hidden;
}
.home-subscribe::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 50%, color-mix(in srgb, var(--accent) 4%, transparent), transparent);
  pointer-events: none;
}

.home-subscribe-inner {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  color: var(--ink);
}

.home-subscribe h3 {
  font-family: var(--home-font-display);
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0 0 12px;
}

.home-subscribe-desc {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
  margin: 0 0 24px;
}

/* ═══════════════════════════════════════════════════════════════
   MORE GRID — 4-column with streak
   ═══════════════════════════════════════════════════════════════ */
.home-more-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--home-card-gap);
  margin-top: 24px;
}

.home-more-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  text-decoration: none;
  color: var(--ink);
  transition: transform var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out),
              border-color var(--duration-normal);
}
.home-more-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}

.home-more-card strong {
  font-family: var(--home-font-display);
  font-size: 15px;
  font-weight: 700;
}
.home-more-card p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

.home-more-card--streak {
  cursor: default;
}
.home-more-card--streak:hover {
  transform: none;
  box-shadow: none;
}

/* ═══════════════════════════════════════════════════════════════
   SCROLL ANIMATIONS — [data-anim] + .is-visible
   ═══════════════════════════════════════════════════════════════ */
[data-anim="fade-up"] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .6s cubic-bezier(.16,1,.3,1), transform .6s cubic-bezier(.16,1,.3,1);
}
[data-anim="fade-up"].is-visible {
  opacity: 1;
  transform: none;
}

[data-anim="stagger"] > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .5s cubic-bezier(.16,1,.3,1), transform .5s cubic-bezier(.16,1,.3,1);
}
[data-anim="stagger"].is-visible > * {
  opacity: 1;
  transform: none;
}
[data-anim="stagger"].is-visible > *:nth-child(1) { transition-delay: .05s; }
[data-anim="stagger"].is-visible > *:nth-child(2) { transition-delay: .12s; }
[data-anim="stagger"].is-visible > *:nth-child(3) { transition-delay: .19s; }
[data-anim="stagger"].is-visible > *:nth-child(4) { transition-delay: .26s; }
[data-anim="stagger"].is-visible > *:nth-child(5) { transition-delay: .33s; }
[data-anim="stagger"].is-visible > *:nth-child(6) { transition-delay: .40s; }

[data-anim="slide-left"] {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity .6s cubic-bezier(.16,1,.3,1), transform .6s cubic-bezier(.16,1,.3,1);
}
[data-anim="slide-left"].is-visible {
  opacity: 1;
  transform: none;
}
[data-anim="slide-right"] {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity .6s cubic-bezier(.16,1,.3,1), transform .6s cubic-bezier(.16,1,.3,1);
}
[data-anim="slide-right"].is-visible {
  opacity: 1;
  transform: none;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 1100px) {
  .home-tutorial-grid {
    grid-template-columns: 1fr 1fr;
  }
  .home-tut-card--featured {
    grid-column: span 2;
    grid-row: span 1;
  }
  .home-dual {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .home-more-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}

@media (max-width: 768px) {
  :root {
    --home-section-py: 56px;
  }

  .home-hero {
    min-height: 80vh;
    padding: 96px 16px 64px;
  }

  .home-hero-title {
    font-size: clamp(36px, 10vw, 56px);
  }

  .home-hero-entries {
    grid-template-columns: 1fr;
    max-width: 100%;
  }

  .home-hero-grid-bg {
    display: none;
  }

  .home-stats-inner {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .home-bento {
    grid-template-columns: 1fr;
  }

  .home-tutorial-grid {
    grid-template-columns: 1fr;
  }
  .home-tut-card--featured {
    grid-column: span 1;
    grid-row: span 1;
  }

  .home-more-grid {
    grid-template-columns: 1fr;
  }

  .home-section {
    padding-left: 16px;
    padding-right: 16px;
  }
  .home-subscribe {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 480px) {
  .home-hero {
    min-height: 60vh;
  }
  .home-stat-num {
    font-size: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-entry,
  .home-bento-card,
  .home-tut-card,
  .home-more-card {
    transition: none !important;
  }
  .home-entry:hover,
  .home-bento-card:hover,
  .home-tut-card:hover,
  .home-more-card:hover {
    transform: none !important;
  }
  .home-hero-badge::before {
    animation: none;
  }
  [data-anim] {
    opacity: 1 !important;
    transform: none !important;
  }
  [data-anim] > * {
    opacity: 1 !important;
    transform: none !important;
  }
}
