/* ─────────────────────────────────────────────
   Journal index — editorial contents page.
   Loads: tokens, base, components, this file.
   ───────────────────────────────────────────── */

/* ── Shared beat wrappers (not in components.css) ── */
.beat                { padding-block: calc(var(--space-7) * 1.1); }
.beat.ground-cream   { padding-block: var(--space-7); }
.beat--paper         { background: var(--paper); }

/* ── Hero ───────────────────────────────────── */
.ji-hero {
  padding-block: var(--space-6) var(--space-5);
  text-align: center;
}
.ji-hero__inner {
  max-width: 52rem;
  margin-inline: auto;
}

/* Section label */
.ji-hero__label {
  letter-spacing: 0.25em;
  font-variant-caps: small-caps;
  display: block;
  opacity: 0.65;
}

/* Drawn hairline — 0 → 120px each arm on scroll-in */
.ji-hero__hairline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  margin-top: var(--space-2);
  height: 14px;
}
.ji-hero__hairline-arm {
  height: 1px;
  background: var(--rule);
  width: 0;
  flex-shrink: 0;
  transition: width 700ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
.ji-hero__hairline.is-drawn .ji-hero__hairline-arm {
  width: 120px;
}
.ji-hero__diamond {
  color: var(--accent-40);
  font-size: 0.65em;
  flex-shrink: 0;
  line-height: 1;
}
@media (prefers-reduced-motion: reduce) {
  .ji-hero__hairline-arm {
    transition: none;
    width: 120px;
  }
}

/* H1 display headline */
.ji-hero__title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: var(--fs-display);
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: var(--space-4) 0 var(--space-3);
}
.ji-hero__dek {
  font-family: var(--font-serif);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--ink);
  opacity: 0.72;
  max-width: 52ch;
  margin-inline: auto;
}

/* ── Common entry elements ──────────────────── */
.ji-entry__index {
  font-family: var(--font-label);
  font-size: 0.85rem;
  letter-spacing: 0.25em;
  font-variant-caps: small-caps;
  color: var(--ink-muted);
  display: block;
  line-height: 1;
  margin-bottom: var(--space-1);
}
.ji-entry__kicker {
  letter-spacing: 0.18em;
  opacity: 0.6;
  display: block;
  margin-bottom: var(--space-2);
}
.ji-entry__excerpt {
  font-family: var(--font-serif);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--ink);
  opacity: 0.82;
}
.ji-entry__date {
  display: block;
  letter-spacing: 0.18em;
  color: var(--ink-muted);
}

/* Read-story affordance — underline draw + arrow slide.
   Mirrors about-teaser__cta / journal__more-link pattern.
   Sits inside the wrapping <a> as a <span> — not a nested link. */
