/* Hành trình archive (/hanh-trinh/**). Loaded after style.css, which supplies the tokens, the brocade grounds,
   the glass navigation, buttons, the lightbox and the phone action bar. The pages themselves are generated
   (content/journal/tools/build_site.py); this file and js/journal.js are written by hand.
   Markup: .entry[data-entry-id] holds one post (date, themes, caption, .entry__photos > a.jphoto[data-jphoto-id]);
   .jgroup[data-jgroup] is a month or a year of entries; .hl[data-entry-id] is a compact card on the overview.
   Any entry or photo may be deleted from the HTML before it is served: empty groups, photo sets and their jump
   links hide themselves here with :has(), and js/journal.js does the same for older browsers. */

.jr-body { min-height: 100vh; }

/* ---------- page opening ---------- */
.jr-hero { padding: clamp(128px, 19vh, 180px) 0 clamp(20px, 4vh, 40px); }
.jr-crumb { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; color: var(--gold-deep); text-decoration: none; }
.jr-crumb::after { content: ""; width: 28px; height: 1px; margin-left: 12px; background: currentColor; }
.jr-hero h1 { font-size: clamp(40px, 6.4vw, 96px); letter-spacing: -.045em; }
.jr-hero--year h1 { font-size: clamp(84px, 17vw, 240px); line-height: 1; letter-spacing: -.06em; margin-left: -.04em; font-variant-numeric: tabular-nums; }
.jr-lead { max-width: 40em; margin-top: 14px; font-size: clamp(17px, 1.45vw, 20px); font-weight: 500; color: var(--ink-soft); }
.js .jr-hero .wrap > * { opacity: 0; transform: translateY(22px); animation: jr-in 1.1s var(--ease) forwards; }
.js .jr-hero .wrap > :nth-child(2) { animation-delay: .08s; }
.js .jr-hero .wrap > :nth-child(3) { animation-delay: .16s; }
@keyframes jr-in { to { opacity: 1; transform: none; } }

/* ---------- year and theme switcher: sticks under the header (ordinary navigation) ---------- */
.jr-bar { position: sticky; top: 82px; z-index: 40; padding-inline: var(--pad); margin-bottom: clamp(20px, 4vh, 44px); pointer-events: none; }
.jr-bar__in {
  pointer-events: auto; display: flex; align-items: center; gap: 4px; width: fit-content; max-width: min(100%, 1248px); margin-inline: auto; padding: 4px;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; border-radius: var(--r-pill);
  background: rgba(251, 248, 241, .66); border: 1px solid rgba(255, 255, 255, .6);
  -webkit-backdrop-filter: blur(22px) saturate(1.7); backdrop-filter: blur(22px) saturate(1.7);
  box-shadow: 0 0 0 1px rgba(33, 28, 21, .05), 0 18px 44px -28px rgba(33, 28, 21, .34);
}
.jr-bar__in::-webkit-scrollbar { display: none; }
.jr-pill { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 15px; border-radius: var(--r-pill); font-size: 14.5px; font-weight: 600; white-space: nowrap; text-decoration: none; transition: background-color .4s, color .4s; }
@media (hover: hover) { .jr-pill:hover { background: rgba(33, 28, 21, .07); } }
.jr-pill[aria-current] { background: var(--ink) var(--tex-ink) 50% 50% / 600px; color: var(--ivory); }
.jr-bar__label { flex: none; padding: 0 6px 0 14px; font-size: 13.5px; font-weight: 500; color: var(--ink-soft); white-space: nowrap; }

/* ---------- sections and headings ---------- */
.jr-sec { padding-block: clamp(48px, 8vh, 96px); }
.jr-h2 { font-size: clamp(30px, 3.8vw, 56px); margin-bottom: clamp(18px, 3vh, 32px); }
.jr-list { padding-bottom: clamp(56px, 9vh, 110px); }
.jr-jump { display: flex; flex-wrap: wrap; gap: 0 22px; margin-bottom: 4px; }
.jr-jump a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; color: var(--gold-deep); text-underline-offset: 5px; text-decoration-thickness: 1px; }
.jgroup { scroll-margin-top: 172px; }
.jgroup + .jgroup { margin-top: clamp(36px, 6vh, 72px); }
.jgroup__title { padding-bottom: 14px; font-size: clamp(26px, 3vw, 44px); font-weight: 600; line-height: 1.2; letter-spacing: -.03em; }
.jr-empty { display: none; padding: 40px 0; font-size: 19px; font-weight: 500; }

