/* =========================================================
   Kidsgrove Athletic FC - Our Story & The Fitzjohn pages
   Uses the colours, fonts and buttons from style.css
   ========================================================= */

/* Header crest always visible on inner pages */
.subpage .header-crest { opacity: 1; transform: none; }

/* ---------- Page hero ---------- */
.page-hero {
  position: relative;
  min-height: 82vh;
  min-height: 82svh;
  display: flex;
  align-items: flex-end;
  padding: 150px 0 clamp(4rem, 8vw, 6.5rem);
  background:
    radial-gradient(ellipse 60% 70% at 75% 35%, rgba(64, 108, 230, .38) 0%, transparent 65%),
    radial-gradient(ellipse 120% 70% at 50% 120%, var(--grove-2) 0%, transparent 70%),
    var(--grove);
  overflow: hidden;
  isolation: isolate;
}
.page-hero-photo { background: var(--abyss); }
.page-hero-bg {
  position: absolute;
  inset: -10% 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(5, 11, 34, .55) 0%, rgba(5, 11, 34, .35) 40%, rgba(5, 11, 34, .95) 100%),
    linear-gradient(90deg, rgba(5, 11, 34, .85) 0%, rgba(5, 11, 34, .2) 70%),
    var(--bg, none) center / cover no-repeat,
    radial-gradient(ellipse 60% 70% at 75% 35%, rgba(64, 108, 230, .38) 0%, transparent 65%),
    repeating-linear-gradient(90deg, transparent 0 58px, rgba(125, 176, 222, .06) 58px 59px, transparent 59px 118px, rgba(195, 51, 47, .07) 118px 119px),
    var(--grove);
}

.page-hero-inner { position: relative; z-index: 1; }
.crumbs {
  display: flex;
  gap: .8rem;
  margin-bottom: 2.4rem;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--mist);
}
.crumbs a { text-decoration: none; transition: color .3s; }
.crumbs a:hover { color: var(--kit-red); }
.crumbs span { color: var(--brass); }

.page-title {
  margin: 0 0 1.6rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(3.4rem, 9vw, 8.5rem);
  line-height: .95;
  letter-spacing: -.03em;
}
.page-title .hero-line { display: block; overflow: hidden; padding-bottom: .06em; }
.page-title .hero-line > * { display: inline-block; transform: translateY(105%); transition: transform 1.4s var(--ease); }
.page-title .hero-line:nth-child(2) > * { transition-delay: .15s; }
.page-title em { font-style: italic; font-weight: 400; color: var(--brass-soft); }
.is-loaded .page-title .hero-line > * { transform: none; }

.page-lead { max-width: 36rem; font-size: 1.18rem; color: rgba(244, 238, 226, .82); opacity: 0; transform: translateY(16px); transition: opacity 1.2s var(--ease) .5s, transform 1.2s var(--ease) .5s; }
.is-loaded .page-lead { opacity: 1; transform: none; }

.page-hero-crest {
  position: absolute;
  right: clamp(1rem, 8vw, 9rem);
  top: 50%;
  width: clamp(220px, 30vw, 420px);
  height: auto;
  margin-top: calc(clamp(220px, 30vw, 420px) / -2);
  opacity: 0;
  filter: drop-shadow(0 30px 70px rgba(0, 0, 0, .55)) drop-shadow(0 0 70px rgba(64, 108, 230, .35));
  transition: opacity 2s var(--ease) .4s;
}
.is-loaded .page-hero-crest { opacity: .95; }

/* ---------- Chapter (ivory story block) ---------- */
.chapter { overflow: hidden; }
.chapter-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: start;
}
.chapter-num {
  position: absolute;
  right: 0;
  top: -2rem;
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(7rem, 16vw, 14rem);
  line-height: 1;
  color: rgba(160, 127, 66, .14);
  pointer-events: none;
}
.chapter-copy { position: relative; }
.chapter-copy p { font-size: 1.12rem; line-height: 1.85; color: rgba(10, 27, 78, .85); }
.chapter-copy p:first-child::first-letter {
  float: left;
  margin: .12em .14em 0 0;
  font-family: var(--serif);
  font-size: 4.4em;
  line-height: .8;
  color: #9A7A3E;
}

