/*
Theme Name: Tanaosri Trail
Theme URI: https://tanaosritrail.com
Description: Tanaosri Trail race theme — Deep Roots, Hard Routes. Static homepage + Race Info + Past Event, with WordPress-managed News (posts).
Version: 1.0
Author: Tanaosri Trail
Text Domain: tanaosri-trail
*/

/* ==========================================================================
   1. GLOBAL SYSTEM VARIABLES, RESETS & TYPOGRAPHY
   ========================================================================== */
:root {
  --black:     #0F0B0B;
  --black-2:   #1B1516;
  --panel:     #231F20;
  --red:       #DF2027;
  --red-lt:    #EA4B50;
  --pink:      #F4B1B3;
  --white:     #FFFFFF;
  --dim:       #B7ACAC;
  --line:      rgba(255,255,255,0.12);
  --maxw:      1280px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
section[id] { scroll-margin-top: 88px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--red-lt); outline-offset: 3px; border-radius: 1px;
}

body {
  background: var(--black);
  color: var(--white);
  font-family: 'IBM Plex Sans Thai', sans-serif;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.mono {
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 10px 28px; }
.wrap-narrow { max-width: 760px; margin: 0 auto; padding: 10px 28px; }

/* Components */
.eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--pink);
  display: flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 22px; height: 1px;
  background: var(--pink);
  display: inline-block;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 2px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--red); color: var(--white); font-weight: 500; }
.btn-primary:hover { background: var(--red-lt); }
.btn-ghost { border-color: var(--line); color: var(--white); }
.btn-ghost:hover { border-color: var(--pink); color: var(--pink); }
.btn.is-disabled { cursor: default; pointer-events: none; opacity: .9; }

/* Section Container Shell */
section { padding: 32px 0; border-bottom: 1px solid var(--line); }
.sec-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 44px; flex-wrap: wrap; }
.sec-head h2 { font-size: clamp(28px, 3.6vw, 42px); margin-top: 10px; }


/* ==========================================================================
   2. SITE GLOBAL NAVIGATION HEADER SYSTEM
   ========================================================================== */
header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(15, 11, 11, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

/* Home page navbar animation entry */
.home header {
  transform: translateY(-100%);
  opacity: 0;
  transition: transform .35s ease, opacity .35s ease;
}
.home header.nav-visible {
  transform: translateY(0);
  opacity: 1;
}

nav.navwrap {
  max-width: var(--maxw); margin: 0 auto; padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  height: 72px;
}

.logo {
  font-family: 'Fraunces', serif;
  font-weight: 700; font-size: 19px; letter-spacing: -0.01em;
  display: flex; flex-direction: column; line-height: 1;
  flex-shrink: 0;
  max-width: 120px;
}
.logo span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; color: var(--pink); letter-spacing: 0.14em;
  text-transform: uppercase; margin-top: 4px; font-weight: 400;
}
.logo img { height: 40px; width: auto; display: block; }

.navlinks { display: flex; align-items: center; gap: 2px; }
.navlinks > li { position: relative; list-style: none; }
.navlinks > li > a, .navlinks > li > button {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 16px; font-size: 14px; color: var(--dim);
  background: none; border: none; font-family: inherit; cursor: pointer;
  transition: color .2s ease;
}
.navlinks > li > a:hover, .navlinks > li > button:hover { color: var(--white); }
.navlinks > li > a.active { color: var(--white); }
.navul { display: flex; gap: 2px; }

.caret { width: 8px; height: 8px; opacity: .7; transition: transform .2s ease; }
li.has-dd:hover .caret, li.has-dd.open .caret { transform: rotate(180deg); }

.dropdown {
  position: absolute; top: 100%; left: 0;
  min-width: 260px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 8px;
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: all .18s ease;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
li.has-dd:hover .dropdown, li.has-dd.open .dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; font-size: 13.5px; color: var(--dim); border-radius: 2px; }
.dropdown a .num { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--red-lt); width: 18px; }
.dropdown a:hover { background: var(--black-2); color: var(--white); }
.dropdown a.ext::after { content: "↗"; margin-left: auto; font-size: 11px; color: var(--pink); }

