/* ==========================================================================
   Aurem — Journal (blog) page: masthead + cover story, filters & search,
   editorial post grid with load-more, most read, newsletter.
   Uses brand tokens (hero.css) + components.css.
   ========================================================================== */

/* ---------- Masthead ---------- */
.ah-jhero { z-index: 1; overflow: hidden; isolation: isolate; padding: clamp(120px, 18vh, 200px) 0 clamp(60px, 10vh, 120px); }
.ah-jhero__glow {
  position: absolute; right: -15vw; top: -10vw; z-index: -1;
  width: 70vw; height: 70vw; max-width: 1100px; max-height: 1100px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(200, 16, 46, .32), rgba(255, 90, 42, .08) 55%, transparent);
  filter: blur(30px); pointer-events: none;
}
.ah-jhero > .ah-grain { z-index: 0; }
.ah-jhero .ah-wrap { position: relative; z-index: 1; }
.ah-jhero__top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px 60px; }
.ah-jhero__title { margin: 0; display: flex; align-items: flex-start; gap: .12em; line-height: .82; }
.ah-jhero__the {
  font-family: var(--ah-serif); font-style: italic; font-weight: 400;
  font-size: clamp(2rem, 4.4vw, 5rem); color: var(--ah-blush); letter-spacing: -.02em;
  margin-top: .3em;
}
.ah-jhero__word {
  display: inline-flex; overflow: hidden; padding-bottom: .06em;
  font-family: var(--ah-display); font-variation-settings: "opsz" 96;
  font-weight: 750; font-size: clamp(4.6rem, 15.5vw, 17.5rem); letter-spacing: -.065em;
}
.ah-jhero__word .ah-char { display: inline-block; will-change: transform; }
.ah-jhero__lead { max-width: 24rem; padding-bottom: 1.2em; font-size: 16px; line-height: 1.7; color: var(--ah-muted); }

/* ---------- Cover story ---------- */
.ah-cover {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: clamp(36px, 6vw, 110px); align-items: center;
  margin-top: clamp(36px, 6vh, 72px); padding-top: clamp(36px, 6vh, 64px);
  border-top: 1px solid var(--ah-line);
}
.ah-cover__kicker { display: flex; align-items: center; gap: 16px; font-size: 12px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--ah-muted); }
.ah-cover__issue {
  font-family: var(--ah-display); font-weight: 800; font-size: 44px; letter-spacing: -.04em; line-height: 1;
  color: transparent; -webkit-text-stroke: 1px var(--ah-ember);
}
.ah-cover__title {
  margin: 22px 0 0;
  font-family: var(--ah-display); font-variation-settings: "opsz" 96;
  font-weight: 600; font-size: clamp(2.3rem, 4.4vw, 5rem);
  line-height: 1; letter-spacing: -.05em;
}
.ah-cover__title a {
  background: linear-gradient(90deg, var(--ah-ember), var(--ah-gold)) left 92% / 0% 3px no-repeat;
  transition: background-size .9s var(--ah-ease);
}
.ah-cover__title a:hover { background-size: 100% 3px; }
.ah-cover__title em { font-family: var(--ah-serif); font-style: italic; font-weight: 400; color: var(--ah-ember); letter-spacing: -.02em; }
.ah-cover__excerpt { max-width: 36rem; margin-top: 22px; font-size: 17px; line-height: 1.7; color: var(--ah-muted); }
.ah-cover__meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 32px; margin: 30px 0 32px; padding: 18px 0; border-block: 1px solid var(--ah-line); }
.ah-cover__facts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; font-size: 14px; color: var(--ah-muted); }
.ah-cover__cat { padding: 6px 12px; border-radius: 999px; background: var(--ah-ember); color: var(--ah-ink); font-size: 12px; font-weight: 700; }
.ah-cover__media { position: relative; max-width: 560px; width: 100%; justify-self: end; }
.ah-cover__img { margin: 0; aspect-ratio: 4 / 5; border-radius: 999px 999px var(--ah-radius-lg) var(--ah-radius-lg); }
.ah-cover__img img { position: absolute; left: 0; top: -7%; height: 114%; will-change: transform; }
.ah-cover__badge { left: -56px; top: 14%; }
.ah-cover__badge .ah-badge__core { font-family: var(--ah-display); font-size: 15px; font-weight: 800; letter-spacing: -.02em; }

