/*
 * CraftBook Custom Theme V1 — Homepage Styles
 *
 * 1.  Hero Section
 * 2.  Featured Grid
 * 3.  Section Headers (shared)
 * 4.  Category Sections
 * 5.  Newsletter Strip
 * 6.  Explore Hub
 * 7.  About Strip
 * 8.  Latest Articles
 * 9.  Responsive
 */


/* =============================================================================
   1. HERO SECTION
   ============================================================================= */

.home-hero {
  position: relative;
  min-height: clamp(480px, 70vh, 720px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background-color: var(--color-heading);  /* Fallback when no image */
}

/* Background image */
.home-hero__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  transition: transform 8s ease;
  will-change: transform;
}

/* Subtle Ken Burns effect — paused if reduced motion preferred */
.home-hero:hover .home-hero__bg {
  transform: scale(1.03);
}

@media (prefers-reduced-motion: reduce) {
  .home-hero__bg { transition: none; }
  .home-hero:hover .home-hero__bg { transform: none; }
}

/* Gradient overlay for text legibility */
.home-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(15, 17, 24, 0.92) 0%,
    rgba(15, 17, 24, 0.6)  40%,
    rgba(15, 17, 24, 0.15) 70%,
    transparent 100%
  );
}

/* When no image — solid dark background */
.home-hero:not(.home-hero--has-image) {
  background: linear-gradient(135deg, var(--color-heading) 0%, #1a2744 100%);
  min-height: clamp(360px, 50vh, 540px);
}

.home-hero__inner {
  position: relative;
  z-index: var(--z-raised);
  padding-block: var(--space-16);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.home-hero__content {
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* Category label — white on dark hero */
.home-hero__category .category-label {
  color: var(--color-accent);
  font-size: var(--text-xs);
}

.home-hero--has-image .home-hero__category .category-label {
  color: #4ADE80;  /* Lighter teal for contrast on dark images */
}

/* Hero headline */
.home-hero__title {
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
  font-weight: var(--weight-black);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: #FFFFFF;
  margin: 0;
}

.home-hero__title-link {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.home-hero__title-link:hover {
  color: var(--color-accent-light);
}

/* Standfirst */
.home-hero__excerpt {
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
  max-width: 600px;
}

/* Meta */
.home-hero .post-meta {
  color: rgba(255, 255, 255, 0.65);
}

.home-hero .post-meta a { color: rgba(255, 255, 255, 0.75); }
.home-hero .post-meta a:hover { color: #FFFFFF; }

/* Button */
.home-hero__btn {
  align-self: flex-start;
}

.btn-arrow {
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.btn:hover .btn-arrow {
  transform: translateX(4px);
}

/* Scroll indicator */
.home-hero__scroll {
  position: absolute;
  bottom: var(--space-8);
  right: var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  opacity: 0.5;
}

.home-hero__scroll-line {
  display: block;
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.8));
  animation: scroll-line 2s ease-in-out infinite;
}

.home-hero__scroll-label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: rgba(255, 255, 255, 0.8);
  writing-mode: vertical-rl;
}

@keyframes scroll-line {
  0%, 100% { transform: scaleY(1); opacity: 0.5; }
  50%       { transform: scaleY(1.3); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .home-hero__scroll { display: none; }
}


/* =============================================================================
   2. FEATURED GRID
   ============================================================================= */

.home-featured {
  background-color: var(--color-background);
  border-bottom: var(--border-width) solid var(--color-border);
}

.home-featured__grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-6);
  align-items: start;
}

.home-featured__primary {
  /* Large card — left column */
}

.home-featured__secondary {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Horizontal card variant — used in secondary column */
.card--horizontal {
  display: flex;
  flex-direction: row;
  gap: var(--space-4);
  align-items: flex-start;
  background-color: var(--color-background-alt);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

.card--horizontal:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.card--horizontal .card__image-wrap--sm {
  flex-shrink: 0;
  width: 100px;
  height: 80px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.card--horizontal .card__image-wrap--sm img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card--horizontal .card__body {
  flex: 1;
  min-width: 0;
  padding: 0;
}

@media (prefers-reduced-motion: reduce) {
  .card--horizontal:hover { transform: none; }
}


/* =============================================================================
   3. SECTION HEADERS (shared across all homepage sections)
   ============================================================================= */

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-6);
  border-bottom: var(--border-width) solid var(--color-border);
}

.section-header__left {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.section-header__label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
}

.section-header__title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--weight-black);
  color: var(--color-heading);
  line-height: var(--leading-tight);
  margin: 0;
}

.section-header__description {
  font-size: var(--text-base);
  color: var(--color-text-light);
  max-width: 560px;
  margin-top: var(--space-2);
  margin-bottom: 0;
}

.section-header__view-all {
  flex-shrink: 0;
}

/* Centred variant for Explore section */
.section-header--centered {
  flex-direction: column;
  align-items: center;
  text-align: center;
  border-bottom: none;
  margin-bottom: var(--space-10);
}

.section-header--centered .section-header__title {
  font-size: var(--text-3xl);
}

.section-header--centered .section-header__label {
  color: var(--color-accent);
}


/* =============================================================================
   4. CATEGORY SECTIONS
   ============================================================================= */

.home-category {
  border-bottom: var(--border-width) solid var(--color-border);
}

/* Alternating background for visual rhythm */
.home-category:nth-child(even) {
  background-color: var(--color-background-subtle);
}

/* Per-category accent colours on the section label */
.home-category--technology .section-header__label { color: #2563EB; }
.home-category--business   .section-header__label { color: #7C3AED; }
.home-category--creativity .section-header__label { color: #D97706; }
.home-category--society    .section-header__label { color: #DB2777; }

/* Left accent border on section heading for category sections */
.home-category .section-header {
  position: relative;
}

.home-category .section-header::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--space-6));
  top: 0;
  bottom: var(--space-6);
  width: 4px;
  border-radius: var(--radius-full);
}

.home-category--technology .section-header::before { background-color: #2563EB; }
.home-category--business   .section-header::before { background-color: #7C3AED; }
.home-category--creativity .section-header::before { background-color: #D97706; }
.home-category--society    .section-header::before { background-color: #DB2777; }

.home-category__grid {
  gap: var(--space-6);
}


/* =============================================================================
   5. NEWSLETTER STRIP
   ============================================================================= */

.home-newsletter {
  background-color: var(--color-heading);
  color: #FFFFFF;
  padding-block: var(--space-16);
  position: relative;
  overflow: hidden;
}

/* Background texture — subtle grid pattern */
.home-newsletter::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.home-newsletter__inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-16);
  align-items: center;
}

.home-newsletter__kicker {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--color-accent);
  margin-bottom: var(--space-3);
}

/* Dark teal for light mode — bright teal works on dark bg */
.home-newsletter__kicker { color: #4ADE80; }

.home-newsletter__heading {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: var(--weight-black);
  color: #FFFFFF;
  line-height: var(--leading-tight);
  margin-bottom: var(--space-5);
}

.home-newsletter__description {
  font-size: var(--text-base);
  color: rgba(255, 255, 255, 0.75);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-6);
}

.home-newsletter__benefits {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.home-newsletter__benefits li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.75);
}

.home-newsletter__benefits li::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  background-color: #4ADE80;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  /* Checkmark via clip-path */
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

/* Newsletter form area */
.home-newsletter__fallback {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  backdrop-filter: blur(8px);
}

.home-newsletter__input-group {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.home-newsletter__input {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: #FFFFFF;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.home-newsletter__input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.home-newsletter__input:focus {
  outline: none;
  border-color: #4ADE80;
  background-color: rgba(255, 255, 255, 0.15);
}

.home-newsletter__submit {
  flex-shrink: 0;
  background-color: #4ADE80;
  color: #111827;
  border-color: #4ADE80;
}

.home-newsletter__submit:hover {
  background-color: #86EFAC;
  border-color: #86EFAC;
  color: #111827;
}

.home-newsletter__privacy {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.45);
  margin: 0;
}

.home-newsletter__privacy-link {
  color: rgba(255, 255, 255, 0.65);
  transition: color var(--transition-fast);
}

.home-newsletter__privacy-link:hover { color: #FFFFFF; }

/* Decorative quotation */
.home-newsletter__quote {
  display: none;  /* Hidden on mobile, shown on larger screens */
  position: absolute;
  top: var(--space-8);
  right: var(--space-8);
  background: none;
  border: none;
  padding: 0;
  max-width: 260px;
  opacity: 0.35;
  pointer-events: none;
}

.home-newsletter__quote p {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: var(--text-md);
  color: #FFFFFF;
  line-height: var(--leading-snug);
  margin-bottom: var(--space-2);
}

.home-newsletter__quote cite {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.6);
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  margin-top: 0;
}

@media (min-width: 1200px) {
  .home-newsletter__quote { display: block; }
}


/* =============================================================================
   6. EXPLORE HUB
   ============================================================================= */

.home-explore {
  background-color: var(--color-background-subtle);
  border-top: var(--border-width) solid var(--color-border);
  border-bottom: var(--border-width) solid var(--color-border);
}

.home-explore__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

/* Feature card */
.explore-card {
  background-color: var(--color-background-alt);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  transition: box-shadow var(--transition-base), transform var(--transition-base), border-color var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.explore-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  transition: height var(--transition-base);
}

.explore-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-4px);
  border-color: transparent;
}