/* ---------- Timeline ---------- */
.timeline-section .display em { color: var(--brass-soft); }
.timeline { position: relative; margin: 0; padding: 0 0 0 clamp(7rem, 16vw, 13rem); list-style: none; }
.timeline::before {
  content: "";
  position: absolute;
  left: calc(clamp(7rem, 16vw, 13rem) - 1.6rem);
  top: .6rem;
  bottom: .6rem;
  width: 1px;
  background: var(--line);
}
.timeline::after {
  content: "";
  position: absolute;
  left: calc(clamp(7rem, 16vw, 13rem) - 1.6rem);
  top: .6rem;
  width: 1px;
  height: calc((100% - 1.2rem) * var(--tl, 0));
  background: linear-gradient(180deg, var(--brass), var(--brass-soft));
  box-shadow: 0 0 12px rgba(197, 164, 101, .5);
}
.tl-item { position: relative; padding: 0 0 3.2rem; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: calc(-1.6rem - 5px);
  top: .55rem;
  width: 11px;
  height: 11px;
  background: var(--abyss);
  border: 1px solid var(--brass);
  transform: rotate(45deg);
  transition: background-color .6s var(--ease);
}
.tl-item.in::before { background: var(--brass); }
.tl-highlight::before { border-color: var(--kit-red); }
.tl-highlight.in::before { background: var(--kit-red); }
.tl-year {
  position: absolute;
  right: calc(100% + 3.4rem);
  top: 0;
  white-space: nowrap;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.3rem, 2.2vw, 1.9rem);
  line-height: 1.2;
  color: var(--brass-soft);
}
.tl-body { max-width: 40rem; }
.tl-body h3 { margin-bottom: .5rem; font-family: var(--serif); font-weight: 500; font-size: clamp(1.4rem, 2.4vw, 1.9rem); line-height: 1.15; }
.tl-body p { margin: 0; color: rgba(244, 238, 226, .78); }
.tl-highlight .tl-body { padding: 1.6rem 1.8rem; border: 1px solid var(--hair); background: rgba(197, 164, 101, .06); }

/* ---------- Honours ---------- */
.honours-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4.5rem); }
.honour-group h3 {
  margin-bottom: 1.2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--grove);
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.8rem;
  color: var(--grove);
}
.honour-group ul { margin: 0; padding: 0; list-style: none; }
.honour-group li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .4rem 1.5rem;
  align-items: baseline;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--line-dark);
  transition: padding .45s var(--ease), background-color .45s var(--ease);
}
.honour-group li:hover { padding-left: .8rem; padding-right: .8rem; background: rgba(10, 27, 78, .04); }
.honour-group li span { font-weight: 600; color: var(--grove); }
.honour-group li b { font-family: var(--serif); font-weight: 500; font-style: italic; font-size: 1.05rem; color: #9A7A3E; text-align: right; }

.records .honours-stats strong { font-size: clamp(2.6rem, 4.8vw, 4.2rem); }

/* ---------- Gallery ---------- */
.gallery-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 3rem; }
.gallery-head .display { margin-bottom: 0; }
.gallery-note { margin: 0; color: var(--mist); }

.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: clamp(180px, 18vw, 260px);
  gap: 1rem;
}
.gallery-item {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: var(--grove);
  border: 1px solid var(--line);
}
.gallery-item:nth-child(1) { grid-column: span 2; grid-row: span 2; }
.gallery-item:nth-child(6) { grid-column: span 2; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease), filter .6s; }
.gallery-item.has-photo { cursor: zoom-in; }
.gallery-item.has-photo:hover img { transform: scale(1.06); }
.gallery-item figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 2.5rem 1.2rem 1rem;
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--ivory);
  background: linear-gradient(180deg, transparent, rgba(5, 11, 34, .85));
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.gallery-item:hover figcaption, .gallery-item:focus-visible figcaption { opacity: 1; transform: none; }
.gallery-item:not(.has-photo) figcaption { display: none; }
.gallery-item::after { content: ""; position: absolute; inset: 0; border: 1px solid transparent; transition: border-color .5s var(--ease); pointer-events: none; }
.gallery-item.has-photo:hover::after { border-color: var(--kit-red); }