.ah-author { display: flex; align-items: center; gap: 12px; }
.ah-author img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; border: 2px solid var(--ah-ember); flex: none; }
.ah-author span { display: grid; font-size: 13px; color: var(--ah-muted); }
.ah-author strong { font-size: 15px; color: var(--ah-text); }
.ah-author--sm img { width: 28px; height: 28px; border-width: 1.5px; }
.ah-author--sm strong { font-size: 13px; font-weight: 600; color: var(--ah-muted); }

/* ---------- Tools: filters + search ---------- */
.ah-posts-sec { z-index: 1; padding: clamp(40px, 7vh, 80px) 0 clamp(80px, 12vh, 140px); }
.ah-jcount b { color: var(--ah-text); font-variant-numeric: tabular-nums; }
.ah-jtools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; margin-top: clamp(32px, 5vh, 48px); }
.ah-jtools__cats { display: flex; flex-wrap: wrap; gap: 8px; }
.ah-search {
  position: relative; display: flex; align-items: center; gap: 10px;
  width: clamp(240px, 26vw, 380px); height: 48px; padding: 0 12px 0 16px;
  border-radius: 999px; border: 1px solid var(--ah-line); background: rgba(255, 255, 255, .03);
  transition: border-color .3s, background-color .3s, box-shadow .4s;
}
.ah-search:focus-within { border-color: var(--ah-ember); background: rgba(255, 90, 42, .06); box-shadow: 0 0 0 4px rgba(255, 90, 42, .12); }
.ah-search svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--ah-muted); stroke-width: 1.8; stroke-linecap: round; }
.ah-search input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: none; color: var(--ah-text); font: 500 15px var(--ah-sans); }
.ah-search input::placeholder { color: rgba(247, 239, 233, .4); }
.ah-search input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }
.ah-search kbd { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--ah-line); font: 700 12px var(--ah-sans); color: var(--ah-muted); }
.ah-search:focus-within kbd { opacity: 0; }