.navcta { display: flex; align-items: center; gap: 14px; }
.lang-toggle {
  background: none; border: 1px solid var(--line); color: var(--white);
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: 0.08em;
  padding: 7px 12px; border-radius: 999px; cursor: pointer; line-height: 1;
  transition: border-color .15s, background .15s;
}
.lang-toggle:hover { border-color: var(--red-lt); background: rgba(255,255,255,0.05); }
.hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 8px; }
.hamburger span { width: 22px; height: 2px; background: var(--white); display: block; }


/* ==========================================================================
   3. HOME PAGE SPECIFIC STYLES
   ========================================================================== */
.hero-image {
  height: 100vh;
  height: 100dvh;
  height: calc(var(--vh, 1vh) * 100);
  line-height: 0;
  overflow: hidden;
  border-bottom: none;
  position: relative;
  width: 100vw;
  margin-bottom: -80px;
  z-index: 1;
}
.hero-bg-img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.hero-poster { display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.hero-image::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 160px; background: linear-gradient(to bottom, transparent, #0a0a0a 100%); pointer-events: none; }

.scroll-cue {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--dim); opacity: .85;
  animation: cueBounce 2.2s ease-in-out infinite;
}
.scroll-cue span { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; }
.scroll-cue svg { width: 16px; height: 16px; }

@keyframes cueBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* Race Block Transitions */
.race-intro { padding-bottom: 0; position: relative; z-index: 0; }
.race-img-block { aspect-ratio: 16/9; overflow: hidden; position: relative; background: var(--black-2); scroll-margin-top: 88px; }
.race-img-block img { width: 100%; height: 100%; object-fit: cover; }
.race-img-block .hot { position: absolute; inset: 0; }

.race-img-block::before, .race-img-block::after { content: ""; position: absolute; left: 0; right: 0; z-index: 2; pointer-events: none; }
.race-img-block::before { top: 0; background: linear-gradient(to bottom, #0a0a0a 0%, transparent 100%); height: 3.5vw; }
.race-img-block::after { bottom: 0; background: linear-gradient(to top, #0a0a0a 0%, transparent 100%); height: 3.5vw; }

#race-spec::before { height: 2.5vw; }
#race-spec::after { height: 3vw; }
#eligibility::before { height: 3vw; }
#eligibility::after { height: 2vw; }
#start::before { height: 3.5vw; }
#start::after { height: 4vw; }
#fees::before { height: 3.5vw; }
#fees::after { height: 1.8vw; }
#awards::before { height: 3.5vw; }
#awards::after { height: 1.8vw; }
#gear::before { height: 1.8vw; }
#gear::after { height: 1.5vw; }
#jacket::before { height: 4.5vw; }
#jacket::after { height: 4.5vw; }
#recommended-gear::before { height: 3.5vw; }
#recommended-gear::after { height: 3vw; }
#map::before { height: 2.5vw; }
#map::after { height: 5vw; }

.placeholder-tag {
  position: absolute; top: 10px; right: 10px;
  background: rgba(15, 11, 11, 0.8);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9.5px; color: var(--pink);
  padding: 4px 8px; border-radius: 2px; letter-spacing: 0.08em;
}


/* ==========================================================================
   4. LAYOUT MODULES (TIMELINES, CARDS, GRIDS)
   ========================================================================== */
/* Highlights Grid system */
.hl-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 180px;
  grid-auto-flow: dense;
  gap: 8px;
}

.hl-grid .cell {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--black-2);
}

.hl-grid .cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}

.hl-grid .cell:hover img {
  transform: scale(1.06);
}

.hl-grid .c-big {
  grid-column: span 3;
  grid-row: span 2;
}

.hl-grid .c-wide {
  grid-column: span 3;
  grid-row: span 1;
}

.hl-grid .c-med {
  grid-column: span 2;
  grid-row: span 1;
}

/* Highlights full-screen lightbox */
body.hl-lightbox-open { overflow: hidden; }

.hl-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  padding: 24px;
  background: rgba(0, 0, 0, .96);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .2s ease, visibility .2s ease;
}

.hl-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.hl-lightbox__dialog {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.hl-lightbox__img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 120px);
  max-height: calc(100dvh - 80px);
  object-fit: contain;
  object-position: center;
  user-select: none;
  -webkit-user-drag: none;
}