.ji-entry__readmore {
  position: relative;
  display: inline-block;
  font-family: var(--font-serif);
  font-size: var(--fs-body);
  color: var(--ink);
  margin-top: var(--space-3);
  background-image: linear-gradient(var(--accent-40), var(--accent-40));
  background-repeat: no-repeat;
  background-position: 0 calc(100% + 2px);
  background-size: 100% 1px;
}
.ji-entry__readmore::before {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 400ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
.ji-entry__readmore::after {
  content: ' \2192';
  display: inline-block;
  transition: transform 400ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
@media (hover: hover) and (pointer: fine) {
  .ji-featured__link:hover .ji-entry__readmore::before { width: 100%; }
  .ji-featured__link:hover .ji-entry__readmore::after  { transform: translateX(6px); }
}
@media (prefers-reduced-motion: reduce) {
  .ji-entry__readmore::before,
  .ji-entry__readmore::after { transition: none; }
}

/* ── Featured entry (editorial spread) ─────── */
.ji-featured {
  padding-block: var(--space-5) var(--space-6);
  border-top: 1px solid var(--rule);
}
.ji-featured__link {
  display: block;
  text-decoration: none;
  color: inherit;
  background-image: none;
}
/* base.css a:hover: override on card link to stop it bleeding to all children. */
.ji-featured__link:hover,
.ji-featured__link:active {
  text-decoration: none;
  background-image: none;
}
/* Title only: underline draws on card hover — desktop pointer only. */
@media (hover: hover) and (pointer: fine) {
  .ji-featured__link:hover .ji-featured__title {
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 0.2em;
    text-decoration-thickness: 1px;
  }
}
/* Excerpt, date, kicker, index: never underlined in any state. */
.ji-featured__text .ji-entry__excerpt,
.ji-featured__text .ji-entry__date,
.ji-featured__text .ji-entry__kicker,
.ji-featured__text .ji-entry__index {
  text-decoration: none;
}
.ji-featured__grid {
  display: grid;
  grid-template-columns: 55fr 45fr;
  gap: clamp(var(--space-4), 5vw, var(--space-6));
  align-items: center;
}
.ji-featured__image-wrap {
  border-radius: var(--radius);
}
.ji-featured__image {
  width: 100%;
  display: block;
  object-fit: cover;
  border-radius: var(--radius);
}
.ji-featured__text {
  display: flex;
  flex-direction: column;
}
.ji-featured__title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: var(--fs-h1);
  line-height: 1.15;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: var(--space-1) 0 var(--space-3);
}
@media (max-width: 760px) {
  .ji-featured__grid      { grid-template-columns: 1fr; }
  .ji-featured__title     { font-size: var(--fs-h2); }
}

/* ── Entry list (hairline-separated rows) ───── */
.ji-list {
  padding-bottom: var(--space-6);
}
.ji-row {
  display: block;
  text-decoration: none;
  color: inherit;
  padding-block: var(--space-4);
  border-top: 1px solid var(--rule);
  transition: none;
  background-image: none;
}
/* Suppress base.css a:hover underline from bleeding into row children */
.ji-row:hover,
.ji-row:active {
  text-decoration: none;
  background-image: none;
}
.ji-row .ji-entry__excerpt,
.ji-row .ji-entry__date,
.ji-row .ji-entry__kicker {
  text-decoration: none;
}
.ji-row:last-child {
  border-bottom: 1px solid var(--rule);
}
.ji-row__inner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3) var(--space-4);
  align-items: center;
}
.ji-row__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.ji-row__title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: var(--fs-h3);
  line-height: 1.25;
  color: var(--ink);
}
/* Thumbnail: only shown on hover-capable desktops */
.ji-row__thumb {
  display: none;
  margin: 0;
}
@media (hover: hover) and (pointer: fine) {
  .ji-row__inner {
    grid-template-columns: auto 1fr auto;
  }
  .ji-row__thumb {
    display: block;
    width: 80px;
    border-radius: var(--radius);
    overflow: hidden;
    flex-shrink: 0;
  }
  .ji-row__thumb img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    display: block;
    transition: transform 700ms cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform;
  }
  .ji-row:hover .ji-row__thumb img {
    transform: scale(1.05);
  }
  .ji-row:hover .ji-row__title {
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 0.25em;
    text-decoration-thickness: 1px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ji-row__thumb img { transition: none; }
  .ji-row:hover .ji-row__thumb img { transform: none; }
}

/* ── Closing CTA ─────────────────────────────
   Duplicated from home.css / portfolio.css since
   journal/index.html doesn't load either. */
.beat--close-hero {
  padding-block: 11rem;
}
.close-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 52rem;
  margin-inline: auto;
  text-align: center;
}
.close-hero__kicker {
  font-family: var(--font-label);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.5;
  margin-bottom: var(--space-4);
}
.close-hero__keyline {
  width: 60%;
  height: 1px;
  background: var(--rule);
}
.close-hero__keyline--top    { margin-bottom: var(--space-5); }
.close-hero__keyline--bottom { margin-top: var(--space-5); margin-bottom: var(--space-4); }
.close-hero__container {
  padding: var(--space-4) var(--space-5);
  background:
    linear-gradient(var(--accent-40), var(--accent-40)) top    left  / 1px  12px no-repeat,
    linear-gradient(var(--accent-40), var(--accent-40)) top    left  / 12px 1px  no-repeat,
    linear-gradient(var(--accent-40), var(--accent-40)) bottom right / 1px  12px no-repeat,
    linear-gradient(var(--accent-40), var(--accent-40)) bottom right / 12px 1px  no-repeat;
}
.close-hero__line {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.5rem, 2vw + 0.75rem, 2.4rem);
  font-weight: 400;
  line-height: 1.3;
  max-width: 34ch;
  color: var(--ink);
  margin: 0;
}
.close__cta {
  display: inline-block;
  padding: 1rem 2.5rem;
  border: 1px solid var(--ink-muted);
  border-radius: 999px;
  color: var(--ink);
  font-family: var(--font-label);
  font-size: var(--fs-label);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  text-decoration: none;
  transition: background-color 400ms ease, color 400ms ease, border-color 400ms ease;
  background-image: none;
}
.close__cta:hover,
.close__cta:active {
  background-color: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
  text-decoration: none;
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 760px) {
  .ji-hero__title          { font-size: var(--fs-h1); }
  .beat--close-hero        { padding-block: 6rem; }
  .close-hero__keyline     { width: 80%; }
  .close-hero__line        { font-size: var(--fs-h3); }
  .close-hero__container   { padding: var(--space-3); }
}

