:root {
  --ink: #14080c;
  --walnut: #1a0b12;
  --bark: #241018;
  --fog: #d5cdd8;
  --ivory: #f2ece8;
  --gold: #e05a5a;
  --leaf: #3d6fe0;
  --glass: rgba(26, 11, 18, 0.58);
  --line: rgba(242, 236, 232, 0.14);
  --display: "Cormorant Garamond", "Palatino Linotype", Georgia, serif;
  --ui: "Sora", "Segoe UI", sans-serif;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--ui);
  font-size: 1.04rem;
  line-height: 1.58;
  color: var(--ivory);
  background-color: #1a0410;
  background-image:
    radial-gradient(circle at 0% 0%, #8b1024 0%, transparent 42%),
    radial-gradient(circle at 100% 0%, #1638b0 0%, transparent 46%),
    linear-gradient(180deg, #4a0a18 0%, #12061a 50%, #06102a 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

body::after {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(176, 28, 48, 0.14) 0, transparent 18%),
    repeating-linear-gradient(
      90deg,
      transparent 0 46px,
      rgba(243, 234, 216, 0.018) 46px 47px
    );
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
  color: inherit;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  padding: 0.6rem 1rem;
  background: var(--gold);
  color: var(--ink);
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  min-height: 100vh;
}

.spine {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 0;
  border-right: 1px solid var(--line);
  background: rgba(20, 14, 10, 0.62);
  backdrop-filter: blur(18px);
}

.spine-mark {
  width: 9px;
  height: 9px;
  border: 1px solid var(--gold);
  transform: rotate(45deg);
}

.spine-mark + .spine-mark {
  margin-top: 0.6rem;
}

.spine-title,
.spine-place {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  margin: 0;
  letter-spacing: 0.18em;
  font-size: 0.7rem;
  color: var(--fog);
}

.spine-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--ivory);
}

.stage {
  padding: 1.6rem var(--gutter) 3rem;
  max-width: 1180px;
}

.top-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.15rem 0 1.15rem;
  border-bottom: 1px solid var(--line);
}

.nav-left,
.nav-right,
.insta-link {
  text-decoration: none;
}

.nav-left {
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.6vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.nav-center {
  justify-self: center;
}

.insta-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.8rem;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(14px);
  color: var(--ivory);
}

.insta-link:hover,
.insta-link:focus-visible {
  border-color: var(--gold);
  color: var(--gold);
}

.nav-right {
  justify-self: end;
  color: var(--fog);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

.landing {
  padding: 3.6rem 0 2rem;
}

.season {
  margin: 0 0 0.85rem;
  color: var(--gold);
  font-size: 0.92rem;
}

#hero-title,
#gate-title {
  margin: 0;
  max-width: 14ch;
  font-family: var(--display);
  font-size: clamp(2.8rem, 8vw, 5.8rem);
  font-weight: 600;
  line-height: 0.92;
  letter-spacing: -0.035em;
}

.lede {
  max-width: 36rem;
  margin: 1.25rem 0 2.5rem;
  color: var(--fog);
  font-size: 1.08rem;
}

.name-form {
  max-width: 28rem;
  display: grid;
  gap: 0.55rem;
}

.name-form label {
  color: var(--fog);
  font-size: 0.92rem;
}

.name-form input,
#search {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  background: rgba(20, 14, 10, 0.55);
  outline: none;
}

.name-form input:focus,
#search:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(224, 90, 90, 0.2);
}

.form-error {
  margin: 0;
  color: var(--gold);
  font-size: 0.9rem;
}

.name-form .btn {
  justify-self: start;
  margin-top: 0.45rem;
}

.desk-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-top: 1.1rem;
}

.subject-tile {
  min-height: 118px;
  display: flex;
  align-items: flex-end;
  padding: 1.05rem;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(61, 111, 224, 0.16), transparent 42%),
    var(--glass);
  backdrop-filter: blur(16px);
  text-align: left;
  cursor: pointer;
  font-family: var(--display);
  font-size: 1.35rem;
}

.subject-tile:hover,
.subject-tile:focus-visible {
  border-color: rgba(224, 90, 90, 0.8);
  outline: none;
}

.class-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.class-tile {
  min-height: 236px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 1.35rem;
  border: 1px solid var(--line);
  background:
    linear-gradient(165deg, rgba(176, 28, 48, 0.22), transparent 38%),
    var(--glass);
  backdrop-filter: blur(20px);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.class-tile:hover,
.class-tile:focus-visible {
  border-color: rgba(224, 90, 90, 0.85);
  background:
    linear-gradient(165deg, rgba(61, 111, 224, 0.22), transparent 40%),
    rgba(42, 29, 22, 0.72);
  transform: translateY(-4px);
  outline: none;
}

.tile-year {
  font-family: var(--display);
  font-size: 3.7rem;
  line-height: 0.82;
  letter-spacing: -0.045em;
}

.tile-name {
  margin-top: 1.15rem;
  font-weight: 600;
}

.tile-meta {
  margin-top: 0.2rem;
  color: var(--fog);
  font-size: 0.86rem;
}

.desk {
  padding-top: 1.9rem;
}

.desk-bar,
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  color: var(--fog);
  font-size: 0.94rem;
}

.crumbs a {
  color: var(--ivory);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.crumbs a:hover,
.crumbs a:focus-visible {
  border-bottom-color: var(--gold);
}

.text-btn {
  background: none;
  border: 0;
  padding: 0.2rem 0;
  color: var(--gold);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.stream-row {
  margin: 1.45rem 0 0.4rem;
}

.stream-label {
  margin: 0 0 0.6rem;
  color: var(--fog);
  font-size: 0.9rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  padding: 0.42rem 0.85rem;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}

.chip[aria-selected="true"],
.chip[aria-pressed="true"] {
  background: var(--gold);
  color: var(--ink);
  border-color: var(--gold);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1.5rem 0 0.85rem;
}

.toolbar {
  margin: 0 0 1rem;
}

.search-wrap {
  flex: 1 1 16rem;
}

.tabs button {
  padding: 0.68rem 1.05rem;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}

.tabs button[aria-selected="true"] {
  background: var(--ivory);
  color: var(--ink);
  border-color: var(--ivory);
}

.subject-row {
  margin-bottom: 1.4rem;
}

.results {
  display: grid;
  gap: 1.6rem;
}

.subject-block h2 {
  margin: 0 0 0.75rem;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 600;
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--line);
}

.item-kicker {
  margin: 0 0 0.18rem;
  color: var(--gold);
  font-size: 0.8rem;
}

.item-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.28rem;
}

.item-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.42rem 0.9rem;
  border: 1px solid var(--line);
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--ink);
}

.btn:hover,
.btn:focus-visible {
  border-color: var(--ivory);
  outline: none;
}

.empty {
  padding: 2.4rem 0;
  color: var(--fog);
}

.colophon {
  margin-top: 4.2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--fog);
  font-size: 0.88rem;
}

.colophon p {
  margin: 0.2rem 0;
}

.toast {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  max-width: 22rem;
  padding: 0.9rem 1.05rem;
  background: var(--ivory);
  color: var(--ink);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .spine {
    position: static;
    height: auto;
    flex-direction: row;
    padding: 0.75rem var(--gutter);
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .spine-title,
  .spine-place {
    writing-mode: horizontal-tb;
    transform: none;
  }

  .spine-mark {
    display: none;
  }

  .class-grid {
    grid-template-columns: 1fr;
  }

  .top-nav {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .nav-center,
  .nav-right {
    justify-self: start;
  }

  .item {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .class-tile {
    transition: none;
  }
}