.hl-lightbox__close,
.hl-lightbox__nav {
  position: fixed;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%;
  background: rgba(15,11,11,.78);
  color: #fff;
  font-family: Arial, sans-serif;
  line-height: 1;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.hl-lightbox__close:hover,
.hl-lightbox__nav:hover {
  background: rgba(223,32,39,.95);
  border-color: rgba(255,255,255,.35);
}

.hl-lightbox__close {
  top: 18px;
  right: 18px;
  font-size: 34px;
  font-weight: 300;
}

.hl-lightbox__prev,
.hl-lightbox__next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 42px;
  font-weight: 300;
}

.hl-lightbox__prev { left: 18px; }
.hl-lightbox__next { right: 18px; }

.hl-lightbox__prev:hover,
.hl-lightbox__next:hover {
  transform: translateY(-50%) scale(1.06);
}

.hl-lightbox__counter {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 10001;
  transform: translateX(-50%);
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  background: rgba(15,11,11,.72);
  color: rgba(255,255,255,.82);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: .08em;
}

.play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(15, 11, 11, 0.4); }
.play::after { content: ""; width: 0; height: 0; border-left: 16px solid var(--white); border-top: 10px solid transparent; border-bottom: 10px solid transparent; margin-left: 4px; }

/* Timeline Strips */
[hidden] { display: none !important; }
.edition-strip { display: flex; gap: 14px; overflow-x: auto; padding: 26px 4px 20px; scrollbar-width: thin; }
.edition-card { flex: 0 0 250px; display: flex; flex-direction: column; gap: 10px; padding: 22px 20px; border: 1px solid var(--line); background: var(--black-2); transition: border-color .2s ease, transform .2s ease; cursor: default; }
a.edition-card { cursor: pointer; color: inherit; text-decoration: none; }
a.edition-card:hover { border-color: var(--pink); transform: translateY(-4px); }
.edition-card.no-link { opacity: .6; }
.edition-card .ep { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--red-lt); letter-spacing: 0.1em; text-transform: uppercase; }
.edition-card .yr { font-family: 'Fraunces', serif; font-size: 30px; font-weight: 600; line-height: 1; }
.edition-card .theme { font-size: 14.5px; color: var(--white); font-weight: 500; min-height: 2.7em; line-height: 1.35; }
.edition-card .date { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--dim); }
.edition-card .desc { font-size: 12.5px; color: var(--dim); line-height: 1.65; }
.edition-card.latest { border-color: var(--red-lt); }

/* News & Teaser Cards */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.news-card { border: 1px solid var(--line); background: var(--black-2); transition: border-color .2s ease; }
.news-card:hover { border-color: var(--pink); }
.news-card .thumb { aspect-ratio: 4/3; overflow: hidden; background: var(--panel); position: relative; }
.news-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.news-card:hover .thumb img { transform: scale(1.06); }
.news-card .body { padding: 20px; }
.news-card .status { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: var(--red-lt); letter-spacing: 0.08em; text-transform: uppercase; }
.news-card h4 { font-family: 'Fraunces', serif; font-size: 18px; margin-top: 8px; font-weight: 600; }
.news-card .date { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--dim); margin-top: 10px; }

