/* ===========================================================================
   Grace International School - shared public stylesheet
   ---------------------------------------------------------------------------
   Extracted verbatim from index.php, which carries the newest and cleanest
   version of the site's CSS (token-driven, accessible nav, reduced-motion
   support).

   Consumed by includes/public_header.php, and therefore by the pages added in
   this change: creative_arts.php and news_articles.php.

   The nine older public pages still carry their own inline <style> blocks.
   Converting them to this stylesheet is a worthwhile follow-up, but it has to
   be done one page at a time with a visual check at each breakpoint - their
   CSS has drifted apart and several of them define rules that exist nowhere
   else. Doing it wholesale alongside this change would risk every public page
   at once.
   =========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;

  --color-ink: #333;
  --color-surface: #fff;
  --color-dark: #333;
  --radius: 5px;
  --content-width: 1200px;
  --header-logo-height: 64px;
  --transition: 0.3s ease-out;
}

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

body {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  color: var(--color-ink);
  padding: var(--space-3);
  background-image: url('assets/background4.jpeg');
  background-color: rgba(255, 255, 255, 0.1);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-blend-mode: overlay;
}

img {
  max-width: 100%;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-dark);
  color: #fff;
  padding: var(--space-1) var(--space-2);
  z-index: 100;
}

.skip-link:focus {
  left: var(--space-2);
}

.container {
  width: min(92%, var(--content-width));
  margin-inline: auto;
}

/* ---------- Header ---------- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: 2px solid #000;
}

.logo img {
  height: var(--header-logo-height);
  width: auto;
  display: block;
}

/* ---------- Navigation ---------- */
nav ul {
  list-style: none;
  display: flex;
}

.nav-link {
  display: block;
  text-decoration: none;
  padding: var(--space-1) var(--space-2);
  color: var(--color-ink);
  transition: background-color var(--transition), color var(--transition);
}

.nav-link:hover,
.nav-link:focus-visible {
  color: #fff;
  background-color: #000;
}

.nav-link.is-active {
  color: #fff;
  background-color: #000;
}

.dropdown {
  position: relative;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #f9f9f9;
  min-width: 180px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

.dropdown-content a {
  color: #000;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
}

.dropdown-content a:hover,
.dropdown-content a:focus-visible {
  background-color: #ddd;
}

/* Hover opens submenus only on devices that actually hover */
@media (hover: hover) {
  .dropdown:hover > .dropdown-content,
  .dropdown:focus-within > .dropdown-content {
    display: block;
  }
}

/* Click/tap opens submenus everywhere (required on touch devices) */
.dropdown.is-open > .dropdown-content {
  display: block;
}

/* ---------- Hamburger toggle ---------- */
.nav-toggle {
  display: none;
  background: none;
  border: 0;
  cursor: pointer;
  height: 44px;
  width: 44px;
  justify-content: center;
  align-items: center;
}

.hamburger,
.hamburger::before,
.hamburger::after {
  background-color: var(--color-ink);
  display: block;
  height: 4px;
  width: 30px;
  transition: transform var(--transition), background-color var(--transition);
}

.hamburger {
  position: relative;
}

.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
  left: 0;
}

.hamburger::before {
  top: -10px;
}

.hamburger::after {
  bottom: -10px;
}

.nav-toggle[aria-expanded="true"] .hamburger {
  background-color: transparent;
}

.nav-toggle[aria-expanded="true"] .hamburger::before {
  transform: translateY(10px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .hamburger::after {
  transform: translateY(-10px) rotate(-45deg);
}

/* ---------- Hero ---------- */
main {
  margin-block: var(--space-5);
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: clamp(320px, 45vh, 520px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-5) var(--space-4);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 2s ease-in-out;
  z-index: 0;
}

/* Scrim keeps the copy legible on every slide */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.3));
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 55ch;
  color: #fff;
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin-bottom: var(--space-2);
}

.hero h1::after {
  content: "";
  display: block;
  width: 40%;
  height: 3px;
  margin-top: var(--space-2);
  background-color: currentColor;
}

.hero p {
  font-size: 1.125rem;
}

/* ---------- Features ---------- */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
  text-align: center;
  padding-block: var(--space-4);
}

.features article {
  background-color: var(--color-surface);
  padding: var(--space-4);
  border-radius: var(--radius);
}

.features img {
  width: 90px;
  height: 90px;
  object-fit: contain;
}

.features h3 {
  font-size: 1.5rem;
  margin-block: var(--space-2);
}

/* ---------- Footer ---------- */
footer {
  text-align: center;
  padding: var(--space-2);
  background: var(--color-dark);
  color: #fff;
}

footer a {
  color: #fff;
  text-decoration: none;
}

footer a:hover,
footer a:focus-visible {
  text-decoration: underline;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  body {
    padding: var(--space-2);
  }

  .nav-toggle {
    display: flex;
  }

  nav {
    width: 100%;
  }

  nav > ul {
    display: none;
    flex-direction: column;
    width: 100%;
  }

  nav > ul.is-open {
    display: flex;
  }

  header {
    flex-wrap: wrap;
  }

  .nav-link {
    padding: 12px;
    text-align: center;
  }

  /* Submenus stack inline rather than floating off-screen */
  .dropdown-content {
    position: static;
    box-shadow: none;
    min-width: 0;
    background-color: #efefef;
  }

  .hero {
    padding: var(--space-4) var(--space-3);
  }

  main {
    margin-block: var(--space-4);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
