:root {
  --black:   #111111;
  --ink:     #2a2a2a;
  --muted:   #6b7280;
  --border:  #e5e7eb;
  --bg:      #ffffff;
  --bg-alt:  #f9f9f8;
  --accent:  #1a1a1a;
  --nav-bg:  rgba(255,255,255,.95);

  --font-body:    'Inter', system-ui, sans-serif;
  --font-heading: 'Playfair Display', Georgia, serif;

  --radius: 8px;
  --shadow: 0 1px 4px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.05);
  --shadow-md: 0 4px 24px rgba(0,0,0,.10);

  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --black:   #f3f4f6;
  --ink:     #e5e7eb;
  --muted:   #9ca3af;
  --border:  #374151;
  --bg:      #0a0a0a;
  --bg-alt:  #141414;
  --accent:  #ffffff;
  --nav-bg:  rgba(10,10,10,.95);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color var(--transition), color var(--transition);
}

img { display: block; max-width: 100%; transition: opacity var(--transition); }
[data-theme="dark"] img { opacity: 0.85; }
[data-theme="dark"] img:hover { opacity: 1; }

a { color: inherit; transition: color var(--transition); }
button { cursor: pointer; font-family: inherit; transition: all var(--transition); }

/* ─── TYPOGRAPHY ──────────────────────────────────────────── */
h1,h2,h3,h4 { font-family: var(--font-heading); color: var(--black); line-height: 1.2; transition: color var(--transition); }

.section-head { text-align: center; margin-bottom: 2.5rem; }
.section-title { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 700; margin-bottom: .6rem; }
.section-sub   { color: var(--muted); font-size: 1rem; letter-spacing: .02em; }
.accent { color: var(--muted); }

/* ─── LAYOUT ──────────────────────────────────────────────── */
.container { width: 90%; max-width: 1180px; margin: 0 auto; }

.section     { padding: 6rem 0; }
.section-alt { background: var(--bg-alt); }

/* ─── HEADER / NAV ────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition), border-color var(--transition);
}

.header-inner {
  display: flex; align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 1.5rem;
}

.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.brand-logo {
  width: 44px; height: 44px;
  background: var(--black);
  color: var(--bg);
  border-radius: var(--radius);
  display: grid; place-items: center;
  font-family: var(--font-heading); font-size: 1rem; font-weight: 700;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}
.brand:hover .brand-logo { transform: rotate(-5deg) scale(1.05); }

.brand-logo.small { width: 36px; height: 36px; font-size: .9rem; }
.brand-name { display: block; font-family: var(--font-heading); font-weight: 700; font-size: 1.2rem; line-height: 1; }
.brand-sub  { display: block; font-size: .75rem; color: var(--muted); margin-top: 2px; }

.main-nav { display: flex; gap: .5rem; align-items: center; }
.main-nav a {
  padding: .5rem 1rem;
  font-size: .9rem; font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}
.main-nav a:hover { color: var(--black); background: var(--bg-alt); }

.header-actions { display: flex; align-items: center; gap: 1rem; }

.theme-toggle {
  background: none; border: 1.5px solid var(--border);
  color: var(--black);
  width: 40px; height: 40px;
  border-radius: var(--radius);
  display: grid; place-items: center;
  font-size: 1.1rem;
}
.theme-toggle:hover { border-color: var(--black); background: var(--bg-alt); }

.nav-toggle {
  display: none; flex-direction: column; gap: 6px;
  background: none; border: none; padding: .5rem;
}
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--black); border-radius: 2px; transition: all var(--transition); }

.nav-toggle.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ─── HERO ────────────────────────────────────────────────── */
.hero {
  padding: 8rem 0 6rem;
  border-bottom: 1px solid var(--border);
  background: radial-gradient(circle at top right, var(--bg-alt), var(--bg));
}
.hero-content { max-width: 720px; }
.hero-tag {
  font-size: .85rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 1.5rem;
}
.hero-title {
  font-size: clamp(3.5rem, 10vw, 6.5rem);
  font-weight: 700;
  line-height: 1;
  margin-bottom: 1.5rem;
  color: var(--black);
  letter-spacing: -0.02em;
}
.hero-desc { font-size: 1.25rem; color: var(--muted); margin-bottom: 2.5rem; line-height: 1.7; }
.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ─── STATS ───────────────────────────────────────────────── */
.stats-strip { border-bottom: 1px solid var(--border); padding: 2.5rem 0; }
.stats-grid  { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; }
.stat-item   {
  text-align: center;
  padding: 1rem;
  border-right: 1px solid var(--border);
}
.stat-item:last-child { border-right: none; }
.stat-num { display: block; font-family: var(--font-heading); font-size: 2.5rem; font-weight: 700; color: var(--black); line-height: 1; margin-bottom: .25rem; }
.stat-label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }

