/* Kodumarket Julge — front page (home.css)
 * Styles for /inc/front-page/*.php partials.
 *
 * Structure (top → bottom):
 *   .km-home__hero       — dark gradient hero (inside a dark wrap)
 *   .km-home__marquee    — scrolling brand ticker (still on dark wrap)
 *   .km-home__body       — white rounded-top container overlapping the hero
 *     .km-home__s-catalog  (editorial category index)
 *     .km-home__s-featured (product grid)
 *     .km-home__s-story    (gradient quote)
 *   .km-home__s-eco      — dark eco strip (full-bleed, below body)
 *
 * Depends on tokens.css + typography.css + components.css + header.css.
 * Loaded only on is_front_page() via functions.php.
 */

/* =============================================================
 * ROOT WRAP
 * ============================================================= */
.km-home {
  width: 100%;
  overflow-x: hidden;
}

/* The dark wrap holds hero + marquee with the mesh gradient.
 * v1.7.8: rounded corners now visible — hero starts BELOW the
 * header (top: 116px in from the viewport edge) with 32px radius.
 * The header remains transparent and simply sits on the WHITE
 * area above the hero, not overlapping it. This gives a clear
 * "card-in-a-frame" look where the rounded top corners breathe.
 */
.km-home__dark-wrap {
  background: var(--km-grad-mesh);
  color: #fff;
  position: relative;
  overflow: hidden;
  margin: 0 12px;
  padding-top: 40px;
  border-radius: 32px 32px 0 0;
}
@media (max-width: 767px) {
  .km-home__dark-wrap {
    margin: 0 8px;
    padding-top: 32px;
    border-radius: 24px 24px 0 0;
  }
}

/* =============================================================
 * 01 · HERO
 * ============================================================= */
.km-home__hero {
  padding: 40px 48px 80px;
  position: relative;
}

/* Campaign eyebrow */
.km-hero__kicker {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .65);
  margin-bottom: 32px;
}
.km-hero__kicker .km-dot {
  background: var(--km-green-500);
  width: 8px; height: 8px;
  border-radius: 999px;
  display: inline-block;
}

/* The big H1 — §5.1 p.3: 128 / 800 / -0.05em / 0.85 */
.km-hero__title {
  font-size: clamp(48px, 10vw, 128px);
  font-weight: 800;
  line-height: .85;
  letter-spacing: -0.05em;
  max-width: 1100px;
  margin: 0;
  text-wrap: balance;
  color: #fff;
}
.km-hero__title .km-serif { color: inherit; }
.km-hero__discount {
  color: var(--km-green-500);
  white-space: nowrap;
}

/* Hero grid: description / CTAs / metrics */
.km-hero__grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 32px;
  margin-top: 48px;
  align-items: end;
}
.km-hero__intro {
  font-size: 16px;
  color: rgba(255, 255, 255, .75);
  line-height: 1.55;
  max-width: 380px;
  margin: 0;
  text-wrap: pretty;
}

/* CTAs */
.km-hero__ctas {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.km-hero__cta-primary,
.km-hero__cta-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 54px;
  padding: 0 26px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  width: fit-content;
  transition: transform .12s ease, box-shadow .15s ease, background .15s;
  cursor: pointer;
}
.km-hero__cta-primary {
  background: var(--km-green-500);
  color: var(--km-ink);
  font-weight: 700;
}
.km-hero__cta-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--km-shadow-green);
  color: var(--km-ink);
}
.km-hero__cta-ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .3);
}
.km-hero__cta-ghost:hover {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .5);
  color: #fff;
}

