/* ------------------------------------------
   Global Overflow Prevention
------------------------------------------ */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

/* ------------------------------------------
   Section Titles
------------------------------------------ */
.resources-section {
  margin: 10rem 0 0 0;
  position: relative;
}

.resources-section:first-child {
  margin: 2rem 0 0 0;
}

.section-title {
  text-align: left;
  padding-left: var(--spacer-md);
  position: relative;
  z-index: 10;
  margin-bottom: 0;
}

.section-title h1 {
  font-family: var(--font-secondary);
  font-size: 5rem !important;
  font-weight: 700;
  letter-spacing: -0.2rem;
  text-transform: uppercase;
  margin-left: 10%;
  margin-bottom: 0;
  line-height: 1;
}

/* -------------------------------------------------
   Videos section title override (consistent style)
   Base size 4rem as requested, with responsive scale
   ------------------------------------------------- */
.videos-title {
  text-align: left;
  position: relative;
  z-index: 10;
  margin-bottom: 0;
}

.videos-title h1 {
  font-family: var(--font-secondary);
  font-size: 5rem;
  font-weight: 700;
  letter-spacing: -0.2rem;
  text-transform: uppercase;
  margin-bottom: 0;
  line-height: 1;
}

@media (max-width: 1199px) {
  .videos-title h1 {
    font-size: 3.5rem;
    margin-left: 6%;
  }
}

@media (max-width: 767px) {
  .videos-title {
    padding-left: 1rem;
    text-align: center;
  }

  .videos-title h1 {
    font-size: 2.8rem;
    margin-left: 0;
  }
}

/* ------------------------------------------
   Railway Track Layout
------------------------------------------ */
.railway-tracks {
  margin: -1rem 0 0 0;
  background: transparent;
  overflow-x: hidden;
  max-width: 100%;
}

.track {
  display: grid;
  grid-template-columns: 12vw 1fr 1fr 1fr 12vw;
  background-color: transparent;
  gap: 0;
  border-top: 1px solid;
  border-bottom: 1px solid;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.track-cell {
  padding: var(--spacer-md);
  background-color: transparent;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: 500px;
  height: auto;
  border-right: 1px solid;
  border-left: 1px solid;
  overflow: hidden;
}

.track-cell:first-child,
.track-cell:last-child {
  border-right: none;
}

/* ------------------------------------------
   Arrow Navigation
------------------------------------------ */
.arrow-cell {
  display: flex;
  align-items: center;
  background: transparent;
  justify-content: center;
}

.nav-arrow {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: var(--spacer-sm);
  border-radius: 50%;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px; /* Touch target size */
  min-width: 64px;
}



.nav-arrow img {
  width: 4.4rem;
  height: 4.4rem;
  object-fit: contain;
}

/* ------------------------------------------
   Resource Cards
------------------------------------------ */
.content-cell {
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: var(--spacer-md);
  justify-content: space-between;
}

.resource-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  justify-content: space-between;
}

.resource-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex-grow: 1;
}

.resource-image {
  margin-bottom: var(--spacer-sm);
  flex-shrink: 0;
  align-self: flex-start;
}

.resource-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  flex-grow: 1;
}

.resource-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: var(--spacer-md);
  width: 100%;
}

/* Remove text decoration from links */
.resource-actions a,
.resource-info a {
  text-decoration: none;
  color: inherit;
}

.resource-actions a:hover,
.resource-info a:hover {
  text-decoration: none;
}