@media (prefers-reduced-motion: reduce) {
  .close__cta { transition: none; }
}

/* ── Section alternation: B / R / B / R ────────────────────────── */
/* ji-hero uses background-color longhand so mgx-ground-oxblood texture survives */
.ji-hero          { background-color: var(--mgx-oxblood); }
.ji-featured      { background: var(--surface); }
.ji-list          { background: var(--paper); }
.beat--close-hero { background: var(--surface); }

/* ═══════════════════════════════════════════════════════════════════════
   MARGAUX: Polaroid index cards (journal entry list)
   ═══════════════════════════════════════════════════════════════════════ */

.ji-polaroid-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  padding-block: var(--space-4) var(--space-5);
  justify-content: center;
}

.ji-polaroid {
  display: block;
  text-decoration: none;
  color: inherit;
  background-image: none;
  width: 260px;
  flex-shrink: 0;
}
.ji-polaroid:hover,
.ji-polaroid:active {
  text-decoration: none;
  background-image: none;
}

/* Polaroid frame: white/parchment thick border, heavy bottom strip */
.ji-polaroid__frame {
  background: var(--mgx-parchment);
  padding: 8px 8px 40px;
  margin: 0;
  box-shadow:
    0 4px 20px color-mix(in srgb, var(--mgx-ink) 18%, transparent),
    0 1px 5px  color-mix(in srgb, var(--mgx-ink) 8%, transparent);
  transform: rotate(-2deg);
  transform-origin: center bottom;
  transition: transform 350ms cubic-bezier(0.22, 0.61, 0.36, 1),
              box-shadow 350ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
@media (hover: hover) and (pointer: fine) {
  .ji-polaroid:hover .ji-polaroid__frame {
    transform: rotate(0deg) scale(1.03);
    box-shadow:
      0 8px 28px color-mix(in srgb, var(--mgx-ink) 22%, transparent),
      0 2px 8px  color-mix(in srgb, var(--mgx-ink) 10%, transparent);
  }
}

.ji-polaroid__photo img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

/* Polaroid bottom strip — handwritten caption area */
.ji-polaroid__foot {
  padding: var(--space-2) var(--space-1) 0;
}
.ji-polaroid__foot .ji-entry__kicker {
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  opacity: 0.55;
  margin-bottom: 0.3em;
}
.ji-polaroid__title {
  font-family: var(--mgx-font-script);
  font-size: 1.1rem;
  line-height: 1.35;
  color: var(--mgx-ink);
  margin: 0 0 0.4em;
}
.ji-polaroid__foot .ji-entry__date {
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  opacity: 0.5;
  display: block;
}

/* Touch: static spread state, no rotation on hover */
@media (hover: none) {
  .ji-polaroid__frame { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ji-polaroid__frame {
    transform: none;
    transition: none;
  }
  .ji-polaroid:hover .ji-polaroid__frame {
    transform: none;
    box-shadow:
      0 4px 20px color-mix(in srgb, var(--mgx-ink) 18%, transparent),
      0 1px 5px  color-mix(in srgb, var(--mgx-ink) 8%, transparent);
  }
}

@media (max-width: 760px) {
  .ji-polaroid-grid { gap: var(--space-4); }
  .ji-polaroid { width: min(220px, 80vw); }
}

/* ── Gallery vignette on featured entry image ───────────────────── */
.ji-featured .img-hover {
  position: relative;
}
.ji-featured .img-hover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(22,18,16,0.13) 100%);
  pointer-events: none;
  z-index: 1;
}