/* Metrics (2×2 grid) */
.km-hero__metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, .6);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.km-hero__metric-num {
  font-family: "Geist", sans-serif;
  font-size: 40px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.04em;
  margin-bottom: 2px;
  line-height: 1;
}
/* Word-style metric (e.g. "Laos", "Eesti") — smaller, less shouty */
.km-hero__metric-num--word {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.km-hero__metric-label { line-height: 1.35; }

/* Floating visual (hero image on the right) */
.km-hero__visual {
  position: absolute;
  right: 48px;
  top: 160px;
  width: 340px;
  height: 500px;
  transform: rotate(14deg);
  filter: drop-shadow(0 40px 80px rgba(0, 0, 0, .4));
  pointer-events: none;
  z-index: 1;
}
.km-hero__visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* =============================================================
 * MARQUEE
 * ============================================================= */
.km-home__marquee {
  border-top: 1px solid rgba(255, 255, 255, .1);
  /* No bottom border — the white rounded-top body visually closes this row. */
  /* Extra bottom padding so the white rounded-top body (which sits on top
     via margin-top: -24px) doesn't clip the scrolling text. */
  padding: 14px 0 42px;
  overflow: hidden;
  white-space: nowrap;
  color: rgba(255, 255, 255, .7);
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.km-marquee__track {
  display: inline-flex;
  align-items: center;
  animation: km-marquee-scroll 45s linear infinite;
  will-change: transform;
}
.km-marquee__track > span {
  padding: 0 24px;
  flex-shrink: 0;
}
.km-marquee__track > span + span::before {
  content: "·";
  margin-right: 24px;
  margin-left: -24px;
  opacity: .5;
}
@keyframes km-marquee-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .km-marquee__track { animation: none; }
}

/* =============================================================
 * WHITE BODY OVERLAP
 * ============================================================= */
.km-home__body {
  background: #fff;
  border-radius: 32px 32px 0 0;
  margin: -24px 12px 0;
  position: relative;
  z-index: 2;
}
@media (max-width: 767px) {
  .km-home__body {
    margin: -16px 8px 0;
    border-radius: 24px 24px 0 0;
  }
}

/* =============================================================
 * SECTION HEAD (shared: .km-s-head)
 * ============================================================= */
.km-s-inner {
  padding: 0;
}
.km-s-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 28px;
}
.km-s-head__kicker {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--km-ink-4);
  margin-bottom: 10px;
}
.km-s-head__title {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  text-wrap: balance;
  color: inherit;
  margin: 0;
  max-width: 720px;
}
.km-s-head__sub {
  font-size: 13px;
  color: var(--km-ink-3);
  line-height: 1.55;
  margin: 16px 0 0;
  max-width: 520px;
}
.km-s-head__updated {
  font-size: 13px;
  color: var(--km-ink-3);
  white-space: nowrap;
}

/* Dark-section variant of section head */
.km-home__s-eco .km-s-head__kicker { color: var(--km-green-500); }
.km-home__s-eco .km-s-head__sub    { color: rgba(255, 255, 255, .6); max-width: 280px; white-space: normal; }
.km-home__s-eco .km-s-head__title  { color: #fff; }

/* =============================================================
 * 01 · KATALOOG — editorial category index
 * ============================================================= */
.km-home__s-catalog {
  padding: 56px 48px 32px;
}
.km-home__s-catalog .km-s-inner {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 48px;
  align-items: start;
}
/* When catalog is in 2-col mode, kill the default s-head flex behavior */
.km-home__s-catalog .km-s-head {
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 0;
}

.km-catalog__list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--km-line);
}
.km-catalog__row {
  display: grid;
  grid-template-columns: 50px 1fr 1fr 80px 32px;
  gap: 16px;
  align-items: center;
  padding: 18px 0;
  border-top: 1px solid var(--km-line);
  text-decoration: none;
  color: inherit;
  transition: background .15s ease, padding-left .15s ease;
}
/* Row with a thumbnail gets an extra 56px column right after the № */
.km-catalog__row--has-thumb {
  grid-template-columns: 50px 56px 1fr 1fr 80px 32px;
}
.km-catalog__row:hover {
  background: var(--km-surface-2);
  padding-left: 12px;
}
.km-catalog__thumb {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--km-surface-2);
  display: grid;
  place-items: center;
}
.km-catalog__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.km-catalog__n {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--km-ink-4);
}
.km-catalog__name {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--km-ink);
}
.km-catalog__sub {
  font-size: 13px;
  color: var(--km-ink-3);
  line-height: 1.4;
}
.km-catalog__count {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--km-ink-4);
  text-align: right;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.km-catalog__arrow {
  color: var(--km-ink-3);
  display: grid;
  place-items: center;
  transition: transform .15s ease, color .15s ease;
}
.km-catalog__arrow svg { width: 16px; height: 16px; }
.km-catalog__row:hover .km-catalog__arrow {
  transform: translateX(4px);
  color: var(--km-ink);
}
.km-catalog__empty {
  padding: 24px 0;
  border-top: 1px solid var(--km-line);
  border-bottom: 1px solid var(--km-line);
  font-size: 14px;
  color: var(--km-ink-3);
}