.news-index { display: grid; gap: 34px; }
.news-lead { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); border: 1px solid var(--line); background: var(--black-2); color: inherit; text-decoration: none; transition: border-color .2s ease; }
.news-lead:hover { border-color: var(--pink); }
.news-lead .thumb { aspect-ratio: 16/9; overflow: hidden; background: var(--panel); }
.news-lead .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.news-lead:hover .thumb img { transform: scale(1.04); }
.news-lead .body { padding: 34px; display: flex; flex-direction: column; justify-content: center; }
.news-lead .status { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--pink); letter-spacing: .12em; text-transform: uppercase; }
.news-lead h2 { font-size: clamp(28px, 3.4vw, 44px); margin-top: 12px; }
.news-lead .excerpt { color: var(--dim); font-size: 15px; line-height: 1.75; margin-top: 16px; max-width: 58ch; }
.news-lead .date { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--dim); margin-top: 20px; }
.news-list-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); padding-top: 34px; }
.news-list-head h2 { font-size: clamp(24px, 3vw, 34px); margin-top: 8px; }
.news-list-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }

.news-strip { display: flex; gap: 22px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 12px; }
.news-strip .news-card { flex: 0 0 min(360px, 82vw); scroll-snap-align: start; }
.news-strip .news-card.featured { display: block; grid-column: auto; }
.news-strip .news-card.featured .thumb { aspect-ratio: 4/3; height: auto; }
/* Featured Card variant */
.card-grid .news-card.featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.2fr 1fr; }
.card-grid .news-card.featured .thumb { aspect-ratio: 4/3; height: auto; }
.card-grid .news-card.featured .body { padding: 32px; display: flex; flex-direction: column; justify-content: center; }
.card-grid .news-card.featured h4 { font-size: 26px; margin-top: 12px; }
.card-grid .news-card.featured .excerpt { color: var(--dim); font-size: 14px; margin-top: 12px; line-height: 1.7; }

/* Travel Section Layout */
.travel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.travel-card { position: relative; aspect-ratio: 4/5; overflow: hidden; border: 1px solid var(--line); background: var(--black-2); }
.travel-card img { width: 100%; height: 100%; object-fit: cover; }
.travel-card .overlay { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(15,11,11,0.92) 0%, rgba(15,11,11,0.1) 55%); display: flex; flex-direction: column; justify-content: flex-end; padding: 28px; }
.travel-card .eyebrow { margin-bottom: 10px; }
.travel-card h4 { font-family: 'Fraunces', serif; font-size: 26px; margin-bottom: 14px; }


/* ==========================================================================
   5. INNER PAGES STYLES (NEWS LISTING, ARTICLE, ARCHIVES)
   ========================================================================== */
/* Generic Page Headers */
.page-hero { padding: 158px 0 30px; border-bottom: 1px solid var(--line); }
.past-event-page .page-hero {
  background: linear-gradient(180deg, rgba(15,11,11,0.55) 0%, rgba(15,11,11,0.92) 100%), url('https://picsum.photos/seed/pasthero2025/1600/700') center/cover no-repeat;
}
.page-hero .crumb { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--dim); display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.page-hero .crumb a:hover { color: var(--pink); }
.page-hero h1 { font-size: clamp(32px, 4.6vw, 52px); margin-bottom: 14px; }
.page-hero .sub { color: var(--dim); font-size: 15px; max-width: 60ch; }
.page-hero .meta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

.meta-pill { font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: 0.04em; color: var(--white); border: 1px solid var(--line); border-radius: 2px; padding: 8px 14px; background: rgba(35, 31, 32, 0.6); }
.meta-pill b { color: var(--pink); font-weight: 500; }

/* Filtering Categories Tabs */
.filter-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 40px; }
.filter-tabs button { font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; padding: 9px 16px; border: 1px solid var(--line); background: none; color: var(--dim); border-radius: 2px; cursor: pointer; transition: all .2s ease; }
.filter-tabs button:hover { color: var(--white); border-color: var(--pink); }
.filter-tabs button.active { background: var(--red); color: var(--white); border-color: var(--red); }

/* Quick Race Stats Panel */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.stat-cell { background: var(--black); padding: 28px 22px; text-align: center; }
.stat-cell .num { font-family: 'Fraunces', serif; font-weight: 700; font-size: clamp(26px, 3vw, 36px); color: var(--red-lt); }
.stat-cell .lbl { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--dim); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 8px; }

.recap-copy { max-width: 74ch; color: var(--dim); font-size: 15.5px; line-height: 1.85; }
.recap-copy strong { color: var(--white); font-weight: 500; }

