/* Abyss Driller: shared components, all lifted from the game's own UI.
   Panels and buttons use the in-game chamfer (small 45° corner cuts) with a 1px keyline,
   drawn as two clipped layers so the keyline follows the cut and focus outlines stay visible. */

:root {
  --chamfer: 6px;
  --cta-fill: #b04a3f;          /* the in-game action brick, raised: cream label 4.97:1 */
  --cta-fill-hover: #9c3f35;    /* darker within the brick family: cream 6.1:1 */
  --cta-fill-active: #703433;   /* the in-game CONTINUE fill */
  --cta-keyline: #e58a6f;
  --cta-ink: var(--cream);
  --to-base: #6f302b;                        /* in-game TO BASE fill */
  --continue: #703433;                       /* in-game CONTINUE fill */
}

/* Chamfered polygon for any size: --c = cut size. */
.chamfer {
  clip-path: polygon(var(--c, var(--chamfer)) 0, calc(100% - var(--c, var(--chamfer))) 0, 100% var(--c, var(--chamfer)),
    100% calc(100% - var(--c, var(--chamfer))), calc(100% - var(--c, var(--chamfer))) 100%, var(--c, var(--chamfer)) 100%,
    0 calc(100% - var(--c, var(--chamfer))), 0 var(--c, var(--chamfer)));
}

/* ---------- Panel: opaque dark teal, 1px cyan keyline, optional bright top rule ---------- */
.panel {
  --c: var(--chamfer);
  --panel-fill: var(--panel-1);
  --panel-line: rgb(40 201 241 / 0.32);
  position: relative;
  isolation: isolate;
  padding: 1px;
}
.panel::before, .panel::after {
  content: "";
  position: absolute;
  z-index: -1;
  clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c));
}
.panel::before { inset: 0; background: var(--panel-line); }
.panel::after { inset: 1px; background: var(--panel-fill); --c: calc(var(--chamfer) - 0.4px); }
.panel--rule { border-top: 0; }
.panel--rule > .panel__rule {
  position: absolute; left: var(--c); right: var(--c); top: 0; height: 4px; background: var(--info-hot);
}

/* ---------- Primary CTA: the in-game action button (TO BASE / CONTINUE), brightened ---------- */
.cta {
  --c: 5px;
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 56px;
  padding: 0 26px;
  color: var(--cta-ink);
  font-family: var(--font-body);
  font-stretch: 112%;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  text-decoration: none;
  text-shadow: 0 1px 0 rgb(0 0 0 / 0.25);
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cta::before, .cta::after {
  content: "";
  position: absolute;
  z-index: -1;
  transition: background-color 0.18s var(--ease-water);
  clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c));
}
.cta::before { inset: 0; background: var(--cta-keyline); }
.cta::after { inset: 1px; background: var(--cta-fill); }
.cta:hover::after { background: var(--cta-fill-hover); }
.cta:active::after { background: var(--cta-fill-active); }
.cta:active { transform: translateY(1px); }
.cta:focus-visible { outline: 2px solid var(--cream); outline-offset: 4px; }
.cta--small { min-height: 40px; padding: 0 16px; font-size: 13px; --c: 4px; }
.cta--block { display: flex; width: 100%; }

/* Secondary: ghost with cyan keyline (information role), never filled. */
.ghost {
  --c: 5px;
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 22px;
  color: var(--cream);
  font-family: var(--font-body);
  font-stretch: 112%;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: 0;
}
.ghost::before, .ghost::after {
  content: "";
  position: absolute;
  z-index: -1;
  clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c));
  transition: background-color 0.18s var(--ease-water);
}
.ghost::before { inset: 0; background: rgb(40 201 241 / 0.55); }
.ghost::after { inset: 1px; background: rgb(1 16 21 / 0.72); }
.ghost:hover::after { background: rgb(5 51 64 / 0.92); }
.ghost:focus-visible { outline: 2px solid var(--info); outline-offset: 4px; }
.ghost svg { width: 14px; height: 14px; flex: none; fill: currentColor; }
.ghost--s { --c: 4px; min-height: 44px; padding: 0 16px; font-size: 13px; }
/* Copy buttons: the label counts up like the in-game MINING percentage, then says it's done. */
.copy[hidden] { display: none; }
.copy__label { min-width: 11.5ch; text-align: center; font-variant-numeric: tabular-nums; }
.copy.is-mining .copy__label { color: var(--value); }
.copy.is-done .copy__label { color: var(--info); }

