/* =====================================================
   JOURNAL — blog index: featured story, year-grouped
   editorial index. Uses site.css tokens.
   ===================================================== */

*, *::before, *::after { box-sizing: border-box; }
body.page-journal {
  margin: 0;
  background: var(--site-bg);
  color: var(--site-text);
  font-family: var(--site-font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
:where(.page-journal) :is(h1, h2, h3, p, ol) { margin: 0; }
:where(.page-journal) ol { padding: 0; list-style: none; }
:where(.page-journal) img { display: block; max-width: 100%; }

.journal {
  max-width: var(--site-max);
  margin: 0 auto;
  padding: clamp(2.5rem, 5vw, 4rem) var(--site-gutter) clamp(4rem, 8vw, 6.5rem);
}

.kicker {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--site-text-3);
}
.kicker__accent {
  padding: 0.25rem 0.55rem; border-radius: 6px;
  background: var(--site-ink); color: #fff; letter-spacing: 0.1em;
}


/* ── Featured story ─────────────────────────────────── */
.feature {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4.5rem);
  padding-bottom: clamp(3rem, 6vw, 4.5rem);
  margin-bottom: clamp(3rem, 6vw, 4.5rem);
  border-bottom: 1px solid var(--site-line);
}
.feature[hidden] { display: none; }
.feature__media {
  position: relative; display: block;
  aspect-ratio: 5 / 4;
  border-radius: 18px; overflow: hidden;
  border: 1px solid var(--site-line-2);
  background: #f5f7f8;
}
.feature__media img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 30%;
  transition: transform 0.9s var(--site-ease);
}
.feature:hover .feature__media img { transform: scale(1.03); }
.feature__title {
  margin-top: 1.1rem;
  font-family: var(--site-display); font-weight: 800;
  font-size: clamp(1.45rem, 2.3vw, 1.95rem); line-height: 1.2; letter-spacing: -0.02em;
  text-wrap: balance;
}
.feature__title a { color: #233D4D; text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 2px no-repeat; transition: background-size 0.45s var(--site-ease); }
.feature__title a:hover { background-size: 100% 2px; }
.feature__excerpt { margin-top: 1.25rem; max-width: 52ch; font-size: 1.05rem; line-height: 1.75; color: var(--site-text-2); }

/* ── Index ──────────────────────────────────────────── */
.index__bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem 2rem;
  margin-bottom: clamp(1.75rem, 3vw, 2.5rem);
}
.index__title {
  font-family: var(--site-display); font-weight: 700;
  font-size: clamp(1.4rem, 2.4vw, 1.9rem); letter-spacing: -0.02em;
}
.index__empty { padding: 2rem 0; color: var(--site-text-3); }

/* Year groups: the year sticks while its entries scroll */
.year {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  border-top: 1px solid var(--site-line-2);
}
.year[hidden] { display: none; }
.year__label {
  position: sticky; top: calc(var(--site-header-h) + 1.25rem);
  align-self: start;
  padding-top: 1.6rem;
  font-family: var(--site-display); font-weight: 800;
  font-size: clamp(1.6rem, 2.6vw, 2.2rem); letter-spacing: -0.03em; line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(35,61,77,0.35);
}

