/*
 * ntnu-theme.css
 * Matches the visual style of www.chem.ntnu.edu.tw (NTNU Chemistry Dept.)
 * Built by referencing the live site's Impreza/Elementor theme.
 *
 * HOW TO USE:
 *   Add the following two lines inside <head> of index.html,
 *   AFTER the existing <style> block so these rules take priority:
 *
 *   <link rel="preconnect" href="https://fonts.googleapis.com">
 *   <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;700&display=swap">
 *   <link rel="stylesheet" href="ntnu-theme.css">
 */

/* =====================================================================
   1. DESIGN TOKENS  — exact values from chem.ntnu.edu.tw
   ===================================================================== */
:root {
  /* Brand colours (sampled from the live site) */
  --ntnu-blue:        #4e070b;   /* logo/header bar — pixel sampled */
  --ntnu-blue-light:  #94142d;   /* nav bar — pixel sampled */
  --ntnu-blue-dark:   #3a0508;   /* footer — darkened header colour */
  --ntnu-red:         #94142d;   /* nav accent crimson — pixel sampled */
  --ntnu-gold:        #c8a951;   /* kept warm gold for contrast */

  /* Neutrals */
  --bg:               #ffffff;
  --bg-soft:          #f7f8fc;   /* hero/section bg — pixel sampled */
  --text:             #333333;
  --text-soft:        #666666;
  --border:           #dddddd;

  /* Typography — matches site's Google Fonts stack */
  --font-main: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC",
               "Helvetica Neue", Arial, sans-serif;

  /* Spacing scale (matches Impreza 20px grid) */
  --max-w: 1200px;               /* matches site's container width */
  --section-pad: 60px 0;
}

/* =====================================================================
   2. BASE RESET & BODY
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-main);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--ntnu-red); }
img { max-width: 100%; display: block; }

/* =====================================================================
   3. TOP UTILITY BAR
   Matches the thin dark-navy bar above the header on the live site.
   ===================================================================== */
.top-bar {
  background: #4e070b;                 /* dark crimson header — sampled */
  color: #ffffff;
  font-size: 12px;
  letter-spacing: 0.03em;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.top-bar-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 7px 20px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 20px;
}
.top-bar a {
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  padding: 2px 0;
  transition: color 0.15s;
}
.top-bar a:hover { color: #ffffff; }

/* =====================================================================
   4. HEADER  (logo row)
   Matches the white header with two logo images side-by-side.
   ===================================================================== */
.header {
  background: #ffffff;
  border-bottom: 2px solid #e0e0e0;
  padding: 0;
}
.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Official NTNU logo image */
.logo-shield-img {
  height: 72px;
  width: auto;
  flex-shrink: 0;
  display: block;
}

/* Shield / circular logo badge (fallback) */
.logo-shield {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--ntnu-blue);
  color: #ffffff;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 2px var(--ntnu-blue);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 10.5px;
  line-height: 1.15;
  flex-shrink: 0;
}
.logo-shield span:first-child { font-size: 22px; letter-spacing: 0.02em; }

/* Text beside logo */
.logo-block { display: flex; align-items: center; gap: 14px; }
.logo-text {
  border-left: 2px solid var(--border);
  padding-left: 16px;
}
.logo-text .school {
  font-size: 12px;
  color: var(--text-soft);
  letter-spacing: 0.06em;
  line-height: 1.4;
}
.logo-text .lab-zh {
  font-size: 24px;
  font-weight: 700;
  color: var(--ntnu-blue);
  line-height: 1.2;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.logo-text .lab-en {
  font-size: 11.5px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 3px;
}

/* Search bar (right side of header) */
.header-search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0;
}
.header-search input {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 3px 0 0 3px;
  font-family: var(--font-main);
  font-size: 13px;
  color: var(--text);
  width: 210px;
  outline: none;
  background: #fafafa;
  transition: border-color 0.15s;
}
.header-search input:focus {
  border-color: var(--ntnu-blue);
  background: #fff;
}
.header-search button {
  height: 36px;
  padding: 0 16px;
  background: var(--ntnu-blue);
  color: #ffffff;
  border: 1px solid var(--ntnu-blue);
  border-radius: 0 3px 3px 0;
  font-family: var(--font-main);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.header-search button:hover { background: var(--ntnu-blue-light); }

/* =====================================================================
   5. MAIN NAVIGATION
   Matches the navy bar with red top border and white text items.
   Submenus appear as white dropdowns.
   ===================================================================== */
nav.main-nav {
  background: var(--ntnu-blue-light);   /* #94142d crimson nav */
  border-top: 3px solid #4e070b;           /* dark crimson stripe matches header */
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  list-style: none;
  padding: 0;
}
.nav-inner > li {
  position: relative;
  flex: 1;
}
.nav-inner > li > a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 13px 10px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  line-height: 1.25;
  border-right: 1px solid rgba(255,255,255,0.1);
  transition: background 0.18s;
  white-space: nowrap;
}
.nav-inner > li:last-child > a { border-right: none; }
.nav-inner > li > a .en {
  display: block;
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.68;
  margin-top: 2px;
}
.nav-inner > li:hover > a,
.nav-inner > li > a.active {
  background: #601b1e;       /* hover = red bg */
}

