/* Fonts: Montserrat (body) + Playfair Display (headings).
   Tip: for faster loading you can move this to a <link> in base.html <head>. */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&family=Playfair+Display:wght@600;700;800&display=swap');

/* =========================================================================
   Facilities > Sports & Games   (same design system as Transport, Library,
   Mess, Labs and Medical & CCTV). Indoor = navy ribbon, Outdoor = orange ribbon.
   Everything is scoped under .games-page so it cannot leak into other pages.
   ========================================================================= */

.games-page {
  --sg-body: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --sg-head: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sg-navy: #0B2F5B;
  --sg-blue: #1667B0;
  --sg-orange: #E8790E;
  --sg-orange-deep: #C2570A;
  --sg-red: #D32F2F;
  --sg-gold: #FFC400;
  --sg-soft: var(--ink-soft, #555);
  /* ribbon colours (overridden per block below) */
  --rib1: #0B2F5B;
  --rib2: #0F4C8A;
  --rib-dark: #061E3D;
  background: #fff;
  font-family: var(--sg-body);
}

/* body font everywhere (icons keep their own font because they are <i>) */
.games-page p,
.games-page li,
.games-page a,
.games-page span,
.games-page button,
.games-page b,
.games-page figcaption { font-family: var(--sg-body); }

/* headings font */
.games-page h1,
.games-page h2,
.games-page h3 { font-family: var(--sg-head); }

/* ---------- Banner placeholder (1920 x 600) ---------- */
.games-page .sg-hero {
  position: relative;
  width: 100%;
  height: clamp(260px, 31.25vw, 600px);
  padding: 0;
  overflow: hidden;
  background: linear-gradient(135deg, #E8790E 0%, #B8430A 100%);
}
.sg-hero-img {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%;
  object-fit: cover; object-position: top;
  display: block;
}
.sg-hero-ph {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 20px; text-align: center; color: #fff;
}
.sg-hero-ph i { font-size: 3.8rem; color: var(--sg-gold); }
.sg-hero-ph b { font-size: 1.5rem; }
.sg-hero-ph span { font-size: 1.05rem; color: rgba(255, 255, 255, 0.92); }
.sg-hero-ph code {
  background: rgba(255, 255, 255, 0.18);
  padding: 3px 10px; border-radius: 6px; font-size: 0.9rem;
}

/* =========================================================================
   RIBBON HEADING — used for every section heading
   (notched right end + folded corner, same as the Transport page)
   ========================================================================= */
.games-page .ribbon-head {
  position: relative;
  display: inline-block;
  max-width: 100%;
  margin: 0 0 30px;
  padding: 0;
  font-size: clamp(1.35rem, 2.7vw, 2.05rem);
  font-weight: 700; line-height: 1.2; letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: left;
  color: #fff;
  border: 0;
}
.games-page .ribbon-head::before {                /* ribbon body, V-notch on the right */
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(90deg, var(--rib1) 0%, var(--rib2) 100%);
  clip-path: polygon(0 0, 100% 0, calc(100% - 26px) 50%, 100% 100%, 0 100%);
  transform-origin: left center;
}
.games-page .ribbon-head::after {                 /* folded corner under the left edge */
  content: ""; position: absolute; left: 0; top: 100%;
  width: 24px; height: 18px;
  background: var(--rib-dark);
  clip-path: polygon(0 0, 100% 0, 100% 100%);     /* right angle at top-right */
}
.games-page .ribbon-head span {
  position: relative; z-index: 1;
  display: block;
  padding: 14px 70px 14px 30px;
  font-family: inherit;
}

/* ---------- Shared section heading wrapper ---------- */
.games-page .section-head { max-width: 900px; margin: 0 auto 34px; text-align: center; }
.games-page .section-head .ribbon-head { margin-bottom: 0; }

/* ---------- Intro: "Sports & Games" in one rectangular box ---------- */
.games-page .sg-intro { padding: 38px 0 50px; text-align: center; }
.sg-crumbs {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 1rem; font-weight: 600; color: var(--sg-soft);
  margin: 0 0 18px;
}
.sg-crumbs a:hover { color: var(--sg-orange-deep); }
.sg-crumbs i { font-size: 0.6rem; }
.sg-crumbs span { color: var(--sg-red); }

.sg-box {
  position: relative;
  background: linear-gradient(180deg, #fff 0%, #F4F8FD 100%);
  border: 1px solid #D6E2F0;
  border-bottom: 8px solid var(--sg-navy);
  border-radius: 14px;
  padding: 44px 36px 46px;
  box-shadow: 0 40px 70px -44px rgba(11, 47, 91, 0.6);
}
.games-page .sg-title {
  font-size: clamp(2.3rem, 5vw, 3.9rem);
  font-weight: 700; line-height: 1.1; letter-spacing: -0.01em;
  color: var(--sg-navy);
  margin: 0;
}
.sg-tagline {
  margin: 18px auto 0; max-width: 760px;
  font-size: 1.25rem; font-weight: 600; line-height: 1.7;
  color: var(--sg-orange-deep);
}

/* ---------- Blocks ---------- */
.games-page .sg-block { padding: 52px 0 56px; }
.games-page .sg-indoor {
  background: #F4F8FD;
  --rib1: #0B2F5B; --rib2: #0F4C8A; --rib-dark: #061E3D;
  --c: var(--sg-navy); --ph: #9DBDDD;
}
.games-page .sg-outdoor {
  background: #FFF3E3;
  --rib1: #B8430A; --rib2: #E8790E; --rib-dark: #7A2C05;
  --c: var(--sg-orange-deep); --ph: #F0BF8C;
}

/* ---------- Equal-size game photos ---------- */
.sg-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px; perspective: 1000px; }
.sg-shot {
  position: relative; overflow: hidden; margin: 0;
  flex: 0 1 calc((100% - 48px) / 3);      /* 3 per row */
  min-width: 240px;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  border: 6px solid #fff;
  background: linear-gradient(135deg, #fff, #F7F3D9);
  box-shadow: 0 24px 48px -26px rgba(11, 47, 91, 0.55);
  will-change: transform;
}
.sg-grid-4 .sg-shot { flex-basis: calc((100% - 72px) / 4); }   /* 4 per row */
.sg-shot img {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.6s ease;
}
.sg-shot:hover img { transform: scale(1.08); }
.sg-shot-ph {
  position: absolute; inset: 12px; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; text-align: center; padding: 12px 12px 56px;
  border: 2px dashed var(--ph); border-radius: 8px; color: var(--c);
}
.sg-shot-ph i { font-size: 2.4rem; color: var(--c); opacity: 0.85; }
.sg-shot-ph b { font-size: 1.15rem; }
.sg-shot-ph span { font-size: 0.95rem; color: var(--sg-soft); line-height: 1.6; }
.sg-shot-ph code { background: #fff; padding: 2px 8px; border-radius: 6px; font-size: 0.85rem; color: var(--c); }
.sg-shot-caption {
  position: absolute; left: 0; bottom: 20px; z-index: 3;
  background: var(--c); color: #fff;
  padding: 10px 26px 10px 18px;
  border-radius: 0 999px 999px 0;
  font-weight: 700; font-size: 1.08rem;
  box-shadow: 0 10px 22px -10px rgba(0, 0, 0, 0.5);
}

/* =========================================================================
   ANIMATIONS (only when JS is running; reduced-motion users see no motion)
   ========================================================================= */
@keyframes sg-rise {
  from { opacity: 0; transform: perspective(1400px) rotateX(12deg) translateY(36px); }
  to   { opacity: 1; transform: perspective(1400px) rotateX(0) translateY(0); }
}
@keyframes sg-drop {
  from { opacity: 0; transform: perspective(800px) rotateX(-50deg) translateY(22px); }
  to   { opacity: 1; transform: perspective(800px) rotateX(0) translateY(0); }
}
@keyframes sg-flip {
  from { opacity: 0; transform: perspective(900px) rotateX(-70deg) translateY(30px); }
  to   { opacity: 1; transform: perspective(900px) rotateX(0) translateY(0); }
}
@keyframes sg-unroll { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes sg-slide  { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
@keyframes sg-fold   { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* hidden until revealed */
.games-page.js .sg-box:not(.in),
.games-page.js .sg-title:not(.in),
.games-page.js .sg-shot:not(.in) { opacity: 0; }
.games-page.js .ribbon-head:not(.in)::before { transform: scaleX(0); }
.games-page.js .ribbon-head:not(.in)::after,
.games-page.js .ribbon-head:not(.in) span { opacity: 0; }

/* play */
.games-page.js .sg-box.in   { animation: sg-rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
.games-page.js .sg-title.in { animation: sg-drop 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.15s backwards; transform-origin: 50% 100%; }
.games-page.js .sg-shot.in {
  animation: sg-flip 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(var(--i, 0) * 0.15s + 0.2s);
}
.sg-shot:nth-child(4n+1) { --i: 0; }
.sg-shot:nth-child(4n+2) { --i: 1; }
.sg-shot:nth-child(4n+3) { --i: 2; }
.sg-shot:nth-child(4n+4) { --i: 3; }
.games-page.js .ribbon-head.in::before { animation: sg-unroll 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
.games-page.js .ribbon-head.in span    { animation: sg-slide 0.6s ease 0.25s backwards; }
.games-page.js .ribbon-head.in::after  { animation: sg-fold 0.4s ease 0.6s backwards; }

@media (prefers-reduced-motion: reduce) {
  .games-page *, .games-page *::before, .games-page *::after {
    animation: none !important; transition: none !important;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 899px) {
  .sg-grid-4 .sg-shot { flex-basis: calc((100% - 24px) / 2); }
}
@media (max-width: 960px) {
  .sg-shot { flex-basis: calc((100% - 24px) / 2); }
}
@media (max-width: 700px) {
  .games-page .sg-intro { padding: 28px 0 34px; }
  .sg-box { padding: 32px 18px 34px; }
  .games-page .sg-block { padding: 36px 0 40px; }
  .games-page .section-head { margin-bottom: 26px; }
  .games-page .ribbon-head span { padding: 12px 52px 12px 22px; }
  .sg-tagline { font-size: 1.1rem; }
}
@media (max-width: 600px) {
  .sg-shot, .sg-grid-4 .sg-shot { flex-basis: 100%; }
}