.explore-card:hover::before {
  height: 4px;
}

/* Per-colour accent tops */
.explore-card--teal::before   { background-color: var(--color-accent); }
.explore-card--amber::before  { background-color: #D97706; }
.explore-card--purple::before { background-color: #7C3AED; }
.explore-card--blue::before   { background-color: #2563EB; }
.explore-card--green::before  { background-color: #16A34A; }
.explore-card--rose::before   { background-color: #E11D48; }

/* Icon */
.explore-card__icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background-color: var(--color-background-subtle);
  flex-shrink: 0;
}

.explore-card--teal   .explore-card__icon { color: var(--color-accent); background-color: var(--color-accent-light); }
.explore-card--amber  .explore-card__icon { color: #D97706; background-color: #FEF3C7; }
.explore-card--purple .explore-card__icon { color: #7C3AED; background-color: #EDE9FE; }
.explore-card--blue   .explore-card__icon { color: #2563EB; background-color: #EFF6FF; }
.explore-card--green  .explore-card__icon { color: #16A34A; background-color: #DCFCE7; }
.explore-card--rose   .explore-card__icon { color: #E11D48; background-color: #FFF1F2; }

.explore-card__icon svg {
  width: 28px;
  height: 28px;
}

/* Content */
.explore-card__content { flex: 1; }

.explore-card__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-heading);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-2);
}

.explore-card__description {
  font-size: var(--text-sm);
  color: var(--color-text-light);
  line-height: var(--leading-relaxed);
  margin: 0;
}

/* Link */
.explore-card__link {
  align-self: flex-start;
  margin-top: auto;
}

@media (prefers-reduced-motion: reduce) {
  .explore-card:hover { transform: none; }
}


/* =============================================================================
   7. ABOUT STRIP
   ============================================================================= */

.home-about {
  border-bottom: var(--border-width) solid var(--color-border);
}

.home-about__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-10);
  align-items: center;
}

.home-about__avatar {
  flex-shrink: 0;
}

.home-about__avatar-img {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 4px solid var(--color-accent-light);
  box-shadow: var(--shadow-md);
}

.home-about__avatar-placeholder {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-full);
  background-color: var(--color-background-subtle);
  border: 4px solid var(--color-border);
}

.home-about__kicker {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}

.home-about__heading {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-heading);
  line-height: var(--leading-snug);
  margin-bottom: var(--space-4);
}

.home-about__body {
  font-size: var(--text-base);
  color: var(--color-text-light);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-6);
}

.home-about__body p { margin-bottom: 0; }

.home-about__actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* Stats column */
.home-about__stats {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding-left: var(--space-10);
  border-left: var(--border-width) solid var(--color-border);
  flex-shrink: 0;
  min-width: 180px;
}

.home-about__stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.home-about__stat-number {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: var(--weight-black);
  color: var(--color-accent);
  line-height: var(--leading-none);
}

.home-about__stat-label {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--color-meta);
}