/* Dynamic Post Results Table */
.result-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.result-table th { text-align: left; font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); padding: 12px 16px; border-bottom: 1px solid var(--line); }
.result-table td { padding: 16px; border-bottom: 1px solid var(--line); }
.result-table tr:hover td { background: var(--black-2); }
.result-table .dist { color: var(--red-lt); font-weight: 500; }
.result-table .time { font-family: 'IBM Plex Mono', monospace; color: var(--dim); }

/* Compact Media Components */
.gallery-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.gallery-strip a { aspect-ratio: 4/5; overflow: hidden; border: 1px solid var(--line); background: var(--black-2); }
.gallery-strip img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.gallery-strip a:hover img { transform: scale(1.06); }

/* Article Post Headers & Contents */
.post-header { padding: 154px 0 0; }
.post-header .status-badge { display: inline-flex; align-items: center; gap: 8px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--red-lt); margin-bottom: 16px; }
.post-header h1 { font-size: clamp(30px, 4.6vw, 50px); max-width: 24ch; margin-bottom: 20px; }
.post-header .crumb a:last-child { color: var(--pink) !important; text-decoration: none; }
.post-header .crumb a:last-child:hover { color: var(--red-lt) !important; }
.post-header .post-news-btn { margin-bottom: 40px; }
.post-meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--dim); font-size: 13.5px; margin-bottom: 40px; }
.post-meta span { display: flex; align-items: center; gap: 6px; }

.post-hero-img { width: 100%; aspect-ratio: 16/8; overflow: hidden; background: var(--black-2); border: 1px solid var(--line); margin-bottom: 8px; }
.post-hero-img img { width: 100%; height: 100%; object-fit: cover; }

.post-body { padding: 64px 0; }
.cci-import-details { display: none; }
.post-body p { color: var(--dim); font-size: 16px; line-height: 1.9; margin-bottom: 22px; }
.post-body p strong { color: var(--white); font-weight: 500; }
.post-body h2 { font-size: 26px; margin: 44px 0 18px; }
.post-body h3 { font-size: 20px; margin: 34px 0 14px; font-family: 'Fraunces', serif; font-weight: 600; }
.post-body ul, .post-body ol { color: var(--dim); font-size: 16px; line-height: 1.9; margin: 0 0 22px 22px; }
.post-body li { margin-bottom: 8px; }
.post-body blockquote { border-left: 2px solid var(--red); padding: 4px 0 4px 24px; margin: 32px 0; font-family: 'Fraunces', serif; font-size: 20px; font-style: italic; color: var(--white); }
.post-body figure { margin: 36px 0; }
.post-body figure img { width: 100%; border: 1px solid var(--line); }
.post-body figcaption { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--dim); margin-top: 10px; }
.post-body hr { border: none; border-top: 1px solid var(--line); margin: 44px 0; }

.post-foot-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding-top: 28px; border-top: 1px solid var(--line); }
.tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tags span { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--dim); border: 1px solid var(--line); border-radius: 2px; padding: 6px 12px; }
.share { display: flex; gap: 10px; align-items: center; }
.share a { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--dim); transition: all .2s ease; }
.share a:hover { border-color: var(--pink); color: var(--white); }

/* Single Content CTA Bar */
section.cta-sec { padding: 0 0 76px; border-bottom: 1px solid var(--line); }
.cta-band { display: flex; justify-content: space-between; align-items: center; gap: 24px; background: var(--panel); border: 1px solid var(--line); padding: 36px 40px; flex-wrap: wrap; max-width: var(--maxw); margin: 0 auto; }
.cta-band h3 { font-size: 22px; margin-bottom: 6px; }
.cta-band p { color: var(--dim); font-size: 14px; }
.cta-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Sequential Content Navigation Links */
.post-nav, .year-nav { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 0 0 56px; }
.year-nav { border-bottom: none; padding: 56px 0; }
.post-nav a, .year-nav a { display: flex; flex-direction: column; gap: 6px; flex: 1; padding: 22px 26px; border: 1px solid var(--line); transition: border-color .2s ease; }
.post-nav a:hover, .year-nav a:hover { border-color: var(--pink); }
.post-nav a.next, .year-nav a.next { text-align: right; align-items: flex-end; }
.post-nav .dir, .year-nav .dir { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--pink); letter-spacing: 0.08em; text-transform: uppercase; }
.post-nav .ttl { font-family: 'Fraunces', serif; font-weight: 600; font-size: 17px; margin-top: 2px; }
.year-nav .yr { font-family: 'Fraunces', serif; font-weight: 600; font-size: 24px; margin-top: 2px; }
.year-nav a.disabled { opacity: .35; pointer-events: none; }

