/* ==========================================================================
   FUBK DEPARTMENT OF ARCHITECTURAL SCIENCE — Class of 2026
   Design System: Premium Architectural Palette (Terracotta / Brass / Ink)
   ========================================================================== */

:root {
  /* ---- Base neutrals ---- */
  /*--bg-primary: #FFFFFF;
  --bg-secondary: #F7F5F1;
  --bg-tertiary: #EFEAE2;*/
  --ink: #1B2430;

  /* ---- Accents ---- */
  --accent-terracotta: #B5603A;
  --accent-terracotta-hover: #8C4529;
  --accent-brass: #9C7A3C;
  --accent-brick: #7A2E1D;

  /* ---- Section: Leadership ---- */
  /*--leadership-bg: #F7F5F1;
  --leadership-bg-rgb: 247, 245, 241;
  --leadership-bg-secondary: #EFEAE2;
  --leadership-bg-secondary-rgb: 239, 234, 226;*/
  --leadership-text: #1B2430;
  --leadership-accent: #7A2E1D;
  --leadership-border: #DCD5C9;

  /* ---- Section: Staff ---- */
  /*--staff-bg: #FFFFFF;
  --staff-bg-rgb: 255, 255, 255;
  --staff-bg-secondary: #F3F1EC;
  --staff-bg-secondary-rgb: 243, 241, 236;*/
  --staff-text: #2A2F36;
  --staff-accent: #B5603A;
  --staff-border: #E4E0D8;

  /* ---- Section: Students ---- */
  /*--students-bg: #FAF8F4;
  --students-bg-rgb: 250, 248, 244;
  --students-bg-secondary: #EFE7DC;
  --students-bg-secondary-rgb: 239, 231, 220;*/
  --students-text: #1F242B;
  --students-accent: #9C7A3C;
  --students-border: #E0D6C4;

  /* ---- Typography ---- */
  --h1-color: #161B22;
  --h2-color: #1F2630;
  --h3-color: #2B3340;
  --h4-color: #3B4452;
  --p-color: #454E5A;
  --small-color: #6B7280;
  --link-color: #B5603A;
  --link-hover-color: #8C4529;

  /* ---- Cards ---- */
  /*--card-bg: #FFFFFF;
  --card-bg-rgb: 255, 255, 255;*/
  --card-border: #E6E2D9;
  --card-shadow: rgba(27, 36, 48, 0.08);
  /*--card-hover-bg: #FBF9F5;
  --card-hover-bg-rgb: 251, 249, 245;*/
  --card-hover-border: #B5603A;
  --card-hover-shadow: rgba(181, 96, 58, 0.18);

  /* ---- Buttons ---- */
  --btn-primary-bg: #B5603A;
  --btn-primary-hover: #8C4529;
  --btn-secondary-border: #1B2430;
  --btn-secondary-hover-bg: #1B2430;
  --btn-text-on-primary: #FFFFFF;
  --btn-disabled-bg: #D8D3C8;
  --btn-disabled-text: #A6A090;

  /* ---- UI extras ---- */
  --navbar-bg: rgba(255, 255, 255, 0.95);
  --footer-bg: #1B2430;
  --footer-bg-rgb: 27, 36, 48;
  --footer-text: #8C4529;
  --icon-color: #33363b;
  --divider-color: #E6E2D9;
  --badge-bg: #F1E4D8;
  --badge-text: #8C4529;

  /* ---- Page background image + glass effect ---- */
  --page-bg-image: url("jpg-files/bg-2.avif");
  --glass-alpha: 0.72;

  /* ---- Radius ---- */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-full: 50%;

  /* ---- Shadows ---- */
  --shadow-sm: 0 1px 2px rgba(27, 36, 48, 0.06);
  --shadow-md: 0 4px 12px rgba(27, 36, 48, 0.08);
  --shadow-lg: 0 12px 24px rgba(27, 36, 48, 0.10);
  --shadow-hover: 0 16px 32px rgba(181, 96, 58, 0.18);

  /* ---- Transitions ---- */
  --transition-fast: 150ms ease-out;
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* ---- Spacing ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 128px;
}