/* =============================================================================
   8. LATEST ARTICLES SECTION
   ============================================================================= */

.home-latest {
  border-bottom: var(--border-width) solid var(--color-border);
}

.home-latest__grid {
  gap: var(--space-6);
}


/* =============================================================================
   9. RESPONSIVE
   ============================================================================= */

/* Large tablets */
@media (max-width: 1100px) {
  .home-about__inner {
    grid-template-columns: auto 1fr;
    gap: var(--space-8);
  }
  .home-about__stats {
    grid-column: 1 / -1;
    flex-direction: row;
    border-left: none;
    border-top: var(--border-width) solid var(--color-border);
    padding-left: 0;
    padding-top: var(--space-6);
    min-width: 0;
  }
  .home-about__stat { flex: 1; }
}

/* Tablets */
@media (max-width: 1024px) {
  .home-newsletter__inner {
    grid-template-columns: 1fr;
    gap: var(--space-10);
  }
  .home-explore__grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .home-featured__grid {
    grid-template-columns: 1fr;
  }
  .home-featured__secondary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
  .card--horizontal {
    flex-direction: column;
  }
  .card--horizontal .card__image-wrap--sm {
    width: 100%;
    height: 160px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .home-hero {
    min-height: clamp(400px, 80vh, 560px);
  }
  .home-hero__title {
    font-size: var(--text-3xl);
  }
  .home-hero__excerpt {
    font-size: var(--text-base);
  }
  .home-hero__scroll { display: none; }
  .home-explore__grid { grid-template-columns: 1fr; }
  .home-featured__secondary { grid-template-columns: 1fr; }
  .home-about__inner { grid-template-columns: 1fr; }
  .home-about__avatar { display: none; }
  .home-about__stats { flex-direction: column; }
  .home-about__stat { flex-direction: row; align-items: center; gap: var(--space-4); }
  .home-about__stat-number { font-size: var(--text-2xl); min-width: 64px; }
  .section-header { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
  .home-newsletter__input-group { flex-direction: column; }
  .home-newsletter__input,
  .home-newsletter__submit { width: 100%; }
}

/* Small mobile */
@media (max-width: 480px) {
  .home-hero__content { gap: var(--space-4); }
  .home-hero__title { font-size: var(--text-2xl); }
  .explore-card { padding: var(--space-6); }
}