/* ---------- one entry ---------- */
.entry { display: grid; grid-template-columns: minmax(0, 210px) minmax(0, 1fr); align-items: start; gap: 12px clamp(24px, 4vw, 64px); padding: clamp(22px, 3.4vh, 34px) 0; border-top: 1px solid var(--hair); scroll-margin-top: 172px; }
.entry__date { font-size: 17px; font-weight: 600; line-height: 1.5; letter-spacing: 0; }
.entry__tags { display: flex; flex-wrap: wrap; gap: 0 14px; margin-top: 2px; }
.entry__tags a { display: inline-flex; align-items: center; min-height: 44px; font-size: 13.5px; font-weight: 600; color: var(--gold-deep); text-decoration: none; }
@media (hover: hover) { .entry__tags a:hover { text-decoration: underline; text-underline-offset: 4px; } }
.entry__body { display: grid; gap: 16px; min-width: 0; }
.entry__text { max-width: 44em; overflow-wrap: anywhere; }
.entry__text p + p { margin-top: .7em; }
/* past promotions are history: every one says so, with its year */
.entry__ended { justify-self: start; padding-left: 12px; border-left: 2px solid var(--gold); font-size: 14.5px; font-weight: 700; color: var(--gold-deep); }
span.entry__ended { display: inline-block; margin-left: 10px; }
/* photo set: rows of equal height; each tile is as wide as its photo, stretched a little to fill the row */
.entry__photos { display: flex; flex-wrap: wrap; gap: 8px; --ph: 190px; }
.entry__photos::after { content: ""; flex: 100 1 0; }
.jphoto { flex: var(--ar, 1) 1 calc(var(--ph) * var(--ar, 1)); height: var(--ph); max-width: min(100%, calc(var(--ph) * var(--ar, 1) * 1.45)); border-radius: var(--r-s); overflow: hidden; background: #E9DDD3; cursor: zoom-in; }
.jphoto img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
@media (hover: hover) { .jphoto:hover img { transform: scale(1.05); } }
.entry:target .entry__date { color: var(--gold-deep); }
.entry:target { border-top-color: var(--gold); }
.js .entry, .js .hl, .js .mile-row { opacity: 0; transform: translateY(18px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.js .entry.is-in, .js .hl.is-in, .js .mile-row.is-in { opacity: 1; transform: none; }

/* ---------- overview: milestones ---------- */
.miles { border-bottom: 1px solid var(--hair); }
.mile-row { display: grid; grid-template-columns: minmax(0, 210px) minmax(0, 1fr); gap: 4px clamp(24px, 4vw, 64px); padding: 15px 0; border-top: 1px solid var(--hair); }
.mile-row__date { font-weight: 600; color: var(--gold-deep); font-variant-numeric: tabular-nums; }
.mile-row__body p { max-width: 46em; }
.mile-row__links { display: flex; flex-wrap: wrap; gap: 0 18px; }
.mile-row__links a { display: inline-flex; align-items: center; min-height: 40px; font-size: 14.5px; font-weight: 600; text-underline-offset: 4px; text-decoration-thickness: 1px; }

/* ---------- overview: events and community, on the dark song hỷ ground ---------- */
.jr-dark { padding-top: clamp(64px, 10vh, 120px); background: var(--ink) var(--tex-ink) 0 0 / var(--tex-size); color: var(--ivory); }
.jr-dark .jr-h2 { color: var(--gold-light); margin-bottom: 10px; }
.jr-dark .jr-lead { margin: 0 0 clamp(24px, 4vh, 40px); color: rgba(251, 248, 241, .82); }
.jr-dark .entry { border-top-color: var(--hair-light); }
.jr-dark .entry__tags a, .jr-dark .entry__ended { color: var(--gold-light); }
.jr-dark .jphoto { background: #3A3023; }
.jr-more { padding-top: clamp(20px, 3vh, 32px); border-top: 1px solid var(--hair-light); }

/* ---------- overview: highlights as cards ---------- */
.hls { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: clamp(22px, 2.6vw, 36px) clamp(16px, 2vw, 28px); }
.hl { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.hl__photo { display: block; aspect-ratio: 4 / 3; border-radius: var(--r-m); overflow: hidden; background: #E9DDD3; }
.hl__photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; transition: transform 1.2s var(--ease); }
@media (hover: hover) { .hl:hover .hl__photo img { transform: scale(1.05); } }
.hl__date { font-size: 16px; font-weight: 600; line-height: 1.4; letter-spacing: 0; }
.hl__date a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; color: var(--gold-deep); }
.hl__text { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 15.5px; line-height: 1.55; color: var(--ink-soft); overflow-wrap: anywhere; }
.hl .entry__ended { align-self: flex-start; }

/* ---------- overview: every year, every theme ---------- */
.jr-years { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 clamp(20px, 3vw, 48px); }
.jr-years a { display: flex; flex-direction: column; padding: 14px 0 18px; border-top: 1px solid var(--hair); text-decoration: none; }
.jr-years b { font-size: clamp(54px, 6.4vw, 96px); font-weight: 600; line-height: 1.1; letter-spacing: -.05em; font-variant-numeric: tabular-nums; transition: color .5s, translate .9s var(--ease); }
.jr-years span, .jr-themes span { font-size: 14.5px; font-weight: 500; color: var(--ink-soft); }
.jr-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 clamp(20px, 3vw, 48px); }
.jr-themes a { display: flex; flex-direction: column; gap: 2px; padding: 14px 0 16px; border-top: 1px solid var(--hair); text-decoration: none; }
.jr-themes b { font-size: clamp(19px, 1.7vw, 23px); font-weight: 600; letter-spacing: -.015em; transition: color .5s, translate .9s var(--ease); }
@media (hover: hover) { .jr-years a:hover b, .jr-themes a:hover b { color: var(--gold-deep); translate: 8px 0; } }

/* ---------- previous / next year, pages of a theme ---------- */
.jr-next { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: clamp(40px, 7vh, 80px); padding-top: 18px; border-top: 1px solid var(--ink); }
.jr-next__a { display: flex; flex-direction: column; text-decoration: none; }
.jr-next__a--r { align-items: flex-end; text-align: right; }
.jr-next__a span { font-size: 14.5px; font-weight: 600; color: var(--ink-soft); }
.jr-next__a b { font-size: clamp(44px, 6vw, 88px); font-weight: 600; line-height: 1.1; letter-spacing: -.05em; transition: color .5s; }
@media (hover: hover) { .jr-next__a:hover b { color: var(--gold-deep); } }
.jr-pages { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; margin-top: clamp(36px, 6vh, 64px); padding-top: 18px; border-top: 1px solid var(--ink); }
.jr-pages__a { display: inline-flex; align-items: center; min-height: 48px; padding: 0 22px; border-radius: var(--r-pill); border: 1px solid rgba(33, 28, 21, .3); font-weight: 600; text-decoration: none; }
.jr-pages__a.is-off { opacity: .4; }
.jr-pages__n { display: flex; gap: 4px; }
.jr-pages__n a { display: grid; place-items: center; min-width: 44px; height: 44px; border-radius: 50%; font-weight: 600; text-decoration: none; }
.jr-pages__n a[aria-current] { background: var(--ink); color: var(--ivory); }

/* ---------- footer on the gold song hỷ ground ---------- */
.jfoot { padding: clamp(56px, 9vh, 96px) 0 26px; background: var(--gold) var(--tex-gold) 0 0 / var(--tex-size); font-size: 14.5px; font-weight: 500; }
.jfoot__info { margin-bottom: clamp(20px, 3vh, 30px); font-size: 16px; line-height: 1.6; }
.jfoot__info a { font-weight: 700; white-space: nowrap; }
.jfoot__links { display: flex; flex-wrap: wrap; gap: 0 24px; }

/* ---------- when entries or photos have been taken out of the page ---------- */
.entry__photos:not(:has([data-jphoto-id])) { display: none; }
.entry:not(:has(.entry__text, [data-jphoto-id])), .hl:not(:has(.hl__text, [data-jphoto-id])) { display: none; }
.jgroup:not(:has([data-entry-id])) { display: none; }
.jr-list:not(:has([data-entry-id])) > .jr-empty { display: block; }
.jr-list:not(:has([data-entry-id])) > :is(.jr-jump, .jr-pages) { display: none; }
.jr-dark:not(:has([data-entry-id])) { display: none; }
.is-gone { display: none !important; }
/* jump links of months and years that have no entries left (js/journal.js handles any name; these cover no-JS) */
.jr-list:not(:has(#thang-1 [data-entry-id])) [data-jgroup-link="thang-1"], .jr-list:not(:has(#thang-2 [data-entry-id])) [data-jgroup-link="thang-2"],
.jr-list:not(:has(#thang-3 [data-entry-id])) [data-jgroup-link="thang-3"], .jr-list:not(:has(#thang-4 [data-entry-id])) [data-jgroup-link="thang-4"],
.jr-list:not(:has(#thang-5 [data-entry-id])) [data-jgroup-link="thang-5"], .jr-list:not(:has(#thang-6 [data-entry-id])) [data-jgroup-link="thang-6"],
.jr-list:not(:has(#thang-7 [data-entry-id])) [data-jgroup-link="thang-7"], .jr-list:not(:has(#thang-8 [data-entry-id])) [data-jgroup-link="thang-8"],
.jr-list:not(:has(#thang-9 [data-entry-id])) [data-jgroup-link="thang-9"], .jr-list:not(:has(#thang-10 [data-entry-id])) [data-jgroup-link="thang-10"],
.jr-list:not(:has(#thang-11 [data-entry-id])) [data-jgroup-link="thang-11"], .jr-list:not(:has(#thang-12 [data-entry-id])) [data-jgroup-link="thang-12"],
.jr-list:not(:has(#nam-2017 [data-entry-id])) [data-jgroup-link="nam-2017"], .jr-list:not(:has(#nam-2018 [data-entry-id])) [data-jgroup-link="nam-2018"],
.jr-list:not(:has(#nam-2019 [data-entry-id])) [data-jgroup-link="nam-2019"], .jr-list:not(:has(#nam-2020 [data-entry-id])) [data-jgroup-link="nam-2020"],
.jr-list:not(:has(#nam-2021 [data-entry-id])) [data-jgroup-link="nam-2021"], .jr-list:not(:has(#nam-2022 [data-entry-id])) [data-jgroup-link="nam-2022"],
.jr-list:not(:has(#nam-2023 [data-entry-id])) [data-jgroup-link="nam-2023"], .jr-list:not(:has(#nam-2024 [data-entry-id])) [data-jgroup-link="nam-2024"],
.jr-list:not(:has(#nam-2025 [data-entry-id])) [data-jgroup-link="nam-2025"], .jr-list:not(:has(#nam-2026 [data-entry-id])) [data-jgroup-link="nam-2026"],
.jr-list:not(:has(#nam-2027 [data-entry-id])) [data-jgroup-link="nam-2027"], .jr-list:not(:has(#nam-2028 [data-entry-id])) [data-jgroup-link="nam-2028"],
.jr-list:not(:has(#nam-2029 [data-entry-id])) [data-jgroup-link="nam-2029"], .jr-list:not(:has(#nam-2030 [data-entry-id])) [data-jgroup-link="nam-2030"] { display: none; }

/* ---------- narrower screens ---------- */
@media (max-width: 900px) {
  .entry, .mile-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .entry__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; }
  .entry__tags { margin-top: 0; }
}
@media (max-width: 640px) {
  .jr-hero { padding-top: 112px; }
  .jr-bar { top: 68px; padding-inline: 8px; }
  .jr-pill { padding: 0 13px; font-size: 14px; }
  .entry__photos { --ph: 132px; gap: 6px; }
  .hls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hl__text { font-size: 14.5px; }
  .jr-years { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jr-pages__n { order: -1; flex: 1 1 100%; justify-content: center; }
  .jfoot { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }   /* room for the floating bar */
}

@media (prefers-reduced-motion: reduce) {
  .js .jr-hero .wrap > *, .js .entry, .js .hl, .js .mile-row { opacity: 1; transform: none; animation: none; }
}
