/* ==========================================================
   Haldi Mexicana - Blog page layouts (3 styles) + fade animations
   Load AFTER assets/css/style.min.css
   Layout hooks: .hm-blog--zigzag | .hm-blog--magazine | .hm-blog--timeline
   ========================================================== */

:root {
  --hm-turmeric: #e8a317;
  --hm-turmeric-dark: #c98600;
  --hm-chili: #b3261e;
  --hm-ink: #2b1d16;
  --hm-muted: #6f625a;
  --hm-cream: #fff8ec;
  --hm-card: #ffffff;
  --hm-radius: 18px;
  --hm-shadow: 0 18px 45px rgba(43, 29, 22, .10);
  --hm-shadow-hover: 0 26px 60px rgba(43, 29, 22, .18);
}

.hm-blog {
  background: var(--hm-cream);
  padding: 20px 0 30px;
  overflow: hidden;
}

.hm-blog a { text-decoration: none; }

.hm-blog img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ---------- Shared bits ---------- */
.hm-date {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--hm-turmeric);
  color: var(--hm-ink);
  font-weight: 700;
  line-height: 1.05;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .18);
}
.hm-date b { font-size: 24px; font-weight: 800; }
.hm-date span { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }

.hm-title { margin: 0 0 12px; font-size: 24px; line-height: 1.3; font-weight: 700; }
.hm-title a { color: inherit; }
.hm-title a:hover { color: var(--hm-chili); }

.hm-text { margin: 0; color: var(--hm-muted); line-height: 1.75; font-size: 15.5px; }

.hm-more {
  position: relative;
  z-index: 3;
  display: inline-block;
  margin-left: 4px;
  font-weight: 700;
  color: var(--hm-chili);
  border-bottom: 2px solid transparent;
  transition: border-color .3s ease, color .3s ease;
}
.hm-more:hover { color: var(--hm-turmeric-dark); border-color: currentColor; }

/* ---------- Fade animations (progressive enhancement) ---------- */
.hm-js [data-fade] {
  opacity: 0;
  transition: opacity .9s ease, transform .9s cubic-bezier(.22, .61, .36, 1);
  transition-delay: var(--d, 0s);
  will-change: opacity, transform;
}
.hm-js [data-fade="up"]    { transform: translateY(34px); }
.hm-js [data-fade="left"]  { transform: translateX(-46px); }
.hm-js [data-fade="right"] { transform: translateX(46px); }
.hm-js [data-fade="zoom"]  { transform: scale(.95); }
.hm-js [data-fade="in"]    { transform: none; }
.hm-js [data-fade].is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .hm-js [data-fade] { opacity: 1 !important; transform: none !important; transition: none !important; }
  .hm-blog img { transition: none !important; }
}

/* ==========================================================
   LAYOUT 1 - ZIGZAG (alternating image / text rows)
   ========================================================== */
.hm-zig { counter-reset: hm-post; }

.hm-zig-item {
  counter-increment: hm-post;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  align-items: center;
  margin-bottom: 80px;
  position: relative;
}
.hm-zig-item:last-child { margin-bottom: 0; }
.hm-zig-item:nth-child(even) { grid-template-columns: 1fr 1.15fr; }
.hm-zig-item:nth-child(even) .hm-zig-media { order: 2; }

.hm-zig-media {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--hm-radius);
  overflow: hidden;
  box-shadow: var(--hm-shadow);
}
.hm-zig-media img { transition: transform 1.1s ease; }
.hm-zig-item:hover .hm-zig-media img { transform: scale(1.06); }
.hm-zig-media .hm-date { position: absolute; top: 20px; left: 20px; }

.hm-zig-body {
  position: relative;
  z-index: 2;
  background: var(--hm-card);
  border-radius: var(--hm-radius);
  border-top: 5px solid var(--hm-turmeric);
  padding: 44px 40px 38px;
  margin-left: -70px;
  box-shadow: var(--hm-shadow);
  transition: box-shadow .4s ease;
}
.hm-zig-item:nth-child(even) .hm-zig-body { margin-left: 0; margin-right: -70px; border-top-color: var(--hm-chili); }
.hm-zig-item:hover .hm-zig-body { box-shadow: var(--hm-shadow-hover); }

.hm-zig-body::before {
  content: "0" counter(hm-post);
  position: absolute;
  top: 10px;
  right: 26px;
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  color: rgba(232, 163, 23, .18);
  pointer-events: none;
}
.hm-zig-body .hm-title { position: relative; padding-right: 50px; }

@media (max-width: 991.98px) {
  .hm-zig-item,
  .hm-zig-item:nth-child(even) { grid-template-columns: 1fr; margin-bottom: 60px; }
  .hm-zig-item:nth-child(even) .hm-zig-media { order: 0; }
  .hm-zig-body,
  .hm-zig-item:nth-child(even) .hm-zig-body { margin: -50px 20px 0; padding: 34px 26px 30px; }
}

/* ==========================================================
   LAYOUT 2 - MAGAZINE (bento grid, overlay cards)
   ========================================================== */
.hm-mag {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 28px;
}