.entry[hidden] { display: none; }
.entry + .entry { border-top: 1px solid var(--site-line); }
.entry__link {
  position: relative;
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) 8rem;
  align-items: start; gap: 1.5rem;
  padding: 1.6rem 0.75rem 1.6rem 0;
  color: inherit; text-decoration: none;
}
/* Hover wash slides in from the left */
.entry__link::before {
  content: ''; position: absolute; inset: 0 -1rem 0 -1rem; z-index: -1;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(254, 127, 45, 0.08), rgba(254, 127, 45, 0) 70%);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.45s var(--site-ease);
}
.entry__link:hover::before, .entry__link:focus-visible::before { transform: scaleX(1); }
.entry__link:focus-visible { outline: 2px solid var(--site-orange); outline-offset: 4px; border-radius: 8px; }
.entry__date {
  padding-top: 0.2rem;
  font-size: 0.85rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--site-text-3); font-variant-numeric: tabular-nums;
}
.entry__main { display: grid; gap: 0.45rem; }
.entry__title {
  font-family: var(--site-display); font-weight: 600;
  font-size: clamp(1.08rem, 1.7vw, 1.3rem); line-height: 1.35; color: #233D4D;
  transition: color 0.25s ease;
}
.entry__excerpt { font-size: 0.93rem; line-height: 1.65; color: var(--site-text-2); max-width: 62ch; }
.entry__meta { padding-top: 0.2rem; font-size: 0.82rem; line-height: 1.6; color: var(--site-text-3); text-align: right; }
.entry__meta span { display: block; }
.entry__link:hover .entry__title { color: var(--site-orange-ink); }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 900px) {
  .feature { grid-template-columns: 1fr; }
  .feature__media { aspect-ratio: 16 / 10; }
  .year { grid-template-columns: 1fr; }
  .year__label { position: static; padding: 1.4rem 0 0.25rem; }
}
@media (max-width: 640px) {
  .index__bar .seg { width: 100%; overflow-x: auto; }
  .index__bar .seg__btn { flex: 1 0 auto; white-space: nowrap; padding: 0.6rem 0.8rem; }
  .entry__link { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; padding-right: 0; }
  .entry__date { grid-column: 1; }
  .entry__main { grid-column: 1; }
  .entry__meta { grid-column: 1; text-align: left; }
  .entry__meta span { display: inline; }
  .entry__meta span + span::before { content: "·"; margin: 0 0.4em; }
}
@media (prefers-reduced-motion: reduce) {
  .feature__media img, .entry__link::before { transition: none; }
}

/* ── Index toolbar: heading + count, search, topic filter ── */
.index__bar {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px) auto;
  align-items: center; gap: 1rem 1.25rem;
}
.index__heading { display: flex; align-items: baseline; gap: 0.85rem; flex-wrap: wrap; }
.index__count { font-size: 0.88rem; color: var(--site-text-3); font-variant-numeric: tabular-nums; }

