/* Depthsweeper's page: Sounding, the deep-sea minesweeper's console (the game's default theme).
   Backlit keys in chrome, a porthole on the deep, silkscreen capitals in Bricolage Grotesque,
   every sentence in Atkinson Hyperlegible Next. Its colours are the theme's own (Themes.DATA,
   "sounding"): the dark console, and in light mode the "day watch", the same keys on ivory. */

:root {
  color-scheme: dark light;
  --bg: #15191c;
  --bed: #0d1012;
  --panel: #1b2024;
  --edge: #7f8a91;
  --edge-hi: #aab3b9;
  --inset: #0f1316;
  --ink: #e8eded;
  --dim: #a9b3b6;
  --accent: #78f2e4;
  --accent-dark: #1f6b64;
  --gold: #f8d873;
  --primary: #ffb042;
  --on-primary: #3c1800;
  --chip: #0f1417;
  --chip-ink: #78f2e4;
  --link: #78f2e4;
  --display: "Bricolage Grotesque", "Arial Narrow", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #e3ddcc;
    --bed: #c9c1ad;
    --panel: #f2ede1;
    --edge: #8f989e;
    --edge-hi: #7d878d;
    --inset: #ddd6c4;
    --ink: #1c2429;
    --dim: #55606a;
    --accent: #0b7a70;
    --accent-dark: #0a4f48;
    --gold: #8c5f00;
    --primary: #ffa936;
    --chip: #1d2327;
    --chip-ink: #6ef0e0;
    --link: #0a6158;
  }
}

body {
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--body);
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.ds-wrap {
  width: min(100% - 32px, 68rem);
  margin-inline: auto;
}

/* the console's chrome: a steel edge round a dark inset */
.ds-chrome {
  background: var(--panel);
  border: 3px solid var(--edge);
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px var(--edge-hi), inset 0 0 0 4px var(--inset);
}

.ds-eyebrow,
.ds-h2,
.ds-h3,
.ds-wordmark,
.ds-plate {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 75%;
  text-transform: uppercase;
}

.ds-eyebrow {
  margin: 0 0 6px;
  font-size: 1rem;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.ds-h2 {
  margin: 0 0 14px;
  font-size: clamp(1.9rem, 1.4rem + 2.2vw, 2.8rem);
  line-height: 1;
  letter-spacing: 0.01em;
}

.ds-h3 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  line-height: 1.1;
  letter-spacing: 0.02em;
}

/* ---------- The hero: the porthole on the deep ---------- */

.ds-hero {
  padding: 18px 0 34px;
  background: linear-gradient(180deg, var(--bed), var(--bg) 70%);
}

.ds-porthole {
  display: block;
  margin: 0 auto 6px;
}

.ds-porthole img {
  display: block;
  width: 100%;
}

.ds-hero__in {
  display: grid;
  gap: 8px 40px;
}

@media (min-width: 900px) {
  .ds-hero__in {
    grid-template-columns: 1.1fr 1fr;
    align-items: center;
  }
}

.ds-hero__name {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 8px 0 6px;
}

.ds-icon {
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: 16px;
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.35);
}