/* =============================================================
 * 02 · VALIK (featured) + 04 · ÖKO — product grids
 * ============================================================= */
.km-home__s-featured {
  padding: 32px 48px;
}

/* Product grid (used light and dark) */
.km-prod-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* Product card — light variant (default) */
.km-hp-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--km-line-soft);
  border-radius: var(--km-r-lg);
  padding: 18px;
  text-decoration: none;
  color: var(--km-ink);
  position: relative;
  transition: transform .12s ease, box-shadow .15s ease;
}
.km-hp-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--km-shadow-md);
  color: var(--km-ink);
}
.km-hp-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--km-ink-4);
  text-transform: uppercase;
}
.km-hp-card__img {
  aspect-ratio: 1 / 1;
  background: var(--km-surface-2);
  border-radius: 14px;
  padding: 20px;
  position: relative;
  margin-bottom: 14px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.km-hp-card__img img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  mix-blend-mode: multiply;
}
/* If the product has no thumbnail, WooCommerce outputs a placeholder */
.km-hp-card__img .wp-post-image { display: block; }

.km-hp-card__badge {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: var(--km-ink);
  color: #fff;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  letter-spacing: .04em;
}
.km-hp-card__title {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0 0 4px;
  text-wrap: pretty;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: inherit;
}
.km-hp-card__size {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--km-ink-4);
  margin: 0 0 14px;
}
.km-hp-card__spacer { flex: 1; }
.km-hp-card__foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--km-line-soft);
  gap: 12px;
}
.km-hp-card__price-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.km-hp-card__price {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--km-ink);
}
/* WooCommerce's get_price_html() returns <del>OLD</del> <ins>NEW</ins> for sales */
.km-hp-card__price ins {
  text-decoration: none;
  background: transparent;
  color: inherit;
  font-weight: inherit;
}
.km-hp-card__price del {
  display: block;
  font-size: 11px;
  color: var(--km-ink-4);
  font-weight: 400;
  letter-spacing: 0;
  text-decoration: line-through;
  margin-top: 2px;
}
.km-hp-card__add {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--km-ink);
  color: #fff;
  display: grid;
  place-items: center;
  border: 0;
  cursor: pointer;
  transition: transform .1s ease;
  flex-shrink: 0;
}
.km-hp-card__add:hover { transform: scale(1.08); }
.km-hp-card__add svg { width: 18px; height: 18px; stroke-width: 2; }