/* ---------- Post grid ---------- */
.ah-pgrid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: clamp(20px, 2.4vw, 36px); row-gap: clamp(44px, 7vh, 72px);
  margin-top: clamp(36px, 6vh, 56px); align-items: start;
}
.ah-pcard.is-hidden { display: none; }
.ah-pcard__link { position: relative; display: block; }
.ah-pcard__media { aspect-ratio: 3 / 2; border-radius: 22px; }
.ah-pcard__media img { position: absolute; left: 0; top: -6%; height: 112%; transition: filter .8s var(--ah-ease), scale 1.2s var(--ah-ease); }
.ah-pcard__media::before { transition: opacity .8s var(--ah-ease); }
.ah-pcard__time {
  position: absolute; left: 14px; top: 14px; z-index: 3;
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: rgba(7, 6, 10, .55);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.ah-pcard__time svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ah-pcard__time circle { fill: none; stroke-width: 2.5; }
.ah-pcard__time circle:first-child { stroke: rgba(255, 255, 255, .15); }
.ah-pcard__time circle:last-child { stroke: var(--ah-ember); stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--m, .5)); }
.ah-pcard__time b { position: relative; font-size: 13px; font-weight: 800; }
.ah-pcard__body { padding-top: 20px; }
.ah-pcard__meta { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--ah-muted); }
.ah-pcard__cat { font-size: 11px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--ah-gold); }
.ah-pcard__title {
  margin: 12px 0 0;
  font-family: var(--ah-display); font-weight: 600;
  font-size: clamp(1.3rem, 1.65vw, 1.7rem); line-height: 1.18; letter-spacing: -.035em;
}
.ah-pcard__title span {
  background: linear-gradient(90deg, var(--ah-ember), var(--ah-gold)) left 100% / 0% 2px no-repeat;
  transition: background-size .8s var(--ah-ease);
}
.ah-pcard__excerpt {
  margin-top: 10px; font-size: 15px; line-height: 1.6; color: var(--ah-muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ah-pcard .ah-author { margin-top: 16px; }
@media (hover: hover) {
  .ah-pcard__link:hover .ah-pcard__media::before { opacity: 0; }
  .ah-pcard__link:hover .ah-pcard__media img { filter: none; scale: 1.05; }
  .ah-pcard__link:hover .ah-pcard__title span { background-size: 100% 2px; }
}
.ah-pcard__link:focus-visible { outline: none; }
.ah-pcard__link:focus-visible .ah-pcard__media { outline: 2px solid var(--ah-gold); outline-offset: 4px; }

/* feature card: every 5th visible post spans two columns, side-by-side layout */
.ah-pcard:nth-child(5n + 1 of .ah-pcard:not(.is-hidden)) { grid-column: span 2; }
.ah-pcard:nth-child(5n + 1 of .ah-pcard:not(.is-hidden)) .ah-pcard__link {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(24px, 3vw, 44px); align-items: center;
}
.ah-pcard:nth-child(5n + 1 of .ah-pcard:not(.is-hidden)) .ah-pcard__media { aspect-ratio: 4 / 3; }
.ah-pcard:nth-child(5n + 1 of .ah-pcard:not(.is-hidden)) .ah-pcard__body { padding-top: 0; }
.ah-pcard:nth-child(5n + 1 of .ah-pcard:not(.is-hidden)) .ah-pcard__title { font-size: clamp(1.8rem, 2.8vw, 3rem); line-height: 1.05; letter-spacing: -.045em; }
.ah-pcard:nth-child(5n + 1 of .ah-pcard:not(.is-hidden)) .ah-pcard__excerpt { -webkit-line-clamp: 4; font-size: 16px; }

.ah-jempty { margin-top: 60px; text-align: center; font-size: 18px; color: var(--ah-muted); }
.ah-jempty[hidden] { display: none; }
.ah-jempty strong { color: var(--ah-text); }
.ah-jempty .ah-link { margin-top: 16px; }

.ah-jmore { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: clamp(48px, 8vh, 80px); }
.ah-jmore[hidden] { display: none; }
.ah-jmore__bar { width: 200px; height: 2px; border-radius: 2px; background: var(--ah-line); overflow: hidden; }
.ah-jmore__bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--ah-crimson), var(--ah-ember), var(--ah-gold)); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform .8s var(--ah-ease); }

/* ---------- Most read ---------- */
.ah-mostread { z-index: 1; padding: clamp(40px, 7vh, 80px) 0 clamp(80px, 12vh, 140px); }
.ah-mostread__grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(32px, 6vw, 120px); align-items: start; margin-top: clamp(40px, 7vh, 72px); }
.ah-mostread__list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ah-line); }
.ah-mostread__list a {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; align-items: center; gap: 20px;
  padding: 22px 0; border-bottom: 1px solid var(--ah-line);
}
.ah-mostread__num {
  font-family: var(--ah-display); font-weight: 800; font-size: clamp(2.6rem, 4vw, 3.8rem); line-height: 1; letter-spacing: -.05em;
  color: transparent; -webkit-text-stroke: 1px rgba(255, 197, 143, .4);
  transition: color .5s, -webkit-text-stroke-color .5s;
}
.ah-mostread__title { font-family: var(--ah-display); font-size: clamp(1.15rem, 1.6vw, 1.55rem); font-weight: 600; letter-spacing: -.03em; line-height: 1.25; transition: transform .7s var(--ah-ease), color .4s; }
.ah-mostread__reads { font-size: 13px; color: var(--ah-muted); white-space: nowrap; }
@media (hover: hover) {
  .ah-mostread__list a:hover .ah-mostread__num { color: var(--ah-ember); -webkit-text-stroke-color: var(--ah-ember); }
  .ah-mostread__list a:hover .ah-mostread__title { transform: translateX(8px); color: var(--ah-blush); }
}