/* ─── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1.75rem;
  font-size: .95rem; font-weight: 600;
  border-radius: var(--radius);
  text-decoration: none;
  border: 2px solid transparent;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }

.btn-dark    { background: var(--black); color: var(--bg); border-color: var(--black); }
.btn-dark:hover { background: var(--ink); border-color: var(--ink); box-shadow: 0 4px 12px rgba(0,0,0,.15); }

.btn-outline { background: transparent; color: var(--black); border-color: var(--black); }
.btn-outline:hover { background: var(--black); color: var(--bg); box-shadow: 0 4px 12px rgba(0,0,0,.1); }

/* ─── NOTICES ─────────────────────────────────────────────── */
.notice-list { display: flex; flex-direction: column; gap: 1.25rem; }

.notice-card {
  display: grid; grid-template-columns: 70px 1fr auto;
  gap: 1.5rem;
  padding: 1.75rem 2rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.3s ease;
  align-items: start;
}
.notice-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--muted); }

.notice-date-col {
  display: flex; flex-direction: column; align-items: center;
  padding: .75rem; background: var(--bg); border-radius: var(--radius);
  border: 1px solid var(--border);
}
.notice-day   { font-family: var(--font-heading); font-size: 1.75rem; font-weight: 700; line-height: 1; color: var(--black); }
.notice-month { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }

.notice-badge {
  display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; padding: 4px 10px; border-radius: 6px;
  background: var(--bg); color: var(--muted); border: 1px solid var(--border);
  margin-bottom: .75rem;
}
.notice-title-text { font-family: var(--font-heading); font-size: 1.35rem; font-weight: 700; color: var(--black); margin-bottom: .5rem; }
.notice-text  { font-size: 1rem; color: var(--muted); margin-bottom: 1rem; }

.notice-link  {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem 1rem; background: var(--black); color: var(--bg);
  border-radius: 6px; font-size: .85rem; font-weight: 600; text-decoration: none;
}
.notice-link:hover { opacity: 0.9; }

.view-more-container {
  display: flex;
  justify-content: center;
  margin-top: 2.5rem;
}
.view-more-btn {
  min-width: 180px;
}

/* ─── ROUTINE TABLE / MOBILE VIEW ────────────────────────── */
.section-tabs { display: flex; gap: .5rem; margin-bottom: 2rem; flex-wrap: wrap; justify-content: center; }
.tab-btn {
  padding: .6rem 1.5rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: .9rem; font-weight: 600; color: var(--muted);
}
.tab-btn.active,
.tab-btn:hover { border-color: var(--black); color: var(--black); background: var(--bg-alt); }

.table-scroll { overflow-x: auto; margin-bottom: 2rem; border-radius: var(--radius); border: 1px solid var(--border); }

.routine-table, .subject-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.routine-table th, .routine-table td,
.subject-table th, .subject-table td {
  padding: 1.25rem 1.5rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top;
}
.routine-table th, .subject-table th {
  background: var(--bg-alt); color: var(--black);
  font-weight: 700; font-size: .75rem; letter-spacing: .05em; text-transform: uppercase;
  border-bottom: 2px solid var(--border);
}
.routine-table tr:last-child td { border-bottom: none; }
.routine-table td:first-child { font-weight: 700; color: var(--black); background: var(--bg-alt); width: 120px; }

.class-cell { min-width: 160px; }
.class-code { font-weight: 700; color: var(--black); font-size: .95rem; display: block; margin-bottom: .25rem; }
.class-room, .class-teacher { font-size: .8rem; color: var(--muted); display: block; }

