:root {
  --night-deep: #090d0b;
  --stone-raised: #242d27;
  --stone-warm: #2c281b;
  --parchment: #c9c3b3;
  --ritual-ivory: #d8d2c2;
  --aged-ivory: #b7ab8d;
  --muted-gold: #c2a86c;
  --live-coral: #ff4d5e;
  --active-stone: #484028;
  --hover-stone: #3a3422;
  --hairline: rgba(236, 231, 216, .12);
  --gold-line: rgba(224, 180, 92, .36);
  --content-wide: 1040px;
  --content-narrow: 720px;
}

body {
  background:
    linear-gradient(to bottom, #0a0f0c 0, #131b16 calc(var(--horizon) - 6px), #0e1511 calc(var(--horizon) + 4px), #0b110e 72%, var(--night-deep) 100%);
}

.cove {
  width: 100%;
  max-width: none;
  padding-bottom: max(64px, env(safe-area-inset-bottom));
}

.sky {
  width: min(calc(100% - 32px), 460px);
  margin-inline: auto;
  isolation: isolate;
}

.lede {
  color: var(--parchment);
}

.page-section {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 32px), var(--content-wide));
  margin-inline: auto;
}

.section-intro {
  display: grid;
  justify-items: center;
  max-width: 640px;
  margin-inline: auto;
  text-align: center;
}

.section-intro h2 {
  color: var(--moon);
  font: 500 clamp(30px, 5vw, 48px)/1.05 "Cinzel", Georgia, serif;
  letter-spacing: -.02em;
  text-wrap: balance;
}

.section-intro p {
  max-width: 56ch;
  margin-top: 12px;
  color: var(--fog);
  font-size: 19px;
  line-height: 1.5;
  text-wrap: pretty;
}

.portal-deck {
  margin-top: 56px;
}

.portal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 14px;
  margin-top: 28px;
}

.portal-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 212px;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 26px;
  border: 1px solid var(--hairline);
  border-radius: 16px 4px 16px 16px;
  color: var(--moon);
  background: rgba(28, 36, 31, .82);
  text-decoration: none;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}

.portal-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 54px;
  height: 1px;
  background: var(--moongold);
  opacity: .7;
}

.portal-card--community {
  grid-row: span 2;
  min-height: 438px;
  justify-content: flex-end;
  border-color: var(--gold-line);
  background: var(--stone-warm);
}

.portal-card--community::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to bottom, rgba(9, 13, 11, .18) 8%, rgba(9, 13, 11, .98) 60%),
    url("/img/banner.jpg") center top / cover no-repeat;
}

.portal-card h3 {
  max-width: 15ch;
  color: var(--moon);
  font: 500 clamp(27px, 4vw, 38px)/1.05 "Cinzel", Georgia, serif;
  letter-spacing: -.015em;
  text-wrap: balance;
}

.portal-card--community h3 {
  max-width: 12ch;
  font-size: clamp(34px, 5vw, 54px);
}

.portal-card p {
  max-width: 44ch;
  margin-top: 12px;
  color: var(--parchment);
  font-size: 18px;
  line-height: 1.45;
  text-wrap: pretty;
}

.portal-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 14px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
}

.portal-meta dt {
  color: var(--fog);
  font-size: 15px;
}

.portal-meta dd {
  min-width: 0;
  color: var(--moon);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.portal-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  color: var(--moongold);
  font: 500 15px/1.3 "Cinzel", Georgia, serif;
  letter-spacing: .04em;
  text-decoration: none;
}

.portal-action svg {
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.portal-card:focus-visible {
  outline: 2px solid var(--moon);
  outline-offset: 4px;
}

.portal-action:focus-visible {
  outline: 2px solid var(--moon);
  outline-offset: 4px;
}

.live-note {
  display: inline-flex;
  align-items: center;
  color: var(--moongold);
}

.live-note::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--live-coral);
}

.night-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
  gap: 44px;
  margin-top: 72px;
  padding: clamp(28px, 5vw, 52px);
  border-top: 1px solid var(--gold-line);
  border-bottom: 1px solid var(--hairline);
  background: rgba(28, 36, 31, .7);
}

.night-story {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.night-story .sec-emoji {
  width: 76px;
  height: 76px;
  margin: 0 0 20px;
}

.night-story h2 {
  color: var(--moongold);
  font: 500 15px/1.4 "Cinzel", Georgia, serif;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.night-story .rel-status {
  max-width: 16ch;
  margin-top: 14px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.08;
  text-align: left;
}

.night-story .rel-lore {
  max-width: 48ch;
  margin-top: 14px;
  color: var(--parchment);
  font-size: 20px;
  line-height: 1.45;
}

.lunar-ledger {
  align-self: center;
  margin: 0;
}

.lunar-ledger > div {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 20px;
  padding-block: 14px;
  border-top: 1px solid var(--hairline);
}

.lunar-ledger > div:last-child {
  border-bottom: 1px solid var(--hairline);
}

.lunar-ledger dt {
  color: var(--fog);
  font: 500 14px/1.4 "Cinzel", Georgia, serif;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.lunar-ledger dd {
  color: var(--moon);
  font-size: 18px;
  line-height: 1.4;
}

.night-panel .cycle {
  grid-column: 1 / -1;
  width: 100%;
  height: 4px;
  margin-top: 20px;
}

.ritual {
  max-width: var(--content-narrow);
  margin-top: 80px;
  margin-inline: auto;
}

.ritual blockquote,
.farewell blockquote {
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.4;
}

.districts {
  margin-top: 86px;
}

.district-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 30px;
}

.district-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: rgba(28, 36, 31, .62);
}

.district-card[open] {
  border-color: var(--gold-line);
  background: var(--stone-raised);
}

.district-card.is-tonight {
  border-color: rgba(224, 180, 92, .62);
  background: var(--stone-warm);
}

.district-card summary {
  position: relative;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 26px;
  align-items: center;
  gap: 18px;
  min-height: 132px;
  padding: 20px;
  cursor: pointer;
  list-style: none;
}

.district-card summary::-webkit-details-marker {
  display: none;
}

.district-card summary:focus-visible {
  outline: 2px solid var(--moon);
  outline-offset: -5px;
}

.district-card .d-emblem {
  width: 92px;
  height: 92px;
  margin: 0;
  border-radius: 12px;
}

.district-heading h3 {
  color: var(--moongold);
  font: 500 18px/1.2 "Cinzel", Georgia, serif;
}

.district-heading p {
  margin-top: 7px;
  color: var(--fog);
  font-size: 17px;
  font-style: italic;
  line-height: 1.35;
  text-wrap: pretty;
}

.district-chevron {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--moon);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  transition: rotate .28s cubic-bezier(.2, .7, .2, 1);
}

