/* HSC night city. Navy is the backdrop and light means a room is open.
   Text is orange and warm peach on navy. Nothing on the page is white. */
/* Fredoka and Nunito are served from this folder, never from another site.
   Both are free under the SIL Open Font License; the licenses sit beside the files. */
@font-face {
  font-family: 'Fredoka'; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url(fonts/fredoka-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'Nunito'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(fonts/nunito-latin.woff2) format('woff2');
}
:root {
  --navy: #002461;
  --night: #00123a;
  --deep: #001a4d;
  --orange: #ff6200;
  --flame: #ff7a26;   /* orange for text, a touch lighter so it reads on navy */
  --peach: #ffd3a1;   /* body text */
  --amber: #ffd27a;
  --soft: #f0a868;    /* quieter second line */
  --line: #1d3f8c;
  /* type: one family for titles and place names, one for everything else */
  --font-display: 'Fredoka', 'Trebuchet MS', Arial, sans-serif;
  --font-text: 'Nunito', Arial, Helvetica, sans-serif;
  --display-weight: 600;
  --place-style: normal;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--navy);
  color: var(--peach);
  font: 18px/1.5 var(--font-text);
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
a:focus-visible, button:focus-visible, .card:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}
.skip { position: absolute; left: -999px; top: 0; background: var(--orange); color: var(--night); padding: 12px 16px; z-index: 30; font-weight: 700; }
.skip:focus { left: 8px; top: 8px; }
/* header */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 4%;
  background: var(--deep);
  border-bottom: 4px solid var(--orange);
}
.wordmark { display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 800; letter-spacing: 1.6px; font-size: 16px; line-height: 1.25; color: var(--flame); }
.wordmark .star { font: 44px/1 Georgia, serif; color: var(--orange); transform: rotate(-9deg); }
.top nav { display: flex; align-items: center; gap: 22px; }
.top nav a { text-decoration: none; font-size: 16px; }
.top nav a:hover { text-decoration: underline; }
.top .invite {
  background: var(--orange); color: var(--night); font-weight: 700; white-space: nowrap;
  padding: 10px 16px; border-radius: 6px; min-height: 44px; display: inline-flex; align-items: center;
}
.top .invite:hover { text-decoration: none; background: var(--flame); }