/* ---------- Newsletter ---------- */
.ah-jnews { z-index: 1; padding: 0 0 clamp(100px, 16vh, 180px); }
.ah-jnews__card {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: center;
  gap: clamp(28px, 5vw, 80px);
  padding: clamp(28px, 5vw, 72px);
  border-radius: var(--ah-radius-lg); border: 1px solid rgba(255, 90, 42, .3);
  background:
    radial-gradient(60% 120% at 100% 0%, rgba(255, 90, 42, .24), transparent 60%),
    radial-gradient(50% 100% at 0% 100%, rgba(200, 16, 46, .18), transparent 60%),
    rgba(255, 255, 255, .02);
}
.ah-jnews__title { margin: 14px 0 0; font-family: var(--ah-display); font-weight: 600; font-size: clamp(2rem, 4vw, 4.2rem); line-height: 1; letter-spacing: -.05em; }
.ah-jnews__title em { font-family: var(--ah-serif); font-style: italic; font-weight: 400; color: var(--ah-blush); }
.ah-jnews__text { margin-top: 16px; max-width: 30rem; font-size: 16px; line-height: 1.65; color: var(--ah-muted); }
.ah-jnews__form { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.ah-jnews__form input {
  flex: 1 1 240px; min-width: 0; height: 58px; padding: 0 24px;
  border-radius: 999px; border: 1px solid var(--ah-line); background: rgba(7, 6, 10, .5);
  color: var(--ah-text); font: 500 17px var(--ah-sans); outline: none;
  transition: border-color .3s, box-shadow .4s;
}
.ah-jnews__form input:focus { border-color: var(--ah-ember); box-shadow: 0 0 0 4px rgba(255, 90, 42, .15); }
.ah-jnews__form input::placeholder { color: rgba(247, 239, 233, .35); }
.ah-jnews__msg { flex-basis: 100%; min-height: 1.4em; padding-left: 24px; font-size: 14px; color: var(--ah-muted); }
.ah-jnews__card.is-error input { border-color: #ff5b4f; }
.ah-jnews__card.is-error .ah-jnews__msg { color: #ff8a7a; }
.ah-jnews__card.is-done .ah-jnews__msg { color: var(--ah-gold); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .ah-pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ah-cover { grid-template-columns: 1fr; }
  .ah-cover__media { justify-self: center; max-width: 460px; }
  .ah-mostread__grid { grid-template-columns: 1fr; }
  .ah-jnews__card { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .ah-pgrid { grid-template-columns: 1fr; }
  .ah-pcard:nth-child(5n + 1 of .ah-pcard:not(.is-hidden)) { grid-column: auto; }
  .ah-pcard:nth-child(5n + 1 of .ah-pcard:not(.is-hidden)) .ah-pcard__link { display: block; }
  .ah-pcard:nth-child(5n + 1 of .ah-pcard:not(.is-hidden)) .ah-pcard__body { padding-top: 20px; }
  .ah-search { width: 100%; }
  .ah-search kbd { display: none; }
  .ah-cover__badge { left: -12px; width: 100px; height: 100px; }
  .ah-mostread__list a { grid-template-columns: 60px minmax(0, 1fr); }
  .ah-mostread__reads { grid-column: 2; }
  .ah-head .ah-label:last-child { display: none; }
  .ah-head { grid-template-columns: auto 1fr; }
}