.search {
  position: relative; display: flex; align-items: center;
  height: 46px; padding: 0 0.75rem 0 2.5rem;
  border-radius: 12px; border: 1px solid var(--site-line-2); background: #f5f7f8;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search:focus-within { border-color: var(--site-orange); box-shadow: 0 0 0 3px rgba(254, 127, 45, 0.16); }
.search__icon { position: absolute; left: 0.95rem; font-size: 0.85rem; color: var(--site-text-3); }
.search__input {
  flex: 1; min-width: 0; height: 100%;
  border: 0; outline: 0; background: transparent;
  color: #233D4D; font: 500 0.92rem var(--site-font);
}
.search__input::placeholder { color: var(--site-text-3); }
.search__input::-webkit-search-cancel-button { filter: invert(1) opacity(0.5); }

.seg__count {
  display: inline-block; min-width: 1.3em; margin-left: 0.25rem;
  padding: 0.05rem 0.35rem; border-radius: 5px;
  background: rgba(35,61,77,0.08);
  font-size: 0.72rem; font-variant-numeric: tabular-nums; text-align: center;
}
.seg__btn[aria-selected="true"] .seg__count { background: rgba(35,61,77,0.22); }

mark { background: rgba(254, 127, 45, 0.28); color: #233D4D; border-radius: 3px; padding: 0 0.1em; }

.index__empty { padding: 2.5rem 0; border-top: 1px solid var(--site-line-2); color: var(--site-text-2); }
.index__empty p { margin: 0 0 1rem; }
.index__reset {
  height: 40px; padding: 0 1rem; border-radius: 10px;
  border: 1px solid var(--site-line-2); background: transparent; color: #233D4D;
  font: 600 0.88rem var(--site-font); cursor: pointer;
}
.index__reset:hover { border-color: var(--site-orange); color: var(--site-orange-ink); }

@media (max-width: 1100px) {
  .index__bar { grid-template-columns: minmax(0, 1fr) minmax(200px, 320px); }
  .index__bar .seg { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 640px) {
  .index__bar { grid-template-columns: 1fr; }
}
.feature .action-link { margin-top: 1.75rem; }

/* ── Featured story: stroked card lifted over the teal band ── */
.page-journal .page-hero { padding-bottom: clamp(5.5rem, 10vw, 8rem); }
.journal { padding-top: 0; }
.feature {
  position: relative; z-index: 1;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 0; align-items: stretch;
  margin-top: calc(-1 * clamp(3rem, 6vw, 4.5rem));
  margin-bottom: clamp(3rem, 6vw, 4.5rem);
  padding: 0;
  background: #fff;
  border: var(--site-stroke); border-radius: var(--radius-card, 14px);
  overflow: hidden;
  transition: transform 0.25s var(--site-ease), box-shadow 0.25s var(--site-ease);
}
.feature:hover { transform: translate(-3px, -3px); box-shadow: 5px 5px 0 var(--site-orange); }
.journal .feature__media, .journal a.feature__media:hover {
  aspect-ratio: auto; min-height: 360px;
  border: 0 !important; border-radius: 0 !important;
  border-right: var(--site-stroke) !important;
  transform: none !important; box-shadow: none !important;
}
.feature__media img { position: absolute; inset: 0; object-position: center top; }
.feature__media::after { content: none; }
.feature:hover .feature__media img { transform: none; }
.feature__body {
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: clamp(1.75rem, 3.5vw, 3rem);
}
.feature__title { margin-top: 1rem; text-wrap: pretty; }
.feature__title a:hover { background-size: 0 2px; color: var(--site-orange-ink); }
.feature__excerpt { margin-top: 1rem; }
.feature .action-link { margin-top: 1.5rem; }
.feature[hidden] + .index { padding-top: clamp(2.5rem, 5vw, 3.5rem); }
.kicker__accent { font-size: inherit; }
@media (max-width: 1100px) {
  .feature { grid-template-columns: 1fr; }
  .journal .feature__media, .journal a.feature__media:hover {
    aspect-ratio: 1400 / 948; min-height: 0;
    border-right: 0 !important; border-bottom: var(--site-stroke) !important;
  }
}


/* Feature title: two even lines; the excerpt takes exactly the title's width */
.feature__body { container-type: inline-size; }
.feature__text { display: grid; width: fit-content; max-width: 100%; margin-top: 1rem; }
.feature .feature__title {
  margin-top: 0;
  font-size: min(1.9rem, 5.05cqi) !important; font-weight: 700;
  line-height: 1.28; letter-spacing: -0.015em;
}
.feature__title span { display: block; white-space: nowrap; }
.feature__title a:hover { background-size: 0 2px; }
.feature__text .feature__excerpt { width: 0; min-width: 100%; max-width: none; }
@media (max-width: 560px) {
  .feature .feature__title { font-size: var(--fs-20) !important; }
  .feature__title span { display: inline; white-space: normal; }
}

.feature__media { background: #fff; }

/* Every article carries its full date, so years are not grouped */
.year { display: block; }
.year + .year { border-top: 1px solid var(--site-line); }
.entry__date { white-space: nowrap; }

/* Blog hero matches Experience: full band, featured article sits below it */
.page-journal .page-hero { padding-bottom: clamp(3rem, 6vw, 4.5rem); }
.feature { margin-top: clamp(2.5rem, 5vw, 3.5rem); }

/* Featured article uses the About layout: full-width split, picture panel beside a grey text panel */
.journal .feature {
  width: 100%; margin: 0 0 clamp(3rem, 6vw, 4.5rem);
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  background: #f0f2f3;
  border: 0 !important; border-radius: 0 !important;
}
.journal .feature__media, .journal a.feature__media:hover {
  min-height: 480px; background: #fff;
  border: 0 !important; border-radius: 0 !important;
}
.journal .feature__media img { object-position: center top; }
.journal .feature__body { padding: clamp(2.5rem, 5vw, 4.25rem) clamp(1.5rem, 4.5vw, 4rem); }
.journal .feature__text { width: 100%; }
.journal .feature .feature__title {
  font-size: var(--fs-30) !important; font-weight: 800; line-height: 1.15;
  letter-spacing: -0.015em; text-transform: uppercase;
}
.journal .feature__title span { display: inline; white-space: normal; }
.journal .feature__text .feature__excerpt { width: auto; min-width: 0; max-width: 64ch; }
@media (max-width: 1100px) {
  .journal .feature { grid-template-columns: 1fr; }
  .journal .feature__media, .journal a.feature__media:hover { min-height: 0; aspect-ratio: 1400 / 948; }
}

/* The page wrapper is full width so the feature can bleed; the article index keeps the page margins */
.journal { max-width: none; padding-left: 0; padding-right: 0; }
.journal .index { max-width: var(--site-max); margin: 0 auto; padding: 0 var(--site-gutter); }
