/* ==========================================================================
   Shiva Lakshmanan — personal site
   One stylesheet for every page. Colours and fonts are set once, just below.
   ========================================================================== */

/* Fonts are stored with the site (assets/fonts), so no outside service is called. */
@font-face {
  font-family: "Big Shoulders Display";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../assets/fonts/big-shoulders-display-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../assets/fonts/newsreader-latin-wght-normal.woff2") format("woff2");
}

:root {
  /* Colour */
  --night: #060a13;       /* page background, the night sky */
  --deep: #0a111f;        /* raised surfaces */
  --panel: #0f192b;       /* tower bodies, tiles */
  --line: #22304a;        /* visible rules and borders */
  --line-soft: #172238;   /* quiet rules */
  --text: #d6deeb;
  --muted: #8f9db7;
  --cyan: #3fe0ff;        /* the accent: a lit window */
  --cyan-soft: rgba(63, 224, 255, 0.14);
  --amber: #ffc47a;       /* the occasional warm window */

  /* Type */
  --display: "Big Shoulders Display", "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  --body: "Newsreader", Georgia, "Times New Roman", serif;

  /* Layout */
  --wrap: 72rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --header-h: 4rem;

  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* keep focused or linked-to items clear of the sticky header */
  scroll-padding-top: calc(var(--header-h) + 1.25rem);
  background: var(--night);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--night);
  color: var(--text);
  font-family: var(--body);
  font-size: 1.1875rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main { flex: 1 0 auto; }

img, svg { max-width: 100%; }
img { display: block; height: auto; }

a { color: var(--cyan); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 1px;
}

::selection { background: var(--cyan); color: var(--night); }