.sec-badge {
  display: inline-block; font-size: .6rem; font-weight: 800;
  padding: 2px 6px; border-radius: 4px; margin-left: 4px; vertical-align: middle;
}
.sec-A { background: #dbeafe; color: #1e40af; }
.sec-B { background: #ffedd5; color: #9a3412; }
[data-theme="dark"] .sec-A { background: #1e3a8a; color: #dbeafe; }
[data-theme="dark"] .sec-B { background: #7c2d12; color: #ffedd5; }

.slot-divider { border: none; border-top: 1px dashed var(--border); margin: .75rem 0; }

/* ─── MOBILE CARDS VIEW (Routine) ────────────────────────── */
.routine-mobile { display: none; flex-direction: column; gap: 2rem; }
.day-group { background: var(--bg-alt); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.day-header {
  background: var(--black); color: var(--bg);
  padding: .75rem 1.5rem; font-family: var(--font-heading); font-weight: 700; font-size: 1.1rem;
}
.day-slots { display: flex; flex-direction: column; }
.mobile-slot { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 90px 1fr; gap: 1rem; }
.mobile-slot:last-child { border-bottom: none; }
.slot-time { font-size: .72rem; font-weight: 700; color: var(--muted); padding-top: .15rem; line-height: 1.4; }
.slot-content.empty { color: var(--muted); font-style: italic; font-size: .85rem; }

/* ─── SECTION DETECTOR ────────────────────────────────────── */
.detector-card {
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg);
  padding: 2.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  text-align: center;
}

.detector-input-group {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.detector-input-group input {
  flex: 1;
  padding: 0.85rem 1.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  background: var(--bg-alt);
  color: var(--black);
  transition: border-color var(--transition);
}

.detector-input-group input:focus {
  outline: none;
  border-color: var(--black);
}

.detector-result {
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-label {
  font-size: 0.9rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.result-value {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 1rem;
}

.result-note {
  font-size: 0.9rem;
  color: var(--muted);
}

@media (max-width: 580px) {
  .detector-input-group {
    flex-direction: column;
  }
}

/* ─── GALLERY ─────────────────────────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}
.gallery-item { position: relative; overflow: hidden; border-radius: var(--radius); cursor: pointer; background: var(--bg-alt); transition: all 0.3s ease; }
.gallery-item:hover { transform: scale(1.02); z-index: 10; box-shadow: var(--shadow-md); }
.gallery-item img { width: 100%; height: 280px; object-fit: cover; display: block; transition: transform .6s ease; }
.gallery-item:hover img { transform: scale(1.1); }

.gallery-caption {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 1.5rem 1rem .75rem;
  background: linear-gradient(transparent, rgba(0,0,0,.8));
  color: #fff; font-size: .95rem; font-weight: 500;
  opacity: 0; transition: opacity .3s ease;
}
.gallery-item:hover .gallery-caption { opacity: 1; }


/* ─── FOOTER ──────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0;
  background: var(--bg);
}

.footer-contact-bar {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.contact-admin {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 1rem;
  font-weight: 500;
}

.contact-label {
  color: var(--black);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

.contact-link {
  color: var(--muted);
  text-decoration: none;
  transition: color var(--transition);
}

.contact-link:hover {
  color: var(--black);
}

.divider {
  color: var(--border);
  user-select: none;
}

.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 2rem; flex-wrap: wrap;
}
.footer-brand { display: flex; align-items: center; gap: .75rem; font-weight: 700; font-size: 1.1rem; }
.footer-copy  { font-size: .9rem; color: var(--muted); max-width: 400px; }
.footer-top   {
  padding: .5rem 1rem; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .85rem; color: var(--muted); text-decoration: none;
}
.footer-top:hover { color: var(--black); border-color: var(--black); }

/* ─── LIGHTBOX ────────────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.95);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 1.5rem;
  backdrop-filter: blur(8px);
}
.lightbox.hidden { display: none !important; }

.lightbox-img { max-height: 80vh; max-width: 90vw; object-fit: contain; }
.lightbox-caption { color: #fff; font-size: 1.1rem; }

.lightbox-close {
  position: absolute; top: 1.5rem; right: 2rem;
  background: none; border: none; color: #fff;
  font-size: 3rem; line-height: 1;
}

.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2);
  color: #fff; width: 50px; height: 50px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.5rem;
}
.lightbox-nav.prev { left: 1.5rem; }
.lightbox-nav.next { right: 1.5rem; }

/* ─── UTILITIES ───────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 992px) {
  .hero { padding: 6rem 0 4rem; text-align: center; }
  .hero-content { margin: 0 auto; }
  .hero-cta { justify-content: center; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
  .stat-item { border: 1px solid var(--border); border-radius: var(--radius); }
}

@media (max-width: 768px) {
  .main-nav {
    display: none; flex-direction: column; gap: 0;
    position: absolute; top: 72px; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    box-shadow: var(--shadow-md);
  }
  .main-nav.open { display: flex; }
  .main-nav a { border-radius: 0; padding: 1rem 1.5rem; font-size: 1rem; }
  .nav-toggle { display: flex; }
  .header-inner { position: relative; }

  .section { padding: 4rem 0; }
  .section-title { font-size: 2.2rem; }

  .notice-card { grid-template-columns: 1fr; gap: 1rem; padding: 1.5rem; }
  .notice-date-col { flex-direction: row; gap: .5rem; width: fit-content; padding: .5rem .75rem; }
  .notice-day { font-size: 1.25rem; }

  /* Routine Responsiveness */
  .table-scroll { display: none; }
  .routine-mobile { display: flex; }

  .footer-inner { flex-direction: column; text-align: center; align-items: center; }
  .footer-copy { margin: 0 auto; }
}

@media (max-width: 480px) {
  .hero-title { font-size: 2.5rem; }
  .hero-desc { font-size: 1rem; }
  .btn { width: 100%; }
  .hero-cta .btn { width: auto; flex: 1; }
}