/* Navigation Pagination indexes */
.pagination { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 52px; }
.pagination a, .pagination span { font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: var(--dim); width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 2px; transition: all .2s ease; }
.pagination a:hover { color: var(--white); border-color: var(--pink); }
.pagination .current { background: var(--red); color: var(--white); border-color: var(--red); }


/* ==========================================================================
   6. INTERACTIVE COURSES SYSTEM
   ========================================================================== */
.courses-page .page-hero { padding: 120px 0 36px; }
.courses-page .page-hero .sub { color: var(--dim); max-width: 60ch; margin-top: 14px; font-size: 15.5px; line-height: 1.8; }

.course-selector-wrap { position: sticky; top: 72px; z-index: 40; background: rgba(15, 11, 11, 0.92); backdrop-filter: blur(10px); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.course-selector-wrap .wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.course-selector { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0; scrollbar-width: thin; }

.cs-btn { flex: 0 0 auto; display: flex; flex-direction: column; gap: 2px; padding: 8px 16px; border: 1px solid var(--line); background: var(--black-2); color: var(--dim); text-decoration: none; transition: border-color .2s ease, background .2s ease, color .2s ease; white-space: nowrap; }
.cs-btn b { font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: var(--white); letter-spacing: .05em; }
.cs-btn span { font-size: 11px; }
.cs-btn:hover { border-color: var(--pink); }
.cs-btn.active { border-color: var(--red); background: var(--red); }
.cs-btn.active b, .cs-btn.active span { color: var(--white); }

.course { padding: 0; border-bottom: none; scroll-margin-top: 132px; }
.course-sheet { display: block; position: relative; }
.course-sheet img { width: 100%; height: auto; display: block; }
.course-sheet .zoom { position: absolute; top: 14px; right: 14px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .06em; color: var(--white); background: rgba(15, 11, 11, 0.6); border: 1px solid var(--line); padding: 6px 10px; opacity: 0; transition: opacity .2s ease; }
.course-sheet:hover .zoom { opacity: 1; }


/* ==========================================================================
   7. FOOTER MODULE
   ========================================================================== */
footer { padding: 56px 0 40px; }
.foot-grid { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 40px; margin-bottom: 40px; }
.foot-col h5 { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--pink); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 16px; }
.foot-col a { display: block; color: var(--dim); font-size: 14px; margin-bottom: 10px; }
.foot-col a:hover { color: var(--white); }
.foot-bottom { border-top: 1px solid var(--line); padding-top: 24px; display: flex; justify-content: space-between; color: var(--dim); font-size: 12.5px; flex-wrap: wrap; gap: 10px; }


/* ==========================================================================
   8. MEDIA RESPONSIVE MEDIA QUERIES (900px & 480px Breakpoints)
   ========================================================================== */
