/* Nova's website, made from Nova's own design tokens, type and panels.
   Colors are Nova's Palette roles (docs/design-system.md), Light then Dark. */

@font-face {
  font-family: "Noto Sans";
  src: url("shared/fonts/noto-sans/NotoSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans";
  src: url("shared/fonts/noto-sans/NotoSans-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("shared/fonts/jetbrains-mono/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --surface-window: light-dark(#f3f4f6, #323232);
  --surface-content: light-dark(#ffffff, #1e1e1e);
  --surface-subtle: light-dark(#f8f9fa, #232323);
  --surface-header: light-dark(#eef0f3, #282828);
  --text-primary: light-dark(#1c2128, #dddddd);
  --text-secondary: light-dark(#4a5361, #bfbfbf);
  --text-muted: light-dark(#5e6775, #a3a3a3);
  --border-strong: light-dark(#c3c9d1, #565656);
  --border-default: light-dark(#dce0e5, #424242);
  --border-subtle: light-dark(#eceef1, #303030);
  --accent: light-dark(#1f63c6, #419cff);
  --accent-fill: light-dark(#1f63c6, #0058d0);
  --accent-subtle: light-dark(#eef4fc, #23303e);
  --selection: light-dark(#dbe7f9, #14325c);
  --hover: light-dark(#e0e0e0, #404040);
  --info-border: light-dark(#c3d7f1, #2c5078);
  --good-dot: light-dark(#138a3f, #32d74b);
  --backdrop-ink: light-dark(rgb(110 125 145 / 0.23), rgb(152 152 157 / 0.19));
  --shadow: light-dark(rgb(28 33 40 / 0.14), rgb(0 0 0 / 0.5));

  --ui: "Noto Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 8px;
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--surface-window);
  color: var(--text-primary);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.6;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.mono {
  font-family: var(--mono);
  font-size: 0.9em;
}

.skip {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 20;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--accent-fill);
  color: #fff;
  transform: translateY(-200%);
}

.skip:focus {
  transform: none;
}

/* The bar, like Nova's top bar. */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 52px;
  padding: 8px max(16px, calc((100vw - 1320px) / 2));
  background: var(--surface-window);
  border-bottom: 1px solid var(--border-default);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
}

.bar-links {
  display: flex;
  gap: 4px;
  margin-right: auto;
  font-size: 14px;
}

.bar-links a {
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--text-secondary);
  text-decoration: none;
}

.bar-links a:hover {
  background: var(--hover);
  color: var(--text-primary);
}

/* The Theme switch, like Nova's toggles: the chosen one filled with Selection. */

.theme {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.theme[hidden] {
  display: none;
}

.theme legend {
  float: left;
  padding: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.segments {
  display: flex;
  padding: 2px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface-content);
}

.segments label {
  position: relative;
  cursor: pointer;
}

.segments input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.segments span {
  display: block;
  min-width: 56px;
  padding: 3px 12px;
  border-radius: 5px;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
}

.segments label:hover input:not(:checked) + span {
  background: var(--hover);
}

.segments input:checked + span {
  background: var(--selection);
  color: var(--text-primary);
  font-weight: 600;
}

.segments input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* The hero. */

main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 16px;
}

.hero {
  padding: clamp(40px, 6vw, 72px) 0 0;
}

h1 {
  margin: 0;
  font-size: clamp(56px, 8vw, 96px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
}

.hero-sub {
  margin: 12px 0 0;
  color: var(--text-secondary);
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1.3;
  text-wrap: balance;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 28px 0 0;
}

/* Buttons, like Nova's: outlined, or the default filled with the accent. */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface-content);
  color: var(--text-primary);
  font-size: 15px;
  text-decoration: none;
  white-space: nowrap;
}

.button:hover {
  background: var(--hover);
}

.button.default {
  border-color: var(--accent-fill);
  background: var(--accent-fill);
  color: #fff;
}

.button.default:hover {
  filter: brightness(1.08);
}

.window {
  margin: clamp(32px, 5vw, 56px) 0 0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 60px -24px var(--shadow), 0 0 0 1px var(--border-default);
}

/* A pair: Light underneath, Dark over it, one shown with the page's theme. */

.shot {
  display: grid;
}

.shot > picture {
  grid-area: 1 / 1;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
}

.shot .shot-dark,
:root[data-theme="dark"] .shot .shot-light {
  visibility: hidden;
}

:root[data-theme="dark"] .shot .shot-dark {
  visibility: visible;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .shot .shot-light {
    visibility: hidden;
  }

  :root:not([data-theme]) .shot .shot-dark {
    visibility: visible;
  }
}

/* Switching theme wipes the whole page across, where the browser can. */

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-new(root) {
  animation: wipe 0.7s cubic-bezier(0.65, 0, 0.35, 1);
}

@keyframes wipe {
  from {
    clip-path: inset(0 100% 0 0);
  }

  to {
    clip-path: inset(0 0 0 0);
  }
}

/* Group labels, like Nova's: semibold, tracked, uppercase. */

.group-label {
  margin: clamp(64px, 8vw, 104px) 0 16px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Panels in a grid. */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--surface-content);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  padding: 4px 12px;
  border-bottom: 1px solid var(--border-default);
  background: var(--surface-header);
}

.panel-title {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}

.keys {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}

.panel-text {
  padding: 20px 24px 8px;
}

h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
}

.panel-text p {
  margin: 8px 0 12px;
  color: var(--text-secondary);
}

.more {
  font-size: 14px;
}

/* The well under a panel's text: Nova's backdrop of faint dots, with the picture on it. */

.well {
  display: grid;
  flex: 1;
  place-items: center;
  margin-top: 16px;
  padding: 24px;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--surface-subtle);
  background-image: radial-gradient(var(--backdrop-ink) 1px, transparent 1.4px);
  background-size: 14px 14px;
}

.well .shot {
  width: 100%;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 16px 40px -16px var(--shadow), 0 0 0 1px var(--border-default);
}

/* A panel across both columns: text beside the picture. */

.panel.span {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr);
  grid-template-rows: auto 1fr;
}

.panel.span .panel-header {
  grid-column: 1 / -1;
}

.panel.span .panel-text {
  align-self: center;
  padding: 24px 28px;
}

.panel.span .well {
  margin-top: 0;
  border-top: 0;
  border-left: 1px solid var(--border-subtle);
}

.panel.span.flip {
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
}

.panel.span.flip .panel-text {
  order: 2;
}

.panel.span.flip .well {
  border-left: 0;
  border-right: 1px solid var(--border-subtle);
}

/* Download: a table like Nova's. */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.table thead th {
  height: 34px;
  padding: 4px 16px;
  border-bottom: 1px solid var(--border-default);
  background: var(--surface-header);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

.table tbody th,
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

.table tbody th {
  font-weight: 600;
}

.table td:last-child {
  text-align: right;
}

.download-notes {
  padding: 16px;
  color: var(--text-secondary);
  font-size: 15px;
}

.download-notes p {
  margin: 0;
}

.download-notes .install {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin-top: 8px;
}

/* A notice, like Nova's Info notice. */

.notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px !important;
  padding: 8px 12px;
  border: 1px solid var(--info-border);
  border-radius: 6px;
  background: var(--accent-subtle);
  color: var(--text-primary);
}

.dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.dot.good {
  background: var(--good-dot);
}

/* The footer, like Nova's status bar. */

.status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 24px;
  margin-top: clamp(64px, 8vw, 104px);
  padding: 8px max(16px, calc((100vw - 1320px) / 2));
  border-top: 1px solid var(--border-default);
  background: var(--surface-window);
  color: var(--text-secondary);
  font-size: 13px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}

.status-links a {
  color: var(--text-secondary);
}

/* Narrow screens. */

@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .panel.span {
    display: flex;
  }

  .panel.span .panel-text {
    padding: 20px 24px 8px;
  }

  .panel.span .well,
  .panel.span.flip .well {
    margin-top: 16px;
    border: 0;
    border-top: 1px solid var(--border-subtle);
  }

  .panel.span.flip .panel-text {
    order: 0;
  }
}

@media (max-width: 640px) {
  .wide-only,
  .theme legend {
    display: none;
  }

  .bar {
    gap: 12px;
  }

  .panel-header .keys {
    display: none;
  }

  .well {
    padding: 12px;
  }

  .table thead {
    display: none;
  }

  .table,
  .table tbody,
  .table tr {
    display: block;
  }

  .table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
  }

  .table tbody th,
  .table td {
    padding: 0;
    border: 0;
  }

  .table td:nth-child(2),
  .table td:nth-child(3) {
    grid-column: 1;
    color: var(--text-secondary);
    font-size: 14px;
  }

  .table td:last-child {
    grid-column: 2;
    grid-row: 1 / span 3;
  }
}

@media (max-width: 420px) {
  .brand span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  ::view-transition-new(root) {
    animation: none;
  }
}
