/* ngerakines.me: a full-window terminal on charcoal, with a floating dock in
   the top-right corner, and the whole world as a plain page for visitors
   without JavaScript or WebAssembly. Colors are in main.js's THEME too. */

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: block;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-BoldItalic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: block;
}

:root {
  --ink: #1f2023;
  --raised: #2a2b2f;
  --line: #3a3b40;
  --paper: #e8e6e1;
  --mute: #8e8d89;
  --signal: #4ba3e3;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --dock-height: 40px;
  --gutter: 20px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 14px;
  overflow: hidden;
}

/* The terminal fills the window. The band above it holds the dock, so the
   dock never covers a line of output. */
.screen {
  position: fixed;
  inset: calc(var(--dock-height) + 20px) var(--gutter) 12px var(--gutter);
}
.screen .xterm {
  height: 100%;
}
.screen .xterm-viewport {
  background: transparent !important;
}
.screen .xterm-viewport::-webkit-scrollbar {
  width: 8px;
}
.screen .xterm-viewport::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

/* ----- the dock -------------------------------------------------------------- */

.dock {
  position: fixed;
  top: 10px;
  right: var(--gutter);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--dock-height);
  padding: 0 6px 0 12px;
  background: color-mix(in srgb, var(--raised) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 35%);
  backdrop-filter: blur(8px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.mark {
  display: block;
}
.wordmark {
  font-weight: 700;
  letter-spacing: -0.01em;
}
.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -0.15em;
  background: var(--signal);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}

.keys {
  display: inline-flex;
  gap: 6px;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.key {
  min-width: 44px;
  height: 28px;
  padding: 0 10px;
  background: var(--ink);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  color: var(--paper);
}
.key:hover {
  border-color: var(--mute);
}
.key:active {
  transform: translateY(1px);
  border-bottom-width: 1px;
}
.key.primary {
  background: var(--signal);
  border-color: #2f7fb8;
  color: var(--ink);
  font-weight: 700;
}
.key.primary:hover {
  background: #6bb5ea;
}

.ssh {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 28px;
  padding: 0 4px 0 10px;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.ssh-command::before {
  content: "$ ";
  color: var(--mute);
}
.ssh-copy {
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--mute);
  background: var(--raised);
}
.ssh:hover .ssh-copy {
  color: var(--paper);
}

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

/* ----- the video player ------------------------------------------------------- */

/* Floats under the dock, over the oldest lines rather than the newest. */
.player {
  position: fixed;
  top: calc(var(--dock-height) + 20px);
  right: var(--gutter);
  z-index: 12;
  width: min(480px, calc(100vw - 2 * var(--gutter)));
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 45%);
  overflow: hidden;
}
.player[hidden] {
  display: none;
}
.player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 6px 6px 12px;
}
.player-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-frame {
  aspect-ratio: 16 / 9;
  background: #000;
}
.player-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
/* Spotify's embed: its own rounded card. It picks its layout by its height,
   and 152 px is the one with the artwork and the controls. */
.player-frame[data-shape="music"] {
  aspect-ratio: auto;
  padding: 0 8px 8px;
  background: transparent;
}
.player-frame[data-shape="music"] iframe {
  height: 152px;
  border-radius: 12px;
}

/* ----- the scene window ------------------------------------------------------- */

/* An inner window over the terminal, which dims behind it. The sky is drawn on
   the crew lounge's black. */
.scene {
  position: fixed;
  inset: 0;
  z-index: 14;
  display: grid;
  place-items: center;
  padding: calc(var(--dock-height) + 20px) var(--gutter) 12px;
  background: rgb(11 11 13 / 62%);
}
.scene[hidden] {
  display: none;
}
.scene-window {
  display: flex;
  flex-direction: column;
  width: min(1040px, 100%);
  height: min(640px, 100%);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 16px 48px rgb(0 0 0 / 55%);
  overflow: hidden;
}
.scene-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 6px 6px 12px;
}
.scene-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scene-sky {
  display: block;
  flex: 1;
  min-height: 0;
  width: 100%;
  background: #0b0b0d;
}
.key[aria-pressed="true"] {
  border-color: var(--signal);
  color: var(--signal);
}

/* ----- which view ------------------------------------------------------------- */

/* With scripts, the terminal; the plain page only on request (#plain) or when
   the terminal can't start. Without scripts, the plain page alone: a
   <noscript> style in index.html turns this around. */
.plain {
  display: none;
}
html.show-plain .plain,
html.failed .plain {
  display: block;
}
html.show-plain .dock,
html.show-plain .screen,
html.show-plain .player,
html.show-plain .scene,
html.failed .dock,
html.failed .screen,
html.failed .player,
html.failed .scene {
  display: none;
}
html.show-plain body,
html.failed body {
  overflow: auto;
}
html.failed .to-terminal {
  display: none;
}

.skip {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip:focus {
  position: fixed;
  top: 10px;
  left: var(--gutter);
  z-index: 20;
  width: auto;
  height: auto;
  clip-path: none;
  padding: 8px 12px;
  background: var(--raised);
  border: 1px solid var(--signal);
  border-radius: 6px;
  color: var(--paper);
}

/* ----- the plain page --------------------------------------------------------- */

.plain {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2rem var(--gutter) 4rem;
  line-height: 1.6;
}
.plain:focus {
  outline: none;
}
.plain a {
  color: var(--signal);
}
.plain h1 {
  margin: 0;
  font-size: 1.5rem;
}
.plain .p-note {
  margin-top: 0.25rem;
}
.plain-note {
  color: var(--mute);
}
.plain h3 {
  margin: 2rem 0 0.5rem;
  font-size: 1.125rem;
  color: #f5c66b;
}
.plain h4 {
  margin: 1rem 0 0.25rem;
  font-size: 1rem;
}
.plain p {
  white-space: pre-wrap;
}
.plain pre {
  font: inherit;
  line-height: 1.2;
  overflow-x: auto;
}
.plain .things {
  list-style: none;
  margin: 0;
  padding-left: 1rem;
  border-left: 1px solid var(--line);
}
.plain .exits {
  color: #f5c66b;
}
.plain .when-label {
  color: var(--mute);
}
.plain .facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0 1.5rem;
}
.plain .facts dt {
  font-weight: 700;
}
.plain .facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
/* Draft content: a dashed magenta rule and italics. Finished content inside a
   draft room must not look like a draft. */
.plain .draft {
  border-left: 2px dashed #d78be5;
  padding-left: 0.75rem;
  font-style: italic;
}
.plain .draft .thing:not(.draft) {
  border-left: 0;
  padding-left: 0;
  font-style: normal;
}

/* Narrow screens: the dock keeps the mark and the two most useful keys. */
@media (max-width: 720px) {
  :root {
    --gutter: 10px;
  }
  .wide-only {
    display: none;
  }
}
@media (max-width: 420px) {
  .wordmark {
    display: none;
  }
}

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