/* the map */
.world { position: relative; background: var(--night); }
.lead { position: absolute; left: 4%; top: 22px; z-index: 2; max-width: 30rem; pointer-events: none; }
.lead h1 { font: var(--display-weight) clamp(34px, 4.3vw, 62px)/1.04 var(--font-display); letter-spacing: -1px; margin: 0 0 12px; color: var(--orange); text-shadow: 0 2px 18px #000a28; }
.lead p { margin: 0 0 6px; font-size: 18px; text-shadow: 0 1px 10px #000a28; }
.lead .how { color: var(--amber); }
#city { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
#city .hit, #city .tag { cursor: pointer; }
#city .tag:focus { outline: none; }
/* room name plates: dark glass, edged in the room's own colour */
#city .tag .plate { fill: #001238; fill-opacity: .93; stroke: var(--room); stroke-width: 2; }
#city .tag .name { font-family: var(--font-text); font-weight: 700; fill: var(--flame); }
#city .tag .sub { font-family: var(--font-text); fill: var(--peach); }
#city .tag .bean { stroke: #00123a; stroke-width: 1; }
#city .tag.dark .plate { stroke: #54699f; }
#city .tag.dark .name { fill: #d98a4f; }
#city .tag.dark .sub { fill: #c9b193; }
#city .tag.open .plate { stroke: var(--orange); stroke-dasharray: 6 4; }
#city .tag:focus-visible .plate { stroke: var(--amber); stroke-width: 4; }
#city .ring { opacity: 0; transition: opacity .15s; pointer-events: none; }
#city .ring.hover { opacity: .9; }
#city .ring.here { opacity: 1; animation: here 1.6s ease-in-out infinite; }
#city .lm { font-family: var(--font-display); font-style: var(--place-style); font-weight: 500; fill: var(--peach); paint-order: stroke; stroke: #00123a; stroke-width: 4px; stroke-linejoin: round; opacity: .95; }

/* lights come on, one room at a time, when the page opens */
#city.intro .lot.lit { animation: lightsOn .9s both; animation-delay: var(--d); }
@keyframes lightsOn { from { filter: brightness(.28) saturate(.3); } 60% { filter: brightness(1.25); } to { filter: none; } }
@keyframes here { 50% { opacity: .35; } }

#city .flowIn { animation: flowIn 1.5s linear infinite; }
#city .flowOut { animation: flowOut 1.5s linear infinite; }
@keyframes flowIn { to { stroke-dashoffset: -22; } }
@keyframes flowOut { to { stroke-dashoffset: 22; } }

/* open rooms breathe with light */
#city .pulse { opacity: .3; animation: pulse 2.8s ease-out infinite; }
@keyframes pulse { from { transform: scale(.5); opacity: .9; } to { transform: scale(1.45); opacity: 0; } }
#city .aura { animation: aura 3.2s ease-in-out infinite alternate; }
@keyframes aura { from { opacity: .65; } to { opacity: 1; } }

#city .tw { animation: twinkle 7s infinite; }
@keyframes twinkle { 0%, 86%, 100% { opacity: 1; } 90%, 96% { opacity: .15; } }
#city .beam { animation: sweep 6s ease-in-out infinite alternate; }
@keyframes sweep { from { transform: rotate(-16deg); } to { transform: rotate(16deg); } }
#city .spin { animation: spin 28s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#city .bulb { animation: bulb 1.3s infinite; }
@keyframes bulb { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
#city .steam { animation: steam 3.3s infinite ease-out; }
@keyframes steam { from { transform: translateY(0); opacity: .55; } to { transform: translateY(-22px) translateX(5px); opacity: 0; } }
#city .ballx { animation: ballx 1.3s linear infinite alternate; }
#city .bally { animation: bally .65s ease-out infinite alternate; }
@keyframes ballx { to { transform: translate(var(--bx), var(--by)); } }
@keyframes bally { to { transform: translateY(var(--lift)); } }
#city .jet { animation: bulb 1.1s infinite; }
#city .beacon { animation: bulb 3s infinite; }
#city .beacon.amber { animation-duration: 1.4s; }
#city .ripple { animation: bulb 4.5s infinite; }
#city .claim { animation: march 1.2s linear infinite; }
@keyframes march { to { stroke-dashoffset: -13; } }
#city .car { animation: drive linear infinite; }
@keyframes drive { from { transform: translate(var(--x0), var(--y0)); } to { transform: translate(var(--x1), var(--y1)); } }
#guide { pointer-events: none; }
#guide.walking .bob { animation: bob .26s ease-in-out infinite alternate; }
#guide.walking .leg.l { animation: legL .26s linear infinite alternate; }
#guide.walking .leg.r { animation: legR .26s linear infinite alternate; }
@keyframes bob { to { transform: translateY(-2.5px); } }
@keyframes legL { from { transform: translateX(-1.6px); } to { transform: translateX(1.6px); } }
@keyframes legR { from { transform: translateX(1.6px); } to { transform: translateX(-1.6px); } }

.still #city *, .still #guide * { animation-play-state: paused !important; }
.still #city.intro .lot.lit { animation: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #city * { animation: none !important; }
  .card { animation: none !important; }
}

/* the activity bean: green, yellow or red */
span.bean {
  flex: none; display: inline-block; width: 19px; height: 12px; border-radius: 7px;
  background: var(--bean); box-shadow: 0 0 9px var(--bean); transform: rotate(-18deg);
}

/* strip under the map */
.hud {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px;
  padding: 14px 4%;
  background: var(--deep);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.hud p { margin: 0; }
.hud #legend { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.hud .key { display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; }
.hud #status { color: var(--amber); flex: 1 1 12rem; min-height: 1.5em; }
.hud button {
  background: transparent; border: 2px solid var(--flame); color: var(--flame); border-radius: 6px;
  padding: 8px 14px; min-height: 44px; font-weight: 700;
}
.hud button:hover { background: #123d8c; }

/* list of rooms */
.rooms, .what { padding: 44px 4% 12px; }
h2 { font: var(--display-weight) 34px/1.15 var(--font-display); margin: 0 0 8px; color: var(--flame); }
.rooms > p { margin: 0 0 22px; color: var(--soft); max-width: 36rem; }
#room-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
#room-list li { display: flex; }
#room-list button {
  width: 100%; text-align: left; display: flex; align-items: center; gap: 14px;
  background: #0a2f73; border: 2px solid #23479a; border-radius: 10px;
  padding: 14px 16px; min-height: 76px;
}
#room-list button:hover { border-color: var(--room); background: #0e3884; }
#room-list button.open { border-style: dashed; border-color: var(--orange); }
#room-list .what { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 0; max-width: none; }
#room-list .what strong { color: var(--flame); }
#room-list .what span { color: var(--soft); font-size: 16px; }
#room-list .state { flex: none; font-size: 16px; color: var(--peach); text-align: right; white-space: nowrap; }

/* what is HSC */
.what { padding-bottom: 56px; max-width: 46rem; }
.what p { margin: 0 0 18px; }
.what .flag {
  display: inline-block; margin-bottom: 18px; padding: 6px 12px;
  border: 2px dashed var(--orange); border-radius: 6px; font-size: 16px; color: var(--amber);
}
.foot { padding: 22px 4% 130px; border-top: 1px solid var(--line); color: var(--soft); font-size: 16px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.foot span:first-child { font: var(--place-style) 18px var(--font-display); color: var(--flame); }

/* Keep the reading area centered while the section backgrounds run full width. */
@media (min-width: 1801px) {
  .shell { --content-gutter: max(4%, calc((100% - 1656px) / 2)); }
  .top, .hud, .rooms, main > .what, .foot { padding-inline: var(--content-gutter); }
  .lead { left: var(--content-gutter); }
  main > .what { max-width: none; }
  main > .what p { max-width: calc(46rem - 144px); }
}

/* the room card, like a game dialogue box: orange against the navy page, navy text */
.card {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 20;
  width: min(580px, calc(100% - 24px));
  transform: translateX(-50%);
  background: linear-gradient(180deg, #ff7a26 0%, #ff6200 100%); color: var(--night);
  border: 3px solid var(--night); border-radius: 14px;
  box-shadow: 0 0 0 3px var(--orange), 0 0 34px color-mix(in srgb, var(--room, #ff6200) 60%, transparent), 0 16px 44px #000a28;
  padding: 18px 20px 20px;
  max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow-y: auto;
  animation: rise .22s ease-out;
}
.card[hidden] { display: none; }
@keyframes rise { from { transform: translate(-50%, 18px); opacity: 0; } }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card h2 { font-size: 30px; margin: 0 0 8px; color: var(--night); }
.card:focus-visible { outline-color: var(--night); }
.card .state {
  display: inline-flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 700;
  padding: 4px 12px; border-radius: 999px; margin: 0 0 12px; background: var(--night); color: var(--peach);
}
.card .state::before {
  content: ""; width: 19px; height: 12px; border-radius: 7px; background: var(--bean);
  box-shadow: 0 0 9px var(--bean); transform: rotate(-18deg);
}
.card p { margin: 0 0 10px; }
.card #card-host { font-weight: 700; }
.card #card-soon { border-left: 4px solid var(--night); padding-left: 10px; }
.card .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.card .go {
  background: var(--night); color: var(--flame); text-decoration: none; font-weight: 700;
  padding: 12px 18px; border-radius: 8px; min-height: 48px; display: inline-flex; align-items: center;
}
.card .go:hover { background: var(--navy); }
.card .go[hidden] { display: none; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.card .x {
  flex: none; background: transparent; border: 2px solid var(--night); color: var(--night); border-radius: 8px;
  min-width: 48px; min-height: 48px; padding: 0 14px; font-weight: 700;
}
.card .x:hover { background: #ff8f47; }

/* wide screens: the card sits in the corner so it hides less of the map */
@media (min-width: 1100px) {
  .card { left: auto; right: 24px; bottom: 24px; transform: none; animation-name: riseWide; }
  @keyframes riseWide { from { transform: translateY(18px); opacity: 0; } }
}

/* a phone or folding phone held sideways: little height, so the card
   moves to the side and stays small enough to leave the map in view */
@media (orientation: landscape) and (max-height: 560px) {
  .card {
    left: auto; right: calc(12px + env(safe-area-inset-right)); bottom: 12px; transform: none;
    width: min(400px, 52%); padding: 12px 14px 14px; animation-name: riseWide;
  }
  .card h2 { font-size: 24px; margin-bottom: 4px; }
  .card .state { margin-bottom: 6px; }
  .card p { margin-bottom: 6px; font-size: 16px; }
  .card .actions { margin-top: 8px; }
  .foot { padding-bottom: 40px; }
}

/* tablets and unfolded phones */
@media (max-width: 1099px) {
  .top, .hud, .rooms, .what, .foot { padding-left: 24px; padding-right: 24px; }
  .lead { left: 24px; right: 24px; }
}

/* phones, and the outer screen of a folding phone */
@media (max-width: 599px) {
  .top { padding: 12px 16px; }
  .wordmark { font-size: 13px; letter-spacing: 1px; gap: 8px; }
  .wordmark .star { font-size: 36px; }
  .top nav .plain { display: none; }
  .top .invite { padding: 10px 12px; }
  .lead { left: 16px; right: 16px; top: 16px; }
  .lead h1 { font-size: 36px; }
  .hud, .rooms, .what, .foot { padding-left: 16px; padding-right: 16px; }
  h2 { font-size: 30px; }
  #room-list { grid-template-columns: 1fr; }
  #room-list .state { max-width: 6.5rem; white-space: normal; }
}
@media (max-width: 359px) {
  .lead h1 { font-size: 31px; }
  .lead p { font-size: 16px; }
}