/* Product card — dark variant */
.km-hp-card--dark {
  background: rgba(255, 255, 255, .04);
  border-color: rgba(255, 255, 255, .08);
  color: #fff;
}
.km-hp-card--dark:hover { color: #fff; }
.km-hp-card--dark .km-hp-card__meta  { color: rgba(255, 255, 255, .5); }
.km-hp-card--dark .km-hp-card__img   { background: rgba(255, 255, 255, .03); }
.km-hp-card--dark .km-hp-card__img img { mix-blend-mode: normal; }
.km-hp-card--dark .km-hp-card__badge { background: var(--km-green-500); color: var(--km-ink); }
.km-hp-card--dark .km-hp-card__size  { color: rgba(255, 255, 255, .5); }
.km-hp-card--dark .km-hp-card__foot  { border-top-color: rgba(255, 255, 255, .08); }
.km-hp-card--dark .km-hp-card__price { color: #fff; }
.km-hp-card--dark .km-hp-card__price del,
.km-hp-card--dark .km-hp-card__price .amount ~ .amount { color: rgba(255, 255, 255, .45); }
.km-hp-card--dark .km-hp-card__add   { background: var(--km-green-500); color: var(--km-ink); }

/* Grid variant for dark sections */
.km-prod-grid--dark { /* just a marker — colors come from km-hp-card--dark */ }

/* =============================================================
 * 03 · NÄDALA LUGU (quote card)
 * ============================================================= */
.km-home__s-story {
  padding: 32px 48px;
}
.km-story__card {
  background: var(--km-grad-soft);
  border-radius: var(--km-r-xl);
  padding: 48px;
  color: #fff;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 40px;
  align-items: center;
  min-height: 360px;
  overflow: hidden;
  position: relative;
}
.km-story__kicker {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .7;
  margin-bottom: 18px;
}
.km-story__quote {
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin: 0 0 24px;
  text-wrap: balance;
  color: #fff;
}
.km-story__author {
  font-size: 13px;
  opacity: .8;
  margin: 0 0 28px;
}
.km-story__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: var(--km-ink);
  border-radius: 999px;
  height: 48px;
  padding: 0 22px;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: transform .12s ease, box-shadow .15s ease;
}
.km-story__cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, .3);
  color: var(--km-ink);
}
.km-story__cta svg { width: 14px; height: 14px; }
.km-story__visual {
  aspect-ratio: 1 / 1;
  background: rgba(255, 255, 255, .08);
  border-radius: var(--km-r-lg);
  padding: 40px;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.km-story__visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* =============================================================
 * 04 · ÖKO SARI (dark strip, full-bleed below white body)
 * ============================================================= */
.km-home__s-eco {
  background: #0A1628;
  color: #fff;
  padding: 56px 48px;
}

/* =============================================================
 * RESPONSIVE
 * ============================================================= */
@media (max-width: 1200px) {
  .km-prod-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
  .km-home__dark-wrap { margin-top: -96px; padding-top: 96px; }
  .km-home__hero { padding: 32px 24px 56px; }
  .km-hero__title { font-size: clamp(44px, 8vw, 80px); }
  .km-hero__grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .km-hero__visual {
    position: relative;
    right: auto;
    top: auto;
    width: 100%;
    max-width: 340px;
    height: 320px;
    margin: 24px auto 0;
    transform: rotate(6deg);
  }
  .km-home__s-catalog { padding: 40px 24px 20px; }
  .km-home__s-catalog .km-s-inner { grid-template-columns: 1fr; gap: 24px; }
  .km-catalog__row { grid-template-columns: 36px 1fr 60px 24px; padding: 16px 0; }
  .km-catalog__row--has-thumb { grid-template-columns: 36px 44px 1fr 60px 24px; }
  .km-catalog__thumb { width: 44px; height: 44px; border-radius: 10px; }
  .km-catalog__sub { display: none; }
  .km-home__s-featured,
  .km-home__s-story { padding: 24px; }
  .km-home__s-eco { padding: 40px 24px; }
  .km-prod-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .km-story__card {
    grid-template-columns: 1fr;
    padding: 32px;
  }
  .km-story__visual { display: none; }
  .km-s-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .km-s-head__title { font-size: 36px; }
}

@media (max-width: 640px) {
  .km-home__hero { padding: 24px 16px 48px; }
  .km-home__s-catalog { padding: 32px 16px 20px; }
  .km-home__s-featured,
  .km-home__s-story { padding: 20px 16px; }
  .km-home__s-eco { padding: 32px 16px; }
  .km-s-head__title { font-size: 28px; }
  .km-story__card { padding: 24px; min-height: 0; }
  .km-hp-card__price { font-size: 20px; }
}