/* Plain text link in the info role. */
.textlink { color: var(--info); text-decoration: underline; text-underline-offset: 0.25em; text-decoration-thickness: 1px; }
.textlink:hover { color: var(--cream); }

/* ---------- HUD depth readout, built like the in-game top-centre frame ---------- */
.readout {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  gap: 14px;
  padding: 6px 18px;
  border-block: 1px solid var(--hud-rule);
  font-family: var(--font-hud);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.readout__now { font-weight: 700; font-size: 22px; color: var(--text); min-width: 4.6ch; text-align: right; }
.readout__div { width: 1px; align-self: stretch; background: var(--hud-rule); }
.readout__limit { font-weight: 500; font-size: 22px; color: var(--info); min-width: 4.6ch; } /* "550 m" fits, so the frame never changes width */
.readout__label { font-weight: 500; font-size: 11px; line-height: 1.05; letter-spacing: 0.02em; color: var(--info); text-transform: uppercase; }

/* ---------- Segmented bar (HULL / ENERGY) ---------- */
.bar { --seg: var(--energy); --fill: 1; display: grid; gap: 4px; }
.bar__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.bar__track {
  height: 7px;
  background: linear-gradient(90deg, var(--seg) calc(var(--fill) * 100%), rgb(255 255 255 / 0.08) 0);
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 calc(10% - 3px), transparent calc(10% - 3px) 10%);
  mask: repeating-linear-gradient(90deg, #000 0 calc(10% - 3px), transparent calc(10% - 3px) 10%);
}
.bar--hull { --seg: var(--hull); }

/* ---------- Clip frame: a gameplay clip shown like a monitor, with a pause control ---------- */
.clip { position: relative; background: #000; overflow: hidden; }
.clip video, .clip img { width: 100%; height: 100%; object-fit: cover; }
.clip__toggle {
  --c: 3px;
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  color: var(--cream);
  background: rgb(1 4 7 / 0.66);
  cursor: pointer;
  clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c));
}
.clip__toggle:hover { background: rgb(5 51 64 / 0.9); }
.clip__toggle:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; clip-path: none; }
.clip__toggle svg { width: 12px; height: 12px; fill: currentColor; }
.clip__toggle[hidden] { display: none; } /* with JS off, the native controls are the only controls */
@media (pointer: coarse) { .clip__toggle { width: 44px; height: 44px; } }
.clip__toggle .i-play { display: none; }
.clip__toggle[data-playing="false"] .i-play { display: block; }
.clip__toggle[data-playing="false"] .i-pause { display: none; }

/* ---------- Dialogs: trailer and screenshot lightbox ---------- */
dialog.viewer {
  width: min(1280px, 100vw - 32px);
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  background: #000;
  color: var(--text);
  overflow: visible;
}
dialog.viewer::backdrop { background: rgb(1 4 7 / 0.9); }
dialog.viewer video, dialog.viewer img { display: block; width: 100%; height: auto; max-height: calc(100dvh - 120px); object-fit: contain; background: #000; }
.viewer__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0 0; background: transparent; }
.viewer__btn {
  --c: 4px;
  --kl: rgb(40 201 241 / 0.45);
  --fl: rgb(1 16 21 / 0.85);
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  background: none;
  color: var(--cream);
  font: 700 13px/1 var(--font-body);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}