/* Dropdown */
.nav-inner > li .submenu {
  display: none;                /* JS/CSS hover unhides */
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: #ffffff;
  border-top: 3px solid var(--ntnu-red);
  box-shadow: 0 6px 18px rgba(0,0,0,0.14);
  list-style: none;
  z-index: 300;
}
.nav-inner > li:hover .submenu { display: block; }
.nav-inner > li .submenu li a {
  display: block;
  padding: 10px 18px;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid #eeeeee;
  transition: background 0.12s, color 0.12s, padding-left 0.12s;
}
.nav-inner > li .submenu li:last-child a { border-bottom: none; }
.nav-inner > li .submenu li a:hover {
  background: var(--bg-soft);
  color: var(--ntnu-red);
  padding-left: 24px;
}

/* =====================================================================
   6. HERO CAROUSEL
   Full-width slides with bottom-anchored text; overlayed gradient.
   Matches the full-bleed slider on chem.ntnu.edu.tw.
   ===================================================================== */
.hero { position: relative; overflow: hidden; }

.slides {
  position: relative;
  width: 100%;
  height: 480px;         /* matches site's approx slider height */
  max-width: 1920px;
  margin: 0 auto;
}
.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.7s ease-in-out;
  background-size: cover;
  background-position: center center;
  display: flex;
  align-items: flex-end;
}
.slide.active { opacity: 1; z-index: 1; }

/* YouTube embed slide */
.yt-slide-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #000;
}
.yt-embed {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  aspect-ratio: 16 / 9;
  width: max(100%, 853.34px);   /* covers the 480px-tall hero with no letterboxing */
  height: auto;
  border: 0;
}

.slide-overlay {
  position: absolute;
  inset: 0;
  /* gradient mirror of chem site: strong bottom vignette */
  background: linear-gradient(
    to top,
    rgba(30, 0, 5, 0.82) 0%,
    rgba(30, 0, 5, 0.30) 45%,
    rgba(30, 0, 5, 0.05) 100%
  );
  z-index: 1;
}
.slide-content {
  position: relative;
  z-index: 2;
  color: #ffffff;
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: 0 20px 52px;
}
.slide-content .tag {
  display: inline-block;
  background: var(--ntnu-red);
  color: #ffffff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 2px;
  margin-bottom: 14px;
}
.slide-content h2 {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 10px;
  text-shadow: 0 1px 8px rgba(0,0,0,0.35);
}
.slide-content p {
  font-size: 15px;
  line-height: 1.65;
  opacity: 0.93;
  max-width: 620px;
  margin-bottom: 20px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.slide-content .btn {
  display: inline-block;
  background: var(--ntnu-gold);
  color: var(--ntnu-blue-dark);
  font-size: 13.5px;
  font-weight: 700;
  padding: 9px 26px;
  border-radius: 2px;
  letter-spacing: 0.04em;
  transition: background 0.15s, transform 0.15s;
}
.slide-content .btn:hover {
  background: #d4aa42;
  transform: translateY(-2px);
  color: var(--ntnu-blue-dark);
}

/* Arrow buttons */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,0.18);
  border: 1.5px solid rgba(255,255,255,0.45);
  color: #ffffff;
  font-size: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  line-height: 1;
}
.carousel-arrow:hover { background: var(--ntnu-red); border-color: var(--ntnu-red); }
.carousel-arrow.prev { left: 24px; }
.carousel-arrow.next { right: 24px; }

