/* =====================================================================
   pages.css: layouts that belong to one page or a few pages.
   ===================================================================== */

/* ---------- title band on inner pages ---------- */
.page-head {
  padding-block: clamp(2rem, 5vw, 3.25rem);
  background: var(--brand);
  color: #fff;
  border-bottom: 5px solid var(--accent);
}
.page-head h1 { margin: 0; color: #fff; }
.page-head-lead { margin: 0.6rem 0 0; max-width: 60ch; color: #f3dde0; }

/* ---------- Home hero: the one bold moment ----------
   The picture (.hero-bg) is FIXED to the screen, behind everything, from just under the
   header to the bottom. The .hero section on top of it is see-through and as tall as the
   screen, so at the top of the page you see picture + text. When you scroll, the text moves
   up while the picture stays, and the solid white sections slide up over it. */
.hero-bg {
  position: fixed;
  top: calc(var(--header-height) + 1px);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -1;                         /* lower than everything else on the page */
  background-color: var(--brand);
  background-image: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  background-size: cover;
  background-position: center;
}
/* darkens the picture so white text stays readable on any photo */
.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(38, 6, 12, 0.86) 0%, rgba(38, 6, 12, 0.4) 55%, rgba(38, 6, 12, 0.2) 100%);
}
.hero {
  display: flex;
  align-items: flex-end;
  min-height: calc(100vh - var(--header-height));
  min-height: calc(100svh - var(--header-height));   /* the visible screen below the header */
  color: #fff;
}
.hero-inner { position: relative; padding-block: clamp(2rem, 6vw, 4rem); }
.hero-logo { width: 5rem; height: 5rem; margin-bottom: 1.25rem; object-fit: contain; }
.hero-title {
  max-width: 18ch;
  margin: 0;
  padding-left: 1.1rem;
  border-left: 6px solid var(--accent);
  font-size: clamp(2.3rem, 7vw, 4.4rem);
  line-height: 1.1;
  color: #fff;
}
.hero-motto { max-width: 40ch; margin: 1rem 0 0 1.1rem; font-size: 1.2rem; color: #f6e6e8; }

/* ---------- picture + text rows ---------- */
.split { display: grid; gap: 1.75rem; align-items: center; }
.split-media img { width: 100%; border-radius: var(--radius); aspect-ratio: 4 / 3; object-fit: cover; }
.split-text > :last-child { margin-bottom: 0; }
.split-text p { max-width: 62ch; }

.split-text ul, .split-text ol { max-width: 62ch; padding-left: 1.3rem; }
.split-text li { margin-bottom: 0.35rem; }
.split-text a { color: var(--brand); text-decoration: underline; }
.split-text img { max-width: 100%; height: auto; }

@media (min-width: 800px) {
  .split { grid-template-columns: 1fr 1fr; gap: 3.5rem; }
  .split--flip .split-media { order: 2; }   /* picture on the right */
  .split--single { grid-template-columns: 1fr; }   /* a row without a picture: full width */
}

/* Academics > Classes: space around and between the rows */
.class-rows { margin: 2.25rem 0 3rem; }
.class-rows > .split + .split { margin-top: 3rem; }
@media (min-width: 800px) { .class-rows > .split + .split { margin-top: 4rem; } }

/* The principal's portrait is a circle. The selector is written as
   '.split-media .split-portrait' so it beats the general '.split-media img' rule. */
.split-media .split-portrait {
  width: min(16rem, 70%);
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  margin-inline: auto;
}
.split-caption { margin: 0.9rem 0 0; text-align: center; color: var(--ink-soft); }
.split-caption strong { color: var(--ink); font-family: var(--font-display); font-size: 1.15rem; }

/* ---------- About ---------- */
.motto {
  max-width: 24ch;
  margin: 0 auto;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4.5vw, 2.6rem);
  font-weight: 600;
  line-height: 1.25;
  color: var(--brand);
}

.people {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 2rem 2.5rem;
  margin: 2.5rem 0 0;
  padding: 0;
  list-style: none;
}
.person { display: flex; flex-direction: column; align-items: center; width: 11rem; text-align: center; }
.person-photo {
  width: 8rem;
  height: 8rem;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.8rem;
}
.person--principal .person-photo { width: 11rem; height: 11rem; border: 5px solid var(--accent); }
.person-photo--empty {
  display: grid;
  place-items: center;
  background: var(--brand-tint);
  color: var(--brand-dark);
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 600;
}
.person-name { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; }
.person-role { color: var(--ink-soft); }
/* on phones the principal comes first, the rest follow in a column */
@media (max-width: 639px) {
  .people { flex-direction: column; align-items: center; }
  .person--principal { order: -1; }
}