/* Dark mode — activated manually via the toggle button (adds data-theme="dark" to <html>) */
[data-theme="dark"] {
    --bg-primary: #12161C;
    --bg-secondary: #181D24;
    --bg-tertiary: #1E242C;
    --ink: #E7E9EC;

    --accent-terracotta: #C97A54;
    --accent-terracotta-hover: #B5603A;
    --accent-brass: #C4A467;
    --accent-brick: #C97A54;

    --leadership-bg: #12161C;
    --leadership-bg-rgb: 18, 22, 28;
    --leadership-bg-secondary: #1A2029;
    --leadership-bg-secondary-rgb: 26, 32, 41;
    --leadership-text: #E7E9EC;
    --leadership-accent: #C97A54;
    --leadership-border: #2A313C;

    --staff-bg: #161B22;
    --staff-bg-rgb: 22, 27, 34;
    --staff-bg-secondary: #1E242C;
    --staff-bg-secondary-rgb: 30, 36, 44;
    --staff-text: #DCE0E5;
    --staff-accent: #C97A54;
    --staff-border: #293039;

    --students-bg: #10141A;
    --students-bg-rgb: 16, 20, 26;
    --students-bg-secondary: #1C222B;
    --students-bg-secondary-rgb: 28, 34, 43;
    --students-text: #E7E9EC;
    --students-accent: #C4A467;
    --students-border: #2E3540;

    --h1-color: #F5F6F7;
    --h2-color: #E9EBEE;
    --h3-color: #DCE0E5;
    --h4-color: #C7CDD5;
    --p-color: #B8C0CA;
    --small-color: #8A94A0;
    --link-color: #D98F6B;
    --link-hover-color: #E7A98A;

    --card-bg: #181D24;
    --card-bg-rgb: 24, 29, 36;
    --card-border: #2A313C;
    --card-shadow: rgba(0, 0, 0, 0.45);
    --card-hover-bg: #1E242D;
    --card-hover-bg-rgb: 30, 36, 45;
    --card-hover-border: #C97A54;
    --card-hover-shadow: rgba(201, 122, 84, 0.25);

    --btn-primary-bg: #C97A54;
    --btn-primary-hover: #B5603A;
    --btn-secondary-border: #E7E9EC;
    --btn-secondary-hover-bg: #E7E9EC;
    --btn-text-on-primary: #12161C;
    --btn-disabled-bg: #2A313C;
    --btn-disabled-text: #5B6472;

    --navbar-bg: rgba(18, 22, 28, 0.95);
    --footer-bg: #0A0D11;
    --footer-bg-rgb: 10, 13, 17;
    --footer-text: #9AA3AD;
    --icon-color: #8A94A0;
    --divider-color: #242A33;
    --badge-bg: #2E241C;
    --badge-text: #E7A98A;

    --glass-alpha: 0.78;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.55);
    --shadow-hover: 0 16px 32px rgba(201, 122, 84, 0.25);
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'Suisse Int\'l', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-primary);
  color: var(--p-color);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition-slow), color var(--transition-slow);
  position: relative;
}

/* Fixed full-page background image — sits behind everything.
   Uses position:fixed on a pseudo-element rather than
   background-attachment:fixed, which iOS Safari handles unreliably. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: var(--page-bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Smooth cross-fade for any element whose color depends on the theme */
section,
header,
footer,
.card,
.leader-card,
.student-card {
  transition: background-color var(--transition-slow),
              border-color var(--transition-slow),
              box-shadow var(--transition-slow);
}

/* ==========================================================================
   THEME TOGGLE BUTTON
   ========================================================================== */

.theme-toggle {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  z-index: 1000;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-fast),
              background-color var(--transition-base),
              border-color var(--transition-base);
}

.theme-toggle:hover {
  transform: scale(1.08);
  border-color: var(--accent-terracotta);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  stroke: var(--icon-color);
  transition: stroke var(--transition-base);
}

.theme-toggle .icon-moon {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: block;
}

@media (max-width: 768px) {
  .theme-toggle {
    top: var(--space-3);
    right: var(--space-3);
    width: 40px;
    height: 40px;
  }
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--link-hover-color);
}