h1, h2, h3 {
  font-family: var(--display);
  line-height: 1.02;
  margin: 0 0 0.6em;
  text-wrap: balance;
}
h2 { font-size: clamp(2rem, 4.6vw, 3.4rem); font-weight: 800; }
h3 { font-size: clamp(1.45rem, 2.4vw, 1.8rem); font-weight: 700; letter-spacing: 0.005em; }
p { margin: 0 0 1.1em; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 50;
  background: var(--cyan);
  color: var(--night);
  padding: 0.5rem 0.9rem;
  font-family: var(--display);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { top: 0.6rem; }

/* --------------------------------------------------------------------------
   Header and navigation
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(6, 10, 19, 0.84);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
  flex-wrap: wrap;
}

.brand {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.45rem;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0;
}
.brand::before {
  content: "";
  width: 9px;
  height: 13px;
  background: var(--cyan);
  box-shadow: 0 0 14px rgba(63, 224, 255, 0.8);
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0 clamp(1rem, 2.6vw, 2.25rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list a {
  position: relative;
  display: block;
  padding: 0.55rem 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.03em;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-list a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0.3rem;
  height: 2px;
  background: var(--cyan);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.nav-list a:hover,
.nav-list a[aria-current="page"] { color: var(--text); }
.nav-list a:hover::after,
.nav-list a[aria-current="page"]::after { transform: scaleX(1); }

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.55rem;
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
}
.nav-toggle .bars { width: 16px; height: 10px; border-top: 2px solid currentColor; border-bottom: 2px solid currentColor; }

@media (max-width: 760px) {
  .js .nav-toggle { display: inline-flex; }
  .js .nav {
    display: none;
    flex-basis: 100%;
    border-top: 1px solid var(--line-soft);
  }
  .js .nav.open { display: block; }
  .js .nav-list { flex-direction: column; padding: 0.5rem 0 1rem; }
  .js .nav-list a { font-size: 1.6rem; padding: 0.55rem 0; }
  .js .nav-list a::after { display: none; }
  .js .nav-list a[aria-current="page"] { color: var(--cyan); }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.9rem;
  padding: 0.5rem 1.4rem;
  border: 1.5px solid var(--cyan);
  border-radius: 2px;
  background: var(--cyan);
  color: var(--night);
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow 0.25s, background 0.2s, color 0.2s, opacity 0.2s;
}
.btn:hover { box-shadow: 0 0 0 4px rgba(63, 224, 255, 0.16), 0 0 30px rgba(63, 224, 255, 0.4); }
.btn.ghost { background: transparent; color: var(--cyan); }
.btn.ghost:hover { background: var(--cyan-soft); box-shadow: none; }
.btn.quiet { border-color: var(--line); background: transparent; color: var(--text); font-weight: 700; }
.btn.quiet:hover { border-color: var(--muted); box-shadow: none; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 1.75rem; }

/* --------------------------------------------------------------------------
   Skyline (drawn by js/main.js)
   -------------------------------------------------------------------------- */

.skyline { line-height: 0; }
.skyline-svg { display: block; width: 100%; height: 100%; }
.skyline-svg .far { fill: #0a1424; }
.skyline-svg .body { fill: #0d1728; stroke: #1b2a45; stroke-width: 1; }
.skyline-svg .mast { stroke: #1b2a45; stroke-width: 2; }
.skyline-svg .ground { fill: #050810; }
.skyline-svg .win { fill: #152136; transition: fill 0.35s; }
.skyline-svg .win.on { fill: var(--cyan); animation: win-on 1.1s both; animation-delay: var(--d, 0s); }
.skyline-svg .win.on.warm { fill: var(--amber); }
.skyline-svg .beacon { fill: #ff6b6b; animation: beacon 2.6s infinite; }
.skyline.live .win { cursor: pointer; }

@keyframes win-on {
  0% { fill: #152136; }
  40% { fill: #152136; }
  55% { fill: #b9f4ff; }
  70% { fill: #1f5a70; }
  100% { }
}
@keyframes beacon { 0%, 60%, 100% { opacity: 0.15; } 70%, 85% { opacity: 1; } }

/* --------------------------------------------------------------------------
   Home: hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100svh - var(--header-h));
  overflow: hidden;
  background:
    radial-gradient(90% 55% at 70% 100%, rgba(63, 224, 255, 0.17), transparent 65%),
    linear-gradient(180deg, #060a13 0%, #07101f 50%, #0a1a30 100%);
}

.hero-copy {
  position: relative;
  z-index: 2;
  padding-top: clamp(2.5rem, 9vh, 6.5rem);
  padding-bottom: 1.5rem;
}

.hero-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.3rem, 2.3vw, 1.75rem);
  letter-spacing: 0.02em;
  color: var(--cyan);
  margin: 0 0 0.9rem;
}

.display {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3.3rem, min(14.5vw, 15.5vh), 8.25rem);
  line-height: 0.93;
  letter-spacing: -0.005em;
  margin: 0;
  max-width: 13ch;
  text-wrap: balance;
}

.lede {
  font-size: clamp(1.2rem, 1.7vw, 1.4rem);
  line-height: 1.55;
  max-width: 34rem;
  margin: 1.75rem 0 0;
  color: var(--text);
}

.hero .skyline {
  position: relative;
  z-index: 1;
  margin-top: auto;
  height: clamp(190px, 36vh, 360px);
}

.hero-hint {
  position: absolute;
  right: var(--gutter);
  bottom: 0.9rem;
  z-index: 3;
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--muted);
  background: rgba(5, 8, 16, 0.72);
  padding: 0.15rem 0.6rem;
}

/* --------------------------------------------------------------------------
   Sections and shared pieces
   -------------------------------------------------------------------------- */

.band { padding: clamp(3.5rem, 9vw, 7rem) 0; }
.band + .band { border-top: 1px solid var(--line-soft); }
.band.tint { background: var(--deep); }

.prose { max-width: 40rem; }
.prose p { margin-bottom: 1.25em; }
.muted { color: var(--muted); }

/* Link rows on Home */
.rows { list-style: none; margin: 2rem 0 0; padding: 0; border-top: 1px solid var(--line); }
.rows a {
  position: relative;
  display: grid;
  grid-template-columns: minmax(9rem, 17rem) 1fr;
  gap: 0.25rem 2rem;
  align-items: baseline;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  transition: padding-left 0.3s ease;
}
.rows a::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 10px; height: 14px;
  margin-top: -7px;
  background: var(--cyan);
  box-shadow: 0 0 16px rgba(63, 224, 255, 0.9);
  opacity: 0;
  transition: opacity 0.3s;
}
.rows a:hover, .rows a:focus-visible { padding-left: 1.75rem; }
.rows a:hover::before, .rows a:focus-visible::before { opacity: 1; }
.rows .r-title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.1rem, 5vw, 3.6rem);
  line-height: 1;
}
.rows .r-desc { color: var(--muted); font-size: 1.15rem; line-height: 1.45; }
@media (max-width: 620px) { .rows a { grid-template-columns: 1fr; } }

/* Game teaser on Home */
.teaser { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: end; }
@media (max-width: 760px) { .teaser { grid-template-columns: 1fr; } }
.teaser-progress { font-family: var(--display); font-weight: 600; font-size: 1.3rem; color: var(--cyan); margin: 0 0 0.5rem; }

/* The street: twelve towers showing game progress */
.street {
  display: flex;
  align-items: flex-end;
  gap: clamp(3px, 0.8vw, 8px);
  height: clamp(130px, 22vw, 200px);
  border-bottom: 3px solid #050810;
}
.street .t {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: calc(var(--h, 0.6) * 100%);
  padding: 0;
  border: 1px solid #1b2a45;
  border-bottom: 0;
  background-color: #0d1728;
  background-image: radial-gradient(circle, var(--w, #1b2942) 1.7px, transparent 2.2px);
  background-size: 9px 11px;
  background-position: center 5px;
  color: var(--muted);
  font-family: var(--display);
  font-weight: 700;
  font-size: 1rem;
  transition: box-shadow 0.4s, border-color 0.3s;
}
.street .t.lit { --w: var(--cyan); box-shadow: 0 0 26px rgba(63, 224, 255, 0.22); }
.street .t.lit:nth-child(4n) { --w: var(--amber); }
.street button.t { cursor: pointer; }
.street button.t:hover:not([disabled]) { border-color: var(--cyan); }
.street button.t[disabled] { cursor: not-allowed; opacity: 0.55; }
.street .t.current { border-color: var(--cyan); }
.street .t.current::before {
  content: "";
  position: absolute;
  left: 50%; top: -14px;
  width: 0; height: 0;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top-color: var(--cyan);
}
.street .t .num {
  position: absolute;
  left: 0; right: 0; bottom: 3px;
  text-align: center;
  line-height: 1;
  text-shadow: 0 0 4px #060a13, 0 0 4px #060a13;
}

/* Inner page heading */
.page-head {
  padding: clamp(3rem, 9vw, 6.5rem) 0 clamp(2.25rem, 5vw, 3.75rem);
  background:
    radial-gradient(70% 90% at 85% 110%, rgba(63, 224, 255, 0.1), transparent 70%),
    linear-gradient(180deg, #060a13, #08111f);
  border-bottom: 1px solid var(--line-soft);
}
.page-head h1 {
  font-weight: 600;
  font-size: clamp(1.3rem, 2.3vw, 1.75rem);
  letter-spacing: 0.02em;
  color: var(--cyan);
  margin: 0 0 0.9rem;
}
.page-head .display { font-size: clamp(2.7rem, 7.2vw, 6rem); max-width: 17ch; }
.page-head .lede { max-width: 38rem; }

/* Scroll reveal (only when JavaScript is running) */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s ease, transform 0.7s ease; }
.js .reveal.in { opacity: 1; transform: none; }

/* --------------------------------------------------------------------------
   About
   -------------------------------------------------------------------------- */

.about-grid { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: clamp(2.5rem, 6vw, 5.5rem); align-items: start; }
@media (max-width: 900px) { .about-grid { grid-template-columns: 1fr; } }

.about-aside { position: sticky; top: calc(var(--header-h) + 1.5rem); }
@media (max-width: 900px) { .about-aside { position: static; } }

.portrait { border: 1px solid var(--line); background: var(--deep); margin: 0 0 1.75rem; }
.portrait img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }

.facts { margin: 0; }
.facts dt { font-family: var(--display); font-weight: 700; font-size: 1.25rem; color: var(--text); margin-top: 1.4rem; }
.facts dt:first-child { margin-top: 0; }
.facts dd { margin: 0.2rem 0 0; color: var(--muted); font-size: 1.05rem; line-height: 1.5; }

.timeline { list-style: none; margin: 1.75rem 0 0; padding: 0; border-left: 1px solid var(--line); }
.timeline li { position: relative; padding: 0 0 2.1rem 1.9rem; max-width: 38rem; }
.timeline li:last-child { padding-bottom: 0.25rem; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -5px; top: 0.5rem;
  width: 9px; height: 12px;
  background: var(--line);
  transition: background 0.6s 0.3s, box-shadow 0.6s 0.3s;
}
.timeline li.in::before { background: var(--cyan); box-shadow: 0 0 14px rgba(63, 224, 255, 0.85); }
.t-when { display: block; font-family: var(--display); font-weight: 600; font-size: 1.2rem; letter-spacing: 0.02em; color: var(--cyan); line-height: 1.3; }
.timeline h3 { margin: 0.1rem 0 0.35rem; }
.timeline p { margin: 0; color: var(--text); }

.plain-list { list-style: none; margin: 1.5rem 0 0; padding: 0; max-width: 40rem; }
.plain-list li { padding: 0.95rem 0; border-top: 1px solid var(--line-soft); }
.plain-list li:last-child { border-bottom: 1px solid var(--line-soft); }

.beliefs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.5rem, 4vw, 3rem); margin-top: 2rem; }
@media (max-width: 800px) { .beliefs { grid-template-columns: 1fr; } }
.beliefs h3 { color: var(--text); }
.beliefs p { color: var(--muted); margin: 0; }

.sub { margin-top: clamp(3rem, 7vw, 5rem); }

/* --------------------------------------------------------------------------
   Writing
   -------------------------------------------------------------------------- */

.doors { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.25rem, 3vw, 2.5rem); }
@media (max-width: 720px) { .doors { grid-template-columns: 1fr; } }
.door {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 19rem;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--deep), var(--night));
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition: border-color 0.3s, transform 0.3s;
}
.door::after {
  /* light spilling from an opening door */
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 0;
  background: linear-gradient(180deg, transparent, rgba(63, 224, 255, 0.16));
  transition: height 0.45s ease;
}
.door:hover, .door:focus-visible { border-color: var(--cyan); transform: translateY(-3px); }
.door:hover::after, .door:focus-visible::after { height: 70%; }
.door .d-name { font-family: var(--display); font-weight: 800; font-size: clamp(2.6rem, 6vw, 4.4rem); line-height: 1; margin: 0 0 0.75rem; }
.door .d-desc { color: var(--muted); margin: 0; max-width: 24rem; }
.door .d-go { position: relative; z-index: 1; margin-top: auto; padding-top: 2rem; font-family: var(--display); font-weight: 700; font-size: 1.3rem; color: var(--cyan); }

/* --------------------------------------------------------------------------
   Lab
   -------------------------------------------------------------------------- */

.strand-head { max-width: 40rem; margin-bottom: 2rem; }
.entries { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.25rem; }
.entry { border: 1px solid var(--line); background: var(--night); padding: 1.35rem 1.5rem 1.5rem; transition: border-color 0.3s; }
.entry:hover { border-color: #37507a; }
.entry h3 { margin-bottom: 0.4rem; }
.entry p { color: var(--muted); margin: 0; font-size: 1.08rem; line-height: 1.55; }
.entry p + p { margin-top: 0.8rem; }
.tag {
  display: inline-block;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  line-height: 1.5;
  color: var(--amber);
  border: 1px solid currentColor;
  padding: 0 0.45rem;
  margin-bottom: 0.7rem;
}

.sketcher { display: grid; grid-template-columns: minmax(0, 18rem) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: stretch; border: 1px solid var(--line); background: var(--night); padding: clamp(1.25rem, 3vw, 2.25rem); margin-bottom: 1.25rem; }
@media (max-width: 720px) { .sketcher { grid-template-columns: 1fr; } }
.sketcher .field { margin-bottom: 1.2rem; }
.sketcher .field-head { display: flex; justify-content: space-between; font-family: var(--display); font-weight: 700; font-size: 1.2rem; }
.sketch-note { padding: 1.5rem; }
.sketcher output { color: var(--cyan); }
.sketcher input[type="range"] { width: 100%; accent-color: var(--cyan); margin: 0.35rem 0 0; height: 1.6rem; }
.sketch-stage {
  min-height: 22rem;
  background:
    radial-gradient(80% 50% at 50% 100%, rgba(63, 224, 255, 0.14), transparent 70%),
    linear-gradient(180deg, #060a13, #0a1a30);
  border: 1px solid var(--line-soft);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sketch-stage svg { display: block; width: 100%; height: 26rem; max-height: 70vh; }
.sketch-caption { color: var(--muted); font-size: 1.02rem; margin: 0.9rem 0 0; }

.cities { display: flex; flex-wrap: wrap; gap: 0.3rem 1.75rem; list-style: none; padding: 0; margin: 0 0 2rem; font-family: var(--display); font-weight: 800; font-size: clamp(1.7rem, 4vw, 2.8rem); line-height: 1.15; }
.cities li { color: var(--text); }
.cities li:nth-child(even) { color: var(--muted); }

.frames { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
@media (max-width: 720px) { .frames { grid-template-columns: 1fr; } }
.frame { margin: 0; border: 1px solid var(--line); background: var(--night); overflow: hidden; }
.frame img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform 0.6s ease; }
.frame:hover img { transform: scale(1.04); }
.frame figcaption { padding: 0.8rem 1rem 0.95rem; color: var(--muted); font-size: 1.02rem; line-height: 1.45; border-top: 1px solid var(--line-soft); position: relative; background: var(--night); }
.frame .tag { margin: 0 0.5rem 0 0; }

/* --------------------------------------------------------------------------
   Contact
   -------------------------------------------------------------------------- */

.contact-card { max-width: 44rem; }
.email-line { font-family: var(--display); font-weight: 800; font-size: clamp(1.7rem, 5.2vw, 3.4rem); line-height: 1.1; margin: 0 0 0.5rem; overflow-wrap: anywhere; }
.email-line a { color: var(--text); text-decoration-color: var(--cyan); text-decoration-thickness: 3px; text-underline-offset: 0.16em; }
.email-line a:hover { color: var(--cyan); }
.copy-note { min-height: 1.6em; color: var(--cyan); margin: 0.8rem 0 0; }

/* --------------------------------------------------------------------------
   Game: Lights On
   -------------------------------------------------------------------------- */

.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
@media (max-width: 900px) { .game-layout { grid-template-columns: 1fr; } }

.game-side h2 { font-size: clamp(2rem, 4vw, 2.8rem); margin-bottom: 0.3rem; }
.game-status { font-family: var(--display); font-weight: 600; font-size: 1.35rem; color: var(--cyan); margin: 0 0 1.25rem; min-height: 1.6em; }
.game-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0 0 1.5rem; }
.game-actions .btn { font-size: 1.12rem; min-height: 2.7rem; padding: 0.4rem 1rem; }

.win {
  border: 1px solid var(--cyan);
  background: var(--cyan-soft);
  padding: 1.1rem 1.25rem 1.25rem;
  margin: 0 0 1.5rem;
}
.win p { margin: 0 0 0.9rem; font-size: 1.15rem; line-height: 1.5; }
.win[hidden] { display: none; }

.howto { border-top: 1px solid var(--line); padding-top: 1rem; color: var(--muted); font-size: 1.05rem; line-height: 1.55; }
.howto summary { font-family: var(--display); font-weight: 700; font-size: 1.25rem; color: var(--text); cursor: pointer; padding: 0.2rem 0; }
.howto ul { margin: 0.75rem 0 0; padding-left: 1.1rem; }
.howto li { margin-bottom: 0.5rem; }

.tower-stage {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: clamp(1.5rem, 4vw, 2.75rem) 0 0;
  background:
    radial-gradient(70% 50% at 50% 100%, rgba(63, 224, 255, 0.13), transparent 70%),
    linear-gradient(180deg, #060a13, #0a1a30);
  border: 1px solid var(--line-soft);
  border-bottom: 4px solid #050810;
  min-height: 20rem;
}

.tower {
  --cols: 4;
  --rows: 4;
  --cell: max(34px, min(66px, calc((100vw - 2 * var(--gutter) - 2.5rem) / var(--cols)), calc((100vh - 15rem) / var(--rows))));
  width: calc(var(--cell) * var(--cols) + 14px);
  max-width: 100%;
  position: relative;
}
.tower .roof {
  height: 12px;
  margin: 0 14px;
  border: 1px solid #2a3d61;
  border-bottom: 0;
  background: #101c31;
  position: relative;
}
.tower .roof::before {
  /* mast */
  content: "";
  position: absolute;
  left: 22%;
  bottom: 100%;
  width: 2px;
  height: 26px;
  background: #2a3d61;
}
.tower .roof::after {
  content: "";
  position: absolute;
  left: calc(22% - 2px);
  bottom: calc(100% + 26px);
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #ff6b6b;
  animation: beacon 2.6s infinite;
}
.tower .grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--cell));
  grid-auto-rows: var(--cell);
  justify-content: center;
  padding: 6px;
  border: 1px solid #2a3d61;
  background: #0b1424;
}
.tower .plinth {
  height: 20px;
  margin: 0 -8px;
  background: #101c31;
  border: 1px solid #2a3d61;
  border-bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  line-height: 1;
}

.tile {
  --turns: 0;
  --delay: 0ms;
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 1px solid #0b1424;
  background: var(--panel);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
.tile:focus-visible { outline: 2px solid #fff; outline-offset: -3px; z-index: 2; }
.tile .room {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(63, 224, 255, 0.34), rgba(63, 224, 255, 0.1) 70%);
  opacity: 0;
  transition: opacity 0.35s ease var(--delay);
}
.tile.warm .room { background: radial-gradient(circle at 50% 50%, rgba(255, 196, 122, 0.36), rgba(255, 196, 122, 0.1) 70%); }
.tile .wire {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(calc(var(--turns) * 90deg));
  transition: transform 0.2s ease;
}
.tile .wire line { stroke: #50638a; stroke-width: 9; transition: stroke 0.3s ease var(--delay); }
.tile .wire circle { fill: #50638a; transition: fill 0.3s ease var(--delay); }
.tile.on .room { opacity: 1; }
.tile.on .wire line { stroke: var(--cyan); }
.tile.on .wire circle { fill: var(--cyan); }
.tile.on.end .wire circle { fill: #eafcff; }
.tile.source::after {
  /* the mains: a ring around the starting tile */
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 56%; height: 56%;
  transform: translate(-50%, -50%);
  border: 2px solid var(--cyan);
  border-radius: 50%;
  pointer-events: none;
}
.tile.locked { cursor: default; }
.tile.locked::before {
  /* a pin on tiles fixed by a hint */
  content: "";
  position: absolute;
  right: 4px; top: 4px;
  width: 6px; height: 6px;
  background: var(--amber);
  z-index: 1;
}
.tile:hover:not(.locked) { background: #142038; }
.tower.won .tile { cursor: default; }
.tower.won .tile .room { animation: room-pulse 1.4s ease calc(var(--row) * 70ms) 1; }
@keyframes room-pulse { 0% { filter: brightness(1); } 35% { filter: brightness(2.4); } 100% { filter: brightness(1); } }

.street-wrap { margin-top: clamp(2.5rem, 6vw, 4rem); }
.street-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1.5rem; margin-bottom: 1.4rem; }
.street-head h2 { margin: 0; font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
.link-btn { background: none; border: 0; padding: 0.3rem 0; color: var(--muted); font-family: var(--body); font-size: 1.02rem; text-decoration: underline; text-underline-offset: 0.18em; cursor: pointer; }
.link-btn:hover { color: var(--text); }
.link-btn[hidden] { display: none; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer { margin-top: clamp(3rem, 8vw, 6rem); }
.site-footer .skyline { height: clamp(70px, 11vw, 120px); opacity: 0.9; }
.footer-bar { background: #050810; border-top: 1px solid var(--line-soft); padding: 1.4rem 0 1.6rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; color: var(--muted); font-size: 1rem; }
.footer-inner p { margin: 0; }
.footer-inner a { color: var(--muted); }
.footer-inner a:hover { color: var(--cyan); }
.home .site-footer { margin-top: 0; }

/* 404 */
.lost { min-height: 55vh; display: flex; align-items: center; }

/* --------------------------------------------------------------------------
   Reduced motion: keep everything visible, drop the movement
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0s !important;
  }
  .js .reveal { opacity: 1; transform: none; }
  .skyline-svg .beacon, .tower .roof::after { opacity: 1; }
}

@media print {
  .site-header, .site-footer .skyline, .hero .skyline, .hero-hint { display: none; }
  body { background: #fff; color: #000; }
}

/* Windows switched on by a visitor light instantly, without the flicker */
.skyline-svg .win.on.touched { animation: none; }
.sketch-stage.live .win { cursor: pointer; }

/* Small fixes and extras */
.hero-hint { display: none; }
.js .hero-hint { display: block; }
.teaser-progress:empty { display: none; }
.game-main h2 { font-size: clamp(2rem, 4vw, 2.8rem); margin-bottom: 0.3rem; }
.tower-stage { container-type: inline-size; overflow-x: auto; padding-inline: 0.5rem; }
@supports (width: 1cqw) {
  .tower {
    --cell: max(30px, min(66px, calc((100cqw - 1.5rem) / var(--cols)), calc((100vh - 15rem) / var(--rows))));
  }
}
a.btn:not([href]) { cursor: default; }

/* Wide screens: the city rises behind the hero text instead of sitting below it */
@media (min-width: 1000px) {
  .hero .skyline { position: absolute; left: 0; right: 0; bottom: 0; height: 80%; margin: 0; }
  .hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(6, 10, 19, 0.92) 0%, rgba(6, 10, 19, 0.72) 36%, rgba(6, 10, 19, 0) 66%);
  }
  .hero-copy { padding-bottom: 5.5rem; }
}
em, i, cite { font-style: normal; }

.band .beliefs + .btn-row { margin-top: 2.75rem; }
.street .t.lit .num { color: var(--text); }

/* Game page: a shorter heading so the tower is on screen sooner */
.page-head.compact { padding: clamp(1.75rem, 4vw, 2.75rem) 0 clamp(1.4rem, 3vw, 2rem); }
.page-head.compact h1 { margin-bottom: 0.35rem; }
.page-head.compact .display { font-size: clamp(2.6rem, 5vw, 4rem); }
.page-head.compact .lede { margin-top: 0.7rem; max-width: 46rem; font-size: 1.15rem; }
.band.tight { padding-top: clamp(1.75rem, 4vw, 2.75rem); }
