:root {
  color-scheme: dark;
  --primary: hsl(258, 100%, 72%);
  --primary-content: hsl(258, 100%, 22%);
  --primary-light: hsl(258, 100%, 82%);
  --primary-lighter: hsl(258, 88%, 100%);
  --secondary: hsl(78, 100%, 72%);
  --secondary-light: hsl(78, 100%, 82%);
  --background: hsl(260, 29%, 10%);
  --foreground: hsl(257, 27%, 15%);
  --foregrounder: hsl(257, 27%, 20%);
  --border: hsl(259, 28%, 25%);
  --copy-light: hsl(260, 27%, 85%);
  --page-bg: var(--foreground);
  --code-border: var(--border);
  --code-bg: var(--foregrounder);
  --code-text: var(--copy-light);
  --button-bg: hsla(258, 100%, 72%, 0.12);
  --button-border: hsla(258, 100%, 82%, 0.28);
  --button-text: var(--primary-lighter);
  --button-fill: var(--primary-light);
  --button-fill-pressed: var(--primary);
  --button-fill-text: var(--primary-content);
  --button-success-bg: var(--secondary);
  --button-success-text: var(--background);
  --module-surface: hsla(257, 27%, 20%, 0.9);
  --time-kicker: hsl(322, 100%, 78%);
  --time-clock: hsl(184, 100%, 72%);
  --time-progress-start: hsl(78, 100%, 72%);
  --time-progress-end: hsl(184, 100%, 72%);
  --time-fill: hsl(78, 100%, 72%);
  --time-border: hsl(78, 100%, 82%);
  --time-cell-track: hsla(184, 100%, 72%, 0.1);
  --time-cell-border: hsla(267, 100%, 82%, 0.43);
  scrollbar-color: var(--secondary) var(--background);
  accent-color: var(--primary);
}

@property --grid-fill {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}

* {
  box-sizing: border-box;
}

a,
button,
[role="button"],
summary {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
[role="button"]:focus:not(:focus-visible),
summary:focus:not(:focus-visible) {
  outline: none;
}

::selection {
  background: var(--primary-light);
  color: var(--foregrounder);
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  align-content: start;
  place-items: start center;
  --shell-pad: 24px;
  padding: var(--shell-pad);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background: var(--page-bg);
  color: var(--copy-light);
}

/* val.packett.cool-style layered wave, colored by the active theme. */
.immersion-top {
  justify-self: stretch;
  margin: calc(-1 * var(--shell-pad)) calc(-1 * var(--shell-pad)) 0;
  line-height: 0;
  overflow: hidden;
}

.immersion-top svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2400 / 180;
}

.immersion-top g {
  fill: var(--primary);
}

@media (max-width: 768px) {
  .immersion-top svg {
    width: calc(716.8px + 6.667vw);
    max-width: none;
    margin-left: 50%;
    transform: translateX(-50%);
  }
}

pre {
  font-family: "SFMono-Regular", "JetBrains Mono", "IBM Plex Mono", "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  font-variant-ligatures: none;
}

.page-shell {
  width: 100%;
  display: grid;
  gap: 28px;
}

.page-title {
  margin: 0;
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--secondary-light);
}