.ds-wordmark {
  margin: 0;
  font-size: clamp(2.6rem, 1.3rem + 6.5vw, 5.4rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.ds-tagline {
  margin: 4px 0 16px;
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: clamp(1.1rem, 0.95rem + 0.8vw, 1.45rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.ds-lede {
  margin: 0 0 16px;
  font-size: 1.15rem;
  max-width: 36rem;
}

.ds-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.ds-chips li {
  margin: 0;
  padding: 3px 12px;
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--chip-ink);
  background: var(--chip);
  border: 2px solid var(--edge);
  border-radius: 8px;
}

.ds-get {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin: 0;
}

.ds-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: 1.2rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--on-primary);
  background: linear-gradient(#ffc76e, var(--primary));
  border: 0;
  border-radius: 10px;
  box-shadow: inset 0 -3px 0 rgb(120 60 0 / 0.35), 0 0 0 3px #1d2327, 0 0 0 5px var(--edge);
  text-decoration: none;
}

.ds-get a:not(.ds-key) {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.ds-hero__shot {
  display: none;
}

@media (min-width: 900px) {
  .ds-hero__shot {
    display: block;
    justify-self: center;
    width: min(100%, 300px);
    margin: 0;
  }
}

/* ---------- Sections ---------- */

.ds-section {
  padding: 40px 0 12px;
}

.ds-split {
  display: grid;
  gap: 18px 40px;
  align-items: start;
}

@media (min-width: 860px) {
  .ds-split {
    grid-template-columns: 1fr 1fr;
  }

  .ds-split.flip > :first-child {
    order: 2;
  }
}

.ds-list {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
}

.ds-list li {
  margin: 0 0 0.55rem;
}

.ds-list li::marker {
  color: var(--accent);
}

.ds-shots {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ds-shots li {
  margin: 0;
}

.ds-shot {
  margin: 0;
}

.ds-shot img {
  display: block;
  width: 100%;
  border-radius: 14px;
  border: 3px solid var(--edge);
  box-shadow: inset 0 0 0 1px var(--edge-hi), 0 12px 28px rgb(0 0 0 / 0.3);
}

.ds-shot figcaption {
  margin-top: 8px;
  font-size: 0.92rem;
  color: var(--dim);
}

/* the six rules, as chips */
.ds-rules {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 10px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.ds-rules li {
  margin: 0;
  padding: 10px 14px 12px;
}

.ds-rules b {
  display: block;
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: 1.2rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.ds-rules span {
  color: var(--dim);
  font-size: 0.98rem;
}

.ds-themes {
  margin: 0 0 18px;
  overflow: hidden;
  border-radius: 14px;
  border: 3px solid var(--edge);
}

.ds-themes img {
  display: block;
  width: 100%;
}

.ds-theme-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: 6px 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ds-theme-list li {
  margin: 0;
  padding: 8px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--edge) 45%, transparent);
}

.ds-theme-list b {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ds-theme-list span {
  display: block;
  color: var(--dim);
  font-size: 0.98rem;
}

/* ---------- The demo: three floors on Sounding's keys ---------- */

.ds-demo__in {
  display: grid;
  gap: 18px 36px;
  align-items: start;
}

@media (min-width: 860px) {
  .ds-demo__in {
    grid-template-columns: auto 1fr;
  }
}

.ds-console {
  --key: min(15vw, 58px);
  justify-self: center;
  padding: 14px 14px 10px;
  background: var(--bed);
  border: 3px solid var(--edge);
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px var(--edge-hi), inset 0 0 0 4px #0b0e10, 0 18px 40px rgb(0 0 0 / 0.35);
}

.ds-board {
  display: grid;
  grid-template-columns: repeat(5, var(--key));
  gap: 0;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.ds-tile {
  position: relative;
  width: var(--key);
  height: calc(var(--key) * 280 / 256);
  margin: 0;
  padding: 0;
  border: 0;
  background: url("/depthsweeper/img/keys.webp") 0 0 / 1300% 100% no-repeat;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.ds-tile:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: -3px;
  border-radius: 10px;
}

/* the sprite strip's frames, in tools/import_assets.py's order */
.k-unreach { background-position-x: 0; }
.k-reach { background-position-x: calc(100% / 12 * 1); }
.k-open { background-position-x: calc(100% / 12 * 2); }
.k-zero { background-position-x: calc(100% / 12 * 3); }
.k-mark { background-position-x: calc(100% / 12 * 4); }
.k-boom { background-position-x: calc(100% / 12 * 5); }
.k-stairs { background-position-x: calc(100% / 12 * 6); }

.k-far {
  filter: brightness(0.42) saturate(0.6);
}

/* the tiles a tapped number counts */
.ds-tile.counted::after {
  content: "";
  position: absolute;
  inset: 8% 9% 14%;
  border: 3px solid #78f2e4;
  border-radius: 10px;
  box-shadow: 0 0 10px rgb(120 242 228 / 0.7);
  pointer-events: none;
}

.ds-badge,
.ds-glow {
  position: absolute;
  inset: 0;
  background: url("/depthsweeper/img/keys.webp") 0 0 / 1300% 100% no-repeat;
  pointer-events: none;
}

.ds-badge {
  display: grid;
  place-items: center;
  padding-top: calc(var(--key) * 0.03);
  font-family: var(--body);
  font-weight: 800;
  font-size: calc(var(--key) * 0.34);
  line-height: 1;
}

.b-1 { background-position-x: calc(100% / 12 * 7); color: #00804e; }
.b-2 { background-position-x: calc(100% / 12 * 8); color: #1844c8; }
.b-3 { background-position-x: calc(100% / 12 * 9); color: #6c2cba; padding-top: calc(var(--key) * 0.1); }
.b-4 { background-position-x: calc(100% / 12 * 10); color: #c41654; }
.b-5 { background-position-x: calc(100% / 12 * 11); color: #de4a08; }

.ds-glow {
  background-position-x: calc(100% / 12 * 12);
  animation: ds-pulse 1.4s ease-in-out infinite alternate;
}

@keyframes ds-pulse {
  from { opacity: 0.45; }
  to { opacity: 1; }
}

.ds-plate {
  margin: 10px auto 2px;
  padding: 7px 10px;
  width: fit-content;
  max-width: calc(var(--key) * 5);
  font-size: clamp(0.8rem, 0.55rem + 1.2vw, 0.95rem);
  letter-spacing: 0.1em;
  color: #78f2e4;
  background: #0f1417;
  border: 2px solid #7f8a91;
  border-radius: 6px;
  text-align: center;
}

.ds-panel {
  padding: 16px 18px;
}

.ds-panel p {
  margin: 0 0 12px;
}

.ds-line {
  min-height: 3.2em;
  font-size: 1.08rem;
}

.ds-floor {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ds-floor .rule {
  margin-left: 8px;
  padding: 1px 8px;
  font-size: 1rem;
  letter-spacing: 0.08em;
  color: var(--chip-ink);
  background: var(--chip);
  border: 2px solid var(--edge);
  border-radius: 6px;
  vertical-align: 3px;
}

.ds-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 0;
}

.ds-tool {
  min-height: 48px;
  min-width: 96px;
  padding: 0 16px;
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffeecd;
  background: #171c20;
  border: 3px solid var(--edge);
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px var(--edge-hi);
  cursor: pointer;
}

.ds-tool[aria-pressed="true"],
.ds-tool.primary {
  color: #3c1800;
  background: #ffb042;
}

.ds-help {
  margin-top: 12px;
  font-size: 0.95rem;
  color: var(--dim);
}

/* the rule card, shown before a floor with a new rule */
.ds-card {
  margin: 0 0 12px;
  padding: 12px 14px;
  background: var(--chip);
  color: #e8eded;
  border: 2px solid var(--edge);
  border-radius: 10px;
}

.ds-card p {
  margin: 0 0 10px;
}

/* ---------- Press kit and policy ---------- */

.ds-press {
  display: grid;
  gap: 8px 48px;
}

@media (min-width: 860px) {
  .ds-press {
    grid-template-columns: 1fr 1fr;
  }
}

.ds-sheet {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 18px;
  margin: 0 0 20px;
}

.ds-sheet dt {
  font-weight: 700;
}

.ds-sheet dd {
  margin: 0;
  color: var(--dim);
}

.ds-files {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.ds-files li {
  margin: 0;
}

.ds-files a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 6px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--edge) 45%, transparent);
  text-decoration: none;
}

.ds-files a:hover span:first-child {
  text-decoration: underline;
}

.ds-files .size {
  color: var(--dim);
  font-size: 0.9rem;
  white-space: nowrap;
}

.ds-privacy {
  margin: 8px 0 56px;
  padding: 16px 18px;
}

.ds-privacy p {
  margin: 0;
}

.ds-policy {
  padding: 28px 0 56px;
}

.ds-policy .ds-wrap {
  width: min(100% - 32px, 44rem);
}

.ds-policy h1 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: clamp(2.1rem, 1.6rem + 2.4vw, 3rem);
  line-height: 1;
  text-transform: uppercase;
}

.ds-policy h2 {
  margin: 2.2rem 0 0.6rem;
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 75%;
  font-size: 1.45rem;
  line-height: 1.1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.ds-policy .meta {
  margin: 0 0 1.25rem;
  color: var(--dim);
  font-size: 0.95rem;
}

.ds-policy .back {
  margin: 0 0 14px;
}

.ds-policy .back a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  font-weight: 700;
}

.ds-policy .lede {
  font-size: 1.12rem;
}

.ds-policy ul {
  padding-left: 1.2rem;
}

.ds-policy li + li {
  margin-top: 0.4rem;
}

.ds-policy li::marker {
  color: var(--accent);
}

.ds-policy .summary {
  margin: 1.6rem 0 0.5rem;
  padding: 1rem 1.2rem 0.2rem;
}

.ds-policy .summary h2 {
  margin: 0 0 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
  .ds-glow {
    animation: none;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .ds-policy .back {
    display: none;
  }

  .ds-policy a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
  }
}

/* ---------- Depth: lit from behind, a rail for the screens on a phone ---------- */

.ds-porthole {
  position: relative;
  isolation: isolate;
}

.ds-porthole::before {
  content: "";
  position: absolute;
  inset: 10% 8% 0;
  z-index: -1;
  background: radial-gradient(closest-side, rgb(120 242 228 / 0.3), transparent);
  filter: blur(30px);
  animation: ds-lamp 5s ease-in-out infinite alternate;
}

.ds-porthole img {
  animation: ds-settle 1200ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes ds-settle {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
}

@keyframes ds-lamp {
  to { opacity: 0.6; }
}

.ds-shot {
  transition: transform 350ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (hover: hover) {
  .ds-shot:hover {
    transform: translateY(-6px);
  }
}

@media (max-width: 899px) {
  .ds-shots {
    grid-auto-flow: column;
    grid-auto-columns: 62%;
    grid-template-columns: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 0 16px 8px;
    margin-inline: -16px;
    scrollbar-width: none;
  }
  .ds-shots > li {
    scroll-snap-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ds-porthole::before,
  .ds-porthole img { animation: none; }
  .ds-shot { transition: none; }
}