/* ------------------------------------------
   Image Sizing per Section
------------------------------------------ */
.books .resource-image img {
  width: 16rem;
  height: 24rem;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.booklets .resource-image img {
  width: 15rem;
  height: 15rem;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.manuals .resource-image img {
  width: 16rem;
  height: 24rem;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.reports .resource-image img {
  width: 16rem;
  height: 24rem;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ------------------------------------------
   Typography
------------------------------------------ */
.resource-text h2 {
  font-family: var(--font-primary);
  font-size: 1.8rem;
  font-weight: 500;
  margin: var(--spacer-sm) 0;
  color: #252422;
  line-height: 1.3;
  text-align: left;
}

.resource-text p {
  font-family: var(--font-primary);
  font-size: 1.4rem;
  line-height: 1.6;
  margin-bottom: var(--spacer-sm);
  color: #252422;
  flex-grow: 1;
  max-width: 90%;
  text-align: left;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

/* Allow more lines for the first cell with longer content */
.books .track-cell:nth-child(2) .resource-text p {
  -webkit-line-clamp: 10;
  max-width: 95%;
}

/* ------------------------------------------
   Button Styles
------------------------------------------ */
.resource-btn {
  font-family: var(--font-primary);
  font-weight: var(--font-weight-medium);
  padding: var(--spacer-xs) var(--spacer-sm);
  background-color: transparent;
  cursor: pointer;
  font-size: 1rem;
  border-radius: 6px;
  transition: all 0.3s ease;
  margin: 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid;
  min-height: 44px; /* Touch target size */
  display: flex;
  align-items: center;
  justify-content: center;
}

.resource-btn:hover {
  transform: translateY(-2px);
}

.resource-btn.unavailable {
  background-color: transparent;
  color: #999;
  border-color: #999;
  cursor: not-allowed;
  opacity: 0.7;
}

.resource-btn.unavailable:hover {
  transform: none;
  background-color: transparent;
  color: #999;
}

.button-group {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: var(--spacer-xs);
  flex-wrap: wrap;
}

.language-options {
  display: flex;
  gap: var(--spacer-xs);
  flex-wrap: wrap;
}

/* ------------------------------------------
   Section Colors (Borders, Titles, Buttons)
------------------------------------------ */

/* Books: Red color (#C32921) */
.books-section .section-title h1 {
  color: #C32921;
}

.books .track {
  border-color: #C32921;
}

.books .track-cell {
  border-color: #C32921;
}

.books .nav-arrow img {
  filter: brightness(0) saturate(100%) invert(16%) sepia(85%) saturate(1650%) hue-rotate(345deg) brightness(95%) contrast(98%);
}
 .nav-arrow img{
  height: 40%;
  width: 40%;
 }
.books .resource-btn:not(.unavailable) {
  color: #C32921;
  border-color: #C32921;
}

.books .resource-btn:not(.unavailable):hover {
  background-color: #C32921;
  color: white;
}

/* Booklets: Green color (#339A5E) */
.booklets-section .section-title h1 {
  color: #339A5E;
}

.booklets .track {
  border-color: #339A5E;
}

.booklets .track-cell {
  border-color: #339A5E;
}

.booklets .nav-arrow img {
  filter: brightness(0) saturate(100%) invert(42%) sepia(47%) saturate(1847%) hue-rotate(130deg) brightness(94%) contrast(87%);
}

.booklets .resource-btn:not(.unavailable) {
  color: #339A5E;
  border-color: #339A5E;
}

.booklets .resource-btn:not(.unavailable):hover {
  background-color: #339A5E;
  color: white;
}

/* Manuals: Pink color (#C74A9B) */
.manuals-section .section-title h1 {
  color: #C74A9B;
}

.manuals .track {
  border-color: #C74A9B;
}

.manuals .track-cell {
  border-color: #C74A9B;
}

.manuals .nav-arrow img {
  filter: brightness(0) saturate(100%) invert(42%) sepia(96%) saturate(1015%) hue-rotate(294deg) brightness(94%) contrast(88%);
}

.manuals .resource-btn:not(.unavailable) {
  color: #C74A9B;
  border-color: #C74A9B;
}

.manuals .resource-btn:not(.unavailable):hover {
  background-color: #C74A9B;
  color: white;
}

/* Reports: Green color (#339A5E) */
.reports-section .section-title h1 {
  color: #339A5E;
}

.reports .track {
  border-color: #339A5E;
}

.reports .track-cell {
  border-color: #339A5E;
}

.reports .nav-arrow img {
  filter: brightness(0) saturate(100%) invert(42%) sepia(47%) saturate(1847%) hue-rotate(130deg) brightness(94%) contrast(87%);
}

.reports .resource-btn:not(.unavailable) {
  color: #339A5E;
  border-color: #339A5E;
}

.reports .resource-btn:not(.unavailable):hover {
  background-color: #339A5E;
  color: white;
}

/* ------------------------------------------
   PROFESSIONAL RESPONSIVE DESIGN
------------------------------------------ */

/* Large Desktop - 1440px+ */
@media (min-width: 1440px) {
  .track {
    grid-template-columns: 15vw 1fr 1fr 1fr 15vw;
  }
  
  .section-title h1 {
    font-size: 4.5rem;
  }
  
  .track-cell {
    min-height: 550px;
    height: auto;
  }
}

/* Desktop - 1200px to 1439px */
@media (max-width: 1439px) and (min-width: 1200px) {
  .track {
    grid-template-columns: 10vw 1fr 1fr 1fr 10vw;
  }
  
  .section-title h1 {
    font-size: 3.8rem;
    margin-left: 8%;
  }
  
  .track-cell {
    min-height: 480px;
    height: auto;
    padding: 2rem;
  }
}

/* Tablet Landscape - 1024px to 1199px */
@media (max-width: 1199px) and (min-width: 1024px) {
  .resources-section {
    margin: 2rem 0;
  }
  
  .section-title h1 {
    font-size: 3.5rem;
    margin-left: 6%;
  }
  
  .track {
    grid-template-columns: 8vw 1fr 1fr 1fr 8vw;
  }
  
  .track-cell {
    min-height: 450px;
    height: auto;
    padding: 1.8rem;
  }
  
  .resource-text h2 {
    font-size: 1.5rem;
  }
  
  .resource-text p {
    font-size: 1.2rem;
  }
  
  /* Slightly smaller images for tablets */
  .books .resource-image img,
  .manuals .resource-image img,
  .reports .resource-image img {
    width: 10rem;
    height: 16rem;
  }
  
  .booklets .resource-image img {
    width: 12rem;
    height: 12rem;
  }
}

/* Tablet Portrait - 768px to 1023px */
@media (max-width: 1023px) and (min-width: 768px) {
  .resources-section {
    margin: 2rem 0;
  }
  
  .section-title {
    padding-left: 2rem;
  }
  
  .section-title h1 {
    font-size: 3.2rem;
    margin-left: 4%;
  }
  
  .track {
    grid-template-columns: 4vw 1fr 1fr 1fr 4vw;
    width: 100%;
    max-width: 100vw;
  }

  .track-cell {
    min-height: 420px;
    height: auto;
    padding: 1.2rem;
  }

  /* Show all content cells on tablet */
  .track .content-cell {
    display: flex !important;
  }
  
  .resource-text h2 {
    font-size: 1.4rem;
  }
  
  .resource-text p {
    font-size: 1.1rem;
    max-width: 95%;
    -webkit-line-clamp: 4;
  }

  /* Maintain first cell extended content on tablet */
  .books .track-cell:nth-child(2) .resource-text p {
    -webkit-line-clamp: 5;
    max-width: 98%;
  }
  
  /* Optimized images for tablet */
  .books .resource-image img,
  .manuals .resource-image img,
  .reports .resource-image img {
    width: 9rem;
    height: 14rem;
  }
  
  .booklets .resource-image img {
    width: 11rem;
    height: 11rem;
  }
  
  .button-group {
    flex-direction: column;
    align-items: stretch;
  }
  
  .language-options {
    margin-top: 0.5rem;
  }
}

/* Mobile Landscape - 480px to 767px */
@media (max-width: 767px) and (min-width: 480px) {
  .resources-section {
    margin: 4rem 0;
  }
  
  .section-title {
    padding-left: 1rem;
    text-align: center;
  }
  
  .section-title h1 {
    font-size: 2.8rem;
    margin-left: 0;
  }
  
  .track {
    grid-template-columns: 1fr 1fr;
    width: 100%;
    max-width: 95vw;
    margin: 0 auto;
    gap: 1rem;
  }
  
  .arrow-cell {
    display: none;
  }
  
  .track-cell {
    height: auto;
    min-height: 400px;
    padding: 1.5rem;
    border: 1px solid !important;
    border-radius: 8px;
    margin-bottom: 1rem;
  }
  
  .content-cell {
    display: flex !important;
  }
  
  .resource-text h2 {
    font-size: 1.3rem;
    margin: 1rem 0 0.5rem 0;
  }
  
  .resource-text p {
    font-size: 1rem;
    line-height: 1.5;
    max-width: 100%;
  }
  
  /* Mobile-optimized images */
  .books .resource-image img,
  .manuals .resource-image img,
  .reports .resource-image img {
    width: 8rem;
    height: 12rem;
  }
  
  .booklets .resource-image img {
    width: 9rem;
    height: 9rem;
  }
  
  .resource-btn {
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
    min-height: 44px;
  }
  
  .button-group {
    width: 100%;
  }
  
  .language-options {
    width: 100%;
    justify-content: space-between;
  }
}

/* Mobile Portrait - 320px to 479px */
@media (max-width: 479px) {
  .resources-section {
    margin: 3rem 0;
  }
  
  .section-title {
    padding-left: 0.5rem;
    text-align: center;
  }
  
  .section-title h1 {
    font-size: 2.2rem;
    margin-left: 0;
    padding: 0 1rem;
  }
  
  .track {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 90vw;
    margin: 0 auto;
    gap: 1rem;
    border: none;
  }
  
  .arrow-cell {
    display: none;
  }
  
  .track-cell {
    height: auto;
    min-height: 350px;
    padding: 1.25rem;
    border: 1px solid !important;
    border-radius: 12px;
    margin-bottom: 1.5rem;
  }
  
  .content-cell {
    display: flex !important;
  }
  
  .resource-info {
    align-items: center;
    text-align: center;
  }
  
  .resource-image {
    align-self: center;
    margin-bottom: 1rem;
  }
  
  .resource-text {
    align-items: center;
    text-align: center;
  }
  
  .resource-text h2 {
    font-size: 1.2rem;
    margin: 0.75rem 0;
    text-align: center;
  }
  
  .resource-text p {
    font-size: 0.95rem;
    line-height: 1.4;
    text-align: center;
    max-width: 100%;
  }
  
  /* Compact mobile images */
  .books .resource-image img,
  .manuals .resource-image img,
  .reports .resource-image img {
    width: 10rem !important;
    height: 15rem !important;
  }
  
  .booklets .resource-image img {
    width: 12rem;
    height: 12rem;
  }
  
  .resource-actions {
    align-items: center;
    width: 100%;
  }
  
  .resource-btn {
    font-size: 0.85rem;
    padding: 0.6rem 1rem;
    width: 100%;
    max-width: 200px;
    text-align: center;
  }
  
  .button-group {
    width: 100%;
    flex-direction: column;
    align-items: center;
  }
  
  .language-options {
    width: 100%;
    justify-content: center;
    gap: 0.5rem;
  }
  
  .language-options .resource-btn {
    flex: 1;
    max-width: 80px;
  }
}

/* Ultra-small screens - 320px and below */
@media (max-width: 320px) {
  .section-title h1 {
    font-size: 1.8rem;
  }
  
  .track-cell {
    padding: 1rem;
    min-height: 320px;
  }
  
  .resource-text h2 {
    font-size: 1.1rem;
  }
  
  .resource-text p {
    font-size: 0.9rem;
  }
  
  .books .resource-image img,
  .manuals .resource-image img,
  .reports .resource-image img {
    width: 5.5rem;
    height: 8.5rem;
  }
  
  .booklets .resource-image img {
    width: 6.5rem;
    height: 6.5rem;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .resource-image img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Print styles */
@media print {
  .arrow-cell,
  .nav-arrow {
    display: none;
  }

  .track {
    grid-template-columns: 1fr 1fr 1fr;
    border: none;
  }

  .track-cell {
    border: 1px solid #000;
    height: auto;
    break-inside: avoid;
  }
}

/* ------------------------------------------
   Footer Social Icons Fix - Ensure Horizontal Layout
------------------------------------------ */
.footer_socials {
  display: flex !important;
  flex-direction: row !important;
  gap: 1rem !important;
  margin-bottom: 0.8rem !important;
  align-items: center !important;
  justify-content: flex-start !important;
}

.footer_socials picture {
  display: inline-block !important;
}

.footer_socials img {
  width: 45px !important;
  height: 45px !important;
  filter: brightness(0) invert(1) !important;
  transition: transform 0.3s ease !important;
  display: block !important;
}

.footer_socials img:hover {
  transform: scale(1.1) !important;
  cursor: pointer !important;
}

/* ------------------------------------------------------------------
   Styles moved from inline <style> in resources.html
   Purpose: carousel layout, small overrides and videos styles
   Kept here to keep all page-specific styles in one file.
   ------------------------------------------------------------------ */

/* Enforce horizontal carousel and responsive behaviour (page-level overrides) */
.railway-tracks .track { display:flex; align-items:center; gap:12px; }
.nav-arrow {
  cursor: pointer;
  padding: 8px;
  width: 68px;
  height: 68px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.nav-arrow img { width: 32px; height: 32px; display:block; }
.nav-arrow[disabled]{ opacity:.35; cursor:default; transform:none; }
.carousel-viewport { overflow:hidden; flex:1 1 auto; }
.carousel-container { display:flex; gap:16px; transition:transform 400ms ease; will-change:transform; align-items:stretch; }
.content-cell { box-sizing:border-box; flex:0 0 calc((100% - 32px) / 3); max-width:calc((100% - 32px) / 3); }
.content-cell picture, .content-cell img { width:100%; height:auto; display:block; }
@media (max-width:1023px){
  .nav-arrow{ display:none; }
  .carousel-viewport{ overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .carousel-container{ gap:12px; scroll-snap-type:x mandatory; }
  .content-cell{ flex:0 0 auto; width:70%; max-width:70%; scroll-snap-align:start; }
}
/* Vertical separators between items on desktop (restore previous visual style) */
@media (min-width:1024px) {
    /* Section-wise colored separators (thicker for clearer visual match with container borders) */
    #books .carousel-container .content-cell + .content-cell { border-left: 1px solid #C32921; padding-left: 16px; }
    #booklets .carousel-container .content-cell + .content-cell { border-left: 1px solid #339A5E; padding-left: 16px; }
    #manuals .carousel-container .content-cell + .content-cell { border-left: 1px solid #C74A9B; padding-left: 16px; }
    #reports-papers .carousel-container .content-cell + .content-cell { border-left: 1px solid #436E55; padding-left: 16px; }
  .carousel-container .content-cell { padding-right: 8px; }
}

/* Videos section styles (page-specific) */
#videos { padding: 5rem; }
#videos .section-title h1 { margin-top: 0; }
.videos-container { margin: 18px 0 40px; }
.video-group { margin-bottom: 28px; }
.video-group h2 { font-size: 3.35rem; margin: 0 0 16px; font-weight:800; letter-spacing:0.2px; }
.videos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
/* keep only the thumbnail visible: transparent card and overlay */
.video-card { position: relative; background: transparent; border-radius: 6px; overflow: hidden; cursor: pointer; box-shadow: none; }
.video-thumb img { display:block; width:100%; height:auto; }
.video-play-overlay { position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); width:64px; height:64px; background:rgba(0,0,0,0.45); border-radius:50%; display:flex; align-items:center; justify-content:center; }
.video-play-overlay svg{ width:28px; height:28px; fill: #fff; }
/* caption removed from DOM; if present it will be an overlay */
.video-title { display:none; }
.video-embed { position: relative; width:100%; padding-bottom:56.25%; height:0; }
.video-embed iframe{ position:absolute; left:0; top:0; width:100%; height:100%; border:0; }

@media (max-width:1023px){
  .videos-grid{ grid-template-columns: repeat(2, 1fr); }
}
@media (max-width:639px){
  .videos-grid{ grid-template-columns: 1fr; }
  .video-play-overlay { width:48px; height:48px; }
  .video-play-overlay svg{ width:20px; height:20px; }
}