.viewer__btn::before, .viewer__btn::after { content: ""; position: absolute; z-index: -1; clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c)); transition: background-color 0.18s var(--ease-water); }
.viewer__btn::before { inset: 0; background: var(--kl); }
.viewer__btn::after { inset: 1px; background: var(--fl); }
.viewer__btn:focus-visible { outline: 2px solid var(--info); outline-offset: 3px; }
.viewer__btn[hidden] { display: none; }
.viewer__btn:disabled, .viewer__btn[aria-disabled="true"] { opacity: 0.5; cursor: default; }
.viewer__btn--close { --kl: rgb(255 255 255 / 0.22); --fl: var(--to-base); }
/* The in-game TO BASE brick (Refit, the drill's To base), drawn in the same two layers. */
.viewer__btn--brick { --kl: rgb(255 255 255 / 0.22); --fl: var(--to-base); }
/* Hover fills for a mouse only: on a touch screen the last button tapped would stay lit. */
@media (hover: hover) {
  .viewer__btn:hover { --fl: var(--panel-2); }
  .viewer__btn--close:hover { --fl: #85392f; }
  .viewer__btn--brick:hover { --fl: #85392f; }
  .viewer__btn--brick[aria-disabled="true"]:hover { --fl: var(--to-base); }
  .viewer__btn:not(.viewer__btn--brick, .viewer__btn--close)[aria-disabled="true"]:hover { --fl: rgb(1 16 21 / 0.85); } /* Back or Next at its end */
}
.viewer__bar .cta--small { min-height: 44px; }
/* In a dialog's button bar the pause toggle matches its neighbours: 44 px, keyline along the chamfer. */
.viewer__bar .clip__toggle { --c: 4px; position: relative; isolation: isolate; width: 44px; height: 44px; background: none; clip-path: none; }
.viewer__bar .clip__toggle::before, .viewer__bar .clip__toggle::after { content: ""; position: absolute; z-index: -1; clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c)); transition: background-color 0.18s var(--ease-water); }
.viewer__bar .clip__toggle::before { inset: 0; background: rgb(40 201 241 / 0.45); }
.viewer__bar .clip__toggle::after { inset: 1px; background: rgb(1 16 21 / 0.85); }
.viewer__bar .clip__toggle:hover { background: none; }
.viewer__bar .clip__toggle:hover::after { background: var(--panel-2); }
.viewer__bar .clip__toggle:focus-visible { outline-offset: 3px; }

/* ---------- Mobile dock (bottom thumb bar) ---------- */
.dock {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 40;
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: var(--abyss);
  border-top: 1px solid var(--hud-rule);
  transform: translateY(110%);
  transition: transform 0.28s var(--ease-water);
}
.dock[data-show="true"] { transform: none; }
.dock__meta { flex: none; display: grid; gap: 2px; }
.dock .cta { flex: 1; min-height: 50px; }
@media (max-width: 899px) { .js .dock { display: flex; } }

/* ---------- Pre-launch-only blocks disappear in the launch build ---------- */
[data-state="live"] [data-prelaunch-only] { display: none !important; }
[data-state="prelaunch"] [data-live-only] { display: none !important; }