.district-card[open] .district-chevron {
  rotate: 45deg;
}

.district-body {
  padding: 0 20px 22px 130px;
  border-top: 1px solid var(--hairline);
}

.district-body h4 {
  margin-top: 18px;
  color: var(--moon);
  font: 500 15px/1.3 "Cinzel", Georgia, serif;
}

.district-body ul {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.district-body li {
  position: relative;
  padding-left: 18px;
  color: var(--parchment);
  font-size: 17px;
  line-height: 1.4;
}

.district-body li::before {
  content: "";
  position: absolute;
  top: .62em;
  left: 0;
  width: 7px;
  height: 1px;
  background: var(--moongold);
}

.d-now {
  display: inline-block;
  margin: 18px 0 0;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--night);
  background: var(--moongold);
  font: 600 12px/1 "Cinzel", Georgia, serif;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.community-section {
  margin-top: 86px;
}

.community-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  overflow: hidden;
  margin-top: 30px;
  border-radius: 16px;
  background: var(--stone);
}

.community-feature img {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
}

.community-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 5vw, 52px);
}

.community-copy h3 {
  color: var(--moon);
  font: 500 clamp(28px, 4vw, 42px)/1.08 "Cinzel", Georgia, serif;
  letter-spacing: -.015em;
}

.community-copy p {
  margin-top: 14px;
  color: var(--parchment);
  font-size: 19px;
  line-height: 1.5;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.character-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  min-width: 0;
  padding: 22px;
  border-radius: 16px;
  background: rgba(28, 36, 31, .62);
}

.character-card img {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
}

.character-card h3 {
  color: var(--moongold);
  font: 500 22px/1.15 "Cinzel", Georgia, serif;
}

.character-card p {
  margin-top: 8px;
  color: var(--fog);
  font-size: 17px;
  line-height: 1.4;
}

.farewell {
  max-width: var(--content-narrow);
  margin: 80px auto 0;
}

footer {
  width: min(calc(100% - 32px), var(--content-wide));
  margin: 72px auto 0;
  padding-top: 28px;
  border-top: 1px solid var(--hairline);
}

.footer-attribution {
  margin-top: 16px;
  color: var(--fog);
  font-size: 16px;
  line-height: 1.6;
}

.footer-attribution a {
  color: var(--moongold);
  text-underline-offset: 4px;
}

.footer-attribution a:focus-visible {
  outline: 2px solid var(--moon);
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .portal-card {
    transition:
      translate .3s cubic-bezier(.2, .7, .2, 1),
      border-color .25s ease,
      background-color .25s ease;
  }

  .portal-card:hover {
    translate: 0 -4px;
    border-color: var(--gold-line);
    background-color: var(--stone-raised);
  }

  .portal-card:hover .portal-action svg {
    translate: 4px 0;
  }

  .portal-action svg {
    transition: translate .3s cubic-bezier(.2, .7, .2, 1);
  }

  .district-card summary:hover {
    background: rgba(236, 231, 216, .03);
  }
}

@media (max-width: 760px) {
  .portal-grid,
  .night-panel,
  .community-feature {
    grid-template-columns: 1fr;
  }

  .portal-card--community {
    grid-row: auto;
    min-height: 420px;
  }

  .night-panel {
    gap: 28px;
  }

  .community-feature img {
    min-height: 220px;
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 620px) {
  .section-intro {
    justify-items: start;
    text-align: left;
  }

  .portal-grid,
  .district-grid,
  .character-grid {
    grid-template-columns: 1fr;
  }

  .portal-card {
    min-height: 208px;
    padding: 24px 22px;
  }

  .portal-card--community {
    min-height: 420px;
  }

  .night-panel {
    width: 100%;
    padding-inline: 22px;
  }

  .district-card summary {
    grid-template-columns: 72px minmax(0, 1fr) 24px;
    gap: 14px;
    min-height: 112px;
    padding: 16px;
  }

  .district-card .d-emblem {
    width: 72px;
    height: 72px;
  }

  .district-body {
    padding: 0 16px 20px;
  }

  .character-card {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 18px;
    padding: 18px;
  }

  .character-card img {
    width: 88px;
    height: 88px;
  }
}

@media (max-width: 360px) {
  .lunar-ledger > div {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .portal-card--community {
    min-height: 390px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-card,
  .portal-action svg,
  .district-chevron {
    transition: none;
  }
}
