/* 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 > Library   (same design system as the Transport page)
   Palette: deep forest green + gold, with ONE light green used for the
   list boxes. Everything is scoped under .library-page so it cannot leak
   into other pages.
   ========================================================================= */

.library-page {
  --l-body: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --l-head: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --l-forest: #0F3D2B;
  --l-forest-dark: #082A1D;
  --l-green: #1F7A4D;
  --l-gold: #F2B01E;
  --l-blue: #1667B0;
  --l-red: #D32F2F;
  --l-orange: #E8790E;
  --l-lgreen: #7CB342;        /* light green – list boxes */
  --l-lgreen-bg: #EEF7E3;
  --l-lgreen-line: #CFE6B0;
  --l-tint: #F2F7F3;
  --l-edge: #D3E3D8;
  --l-ink: var(--ink, #1a1a1a);
  --l-soft: var(--ink-soft, #555);
  --l-line: var(--line, #e5e7eb);
  --l-shadow: var(--shadow, 0 22px 50px -28px rgba(15, 61, 43, 0.45));
  background: #fff;
  font-family: var(--l-body);
}

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

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

.library-page .btn { font-size: 1rem; font-weight: 700; }

/* ---------- Banner placeholder (1920 x 600) ---------- */
.library-page .l-hero {
  position: relative;
  width: 100%;
  height: clamp(260px, 31.25vw, 600px);
  padding: 0;
  overflow: hidden;
  background: linear-gradient(135deg, #0F3D2B 0%, #1F7A4D 100%);
}
.l-hero-img {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%;
  object-fit: cover; object-position: top;
  display: block;
}
.l-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;
}
.l-hero-ph i { font-size: 3.8rem; color: var(--l-gold); }
.l-hero-ph b { font-size: 1.5rem; }
.l-hero-ph span { font-size: 1rem; color: rgba(255, 255, 255, 0.9); }
.l-hero-ph code {
  background: rgba(255, 255, 255, 0.16);
  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)
   ========================================================================= */
.library-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;
}
.library-page .ribbon-head::before {              /* ribbon body, V-notch on the right */
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(90deg, #0F3D2B 0%, #1B6B46 100%);
  clip-path: polygon(0 0, 100% 0, calc(100% - 26px) 50%, 100% 100%, 0 100%);
  transform-origin: left center;
}
.library-page .ribbon-head::after {               /* folded corner under the left edge */
  content: ""; position: absolute; left: 0; top: 100%;
  width: 24px; height: 18px;
  background: var(--l-forest-dark);
  clip-path: polygon(0 0, 100% 0, 100% 100%);     /* right angle at top-right */
}
.library-page .ribbon-head span {
  position: relative; z-index: 1;
  display: block;
  padding: 14px 70px 14px 30px;
  font-family: inherit;
}

/* ---------- Shared section heading wrapper ---------- */
.library-page .section-head { max-width: 900px; margin: 0 auto 34px; text-align: center; }
.library-page .section-head .ribbon-head { margin-bottom: 0; }
.library-page .section-head p.lede {
  margin: 34px 0 0; font-size: 1.2rem; font-weight: 500; line-height: 1.8; color: var(--l-soft);
}

/* ---------- 1. Our Library + Library at a Glance (one section, one box) ---------- */
.library-page .l-intro { padding: 38px 0 50px; text-align: center; }
.l-crumbs {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 1rem; font-weight: 600; color: var(--l-soft);
  margin: 0 0 18px;
}
.l-crumbs a:hover { color: var(--l-green); }
.l-crumbs i { font-size: 0.6rem; }
.l-crumbs span { color: var(--l-red); }

.l-box {
  position: relative;
  background: linear-gradient(180deg, #fff 0%, var(--l-tint) 100%);
  border: 1px solid var(--l-edge);
  border-bottom: 8px solid var(--l-forest);
  border-radius: 14px;
  padding: 38px 36px 42px;
  box-shadow: 0 40px 70px -44px rgba(15, 61, 43, 0.6);
}
.library-page .l-title {
  font-size: clamp(2.3rem, 5vw, 3.9rem);
  font-weight: 700; line-height: 1.1; letter-spacing: -0.01em;
  color: var(--l-forest);
  margin: 0;
}
.l-box .section-head { margin: 34px auto 36px; }

.l-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; perspective: 1000px; }
.l-stat {
  display: flex; align-items: stretch;
  background: #fff;
  border: 1px solid var(--l-edge);
  border-radius: 10px;
  text-align: left;
  box-shadow: 0 18px 36px -26px rgba(15, 61, 43, 0.6);
  transform-style: preserve-3d;
  will-change: transform;
}
.l-stat-ico {
  flex: 0 0 76px;
  display: flex; align-items: center; justify-content: center;
  background: var(--l-forest); color: var(--l-gold);
  border-radius: 9px 0 0 9px;
  font-size: 1.6rem;
}
.l-stat-ico i { transform: translateZ(26px); }
.l-stat-body { padding: 22px 20px 20px; transform: translateZ(18px); min-width: 0; }
.l-stat-value { line-height: 1; white-space: nowrap; }
.library-page .l-num { font-size: clamp(2rem, 3vw, 2.7rem); font-weight: 800; color: var(--l-forest); }
.library-page .l-unit { font-size: clamp(1.2rem, 1.8vw, 1.5rem); font-weight: 800; color: var(--l-forest); }
.l-stat-body p { margin: 10px 0 0; color: var(--l-soft); font-size: 1.12rem; font-weight: 600; }

/* ---------- 2. About (split) ---------- */
.library-page .l-about { padding: 52px 0 56px; background: var(--l-tint); }
.l-split {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 64px; align-items: center;
}
.l-split-copy { padding-bottom: 18px; }
.library-page .l-lead {
  font-size: clamp(1.35rem, 2.4vw, 1.8rem);
  font-weight: 700; line-height: 1.3; color: var(--l-forest);
  margin: 0 0 18px;
}
.l-split-copy p { font-size: 1.15rem; font-weight: 500; line-height: 1.9; color: var(--l-soft); margin: 0 0 14px; }

.l-split-photo { position: relative; padding: 24px 28px 28px 24px; }
.l-split-photo::before {
  content: ""; position: absolute; right: 0; bottom: 0; z-index: 0;
  width: 78%; height: 78%;
  background: var(--l-gold); border-radius: 30px;
}
.l-split-photo::after {
  content: ""; position: absolute; left: 0; top: 0; z-index: 0;
  width: 120px; height: 120px; border-radius: 50%;
  border: 10px solid var(--l-forest);
}
.l-photo-frame {
  position: relative; z-index: 1;
  aspect-ratio: 1 / 1;
  border-radius: 28px; overflow: hidden;
  border: 8px solid #fff;
  background: var(--l-tint);
  box-shadow: 0 30px 60px -28px rgba(15, 61, 43, 0.6);
}
.l-photo-frame img {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%; object-fit: cover;
}
.l-photo-ph {
  position: absolute; inset: 14px; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; padding: 16px;
  border: 2px dashed #9CC7AE; border-radius: 18px; color: var(--l-forest);
}
.l-photo-ph i { font-size: 3rem; color: var(--l-green); opacity: 0.7; }
.l-photo-ph b { font-size: 1.1rem; }
.l-photo-ph span { font-size: 0.9rem; color: var(--l-soft); line-height: 1.6; }
.l-photo-ph code { background: #fff; padding: 2px 8px; border-radius: 6px; font-size: 0.82rem; }

/* ---------- 3. Categories ---------- */
.library-page .l-cats { padding: 52px 0 56px; background: #fff; }
.l-cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.l-cat {
  background: #fff;
  border: 1px solid var(--l-edge);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 18px 36px -28px rgba(15, 61, 43, 0.5);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.l-cat:hover { transform: translateY(-6px); box-shadow: var(--l-shadow); }

.l-cat-media {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  background: linear-gradient(135deg, #EAF5EE, #F7F3D9);
}
.l-cat-media img {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%; object-fit: cover;
}
.l-cat-ph {
  position: absolute; inset: 10px; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; text-align: center; padding: 6px;
  border: 2px dashed #9CC7AE; border-radius: 10px; color: var(--l-forest);
}
.l-cat-ph i { font-size: 1.8rem; color: var(--l-green); opacity: 0.75; }
.l-cat-ph b { font-size: 0.95rem; }
.l-cat-ph span { font-size: 0.85rem; }
.l-cat-ph code { background: #fff; padding: 1px 6px; border-radius: 5px; font-size: 0.8rem; }
.l-cat-icon {
  position: absolute; left: 14px; bottom: 12px; z-index: 3;
  width: 46px; height: 46px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--l-forest); color: var(--l-gold); font-size: 1.1rem;
  box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.55);
}
.l-cat-body { padding: 18px 20px 22px; }
.library-page .l-cat-body h3 { font-size: 1.25rem; font-weight: 700; color: var(--l-forest); margin: 0 0 8px; }
.l-cat-body p { margin: 0; font-size: 1.08rem; font-weight: 500; line-height: 1.65; color: var(--l-soft); }

/* ---------- Quote boxes — one light-green colour, quote mark only at the start ---------- */
.library-page .quote-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 14px;
}
.library-page .quote-list li {
  display: flex; align-items: stretch;
  background: var(--l-lgreen-bg);
  border: 1px solid var(--l-lgreen-line);
  border-radius: 8px;
  overflow: hidden;
  font-weight: 700; font-size: 1.18rem; line-height: 1.5; color: var(--l-ink);
}
.library-page .quote-list li i {
  flex: 0 0 auto;
  width: 58px;
  display: flex; align-items: center; justify-content: center;
  background: var(--l-lgreen); color: #fff; font-size: 1.2rem;
}
.library-page .quote-list li span { padding: 16px 20px; }

/* ---------- 4. Facilities (2 columns of quote boxes) ---------- */
.library-page .l-facilities { padding: 52px 0 56px; background: var(--l-tint); }
.library-page .quote-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; max-width: 1040px; margin: 0 auto; }

/* ---------- 5. Gallery — all photos the same medium size ---------- */
.library-page .l-gallery { padding: 52px 0 56px; background: #fff; }
.l-gallery-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px; }
.l-shot {
  --c: var(--l-red);
  position: relative; overflow: hidden; margin: 0;
  flex: 0 1 calc((100% - 48px) / 3);
  min-width: 260px;
  aspect-ratio: 4 / 3;
  border-radius: 22px;
  background: linear-gradient(135deg, #EAF5EE, #F7F3D9);
  box-shadow: var(--l-shadow);
}
.l-shot-ph {
  position: absolute; inset: 14px; z-index: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; text-align: center;
  padding: 12px 12px 58px;
  border: 2px dashed #9CC7AE; border-radius: 16px; color: var(--l-forest);
}
.l-shot-ph i { font-size: 2.4rem; color: var(--l-green); opacity: 0.7; }
.l-shot-ph b { font-size: 1rem; }
.l-shot-ph span { font-size: 0.85rem; color: var(--l-soft); line-height: 1.6; }
.l-shot-ph code { background: #fff; padding: 2px 8px; border-radius: 6px; font-size: 0.8rem; color: var(--l-forest); }
.l-shot img {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.6s ease;
}
.l-shot:hover img { transform: scale(1.08); }
.l-shot-caption {
  position: absolute; left: 0; bottom: 22px; z-index: 2;
  background: var(--c); color: #fff;
  padding: 10px 26px 10px 20px;
  border-radius: 0 999px 999px 0;
  font-family: var(--l-body);
  font-weight: 700; font-size: 1.08rem;
  box-shadow: 0 10px 22px -10px rgba(0, 0, 0, 0.5);
}
.l-shot:nth-child(1) { --c: var(--l-red); }
.l-shot:nth-child(2) { --c: var(--l-blue); }
.l-shot:nth-child(3) { --c: var(--l-green); }
.l-shot:nth-child(4) { --c: var(--l-orange); }
.l-shot:nth-child(5) { --c: var(--l-forest); }
.l-shot:nth-child(6) { --c: var(--l-blue); }

/* ---------- 6. Rules ---------- */
.library-page .l-rules { padding: 52px 0 56px; background: var(--l-tint); }
.l-rules-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px;
  max-width: 1040px; margin: 0 auto;
}
.l-rule-col {
  --c: var(--l-lgreen);
  --bg: var(--l-lgreen-bg);
  --line: var(--l-lgreen-line);
  background: #fff;
  border: 1px solid var(--l-edge);
  border-radius: 12px;
  padding: 28px 26px 26px;
  box-shadow: 0 18px 36px -28px rgba(15, 61, 43, 0.45);
}
.l-rule-col.l-dont { --c: var(--l-red); --bg: #FDECEC; --line: #F3C2C2; }
.library-page .l-rule-col h3 {
  display: flex; align-items: center; gap: 14px;
  font-size: 1.5rem; font-weight: 700; color: var(--l-forest); margin: 0 0 20px;
}
.l-rule-ico {
  width: 48px; height: 48px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--c); color: #fff; font-size: 1.25rem;
}
.l-rule-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.l-rule-list li {
  display: flex; align-items: stretch;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  font-weight: 700; font-size: 1.12rem; line-height: 1.5; color: var(--l-ink);
}
.l-rule-list li i {
  flex: 0 0 auto; width: 50px;
  display: flex; align-items: center; justify-content: center;
  background: var(--c); color: #fff; font-size: 0.95rem;
}
.l-rule-list li span { padding: 14px 18px; }

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

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

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

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

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .l-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 899px) {
  .l-cat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  .l-split { grid-template-columns: 1fr; gap: 48px; }
  .l-split-photo { max-width: 520px; margin: 0 auto; width: 100%; }
  .l-shot { flex-basis: calc((100% - 24px) / 2); }
  .l-rules-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .library-page .l-intro { padding: 28px 0 34px; }
  .l-box { padding: 28px 18px 30px; }
  .l-box .section-head { margin: 28px auto 26px; }
  .library-page .l-about,
  .library-page .l-cats,
  .library-page .l-facilities,
  .library-page .l-gallery,
  .library-page .l-rules { padding: 36px 0 40px; }
  .library-page .section-head { margin-bottom: 26px; }
  .library-page .section-head p.lede { margin-top: 28px; }
  .library-page .ribbon-head span { padding: 12px 52px 12px 22px; }
  .l-stats-grid { grid-template-columns: 1fr; max-width: 460px; margin: 0 auto; }
  .library-page .quote-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .l-cat-grid { grid-template-columns: 1fr; }
  .l-shot { flex-basis: 100%; }
  .library-page .quote-list li i { width: 48px; }
  .library-page .quote-list li { font-size: 1.08rem; }
  .l-stat-ico { flex-basis: 70px; }
}