@media (max-width: 900px) {
  /* มือถือ: banner -> รูปแนวตั้ง */
  .hero-bg-img { display: none; }
  .hero-poster { display: block; }

  /* Dynamic Fixed Mobile Overlay Menu — เต็มจอ */
  .navlinks { display: none; }
  .navlinks.mobile-open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 72px; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: calc(100dvh - 72px);   /* เต็มความสูงจอที่เหลือใต้ navbar */
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    padding: 16px;
    overflow-y: auto;
    z-index: 999;
  }

  /* จัดการกล่องหัวข้อใหญ่ให้เรียงแถวลงมาและมีช่องว่างอย่างเหมาะสม */
  .navlinks.mobile-open > li {
    width: 100%;
    display: block;
    position: relative;
    margin-bottom: 6px;
  }

  /* ปรับปรุงขนาดและดีไซน์ของปุ่มหัวข้อใหญ่ในโหมดมือถือ */
  .navlinks.mobile-open > li > a,
  .navlinks.mobile-open > li > button {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    font-size: 15px;
    color: var(--white);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
  }

  /* ระบบ Accordion Dropdown แบบเปิดแทรกเนื้อหา ไม่เปิดลอยทับหัวข้ออื่น */
  .navlinks.mobile-open .dropdown {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    background: var(--black-2);
    margin: 6px 0 10px 0;
    padding: 4px;
    width: 100%;
    min-width: 0;
    border-left: 2px solid var(--red);
    display: none;
  }

  /* แสดงผล Dropdown แตกตัวออกแบบดันหัวข้อใหญ่อื่นๆ ลงไปด้านล่าง */
  .navlinks.mobile-open li.has-dd.open .dropdown {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  /* ขยายพื้นที่และระยะห่างของลิงก์ภายใน Dropdown ให้กดง่ายด้วยนิ้วมือ */
  .navlinks.mobile-open .dropdown a {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--dim);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  }

  .navlinks.mobile-open .dropdown a:last-child {
    border-bottom: none;
  }

  /* ปล่อยให้ไอคอน Caret หมุนหัวลง 180 องศาเมื่อเปิดเมนู */
  .navlinks.mobile-open li.has-dd.open .caret {
    transform: rotate(180deg);
  }

  /* Fluid Scaling Interface patches */
  .hamburger { display: flex; }

  .navcta { gap: 8px; flex-grow: 1; justify-content: flex-end; }
  .navcta .btn { padding: 8px 14px; font-size: 11px; text-overflow: ellipsis; }

  /* Structured Content Grids collapse down to single columns */
  .hl-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 160px; }
  .hl-grid .c-big { grid-column: span 2; grid-row: span 2; }
  .hl-grid .c-wide { grid-column: span 2; grid-row: span 1; }
  .hl-grid .c-med { grid-column: span 1; grid-row: span 1; }

  .card-grid, .travel-grid, .post-nav, .year-nav, .news-lead, .news-list-grid { grid-template-columns: 1fr; flex-direction: column; }
  .card-grid .news-card.featured { grid-template-columns: 1fr; }
  .news-lead .body { padding: 24px; }
  .post-nav a.next, .year-nav a.next { align-items: flex-start; text-align: left; }

  .stat-grid, .gallery-strip { grid-template-columns: repeat(2, 1fr); }
  .cta-band { flex-direction: column; align-items: flex-start; }
  .foot-grid { gap: 28px; }

  /* Course selector layout shift overrides */
  .course-selector-wrap { top: 0; }
  .course-sheet .zoom { opacity: 1; }
}

@media (max-width: 480px) {
  section { padding: 56px 0; }
  .wrap, .wrap-narrow { padding: 0 20px; }
  .page-hero, .post-header { padding: 148px 0 48px; }
  .post-header { padding-top: 140px; }
  .post-body { padding: 48px 0; }
  .result-table { font-size: 13px; }
  .result-table th, .result-table td { padding: 10px; }
  .navcta .btn { padding: 6px 10px; font-size: 10px; }
  .hero-image { margin-bottom: 0; }
}

/* ==========================================================================
   PER-YEAR PAST EVENT — theme colour via --accent (set inline per edition).
   Scoped to .pe so the site header/nav keep the brand red.
   ========================================================================== */