/* Dot indicators — wide rect style matching site */
.dots {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 8px;
  align-items: center;
}
.dot {
  width: 32px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.38);
  border: none;
  cursor: pointer;
  transition: background 0.2s, width 0.2s;
  padding: 0;
}
.dot.active {
  background: #ffffff;
  width: 44px;
}
.dot:hover { background: rgba(255,255,255,0.7); }

/* =====================================================================
   7. STATS BAR
   Matches the dark full-width numbers strip below the slider.
   ===================================================================== */
.stats-bar {
  background: #3a0508;
  color: #ffffff;
  padding: 28px 20px;
}
.stats-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  text-align: center;
}
.stat-item {
  padding: 10px 16px;
  border-right: 1px solid rgba(255,255,255,0.12);
}
.stat-item:last-child { border-right: none; }
.stat-num {
  font-size: 40px;
  font-weight: 700;
  color: var(--ntnu-gold);
  line-height: 1;
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  margin-top: 6px;
  font-weight: 500;
}
.stat-label-en {
  font-size: 10.5px;
  color: rgba(255,255,255,0.42);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* =====================================================================
   8. SECTION HEADER  (title + red underline)
   Matches chem.ntnu.edu.tw's centred h2 with red rule.
   ===================================================================== */
.sec-head {
  text-align: center;
  margin-bottom: 42px;
}
.sec-head .sub {
  font-size: 12px;
  color: var(--ntnu-red);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 6px;
}
.sec-head h2 {
  font-size: 28px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.3;
  letter-spacing: 0.04em;
}
.sec-head .underline {
  width: 44px;
  height: 3px;
  background: var(--ntnu-red);
  margin: 14px auto 0;
  border-radius: 2px;
}
.sec-head .desc {
  max-width: 600px;
  margin: 16px auto 0;
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.75;
}

/* =====================================================================
   8b. NEWS SECTION
   ===================================================================== */
.news-section {
  padding: var(--section-pad);
  background: var(--bg-soft);
}
.news-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}
.news-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.news-item {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.news-item:last-child { border-bottom: none; }
.news-item:hover { background: #f8f9fc; }
.news-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  margin-right: 20px;
  flex-shrink: 0;
  color: var(--ntnu-red);
  line-height: 1.2;
}
.news-month {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #888;
}
.news-day {
  font-size: 26px;
  font-weight: 700;
  color: var(--ntnu-red);
  line-height: 1.1;
}
.news-year {
  font-size: 10px;
  color: #aaa;
}
.news-body {
  flex: 1;
}
.news-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 2px 8px;
  border-radius: 2px;
  margin-bottom: 6px;
  text-transform: uppercase;
}
.news-tag--notice { background: #e8f0fe; color: #1a56db; }
.news-tag--maint  { background: #fef3c7; color: #92400e; }
.news-tag--event  { background: #f0fdf4; color: #166534; }
.news-tag--new    { background: #fce7f3; color: #9d174d; }
.news-body h4 {
  font-size: .97rem;
  font-weight: 600;
  color: var(--ntnu-dark);
  margin: 0 0 4px;
}
.news-body h4 a {
  color: inherit;
  text-decoration: none;
  transition: color .15s;
}
.news-body h4 a:hover { color: var(--ntnu-red); }
.news-body p {
  font-size: .86rem;
  color: #666;
  line-height: 1.6;
  margin: 0;
}
.news-more-btn {
  display: inline-block;
  padding: 9px 26px;
  border: 1.5px solid var(--ntnu-red);
  border-radius: 5px;
  color: var(--ntnu-red);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.news-more-btn:hover {
  background: var(--ntnu-red);
  color: #fff;
}

/* =====================================================================
   9. QUICK CATEGORIES
   ===================================================================== */
.categories { padding: var(--section-pad); }
.categories-inner { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.cat-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 28px 18px 24px;
  text-align: center;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.cat-card::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--ntnu-red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s;
}
.cat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,53,128,0.13);
  border-color: var(--ntnu-blue);
}
.cat-card:hover::after { transform: scaleX(1); }
.cat-icon {
  width: 58px; height: 58px;
  margin: 0 auto 14px;
  background: var(--ntnu-blue);
  color: #ffffff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
  transition: background 0.2s;
}
.cat-card:hover .cat-icon { background: var(--ntnu-red); }
.cat-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 8px;
  letter-spacing: 0.03em;
}
.cat-card p { font-size: 13px; color: var(--text-soft); line-height: 1.6; }

/* =====================================================================
   10. INSTRUMENTS GRID
   ===================================================================== */
.instruments-section {
  background: var(--bg-soft);
  padding: var(--section-pad);
}
.instruments-inner { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }
.inst-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.inst-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  transition: box-shadow 0.22s, transform 0.22s;
}
.inst-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 28px rgba(0,53,128,0.13);
}
.inst-image {
  height: 190px;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.inst-image::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(circle at 68% 28%, rgba(255,255,255,0.15) 0%, transparent 45%);
}
.inst-image .icon-svg { width: 76px; height: 76px; z-index: 1; opacity: 0.88; }
.inst-image--photo {
  background: #1a1a2e;
}
.inst-image--photo img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  transition: transform 0.4s ease;
}
.inst-card:hover .inst-image--photo img { transform: scale(1.05); }
.inst-image--placeholder {
  background: linear-gradient(135deg, #2a2a4a 0%, #1a1a2e 100%);
}
.inst-placeholder-icon {
  font-size: 3rem; z-index: 1;
}
.inst-tag {
  position: absolute; top: 12px; left: 12px;
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 2px;
  color: #ffffff; background: var(--ntnu-red);
  z-index: 2;
}
.inst-tag.available { background: #2e7d32; }

.inst-body { padding: 18px 18px 16px; }
.inst-body h3 {
  font-size: 15.5px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 4px;
  line-height: 1.35;
}
.inst-body .model {
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 10px;
  font-style: italic;
}
.inst-body p {
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.6;
  margin-bottom: 14px;
}
.inst-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}
.inst-meta .location { color: var(--text-soft); }
.inst-meta .book {
  color: #94142d;
  font-weight: 600;
  font-size: 13px;
  transition: color 0.14s;
}
.inst-meta .book:hover { color: var(--ntnu-red); }

/* =====================================================================
   11. ABOUT SECTION
   ===================================================================== */
.about-preview {
  background: #ffffff;
  padding: var(--section-pad);
}
.about-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
}
.about-img {
  height: 360px;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(0,53,128,0.18);
}
.about-img-label {
  position: absolute; bottom: 18px; left: 18px;
  color: rgba(255,255,255,0.82);
  font-size: 12px;
  letter-spacing: 0.18em;
  z-index: 1;
}
.about-content .sub {
  font-size: 11.5px;
  color: var(--ntnu-red);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 6px;
}
.about-content h2 {
  font-size: 28px;
  font-weight: 700;
  color: var(--ntnu-blue);
  margin-bottom: 16px;
  letter-spacing: 0.03em;
}
.about-content p {
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.78;
  margin-bottom: 14px;
}
.about-features {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.feature { display: flex; gap: 12px; align-items: flex-start; }
.feature-icon {
  width: 38px; height: 38px;
  background: var(--bg-soft);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.feature-text strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 2px;
}
.feature-text span { font-size: 12px; color: var(--text-soft); }

/* =====================================================================
   12. R&D HIGHLIGHTS  (bento-style mosaic)
   ===================================================================== */
.rd-section {
  background: var(--bg-soft);
  padding: var(--section-pad);
}
.rd-inner { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }
.rd-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 18px;
  height: 580px;
}
.rd-card {
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: transform 0.28s;
}
.rd-card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(0,0,0,0.18); }
.rd-card:nth-child(1) { grid-row: span 2; }
.rd-card .rd-bg {
  position: absolute; inset: 0;
  transition: transform 0.4s;
  background-size: cover;
  background-position: center;
}
.rd-card:hover .rd-bg { transform: scale(1.04); }
.rd-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(30,0,5,0.92) 0%, rgba(30,0,5,0.28) 60%, transparent 100%);
}
.rd-content {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 20px;
  color: #ffffff; z-index: 2;
}
.rd-card:nth-child(1) .rd-content { padding: 28px; }
.rd-content .rd-tag {
  display: inline-block;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(6px);
  padding: 3px 10px; border-radius: 2px;
  font-size: 10.5px; letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.rd-content h3 {
  font-size: 16px; font-weight: 700;
  line-height: 1.3; margin-bottom: 6px;
}
.rd-card:nth-child(1) .rd-content h3 { font-size: 22px; }
.rd-content p { font-size: 12.5px; opacity: 0.85; line-height: 1.55; }
.rd-card:nth-child(1) .rd-content p { font-size: 14px; }

/* =====================================================================
   13. RULES SECTION
   ===================================================================== */
.rules-section {
  background: #ffffff;
  padding: var(--section-pad);
}
.rules-inner { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }
.rules-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.rule-card {
  background: var(--bg-soft);
  border-left: 4px solid #94142d;
  border-radius: 0 4px 4px 0;
  padding: 22px 22px 20px;
  transition: border-left-color 0.18s, transform 0.18s, box-shadow 0.18s, background 0.18s;
}
.rule-card:hover {
  border-left-color: var(--ntnu-red);
  transform: translateX(4px);
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(0,53,128,0.09);
}
.rule-card .rule-num {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ntnu-red);
  font-weight: 600;
  margin-bottom: 6px;
}
.rule-card h4 {
  font-size: 15.5px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 8px;
  line-height: 1.3;
}
.rule-card p {
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.65;
  margin-bottom: 12px;
}
.rule-card a {
  font-size: 13px;
  color: #94142d;
  font-weight: 600;
  transition: color 0.14s;
}
.rule-card a:hover { color: var(--ntnu-red); }
.rule-forms {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.rule-form-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: #5a3800;
  background: #fff8e6;
  border: 1px solid #e0c070;
  border-radius: 20px;
  text-decoration: none;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
  white-space: nowrap;
}
.rule-form-tag:hover {
  background: #c8a951;
  color: #fff;
  border-color: #c8a951;
}