.page-links {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.page-link {
  --page-link-fill: var(--button-fill);
  --page-link-fill-pressed: var(--button-fill-pressed);
  --page-link-fill-text: var(--button-fill-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--button-border);
  border-radius: 10px;
  background: var(--button-bg);
  color: var(--button-text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease, transform 120ms ease;
}

.page-link:visited {
  color: var(--button-text);
}

.page-link:hover {
  background: var(--page-link-fill);
  color: var(--page-link-fill-text);
  border-color: var(--page-link-fill);
}

.page-link:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

.page-link:active {
  background: var(--page-link-fill-pressed);
  color: var(--page-link-fill-text);
  border-color: var(--page-link-fill-pressed);
  transform: translateY(1px);
}

.page-shell-home {
  justify-items: center;
  width: min(1360px, 100%);
}

.page-shell-home .code-block {
  width: 100%;
}

.home-columns {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
  align-items: stretch;
}

.home-panel {
  display: grid;
  align-content: start;
  gap: 32px;
  height: 100%;
  min-width: 0;
  padding: 30px;
  border: 1px solid var(--code-border);
  border-radius: 28px;
  background: var(--module-surface);
}

.home-primary-panel {
  justify-items: center;
}

.home-panel > * {
  min-width: 0;
}

.hero-brand-mark {
  width: min(400px, 100%);
  height: auto;
  filter: drop-shadow(0 0 22px hsla(78, 100%, 72%, 0.18));
}

.page-links-compact {
  flex-wrap: wrap;
}

.page-links-compact .page-link {
  min-width: 70px;
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.home-page-links {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: auto;
}

.home-page-links .page-link {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 16px;
  font-size: 16px;
  border-width: 2px;
  border-radius: 14px;
}

.page-link-swatch {
  --page-link-fill: var(--page-link-border, var(--button-fill));
  --page-link-fill-pressed: var(--page-link-border, var(--button-fill-pressed));
  --page-link-fill-text: var(--button-fill-text);
  border-color: var(--page-link-fill);
  box-shadow: 0 0 0 1px hsla(258, 100%, 82%, 0.12) inset;
}

.page-link-swatch:hover {
  border-color: var(--page-link-fill);
  box-shadow: 0 0 22px hsla(258, 100%, 72%, 0.32);
}

.time-passage-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  height: 100%;
}

.time-passage-head {
  display: grid;
  justify-items: start;
  gap: 18px;
}

.time-passage-kicker {
  margin: 0;
  font-family: "SFMono-Regular", "JetBrains Mono", "IBM Plex Mono", "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--time-kicker);
  text-shadow: 0 0 18px hsla(322, 100%, 78%, 0.42);
}

.time-passage-status {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.time-passage-clock {
  font-family: "SFMono-Regular", "JetBrains Mono", "IBM Plex Mono", "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  color: var(--time-clock);
  text-shadow: 0 0 22px hsla(184, 100%, 72%, 0.36);
}

.time-passage-progress {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid hsla(184, 100%, 72%, 0.46);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--time-progress-start), var(--time-progress-end));
  color: var(--background);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 24px hsla(184, 100%, 72%, 0.24), 0 0 18px hsla(78, 100%, 72%, 0.2);
}

.time-passage-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  justify-self: stretch;
  align-self: start;
}

/* Mobile devices (flagged via UA in main.js): sparser, airier hourly grid */
.time-passage-grid.is-compact {
  gap: 16px;
  max-width: 320px;
  justify-self: start;
}

.time-passage-cell {
  --grid-fill: 0%;
  aspect-ratio: 1 / 1;
  border: 2px solid var(--time-cell-border);
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--time-fill) var(--grid-fill), transparent var(--grid-fill)),
    var(--time-cell-track);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    --grid-fill 900ms linear;
}

.time-passage-cell.is-past,
.time-passage-cell.is-current {
  border-color: var(--time-border);
  box-shadow: 0 0 14px hsla(78, 100%, 72%, 0.28);
}

.time-passage-cell.is-current {
  box-shadow: 0 0 20px hsla(78, 100%, 72%, 0.42), inset 0 0 10px hsla(78, 100%, 72%, 0.18);
}

.time-passage-cell.is-future {
  border-color: var(--time-cell-border);
  background:
    linear-gradient(90deg, transparent 0%, transparent 100%),
    var(--time-cell-track);
}

.time-sidebar {
  border-color: hsla(267, 100%, 78%, 0.56);
  background: linear-gradient(160deg, hsla(257, 27%, 20%, 0.94), hsla(257, 27%, 16%, 0.94));
  box-shadow: 0 0 30px hsla(267, 100%, 72%, 0.2);
}

.terminal {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--background);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--foregrounder);
  color: var(--copy-light);
  font-size: 13px;
  line-height: 1;
}

.terminal-lights {
  display: inline-flex;
  gap: 8px;
}

.terminal-light {
  width: 12px;
  height: 12px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 999px;
}

.terminal-light-close {
  background: #ff5f57;
}

.terminal-light-minimize {
  background: #febc2e;
}

.terminal-light-zoom {
  background: #28c840;
}

.terminal-title {
  min-width: 0;
  line-height: 1.4;
  overflow: hidden;
  color: var(--copy-light);
  font-weight: 600;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-copy-button {
  margin-left: auto;
}

.terminal pre {
  margin: 0;
  max-height: min(70vh, 720px);
  padding: 22px 24px;
  overflow: auto;
  background: var(--background);
  color: #f1eff8;
  font-size: 15px;
  line-height: 1.72;
  font-weight: 500;
  letter-spacing: 0;
  scrollbar-width: none;
  white-space: pre;
}

.terminal pre::-webkit-scrollbar,
.code-block-inner::-webkit-scrollbar {
  display: none;
}

.hljs {
  display: block;
  background: transparent;
  color: inherit;
}

.code-block {
  position: relative;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--code-border);
  border-radius: 16px;
}

.code-block-actions {
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 1;
}

.copy-button {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  min-width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--button-border);
  border-radius: 6px;
  background: var(--button-bg);
  color: var(--primary-light);
  cursor: pointer;
  font: inherit;
  font-size: 0;
  line-height: 1;
  backdrop-filter: blur(8px);
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease, transform 120ms ease;
}