.hm-mag-card {
  position: relative;
  grid-column: span 2;
  min-height: 380px;
  border-radius: var(--hm-radius);
  overflow: hidden;
  background: var(--hm-ink);
  box-shadow: var(--hm-shadow);
  isolation: isolate;
}
.hm-mag-card:nth-child(1) { grid-column: span 6; min-height: 500px; }
.hm-mag-card:nth-child(2),
.hm-mag-card:nth-child(3) { grid-column: span 3; min-height: 420px; }

.hm-mag-card > img {
  position: absolute;
  inset: 0;
  z-index: -2;
  transition: transform 1.2s ease;
}
.hm-mag-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to top, rgba(25, 14, 8, .92) 0%, rgba(25, 14, 8, .55) 45%, rgba(25, 14, 8, .05) 80%);
  transition: opacity .5s ease;
}
.hm-mag-card:hover > img { transform: scale(1.08); }

.hm-mag-card .hm-date { position: absolute; top: 20px; left: 20px; }

.hm-mag-body {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 30px 30px 28px;
  color: #fff;
  transform: translateY(0);
  transition: transform .5s ease;
}
.hm-mag-card .hm-title { color: #fff; font-size: 21px; }
.hm-mag-card .hm-title a::after { content: ""; position: absolute; inset: 0; z-index: 2; }
.hm-mag-card .hm-title a:hover { color: var(--hm-turmeric); }
.hm-mag-card .hm-text { color: rgba(255, 255, 255, .82); font-size: 14.5px; }
.hm-mag-card .hm-more { color: var(--hm-turmeric); }
.hm-mag-card .hm-more:hover { color: #fff; }

.hm-mag-card:nth-child(1) .hm-mag-body { padding: 48px; max-width: 760px; }
.hm-mag-card:nth-child(1) .hm-title { font-size: 34px; }
.hm-mag-card:nth-child(1) .hm-text { font-size: 17px; }
.hm-mag-card:nth-child(2) .hm-title,
.hm-mag-card:nth-child(3) .hm-title { font-size: 24px; }

@media (max-width: 991.98px) {
  .hm-mag { grid-template-columns: repeat(2, 1fr); gap: 22px; }
  .hm-mag-card,
  .hm-mag-card:nth-child(2),
  .hm-mag-card:nth-child(3) { grid-column: span 1; min-height: 400px; }
  .hm-mag-card:nth-child(1) { grid-column: span 2; min-height: 440px; }
  .hm-mag-card:nth-child(1) .hm-mag-body { padding: 32px; }
  .hm-mag-card:nth-child(1) .hm-title { font-size: 26px; }
}
@media (max-width: 575.98px) {
  .hm-mag { grid-template-columns: 1fr; }
  .hm-mag-card,
  .hm-mag-card:nth-child(1),
  .hm-mag-card:nth-child(2),
  .hm-mag-card:nth-child(3) { grid-column: span 1; min-height: 400px; }
  .hm-mag-card:nth-child(1) .hm-mag-body { padding: 26px; }
  .hm-mag-card:nth-child(1) .hm-title { font-size: 22px; }
}

/* ==========================================================
   LAYOUT 3 - TIMELINE (center line, alternating cards)
   ========================================================== */
.hm-tl {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
}
.hm-tl::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 3px;
  transform: translateX(-50%);
  border-radius: 3px;
  background: linear-gradient(to bottom, var(--hm-turmeric), var(--hm-chili));
  opacity: .55;
}

.hm-tl-item {
  position: relative;
  width: 50%;
  padding: 0 56px 56px 0;
}
.hm-tl-item:last-child { padding-bottom: 0; }
.hm-tl-item:nth-child(even) { margin-left: 50%; padding: 0 0 56px 56px; }
.hm-tl-item:nth-child(even):last-child { padding-bottom: 0; }

.hm-tl-item::after {
  content: "";
  position: absolute;
  top: 36px;
  right: -11px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--hm-turmeric);
  border: 5px solid var(--hm-cream);
  box-shadow: 0 0 0 3px var(--hm-turmeric);
  z-index: 2;
}
.hm-tl-item:nth-child(even)::after { right: auto; left: -11px; background: var(--hm-chili); box-shadow: 0 0 0 3px var(--hm-chili); }

.hm-tl-card {
  background: var(--hm-card);
  border-radius: var(--hm-radius);
  overflow: hidden;
  box-shadow: var(--hm-shadow);
  transition: transform .5s ease, box-shadow .5s ease;
}
.hm-tl-card:hover { transform: translateY(-6px); box-shadow: var(--hm-shadow-hover); }

.hm-tl-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; }
.hm-tl-media img { transition: transform 1.1s ease; }
.hm-tl-card:hover .hm-tl-media img { transform: scale(1.07); }
.hm-tl-media .hm-date { position: absolute; top: 16px; left: 16px; }

.hm-tl-body { padding: 28px 30px 30px; }

@media (max-width: 767.98px) {
  .hm-tl::before { left: 14px; transform: none; }
  .hm-tl-item,
  .hm-tl-item:nth-child(even) { width: 100%; margin-left: 0; padding: 0 0 24px 30px; }
  .hm-tl-item::after,
  .hm-tl-item:nth-child(even)::after { left: 3px; right: auto; }
}