/* =====================================================================
   13b. INSTRUMENT USAGE GUIDE (儀器使用須知)
   ===================================================================== */
.usage-section { background: #ffffff; padding: var(--section-pad); }
.usage-inner { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }
.usage-group-title {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 30px 0 16px;
  padding-left: 12px;
  border-left: 4px solid #c8a951;
}
.usage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  align-items: start;
}
.usage-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 22px 22px 20px;
}
.usage-card--contact { background: #fbf6ea; border-color: #e0c070; }
.usage-num {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ntnu-red);
  font-weight: 600;
  margin-bottom: 6px;
}
.usage-card h4 {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.usage-list { margin: 0; padding-left: 18px; }
.usage-list li { font-size: 13px; color: var(--text); line-height: 1.7; margin-bottom: 9px; }
.usage-list li:last-child { margin-bottom: 0; }
.usage-list li strong { color: #1a1a1a; }
.usage-list a { color: #94142d; font-weight: 600; }
.usage-list a:hover { color: var(--ntnu-red); }

/* =====================================================================
   13c. ORGANIZATION (組織職掌)
   ===================================================================== */
.team-section { background: var(--bg-soft); padding: var(--section-pad); }
.team-inner { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }
.team-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.team-card {
  background: #ffffff;
  border-top: 3px solid #94142d;
  border-radius: 0 0 4px 4px;
  padding: 22px 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  transition: transform 0.18s, box-shadow 0.18s;
}
.team-card:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,0.10); }
.team-role {
  font-size: 11px;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: var(--ntnu-red);
  margin-bottom: 6px;
}
.team-card h4 { font-size: 19px; font-weight: 700; color: #1a1a1a; margin-bottom: 10px; }
.team-duty { font-size: 13px; color: var(--text-soft); line-height: 1.6; margin-bottom: 12px; }
.team-contact {
  font-size: 12.5px;
  color: var(--text);
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

@media (max-width: 900px) {
  .team-grid { grid-template-columns: repeat(2, 1fr); }
  .usage-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .team-grid { grid-template-columns: 1fr; }
}

/* =====================================================================
   14. FOOTER
   Matches the dark navy 4-column footer on chem.ntnu.edu.tw.
   ===================================================================== */
footer {
  background: #3a0508;                  /* deep dark crimson footer */
  color: rgba(255,255,255,0.72);
  font-size: 13.5px;
  line-height: 1.7;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 46px 20px 36px;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 0.85fr;
  gap: 32px;
}
.footer-col h5 {
  font-size: 14.5px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 14px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(255,255,255,0.14);
  letter-spacing: 0.04em;
}
.footer-col p {
  font-size: 13px;
  color: rgba(255,255,255,0.68);
  margin-bottom: 5px;
}
.footer-col ul { list-style: none; padding: 0; }
.footer-col ul li {
  font-size: 13px;
  color: rgba(255,255,255,0.68);
  margin-bottom: 5px;
  padding-left: 14px;
  position: relative;
}
.footer-col ul li::before {
  content: "›";
  position: absolute; left: 0;
  color: var(--ntnu-gold);
  font-size: 14px;
}
.footer-col a { color: rgba(255,255,255,0.68); transition: color 0.14s; }
.footer-col a:hover { color: var(--ntnu-gold); }

/* Social icons */
.social-icons {
  display: flex;
  gap: 9px;
  margin-top: 10px;
}
.social-icons a {
  width: 34px; height: 34px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: rgba(255,255,255,0.75);
  transition: background 0.15s, color 0.15s;
}
.social-icons a:hover {
  background: var(--ntnu-red);
  color: #ffffff;
}

/* Copyright bar */
.copyright {
  background: rgba(0,0,0,0.30);
  border-top: 1px solid rgba(255,255,255,0.08);
  text-align: center;
  padding: 14px 20px;
  font-size: 12px;
  color: rgba(255,255,255,0.42);
  letter-spacing: 0.04em;
}

/* =====================================================================
   15. BACK TO TOP BUTTON
   ===================================================================== */
.to-top {
  position: fixed;
  bottom: 26px; right: 26px;
  width: 42px; height: 42px;
  background: var(--ntnu-blue);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 19px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.22);
  opacity: 0; visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s, background 0.15s;
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
}
.to-top.show { opacity: 1; visibility: visible; }
.to-top:hover { background: var(--ntnu-red); }

/* =====================================================================
   16. PAGE BANNER  (subpage header strip)
   ===================================================================== */
.page-banner {
  background: linear-gradient(135deg, var(--ntnu-blue) 0%, var(--ntnu-blue-light) 100%);
  color: #ffffff;
  padding: 40px 20px 36px;
  border-bottom: 3px solid var(--ntnu-gold);
}
.page-banner-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}
.page-breadcrumb {
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.page-breadcrumb a {
  color: rgba(255,255,255,0.65);
  transition: color 0.15s;
}
.page-breadcrumb a:hover { color: var(--ntnu-gold); }
.page-breadcrumb .sep { margin: 0 7px; }
.page-banner h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  margin-bottom: 6px;
}
.page-banner p {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* =====================================================================
   17. RESPONSIVE
   ===================================================================== */
@media (max-width: 1040px) {
  .nav-inner > li > a { font-size: 13.5px; padding: 13px 8px; }
  .nav-inner > li > a .en { font-size: 9.5px; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .inst-grid { grid-template-columns: repeat(2, 1fr); }
  .about-inner { grid-template-columns: 1fr; gap: 30px; }
  .about-img { height: 280px; }
  .rd-grid { grid-template-columns: 1fr 1fr; height: auto; }
  .rd-card:nth-child(1) { grid-row: span 1; min-height: 260px; }
  .rd-card { min-height: 200px; }
  .rules-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 26px; }
  .stats-inner { grid-template-columns: repeat(2, 1fr); }
  .stat-item:nth-child(2) { border-right: none; }
  .slides { height: 400px; }
  .slide-content h2 { font-size: 28px; }
}

@media (max-width: 680px) {
  .header-search { display: none; }
  .logo-text .lab-zh { font-size: 19px; }
  .nav-inner { flex-wrap: wrap; }
  .nav-inner > li { flex: 1 1 50%; }
  .nav-inner > li > a .en { display: none; }
  .cat-grid { grid-template-columns: 1fr; }
  .inst-grid { grid-template-columns: 1fr; }
  .about-features { grid-template-columns: 1fr; }
  .rules-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .slides { height: 320px; }
  .slide-content { padding: 0 18px 36px; }
  .slide-content h2 { font-size: 22px; }
  .stat-num { font-size: 30px; }
}