.copy-button svg {
  display: block;
  flex: none;
}

.copy-button svg[data-copy-icon] {
  width: 16px;
  height: 16px;
}

.copy-button:hover {
  color: var(--button-fill-text);
  border-color: var(--button-fill);
  background: var(--button-fill);
}

.copy-button:active {
  color: var(--button-fill-text);
  border-color: var(--button-fill-pressed);
  background: var(--button-fill-pressed);
  transform: scale(0.94);
}

.copy-button:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

.copy-button.is-copied {
  color: var(--button-success-text);
  border-color: var(--button-success-bg);
  background: var(--button-success-bg);
}

.code-block-inner {
  min-width: 0;
  max-width: 100%;
  max-height: min(50vh, 420px);
  padding: 14px 56px 14px 16px;
  overflow: auto;
  border-radius: 16px;
  background: var(--code-bg);
  scrollbar-width: none;
}

.code-block pre {
  margin: 0;
  color: var(--code-text);
  font-size: 14px;
  line-height: 24px;
  font-weight: 400;
  white-space: pre;
}

.home-primary-panel .code-block pre {
  white-space: pre-wrap;
}

.terminal .hljs-keyword,
.terminal .hljs-built_in,
.terminal .hljs-title.function_ {
  color: #7aa5ff;
}

.terminal .hljs-string,
.terminal .hljs-variable,
.terminal .hljs-attr,
.terminal .hljs-operator,
.terminal .hljs-params {
  color: #6dfedf;
}

.terminal .hljs-number,
.terminal .hljs-literal {
  color: #efe4a1;
}

.terminal .hljs-title,
.terminal .hljs-type,
.terminal .hljs-meta {
  color: #ae81ff;
}

.terminal .hljs-comment {
  color: #99c;
}

.code-block .hljs-keyword,
.code-block .hljs-built_in,
.code-block .hljs-title.function_ {
  color: #7aa5ff;
}

.code-block .hljs-string,
.code-block .hljs-variable,
.code-block .hljs-attr,
.code-block .hljs-operator,
.code-block .hljs-params {
  color: #6dfedf;
}

.code-block .hljs-number,
.code-block .hljs-literal {
  color: #efe4a1;
}

.code-block .hljs-title,
.code-block .hljs-type,
.code-block .hljs-meta {
  color: #ae81ff;
}

.code-block .hljs-comment {
  color: #99c;
}

@media (max-width: 640px) {
  body {
    --shell-pad: 16px;
  }

  .page-shell {
    gap: 22px;
  }

  .home-panel {
    gap: 24px;
    padding: 24px;
    border-radius: 22px;
  }

  .terminal {
    border-radius: 18px;
  }

  .terminal-bar {
    gap: 10px;
    padding: 10px 12px;
  }

  .terminal pre {
    max-height: 62vh;
    padding: 18px 16px;
    font-size: 14px;
    line-height: 1.65;
  }

  .code-block,
  .code-block-inner {
    border-radius: 14px;
  }

  .code-block-inner {
    max-height: 44vh;
    padding-right: 54px;
  }

  .hero-brand-mark {
    width: min(320px, 100%);
  }

  .home-columns {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .home-page-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .home-page-links .page-link {
    height: 44px;
    padding: 0 10px;
    font-size: 15px;
  }

  .home-primary-panel .code-block pre {
    white-space: pre;
  }

  .time-passage-panel {
    gap: 12px;
  }

  .time-passage-head {
    gap: 14px;
  }

  .time-passage-clock {
    font-size: 30px;
  }

  .time-passage-progress {
    min-height: 38px;
    padding: 0 14px;
    font-size: 16px;
  }

  .time-passage-cell {
    border-radius: 999px;
  }
}

@media (max-width: 480px) {
  body {
    --shell-pad: 12px;
  }

  .home-panel {
    padding: 20px;
  }

  .home-page-links {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .home-page-links .page-link {
    height: 42px;
    font-size: 14px;
  }

  .code-block-inner {
    padding: 12px 70px 12px 14px;
  }

  .code-block pre {
    font-size: 13px;
    line-height: 22px;
  }

  .time-passage-kicker {
    font-size: 14px;
  }
}

@media (max-width: 360px) {
  body {
    --shell-pad: 10px;
  }

  .home-panel {
    gap: 20px;
    padding: 18px;
    border-radius: 20px;
  }

  .hero-brand-mark {
    width: min(280px, 100%);
  }

  .code-block-actions {
    right: 8px;
  }

  .code-block-inner {
    padding-right: 48px;
  }

  .time-passage-status {
    gap: 10px;
  }

  .time-passage-clock {
    font-size: 26px;
  }

  .time-passage-progress {
    min-height: 34px;
    padding: 0 12px;
    font-size: 15px;
  }
}