.pe { --accent: var(--red); }
.pe-logo { height: 96px; width: auto; margin-bottom: 10px; }
.pe-theme { font-family: 'Fraunces', serif; font-weight: 600; font-size: clamp(20px, 2.6vw, 30px); color: var(--accent); margin: 6px 0 4px; }
.pe .eyebrow { color: var(--accent); }
.pe .page-hero { border-bottom: 2px solid var(--accent); }
/* Per-year hero banner — full designed graphic, shown whole (no crop). Skipped when no banner. */
.pe-banner-sec { padding-top: 80px; }
.pe-banner { display: block; width: 100%; height: auto; }
.pe .pe-head { padding-top: 28px; }
@media (max-width: 720px) { .pe-banner-sec { padding-top: 66px; } .pe .pe-head { padding-top: 20px; } }
.pe .meta-pill b { color: var(--accent); }
.pe .stat-cell .num { color: var(--accent); }
.pe .stat-cell { border-top: 2px solid var(--accent); }
.pe .btn-primary { background: var(--accent); }
.pe .year-nav a:hover { border-color: var(--accent); }
.pe .year-nav .dir { color: var(--accent); }
.pe .result-table thead th { border-bottom: 2px solid var(--accent); }
.pe-lead { color: var(--dim); font-size: 15px; margin-bottom: 22px; }
.pe-lead b { color: var(--accent); font-weight: 600; }
/* Race format cards */
.race-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.race-item { border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; background: var(--panel); }
.race-item .rdist { font-family: 'Fraunces', serif; font-weight: 700; font-size: 28px; color: var(--accent); line-height: 1; }
.race-item .rname { color: var(--dim); font-size: 13.5px; margin-top: 6px; }
/* Results — top-3 podium (male / female) */
.pe-sub { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--dim); letter-spacing: 0.04em; margin-top: 6px; }
.pe-sub b { color: var(--accent); }
.podium-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-top: 24px; }
.podium { border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; background: var(--panel); }
.podium-head { font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin: 0 0 14px; }
.podium-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; counter-reset: none; }
.podium-list li { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.podium-list li:first-child { border-top: none; }
.podium-list .rk { font-family: 'Fraunces', serif; font-weight: 700; font-size: 20px; color: var(--accent); text-align: center; }
.podium-list .nm { font-size: 14.5px; color: var(--white); }
.podium-list .tm { font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: var(--dim); white-space: nowrap; }
/* Responsive video embed (YouTube / Facebook) */
.video-embed { position: relative; aspect-ratio: 16/9; width: 100%; background: #000; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.photo-cta { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 26px 32px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel);
  color: inherit; text-decoration: none; transition: border-color .2s ease, transform .2s ease; }
.photo-cta:hover { border-color: var(--accent); transform: translateY(-3px); }
.photo-cta .eyebrow { color: var(--accent); }
.photo-cta h3 { font-family: 'Fraunces', serif; font-weight: 600; font-size: clamp(20px, 2.6vw, 28px); margin-top: 6px; }
.photo-cta .btn { white-space: nowrap; }

.result-cta { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 26px 32px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel);
  color: inherit; text-decoration: none; transition: border-color .2s ease, transform .2s ease; }
.result-cta:hover { border-color: var(--accent); transform: translateY(-3px); }
.result-cta .eyebrow { color: var(--accent); }
.result-cta h3 { font-family: 'Fraunces', serif; font-weight: 600; font-size: clamp(20px, 2.6vw, 28px); margin-top: 6px; }
.result-cta .btn { white-space: nowrap; }

.cta-2col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: stretch; }
.cta-2col .photo-cta { height: 100%; }

/* Highlights lightbox — mobile refinements */
@media (max-width: 900px) {
  .hl-lightbox {
    padding: 12px;
  }

  .hl-lightbox__img {
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 96px);
  }

  .hl-lightbox__close {
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
  }

  .hl-lightbox__nav {
    top: auto;
    bottom: 12px;
    width: 44px;
    height: 44px;
    transform: none;
    background: rgba(15,11,11,.88);
  }

  .hl-lightbox__prev { left: 12px; }
  .hl-lightbox__next { right: 12px; }

  .hl-lightbox__prev:hover,
  .hl-lightbox__next:hover {
    transform: none;
  }

  .hl-lightbox__counter {
    bottom: 20px;
  }
}

.year-nav a.next { margin-left: auto; }

