
:root {
  --bg: #f5f7fb;
  --surface: #fff;
  --text: #152033;
  --muted: #64748b;
  --primary: #0b57d0;
  --primary-dark: #083b8a;
  --accent: #f4b400;
  --border: #e5e7eb;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.1);
  --radius: 22px;
  --danger: #b91c1c;
}

[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #111827;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --primary: #60a5fa;
  --primary-dark: #93c5fd;
  --accent: #facc15;
  --border: #243244;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

a {
  color: inherit;
}

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

.container {
  width: min(1160px, calc(100% - 32px));
  margin: auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: #111827;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 800;
  text-decoration: none;
}

.skip-link:focus {
  left: 16px;
  top: 16px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .header {
  background: rgba(17, 24, 39, 0.82);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 900;
}

.logo {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.menu {
  display: flex;
  gap: 16px;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.menu a {
  text-decoration: none;
  font-weight: 700;
  color: var(--text);
  font-size: 0.95rem;
  padding: 8px 10px;
  border-radius: 999px;
}

.menu a:hover,
.menu a.active {
  color: var(--primary);
  background: rgba(11, 87, 208, 0.08);
}

.menu .btn-admin {
  background: var(--primary);
  color: #fff !important;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 800;
  border: 0;
  box-shadow: 0 4px 14px rgba(11, 87, 208, 0.25);
}

.menu .btn-admin:hover,
.menu .btn-admin:focus-visible {
  background: var(--primary-dark);
  color: #fff !important;
  transform: translateY(-1px);
}

.icon-btn,
.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

.btn:focus-visible,
.icon-btn:focus-visible,
.menu a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(11, 87, 208, 0.35);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: #111827;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-on-hero {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 44px;
  height: 44px;
  padding: 0;
}

.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(5, 31, 74, 0.88), rgba(11, 87, 208, 0.76)),
    url("../img/hero-pattern.svg");
  padding: 92px 0 70px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 34px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.3rem, 5vw, 4.5rem);
  line-height: 1.05;
  margin: 0 0 18px;
}

.hero p {
  font-size: 1.12rem;
  color: rgba(255, 255, 255, 0.9);
  max-width: 760px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-card {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.hero-card img {
  width: 100%;
  height: 360px;
  object-fit: cover;
  border-radius: 18px;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.08);
}

.section {
  padding: 76px 0;
}

.section-tight {
  padding-top: 0;
}

.section-title {
  text-align: center;
  color: var(--primary-dark);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  margin: 0 0 10px;
}

.section-subtitle {
  text-align: center;
  color: var(--muted);
  max-width: 760px;
  margin: 0 auto 34px;
}

.section-cta {
  text-align: center;
  margin-top: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card h3 {
  margin-top: 0;
  color: var(--primary);
}

.news-date,
.muted {
  color: var(--muted);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
}

.gallery {
  display: grid;
  gap: 18px;
}

.gallery-home {
  grid-template-columns: 2fr 1fr 1fr;
}

.gallery-home .gallery-item:first-child {
  grid-row: span 2;
}

.gallery-home img {
  width: 100%;
  height: 100%;
  min-height: 260px;
  object-fit: cover;
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.gallery-home .gallery-item:first-child img {
  min-height: 540px;
}

.gallery-page {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.gallery-page.count-1 {
  grid-template-columns: 1fr;
  max-width: 720px;
  margin: 0 auto;
}

.gallery-page.count-2 {
  grid-template-columns: repeat(2, 1fr);
}

.gallery-item {
  display: block;
  text-decoration: none;
  overflow: hidden;
  border-radius: 22px;
}

.gallery-page .gallery-item img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  border-radius: 22px;
  box-shadow: var(--shadow);
  background: var(--surface);
}

.gallery-page figcaption {
  margin-top: 10px;
  text-align: center;
  font-weight: 700;
  color: var(--primary-dark);
}

.teacher {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  flex-shrink: 0;
}

.table-wrap {
  overflow: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  background: rgba(11, 87, 208, 0.08);
  color: var(--primary-dark);
}

.form label {
  display: block;
  font-weight: 700;
  margin: 0 0 6px;
}

.form input,
.form textarea,
.form select {
  width: 100%;
  padding: 14px 15px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  margin-bottom: 12px;
}

.form textarea {
  min-height: 140px;
  resize: vertical;
}

.footer {
  background: #0f172a;
  color: rgba(255, 255, 255, 0.82);
  padding: 30px 0;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
}

.footer-links {
  margin: 0;
  display: flex;
  gap: 10px;
  align-items: center;
}

.footer a {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.footer a:hover {
  text-decoration: underline;
}

.map iframe {
  width: 100%;
  height: 360px;
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.mobile-toggle {
  display: none;
}

.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 88px;
}

.sidebar a {
  display: block;
  padding: 12px 14px;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 800;
  color: var(--text);
}

.sidebar a:hover,
.sidebar a.active {
  background: rgba(11, 87, 208, 0.1);
  color: var(--primary);
}

.admin-list p {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.admin-list p:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.admin-thumb {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 12px;
  background: var(--bg);
}

.danger-link {
  color: var(--danger);
  font-weight: 800;
  text-decoration: none;
}

.danger-link:hover {
  text-decoration: underline;
}

.alert {
  padding: 12px 14px;
  border-radius: 14px;
  background: #dcfce7;
  color: #166534;
  font-weight: 800;
  margin-bottom: 16px;
}

.alert.error {
  background: #fee2e2;
  color: #991b1b;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 900px) {
  .mobile-toggle {
    display: inline-flex;
  }

  .menu {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    background: var(--surface);
    padding: 16px;
    border-radius: 18px;
    border: 1px solid var(--border);
  }

  .menu.open {
    display: flex;
  }

  .nav {
    flex-wrap: wrap;
  }

  .hero-grid,
  .grid-3,
  .grid-2,
  .admin-layout,
  .gallery-home,
  .gallery-page.count-2 {
    grid-template-columns: 1fr;
  }

  .gallery-home .gallery-item:first-child,
  .gallery-home .gallery-item:first-child img,
  .gallery-home img,
  .gallery-page .gallery-item img {
    min-height: 280px;
    height: 280px;
    grid-row: auto;
  }

  .hero {
    padding: 64px 0 44px;
  }

  .hero-card img {
    height: 260px;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}
