@import url("https://fonts.cdnfonts.com/css/norse");

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #1d1a14;
  --muted: #5f5645;
  --accent: #bb8a2a;
  --accent-soft: #d9bc7a;
  --line: #e7dcc4;
  --shadow: 0 8px 24px rgba(126, 94, 35, 0.08);
  --display-font: "Norse", "Norse Bold", "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background:
    linear-gradient(180deg, #fffdf8 0%, #ffffff 45%, #fffcf5 100%);
  line-height: 1.6;
  overflow-x: hidden;
}

.steam-sketches {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.sketch {
  position: absolute;
  color: rgba(160, 116, 39, 0.2);
  transform: translate3d(
      calc(var(--mx, 0px) * var(--depth, 1)),
      calc(var(--my, 0px) * var(--depth, 1)),
      0
    )
    rotate(var(--tilt, 0deg));
  animation: sketchFloat var(--float-duration, 12s) ease-in-out infinite;
}

.s-science {
  width: clamp(90px, 10vw, 150px);
  top: 12%;
  left: 4%;
  --depth: 0.7;
  --tilt: -6deg;
  --float-duration: 13s;
}

.s-technology {
  width: clamp(96px, 11vw, 160px);
  top: 18%;
  right: 8%;
  --depth: -0.9;
  --tilt: 4deg;
  --float-duration: 11s;
}

.s-engineering {
  width: clamp(120px, 13vw, 200px);
  top: 54%;
  right: 4%;
  --depth: -1.1;
  --tilt: -3deg;
  --float-duration: 16s;
}

.s-arts {
  width: clamp(100px, 11vw, 160px);
  top: 58%;
  left: 3%;
  --depth: 0.9;
  --tilt: 8deg;
  --float-duration: 14s;
}

.s-math {
  width: clamp(104px, 12vw, 170px);
  bottom: 6%;
  left: 42%;
  --depth: 1.2;
  --tilt: -2deg;
  --float-duration: 15s;
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

@keyframes sketchFloat {
  0%,
  100% {
    margin-top: 0;
  }
  50% {
    margin-top: -10px;
  }
}

.site-header {
  width: min(1120px, 92vw);
  margin: 1rem auto 0;
  padding: 0.9rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 2px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.brand {
  font-family: var(--display-font);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: #8f6720;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.nav-links a {
  text-decoration: none;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  transition: color 0.2s ease, transform 0.2s ease;
}

.nav-links a:hover {
  color: #8f6720;
  transform: translateY(-1px);
}

main {
  width: min(1120px, 92vw);
  margin: 1.2rem auto 3rem;
}

.hero {
  padding: 5rem 0 3rem;
  text-align: center;
}

.eyebrow {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #a17528;
  margin-bottom: 0.8rem;
  font-weight: 700;
}

.hero h1 {
  font-family: var(--display-font);
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.04;
  text-align: center;
  margin: 0;
  max-width: 28ch;
  margin-left: auto;
  margin-right: auto;
}

.hero h1 span {
  color: var(--accent);
}

.hero-copy {
  margin-top: 1.2rem;
  color: var(--muted);
  max-width: 62ch;
  font-size: 1.04rem;
  margin-left: auto;
  margin-right: auto;
}

.hero-actions {
  margin-top: 1.8rem;
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  border: 2px solid var(--accent);
  border-radius: 0.35rem;
  padding: 0.78rem 1.24rem;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(120deg, #c89a3e, #a97823);
  letter-spacing: 0.02em;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(169, 120, 35, 0.24);
  border-color: #8d651f;
}

.btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: #8f6720;
  box-shadow: none;
}

.btn-small {
  padding: 0.48rem 0.86rem;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  box-shadow: none;
}

.about,
.programs,
.gallery,
.collaboration,
.contact {
  margin: 0 0 2rem;
  padding: 0.25rem 0 1.4rem;
  border-bottom: 1px solid var(--line);
}

.about,
.collaboration,
.contact {
  text-align: center;
}

.about h2 {
  margin: 0.2rem 0 0.8rem;
  font-family: var(--display-font);
  font-size: clamp(1.5rem, 2.6vw, 2.2rem);
}

.about p {
  max-width: 74ch;
  margin-left: auto;
  margin-right: auto;
}

.section-heading h2,
.collaboration h2,
.contact h2 {
  margin-top: 0.15rem;
  font-family: var(--display-font);
  font-size: clamp(1.5rem, 2.6vw, 2.3rem);
}

.section-heading {
  text-align: center;
}

.program-list {
  margin: 0.8rem 0 0;
  padding-left: 1.2rem;
}

.program-list li {
  margin: 0 0 0.6rem;
}

.gallery-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.gallery-card {
  padding: 1rem;
  border: 1px solid var(--line);
  background:
    linear-gradient(160deg, #fffdf7 0%, #fff7e6 100%);
  box-shadow: var(--shadow);
}

.gallery-card h3 {
  margin: 0 0 0.45rem;
  font-family: var(--display-font);
  font-size: 1.08rem;
  color: #8f6720;
}

.gallery-card p {
  margin: 0;
  color: var(--muted);
}

.gallery-admin-cta {
  margin-top: 1.4rem;
}

.gallery-admin-cta .trident-icon {
  margin: 0 auto;
  width: 2.8rem;
  height: 2.8rem;
}

.gallery-media-section {
  border-bottom: none;
}

.gallery-media-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  grid-auto-flow: dense;
}

.media-card {
  margin: 0;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #fffef9 0%, #fff8e8 100%);
  box-shadow: var(--shadow);
  padding: 0.6rem;
  min-height: 200px;
  display: flex;
  flex-direction: column;
}

.media-card.small {
  grid-column: span 1;
  grid-row: span 1;
}

.media-card.wide {
  grid-column: span 2;
  grid-row: span 1;
}

.media-card.tall {
  grid-column: span 1;
  grid-row: span 2;
}

.media-card.large {
  grid-column: span 2;
  grid-row: span 2;
}

.media-card img,
.media-card video {
  width: 100%;
  height: 100%;
  min-height: 170px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #fff;
}

.media-card figcaption {
  margin-top: 0.55rem;
}

.media-card h3 {
  margin: 0;
  font-family: var(--display-font);
  font-size: 1.05rem;
  color: #8f6720;
}

.media-card p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.media-card .media-remove {
  margin-top: 0.5rem;
  border: 1px solid var(--line);
  background: #fff;
  color: #7e5920;
  border-radius: 0.25rem;
  padding: 0.32rem 0.55rem;
  align-self: start;
  cursor: pointer;
}

.admin-panel {
  border-bottom: none;
}

.admin-form {
  margin: 0 auto;
  max-width: 760px;
  display: grid;
  gap: 0.9rem;
}

.admin-form label {
  display: grid;
  gap: 0.3rem;
  text-align: left;
  color: var(--muted);
  font-weight: 600;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.64rem 0.7rem;
  color: var(--ink);
  font: inherit;
}

.admin-form textarea {
  resize: vertical;
}

.admin-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.admin-actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.admin-lock {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

.admin-error {
  margin: 0;
  color: #9c2f2f;
  min-height: 1.2em;
}

.admin-only-content {
  display: none;
}

body.admin-unlocked .admin-only-content {
  display: block;
}

body.admin-unlocked .admin-lock {
  display: none;
}

body.admin-locked #admin-logout {
  display: none;
}

.media-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 1rem;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

.collaboration ul {
  margin: 0.8rem 0 0;
  padding-left: 1.1rem;
  display: inline-block;
  text-align: left;
}

.collaboration li::marker {
  color: #9f7427;
}

.site-footer {
  width: min(1120px, 92vw);
  margin: 0 auto 1.4rem;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.site-footer p {
  margin: 0;
}

.footer-socials {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.social-icon {
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #8f6720;
  background: #fff;
  transition: transform 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.social-icon:hover {
  transform: translateY(-2px);
  color: #a17528;
  border-color: #c8ab71;
}

.social-icon svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
  stroke: currentColor;
}

.trident-icon svg {
  width: 1.3rem;
  height: 1.3rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pi-return {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-decoration: none;
  color: #fff;
  background: radial-gradient(circle at 30% 30%, #d6ad59, #9f7427 70%);
  border: 2px solid #8d651f;
  box-shadow: 0 8px 18px rgba(143, 103, 32, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 20;
}

.pi-return:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 12px 20px rgba(143, 103, 32, 0.4);
}

.pi-return:focus-visible {
  outline: 3px solid #d8bf83;
  outline-offset: 2px;
}

.pi-return svg {
  width: 1.55rem;
  height: 1.55rem;
  fill: currentColor;
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

[data-typewriter]::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 0.95em;
  margin-left: 0.14em;
  vertical-align: -0.1em;
  background: currentColor;
  animation: typeCaretBlink 0.8s step-end infinite;
}

[data-typewriter].typed-done::after {
  animation: none;
  opacity: 0.35;
}

@keyframes typeCaretBlink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

@media (max-width: 900px) {
  .site-header {
    flex-wrap: wrap;
    justify-content: center;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery-media-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .media-card.wide,
  .media-card.large {
    grid-column: span 2;
  }
}

@media (max-width: 680px) {
  .sketch {
    opacity: 0.65;
  }

  .s-math {
    left: 28%;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .hero {
    padding-top: 3.4rem;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  .btn-small {
    width: auto;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .gallery-media-grid {
    grid-template-columns: 1fr;
  }

  .media-card.small,
  .media-card.wide,
  .media-card.tall,
  .media-card.large {
    grid-column: span 1;
    grid-row: span 1;
  }

  .admin-actions {
    flex-direction: column;
  }

  .admin-header-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .pi-return {
    right: 0.9rem;
    bottom: 0.9rem;
    width: 2.8rem;
    height: 2.8rem;
  }

  .pi-return svg {
    width: 1.35rem;
    height: 1.35rem;
  }

  .site-footer {
    justify-content: center;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sketch {
    animation: none;
    transform: rotate(var(--tilt, 0deg));
  }
}