h1, h2, h3, h4 {
  font-family: 'Fraunces', 'Canela', Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h1 { color: var(--h1-color); font-size: clamp(1.9rem, 4vw, 2.75rem); line-height: 1.15; }
h2 { color: var(--h2-color); font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.2; margin-bottom: var(--space-6); text-align: center; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35), 0 0 1px rgba(255, 255, 255, 0.4); }
h3 { color: var(--h3-color); font-size: 1.15rem; line-height: 1.3; }
h4 { color: var(--h4-color); font-size: 1rem; }

p {
  color: var(--p-color);
  font-size: 1rem;
}

small {
  color: var(--small-color);
  font-size: 0.85rem;
}

section {
  padding: var(--space-9) var(--space-6);
}

/* ==========================================================================
   HEADER
   ========================================================================== */

header {
  background-color: rgba(var(--leadership-bg-rgb), var(--glass-alpha));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--leadership-border);
  padding: var(--space-8) var(--space-6);
  text-align: center;
}

.fubk-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.fubk-logo img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-full);
  border: 2px solid var(--leadership-border);
  box-shadow: var(--shadow-sm);
}

header h1 {
  margin-bottom: var(--space-2);
}

header h2 {
  color: var(--leadership-accent);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.95rem;
  margin-bottom: var(--space-4);
}

header p {
  color: var(--small-color);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ==========================================================================
   UNIVERSITY LEADERSHIP SECTION
   ========================================================================== */

.leadership {
  background: transparent;
}

.leadership h2 {
  color: var(--leadership-accent);
}

.leadership-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
  max-width: 1000px;
  margin: 0 auto;
}

.leader-card {
  background-color: rgba(var(--card-bg-rgb), var(--glass-alpha));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--leadership-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base),
              box-shadow var(--transition-base),
              border-color var(--transition-base);
}

.leader-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--leadership-accent);
}

.leader-card img {
  width: 100%;
  height: 280px;
  object-fit: contain;
  filter: grayscale(15%);
  transition: filter var(--transition-slow);
}

.leader-card:hover img {
  filter: grayscale(0%);
}

.leader-card.featured {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--space-8);
  border: 1px solid var(--leadership-accent);
  border-top: 3px solid var(--leadership-accent);
  padding: var(--space-6);
  background-color: rgba(var(--card-bg-rgb), var(--glass-alpha));
}

.leader-card.featured img {
  width: 260px;
  height: 100%;
  flex-shrink: 0;
  border-radius: var(--radius-lg);
}

.leader-card.featured .leader-info {
  padding: 0;
  text-align: left;
}

.leader-card.featured .leader-info::before {
  content: "Office of the Vice Chancellor";
  display: block;
  color: var(--leadership-accent);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-3);
}

.leader-card.featured .leader-info h3 {
  font-size: 1.6rem;
  margin-bottom: var(--space-2);
}

.leader-card.featured .leader-info .title {
  font-size: 1rem;
  margin-bottom: var(--space-4);
}

.leader-card.featured .leader-info p:not(.title) {
  font-size: 1.02rem;
  max-width: 55ch;
}

/* Dean + HOD sit in the row below the featured VC card */
.leader-card:not(.featured) {
  display: flex;
  flex-direction: column;
}

.leader-info {
  padding: var(--space-5);
}

.leader-info h3 {
  color: var(--leadership-text);
  margin-bottom: var(--space-1);
}

.leader-info .title {
  color: var(--leadership-accent);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-3);
}

.leader-info p:not(.title) {
  color: var(--p-color);
  font-size: 0.95rem;
}

/* ==========================================================================
   STAFF SECTION
   ========================================================================== */

.staff {
  background: transparent;
}

.staff h2 {
  color: var(--staff-accent);
}

.cc {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--space-5);
  max-width: 1300px;
  margin: 0 auto;
}

/* ==========================================================================
   SHARED CARD STYLE (Staff + SAS Excos use .card)
   ========================================================================== */