/* history: zigzag on desktop, one line down the left on phones */
.timeline { position: relative; margin: 2.5rem 0 0; padding: 0; list-style: none; }
.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0.55rem;
  width: 3px;
  background: var(--line);
}
.timeline-item { position: relative; padding: 0 0 2rem 2.2rem; }
.timeline-item::before {
  content: "";
  position: absolute;
  top: 0.45rem;
  left: 0;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: var(--paper);
  border: 4px solid var(--brand);
}
.timeline-year { display: block; font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; color: var(--brand); }
.timeline-item p { margin: 0; max-width: 46ch; }

@media (min-width: 800px) {
  .timeline::before { left: 50%; transform: translateX(-50%); }
  .timeline-item { width: 50%; padding: 0 3rem 2.5rem 0; text-align: right; }
  .timeline-item p { margin-left: auto; }
  .timeline-item::before { left: auto; right: -0.6rem; }
  .timeline-item:nth-child(even) { margin-left: 50%; padding: 0 0 2.5rem 3rem; text-align: left; }
  .timeline-item:nth-child(even) p { margin-left: 0; }
  .timeline-item:nth-child(even)::before { right: auto; left: -0.6rem; }
}

/* The school song (About page). Line breaks typed in templates/about.html are kept; blank lines separate verses. */
.song {
  max-width: 36rem;
  margin: 1.75rem auto 0;
  padding: 1.5rem 1.25rem;
  text-align: center;
  white-space: pre-line;
  font-family: "Noto Sans Sinhala", var(--font-body);
  font-size: 1.2rem;
  line-height: 2;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 6px solid var(--brand);
  border-radius: var(--radius);
}
@media (min-width: 800px) { .song { padding: 2rem 2.5rem; font-size: 1.3rem; } }

.contact-grid { display: grid; gap: 2.5rem; }
@media (min-width: 800px) { .contact-grid { grid-template-columns: 1fr 1fr; gap: 3.5rem; } }
.contact-list { display: grid; gap: 0.4rem; margin-bottom: 1.25rem; }

/* ---------- featured block (Achievements, News & Events) ---------- */
.feature {
  display: grid;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 2.75rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: var(--radius);
  background: var(--mist);
}
.feature-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); }
.feature-text { display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; }
.feature-text h2 { margin: 0.25rem 0 0; }
.feature-text p { margin: 0; max-width: 56ch; }
@media (min-width: 800px) {
  .feature { grid-template-columns: 5fr 7fr; gap: 2.5rem; padding: 1.5rem; }
}
.grid-title { margin-bottom: 1.25rem; }

/* closing line above the footer (Achievements > Non-academic) */
.closing {
  margin: 3.5rem 0 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 600;
  color: var(--brand);
}

/* ---------- detail pages ---------- */
.article { max-width: 46rem; }
.article-back { margin-bottom: 1.5rem; font-weight: 600; }
.article-title { margin-top: 0.5rem; }
.article-cover { width: 100%; margin: 1.5rem 0 2rem; border-radius: var(--radius); aspect-ratio: 16 / 9; object-fit: cover; }
.event-facts { display: grid; gap: 0.35rem; margin: 0 0 1rem; }
.event-facts div { display: flex; gap: 0.75rem; }
.event-facts dt { min-width: 4.5rem; color: var(--ink-soft); }
.event-facts dd { margin: 0; font-weight: 600; }

/* ---------- Not Found ---------- */
.notfound { max-width: 36rem; text-align: center; padding-block: 3rem; }

/* A section that fills the visible screen (the Home "pillars"). Its content is centred
   up and down. If the content is taller than the screen, the section simply grows. */
.section--screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100vh - var(--header-height));
  min-height: calc(100svh - var(--header-height));
}
.section--screen > .container { width: min(100% - 2rem, var(--container)); }

/* Matches your existing hero heading style */
#hero-title {
  color: #ffffff;
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1.15;
  margin: 0;
}

/* Blinking cursor shown only while typing is active */
#hero-welcome.is-typing::after {
  content: "|";
  margin-left: 4px;
  color: #facc15;
  animation: hero-cursor-blink 0.75s step-end infinite;
}

@keyframes hero-cursor-blink {
  50% {
    opacity: 0;
  }
}


/* ---------- safety net: a long unbroken word (or pasted code) must never widen the page ---------- */
.split > *, .card-body, .pillar { min-width: 0; }
h1, h2, h3, h4, .split-text { overflow-wrap: anywhere; }
body { overflow-x: clip; }   /* also hides the sideways overhang of the slide-in animations */