/* ---------- Legal pages ---------- */
.legal-page { background: var(--abyss); }
.legal-head { padding-block: 28px 8px; }
.legal-home img { width: 200px; height: auto; }
.legal { max-width: 760px; padding-block: 24px 64px; }
.legal h1 { margin: 12px 0 28px; }
.legal h2 { margin: 32px 0 10px; font-size: 15px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--info); }
.legal p { color: var(--text); max-width: 64ch; }
.legal a { color: var(--info); }
.legal-draft { padding: 14px 16px; background: rgb(255 207 38 / 0.08); border-left: 3px solid var(--value); color: var(--text); font-size: 15px; }
.legal-foot { display: flex; flex-wrap: wrap; gap: 12px 28px; justify-content: space-between; padding-block: 24px 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.legal-foot nav { display: flex; gap: 20px; }
.legal-foot a { color: var(--muted); }
.legal-foot a:hover { color: var(--cream); }

/* ---------- Trailer hover preview (desktop only) ----------------------------------------
   Built by core.js on the first hover of the hero's "Watch the trailer" button and hidden at
   rest, so the hero looks exactly the same until someone points at the button. It is a fixed
   layer placed beside the button (in the dark water below the sub) so it never covers the logo,
   the copy or the sub; moving the pointer onto it keeps it open (WCAG 1.4.13), Escape or
   scrolling dismisses it, and clicking it opens the trailer with sound. */
.tpv {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 45;
  width: min(380px, 34vw);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) scale(0.985);
  transform-origin: 0 50%;
  pointer-events: none;
  cursor: pointer;
  transition: opacity 0.18s var(--ease-water), transform 0.18s var(--ease-water), visibility 0.18s;
}
.tpv.is-on { opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
.tpv__card { display: block; background: #000; box-shadow: 0 0 0 1px rgb(40 201 241 / 0.55), 0 18px 40px rgb(0 0 0 / 0.55); }
.tpv video { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
.tpv__bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px;
  background: var(--abyss);
  font: 700 11px/1.2 var(--font-hud);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--info);
}
.tpv__bar b { font-weight: 700; color: var(--cream); }

/* ---------------------------------------------------------------- the sub-pages' header
   Press kit, studio and 404 (tools/partials/subhead.html): the studio's mark, the site menu and the Steam
   button. On phones and tablets the menu folds behind a button (with JS) and drops down under the header;
   without JS its links wrap under the mark. The game page has its own header (site.css), with the same parts. */
.pk-head { position: sticky; top: 0; padding-top: env(safe-area-inset-top, 0px); z-index: 40; background: var(--sea-dark); border-bottom: 1px solid rgb(29 102 112 / 0.5); }
.pk-head__in { display: flex; align-items: center; gap: 28px; min-height: calc(var(--header-h) - 1px); } /* as the home header: its height includes the border */
.pk-head__brand { flex: none; line-height: 0; }
.pk-head__brand img { width: 146px; height: auto; }
.pk-head__nav { display: flex; gap: 26px; margin-left: auto; }
.pk-head__nav a { color: var(--text); text-decoration: none; font: 700 13px/1 var(--font-body); letter-spacing: 0.05em; text-transform: uppercase; }
.pk-head__nav a[aria-current="page"] { color: var(--info); }
@media (hover: hover) { .pk-head__nav a:hover { color: var(--info); } }
@media (max-width: 899px) {
  .pk-head__in { gap: 12px; }
  .pk-head__brand img { width: 120px; }
  .pk-head__cta { margin-left: auto; }
  .js .pk-head__nav { display: none; }
  .pk-head .top__menu { order: 2; }
  .js .pk-head.is-menu .pk-head__nav {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 4px var(--gutter) 12px;
    background: var(--sea-dark);
    border-bottom: 1px solid rgb(29 102 112 / 0.5);
  }
  .pk-head.is-menu .pk-head__nav a { display: block; padding: 15px 0; font-size: 15px; border-bottom: 1px solid rgb(40 201 241 / 0.12); }
  .pk-head.is-menu .pk-head__nav a:last-child { border-bottom: 0; }
  html:not(.js) .pk-head__in { flex-wrap: wrap; padding-block: 10px; }
  html:not(.js) .pk-head__nav { order: 3; width: 100%; margin: 0; flex-wrap: wrap; gap: 12px 20px; }
}
@media (max-width: 479px) {
  .pk-head__in { gap: 8px; }
  .pk-head__brand img { width: 104px; }
  .pk-head__cta.cta--small { padding: 0 12px; font-size: 12px; }
  .js .pk-head .top__menu:not([hidden]) { width: 44px; padding: 0; gap: 0; justify-content: center; font-size: 0; } /* the three bars only; the name stays for screen readers */
}
/* Small phones: the mark and the menu; the page's own Steam buttons are a scroll away. With the Steam button
   gone there is room again for the mark at its phone size and for the menu's name. */
@media (max-width: 371px) {
  .pk-head__cta { display: none; }
  .pk-head .top__menu { margin-left: auto; }
  .pk-head__brand img { width: 120px; }
  .js .pk-head .top__menu:not([hidden]) { width: auto; padding: 0 14px; gap: 10px; font-size: 12px; }
}
@media (pointer: coarse) { .pk-head__nav a { padding-block: 14px; } }
/* Print and Save as PDF: no controls that do nothing on paper. */
@media print { .top__menu, .skip, .dock { display: none !important; } }