.card {
  background-color: rgba(var(--card-bg-rgb), var(--glass-alpha));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--staff-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base),
              box-shadow var(--transition-base),
              border-color var(--transition-base),
              background-color var(--transition-base);
}

.card:hover {
  transform: translateY(-4px);
  background-color: rgba(var(--card-hover-bg-rgb), var(--glass-alpha));
  box-shadow: var(--card-hover-shadow);
  border-color: var(--card-hover-border);
}

.card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  filter: grayscale(10%);
  transition: transform var(--transition-slow), filter var(--transition-slow);
}

.card:hover img {
  transform: scale(1.04);
  filter: grayscale(0%);
}

.card h3 {
  color: var(--staff-text);
  font-size: 1rem;
  margin: var(--space-4) var(--space-3) var(--space-1);
}

.card p {
  color: var(--staff-accent);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0 var(--space-3) var(--space-4);
}

/* ==========================================================================
   SAS EXCOS SECTION
   ========================================================================== */

.sas-ex {
  background: transparent;
}

.sas-ex h2 {
  color: var(--accent-brick);
}

.sas-cc {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-5);
  max-width: 1300px;
  margin: 0 auto;
}

.sas-ex .card {
  border-color: var(--leadership-border);
}

.sas-ex .card:hover {
  border-color: var(--accent-brick);
}

.sas-ex .card p {
  color: var(--accent-brick);
}

/* ==========================================================================
   GRADUATING STUDENTS SECTION
   ========================================================================== */

.students {
  background: transparent;
}

.students h2 {
  color: var(--students-accent);
}

.students a h3 {
  background: fixed linear-gradient(to right, var(--students-accent), var(--accent-brass));
  color: var(--students-text);
}

.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-6);
  max-width: 1300px;
  margin: 0 auto;
}

.student-card {
  display: block;
  background-color: rgba(var(--card-bg-rgb), var(--glass-alpha));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--students-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base),
              box-shadow var(--transition-base),
              border-color var(--transition-base);
}

.student-card:hover {
  transform: scale(1.02);
  box-shadow: var(--card-hover-shadow);
  border-color: var(--students-accent);
}

.student-card img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  background-color: var(--students-bg-secondary);
  transition: transform var(--transition-slow);
}

.student-card:hover img {
  transform: scale(1.05);
}

.student-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(27, 36, 48, 0.55), transparent 60%);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.student-card:hover::after {
  opacity: 1;
}

.student-card h3 {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-4);
  color: #FFFFFF;
  font-size: 1rem;
  z-index: 2;
  transform: translateY(8px);
  opacity: 0.92;
  transition: transform var(--transition-base);
}

.student-card:hover h3 {
  transform: translateY(0);
  opacity: 1;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn-1,
.btn-2 {
  display: inline-block;
  font-weight: 600;
  font-size: 0.95rem;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-base),
              color var(--transition-base),
              transform var(--transition-fast),
              box-shadow var(--transition-base);
}

.btn-1 {
  background-color: var(--btn-primary-bg);
  color: var(--btn-text-on-primary);
  border: 1px solid var(--btn-primary-bg);
}