.gallery-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background:
    radial-gradient(ellipse 70% 70% at 50% 40%, rgba(64, 108, 230, .25) 0%, transparent 70%),
    repeating-linear-gradient(90deg, transparent 0 40px, rgba(125, 176, 222, .05) 40px 41px),
    var(--grove);
}
.gallery-placeholder img { width: 64px; height: 64px; opacity: .3; }
.gallery-placeholder span { font-size: .6rem; font-weight: 600; letter-spacing: .3em; text-transform: uppercase; color: rgba(197, 164, 101, .6); }

/* Photo viewer */
.viewer {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(5, 11, 34, .96);
  color: var(--ivory);
}
.viewer[open] { display: flex; align-items: center; justify-content: center; animation: modal-in .5s var(--ease); }
.viewer::backdrop { background: rgba(5, 11, 34, .9); }
.viewer-figure { margin: 0; max-width: min(1200px, 86vw); text-align: center; }
.viewer-figure img { max-width: 100%; max-height: 80vh; margin: 0 auto; border: 1px solid var(--hair); }
.viewer-figure figcaption { margin-top: 1.2rem; font-size: .7rem; font-weight: 600; letter-spacing: .26em; text-transform: uppercase; color: var(--brass); }
.viewer-close, .viewer-nav {
  position: absolute;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--ivory);
  border: 1px solid var(--hair);
  cursor: pointer;
  transition: background-color .35s var(--ease), border-color .35s var(--ease);
}
.viewer-close { top: 1.5rem; right: 1.5rem; width: 48px; height: 48px; font-size: 1.6rem; }
.viewer-nav { top: 50%; width: 56px; height: 56px; margin-top: -28px; font-size: 1.1rem; }
.viewer-prev { left: 1.5rem; }
.viewer-next { right: 1.5rem; }
.viewer-close:hover, .viewer-nav:hover { background: var(--kit-red); border-color: var(--kit-red); }

/* ---------- Visit cards ---------- */
.visit-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--grove); }
.visit-card { display: flex; flex-direction: column; padding: 2.2rem 1.8rem 2rem 0; border-right: 1px solid var(--line-dark); }
.visit-card + .visit-card { padding-left: 1.8rem; }
.visit-card:last-child { border-right: 0; }
.visit-num { margin-bottom: 1.6rem; font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: #9A7A3E; }
.visit-card h3 { margin-bottom: .8rem; font-family: var(--serif); font-weight: 500; font-size: 1.55rem; line-height: 1.15; color: var(--grove); }
.visit-card p, .visit-card address { flex: 1; margin-bottom: 1.4rem; color: rgba(10, 27, 78, .78); }
.link-dark { align-self: flex-start; color: var(--grove); background-image: linear-gradient(var(--kit-red), var(--kit-red)), linear-gradient(rgba(10, 27, 78, .3), rgba(10, 27, 78, .3)); }
.link-dark:hover { color: var(--kit-red); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .chapter-grid, .honours-grid { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 200px; }
  .gallery-item:nth-child(6) { grid-column: span 1; }
  .visit-grid { grid-template-columns: 1fr 1fr; }
  .visit-card { border-bottom: 1px solid var(--line-dark); }
  .visit-card:nth-child(2) { border-right: 0; }
  .visit-card:nth-child(3) { padding-left: 0; }
  .page-hero-crest { opacity: .25 !important; }
}
@media (max-width: 760px) {
  .page-hero { min-height: 74svh; padding-top: 130px; }
  .page-hero-crest { right: -20%; width: 70vw; margin-top: -35vw; }
  .timeline { padding-left: 1.8rem; }
  .timeline::before, .timeline::after { left: 0; }
  .tl-item::before { left: calc(-1.8rem - 5px); }
  .tl-year { position: static; display: block; margin-bottom: .4rem; }
  .gallery { grid-template-columns: 1fr; grid-auto-rows: 230px; }
  .gallery-item:nth-child(1) { grid-column: span 1; grid-row: span 1; }
  .gallery-item figcaption { opacity: 1; transform: none; }
  .visit-grid { grid-template-columns: 1fr; }
  .visit-card, .visit-card + .visit-card { padding: 2rem 0; border-right: 0; }
  .honour-group li { grid-template-columns: 1fr; }
  .honour-group li b { text-align: left; }
  .viewer-nav { top: auto; bottom: 1.5rem; margin-top: 0; }
}