.btn-1:hover {
  background-color: var(--btn-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: var(--btn-text-on-primary);
}

.btn-2 {
  background-color: transparent;
  color: var(--accent-terracotta);
  border: 1px solid var(--accent-terracotta);
}

.btn-2:hover {
  background-color: var(--accent-terracotta);
  color: var(--btn-text-on-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-disabled {
  background-color: var(--btn-disabled-bg);
  color: var(--btn-disabled-text);
  border: 1px solid var(--btn-disabled-bg);
  cursor: not-allowed;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

footer {
  background: blur(50px);
  color: var(--footer-text);
  text-align: center;
  padding: var(--space-8) var(--space-6);
}

footer p {
  color: var(--footer-text);
  font-size: 0.9rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.developer-credit {
  color: var(--small-color);
  font-size: 0.85rem;
  max-width: 560px;
  margin: 0 auto var(--space-5);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

footer .btn-2 {
  border-color: var(--accent-terracotta);
  color: var(--accent-terracotta);
}

footer .btn-2:hover {
  background-color: var(--accent-terracotta);
  color: #FFFFFF;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
  section {
    padding: var(--space-7) var(--space-4);
  }

  .fubk-logo {
    gap: var(--space-3);
  }

  .fubk-logo img {
    width: 56px;
    height: 56px;
  }

  .leadership-container,
  .cc,
  .sas-cc,
  .student-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-4);
  }

  .leader-card img,
  .leader-card.featured img {
    height: 220px;
  }

  .leader-card.featured {
    flex-direction: column;
    text-align: center;
    gap: var(--space-5);
  }

  .leader-card.featured img {
    width: 100%;
    height: 260px;
  }

  .leader-card.featured .leader-info {
    text-align: center;
  }

  .leader-card.featured .leader-info p:not(.title) {
    max-width: none;
  }
}

/* ---- Small phones (iPhone SE 2nd/3rd gen — 375px width — and similar) ----
   Staff: 2 columns · SAS Excos: 3 columns · Students: 3 columns */
@media (max-width: 600px) {
  section {
    padding: var(--space-6) var(--space-3);
  }

  h2 {
    font-size: 1.3rem;
    margin-bottom: var(--space-4);
  }

  /* Staff — 2 columns */
  .cc {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

  .cc .card img {
    height: 150px;
  }

  .cc .card h3 {
    font-size: 0.82rem;
    margin: var(--space-2) var(--space-2) var(--space-1);
  }

  .cc .card p {
    font-size: 0.72rem;
    padding: 0 var(--space-2) var(--space-3);
    line-height: 1.35;
  }

  /* SAS Excos — 3 columns */
  .sas-cc {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
  }

  .sas-cc .card img {
    height: 110px;
  }

  .sas-cc .card h3 {
    font-size: 0.68rem;
    margin: var(--space-1) var(--space-1) 2px;
    line-height: 1.25;
  }

  .sas-cc .card p {
    font-size: 0.6rem;
    padding: 0 var(--space-1) var(--space-2);
    line-height: 1.25;
  }

  /* Graduating Students — 3 columns */
  .student-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
  }

  .student-card img {
    height: 120px;
  }

  .student-card h3 {
    font-size: 0.7rem;
    padding: var(--space-2) var(--space-1);
  }

  /* Tighter radius reads better on small tiles */
  .cc .card,
  .nacos-cc .card,
  .student-card {
    border-radius: var(--radius-md);
  }
}

/* =========================================================
   PHOTO GALLERY
   ========================================================= */

/* Main gallery section */
.photo-gallery {
    width: 100%;
    padding: 60px 20px;
    box-sizing: border-box;
    text-align: center;
}

/* Gallery heading */
.gallery-heading {
    margin: 0 0 35px;
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Optional gallery introduction */
.photo-gallery > p {
    max-width: 750px;
    margin: 0 auto 30px;
    line-height: 1.7;
}


/* =========================================================
   GALLERY GRID — DESKTOP
   ========================================================= */

.gallery-grid {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;

    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;

    box-sizing: border-box;
}


/* =========================================================
   GALLERY ITEM
   ========================================================= */

.gallery-item {
    width: 100%;
    margin: 0;
    padding: 0;

    overflow: hidden;
    border-radius: 12px;

    position: relative;

    box-sizing: border-box;

    /* Keeps the cards visually consistent */
    background: rgba(0, 0, 0, 0.04);

    /* Smooth hover animation */
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}


/* Hover effect */
.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}


/* =========================================================
   GALLERY IMAGE
   ========================================================= */

.gallery-item img {
    display: block;

    width: 100%;
    max-width: 100%;
    height: auto;

    margin: 0;
    padding: 0;

    object-fit: contain;

    transition: transform 0.4s ease;

    box-sizing: border-box;
}


/* Image zoom on hover */
.gallery-item:hover img {
    transform: scale(1.04);
}


/* =========================================================
   GALLERY CAPTION
   ========================================================= */

.gallery-item figcaption {
    width: 100%;

    padding: 12px 10px;

    box-sizing: border-box;

    font-size: 0.95rem;
    line-height: 1.4;
    font-weight: 500;

    text-align: center;

    background: rgba(0, 0, 0, 0.05);
}

/* BACK TO TOP */
.back-to-top {
    position: fixed;
    right: 5px;
    bottom: 10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent-brass);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    box-shadow: var(--shadow);
    z-index: 999;
}

.back-to-top:hover {
    background: var(--primary);
}

/* =========================================================
   TABLETS
   ========================================================= */

@media (max-width: 1000px) {

    .photo-gallery {
        padding: 50px 18px;
    }

    .gallery-heading {
        font-size: 2rem;
        margin-bottom: 30px;
    }

    .gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
    }

    .gallery-item {
        border-radius: 10px;
    }

    .gallery-item figcaption {
        font-size: 0.9rem;
        padding: 10px 8px;
    }
}


/* =========================================================
   SMALL TABLETS / LARGE PHONES
   ========================================================= */

@media (max-width: 768px) {

    .photo-gallery {
        padding: 45px 15px;
    }

    .gallery-heading {
        font-size: 1.8rem;
        margin-bottom: 25px;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .gallery-item {
        border-radius: 9px;
    }

    .gallery-item figcaption {
        font-size: 0.85rem;
        padding: 9px 6px;
    }
}


/* =========================================================
   PHONES — TWO IMAGES PER ROW
   ========================================================= */

@media (max-width: 600px) {

    .photo-gallery {
        width: 100%;
        padding: 35px 12px;
        box-sizing: border-box;
    }

    .gallery-heading {
        font-size: 1.6rem;
        line-height: 1.3;
        margin-bottom: 20px;
    }

    .photo-gallery > p {
        font-size: 0.9rem;
        line-height: 1.6;
        margin-bottom: 22px;
    }

    /*
       IMPORTANT:
       Two gallery images per row on phones.
    */
    .gallery-grid {
        width: 100%;

        display: grid;

        grid-template-columns: repeat(2, minmax(0, 1fr));

        gap: 12px;

        margin: 0 auto;
    }

    .gallery-item {
        width: 100%;
        min-width: 0;

        border-radius: 8px;

        overflow: hidden;
    }

    .gallery-item img {
        display: block;

        width: 100%;
        max-width: 100%;
        height: auto;

        object-fit: contain;
    }

    .gallery-item figcaption {
        width: 100%;

        font-size: 0.78rem;
        line-height: 1.3;

        padding: 8px 4px;

        overflow-wrap: break-word;
        word-wrap: break-word;
    }

    .gallery-item:hover {
        transform: none;
        box-shadow: none;
    }

    .gallery-item:hover img {
        transform: none;
    }
}


/* =========================================================
   iPHONE SE / SMALL PHONES
   390px AND BELOW
   ========================================================= */

@media (max-width: 390px) {

    .photo-gallery {
        padding: 28px 8px;
    }

    .gallery-heading {
        font-size: 1.4rem;
        margin-bottom: 18px;
    }

    .gallery-grid {
        /*
           Keep TWO images per row
           even on iPhone SE.
        */
        grid-template-columns: repeat(2, minmax(0, 1fr));

        gap: 8px;
    }

    .gallery-item {
        border-radius: 6px;
    }

    .gallery-item img {
        width: 100%;
        max-width: 100%;
        height: auto;
    }

    .gallery-item figcaption {
        font-size: 0.7rem;
        line-height: 1.25;

        padding: 6px 3px;
    }
}


/* =========================================================
   VERY SMALL PHONES
   ========================================================= */

@media (max-width: 340px) {

    .photo-gallery {
        padding-left: 6px;
        padding-right: 6px;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .gallery-item {
        border-radius: 5px;
    }

    .gallery-item figcaption {
        font-size: 0.65rem;
        padding: 5px 2px;
    }
}

/* ---- Extra-narrow fallback (anything under 340px, e.g. older/smaller devices) ---- */
@media (max-width: 340px) {
  .nacos-cc .card img,
  .student-card img {
    height: 95px;
  }

  .nacos-cc .card h3,
  .student-card h3 {
    font-size: 0.62rem;
  }

  .nacos-cc .card p {
    font-size: 0.55rem;
  }
}