/* SuperSnova Lang — terminal UI (MrPeterJin/terminal-landing-page) */

:root,
[data-theme="dark"] {
  --term-body: #0d1117;
  --term-surface: #161b22;
  --term-surface-2: #1c2128;
  --term-border: #30363d;
  --term-scroll: #21262d;
  --term-scroll-hover: #30363d;
  --term-primary: #3fb950;
  --term-secondary: #ff9d00;
  --term-link: #58a6ff;
  --term-text: #e6edf3;
  --term-text-2: #c9d1d9;
  --term-text-3: #8b949e;
  --term-error: #f85149;
}

[data-theme="light"] {
  --term-body: #f6f8fa;
  --term-surface: #ffffff;
  --term-surface-2: #f6f8fa;
  --term-border: #d0d7de;
  --term-scroll: #c1c1c1;
  --term-scroll-hover: #aaaaaa;
  --term-primary: #0969da;
  --term-secondary: #bf8700;
  --term-link: #0969da;
  --term-text: #1f2328;
  --term-text-2: #424a53;
  --term-text-3: #656d76;
  --term-error: #cf222e;
}

[data-theme="mono"] {
  --term-body: #0a0a0a;
  --term-surface: #141414;
  --term-surface-2: #1a1a1a;
  --term-border: #2e2e2e;
  --term-scroll: #262626;
  --term-scroll-hover: #333333;
  --term-primary: #e6edf3;
  --term-secondary: #8b949e;
  --term-link: #c9d1d9;
  --term-text: #f0f3f6;
  --term-text-2: #c9d1d9;
  --term-text-3: #8b949e;
  --term-error: #ff7b72;
}

[data-theme="blue-matrix"] {
  --term-body: #101116;
  --term-surface: #181a20;
  --term-surface-2: #1f2229;
  --term-border: #2a2d35;
  --term-scroll: #424242;
  --term-scroll-hover: #616161;
  --term-primary: #00ff9c;
  --term-secondary: #60fdff;
  --term-link: #60fdff;
  --term-text: #ffffff;
  --term-text-2: #d4d4d4;
  --term-text-3: #8fd9a8;
  --term-error: #ff6b6b;
}

[data-theme="espresso"] {
  --term-body: #323232;
  --term-surface: #3a3a3a;
  --term-surface-2: #404040;
  --term-border: #4a4a4a;
  --term-scroll: #5b5b5b;
  --term-scroll-hover: #393939;
  --term-primary: #e1e48b;
  --term-secondary: #a5c260;
  --term-link: #a5c260;
  --term-text: #f7f7f7;
  --term-text-2: #eeeeee;
  --term-text-3: #9a9a9a;
  --term-error: #ef4444;
}

[data-theme="green-goblin"] {
  --term-body: #000000;
  --term-surface: #0a0a0a;
  --term-surface-2: #111111;
  --term-border: #1f1f1f;
  --term-scroll: #2e2e2e;
  --term-scroll-hover: #414141;
  --term-primary: #e5e500;
  --term-secondary: #04a500;
  --term-link: #04a5b2;
  --term-text: #01ff00;
  --term-text-2: #04a5b2;
  --term-text-3: #8fcc8f;
  --term-error: #e50101;
}

[data-theme="ubuntu"] {
  --term-body: #2d0922;
  --term-surface: #3a1030;
  --term-surface-2: #45153a;
  --term-border: #5c1f4d;
  --term-scroll: #f47845;
  --term-scroll-hover: #e65f31;
  --term-primary: #80d932;
  --term-secondary: #80d932;
  --term-link: #b8f07a;
  --term-text: #ffffff;
  --term-text-2: #e1e9cc;
  --term-text-3: #c9b8c4;
  --term-error: #ff6b6b;
}

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

html {
  scroll-behavior: smooth;
}

body.term-app {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 0.9375rem;
  line-height: 1.5rem;
  background-color: var(--term-body);
  color: var(--term-text);
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 15px;
}
::-webkit-scrollbar-track {
  background: var(--term-body);
}
::-webkit-scrollbar-thumb {
  background: var(--term-scroll);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--term-scroll-hover);
}

::selection {
  background: color-mix(in srgb, var(--term-primary) 35%, transparent);
}

a.term-link {
  color: var(--term-link);
  text-decoration: none;
  border-bottom: 2px dashed var(--term-link);
  white-space: nowrap;
}
a.term-link:hover {
  border-bottom-style: solid;
  color: var(--term-text);
}

.sr-only {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Interactive terminal (home) */
.term {
  display: flex;
  flex-direction: column-reverse;
  max-height: 100dvh;
  overflow-y: auto;
  padding: 0.75rem 1.25rem 1.25rem;
}

.term__form {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  margin-top: 0.25rem;
}

.term__prompt-line {
  display: inline;
  margin-right: 0.75rem;
  white-space: nowrap;
}

.term__prompt,
.term-user {
  color: var(--term-secondary);
}

.term-host {
  color: var(--term-primary);
}

.term-path {
  color: var(--term-text);
}

.term__input {
  flex: 1;
  min-width: 12rem;
  border: none;
  background: var(--term-body);
  color: var(--term-text);
  font: inherit;
  caret-color: var(--term-primary);
  padding: 0;
}
.term__input:focus-visible {
  outline: none;
}

.term__hints {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}
.term-hint {
  color: var(--term-text-3);
}

.term__output {
  display: flex;
  flex-direction: column-reverse;
}

.term-entry {
  margin-bottom: 0.75rem;
}
.term-entry--empty {
  margin-bottom: 0.25rem;
}

.term-echo {
  margin-bottom: 0.25rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.term-echo__cmd {
  color: var(--term-text);
}

.term-block {
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

.term-prose p,
.term-prose div {
  margin: 0 0 0.25rem;
}

.term-art,
.term-code {
  margin: 0.5rem 0 1rem;
  white-space: pre;
  overflow-x: auto;
  color: var(--term-text-2);
  font: inherit;
}

.term-cmd {
  color: var(--term-primary);
}

.term-accent {
  color: var(--term-primary);
}

.term-muted {
  color: var(--term-text-2);
}

.term-error {
  color: var(--term-error);
}

.term-sep {
  margin: 0.75rem 0;
  color: var(--term-text-3);
}

.term-cmd-row {
  margin-bottom: 0.25rem;
}

.term-keys {
  font-size: 0.875rem;
  margin-top: 1rem;
  color: var(--term-text-2);
}
.term-keys div {
  margin-top: 0.25rem;
}

@media (max-width: 550px) {
  .term-keys {
    display: none;
  }
  .term__form {
    display: block;
  }
  .term__input {
    width: 100%;
    margin-top: 0.25rem;
  }
}

/* Static terminal pages (docs / registry) */
.term-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.term-page__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--term-border);
  background: var(--term-body);
}

.term-page__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}
.term-page__brand:hover {
  text-decoration: none;
  opacity: 0.9;
}

.term-page__logo {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 2px;
}

.term-page__title {
  font-size: 0.9375rem;
  color: var(--term-primary);
}

.term-page__subtitle {
  display: block;
  font-size: 0.75rem;
  color: var(--term-text-3);
}

.term-page__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.875rem;
}
.term-page__nav a {
  color: var(--term-text-2);
  text-decoration: none;
  border-bottom: 2px dashed transparent;
}
.term-page__nav a:hover,
.term-page__nav a.is-active {
  color: var(--term-secondary);
  border-bottom-color: var(--term-secondary);
}

.term-page__session {
  padding: 0.5rem 1.25rem 0;
  font-size: 0.875rem;
  color: var(--term-text-3);
}

.term-page__main {
  flex: 1;
  padding: 0.75rem 1.25rem 1.25rem;
}

/* Registry + shared components */
.field-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
  color: var(--term-text-3);
}

.input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--term-border);
  border-radius: 2px;
  background: var(--term-body);
  color: var(--term-text);
  font: inherit;
  caret-color: var(--term-primary);
}
.input:focus {
  outline: none;
  border-color: var(--term-primary);
}
.input::placeholder {
  color: var(--term-text-3);
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--term-primary) 50%, transparent);
  border-radius: 2px;
  background: transparent;
  color: var(--term-primary);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover {
  background: color-mix(in srgb, var(--term-primary) 12%, transparent);
  text-decoration: none;
}
.btn--primary {
  background: color-mix(in srgb, var(--term-primary) 14%, transparent);
}
.btn--secondary {
  border-color: color-mix(in srgb, var(--term-text-3) 40%, transparent);
  color: var(--term-text-2);
}
.btn--ghost {
  border-color: transparent;
  color: var(--term-secondary);
  padding-inline: 0.25rem;
}
.btn--sm {
  font-size: 0.8125rem;
  padding: 0.2rem 0.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid color-mix(in srgb, var(--term-text-3) 35%, transparent);
  border-radius: 2px;
  font-size: 0.75rem;
  color: var(--term-text-2);
}
.badge--success {
  border-color: color-mix(in srgb, var(--term-primary) 45%, transparent);
  color: var(--term-primary);
}
.badge--danger {
  border-color: color-mix(in srgb, var(--term-error) 45%, transparent);
  color: var(--term-error);
}
.badge--neutral {
  border-color: var(--term-border);
  color: var(--term-text-2);
}
.badge__dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: currentColor;
}

.card {
  border: 1px solid var(--term-border);
  border-radius: 2px;
  margin-bottom: 1rem;
  background: var(--term-surface);
}
.card__header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--term-border);
  background: var(--term-surface-2);
}
.card__header h2,
.card__header h3 {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--term-primary);
}
.card__header p {
  margin: 0.25rem 0 0;
  color: var(--term-text-3);
  font-size: 0.8125rem;
}
.card__body {
  padding: 0.75rem 1rem;
  color: var(--term-text-2);
  font-size: 0.875rem;
}
.card__body p {
  margin: 0 0 0.75rem;
}
.card__body p:last-child {
  margin-bottom: 0;
}

.hero__title {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  color: var(--term-text);
}
.hero__lead {
  margin: 0 0 1rem;
  color: var(--term-text-2);
  max-width: 48rem;
}
.hero__pattern {
  padding: 0.75rem 1rem;
  border: 1px solid var(--term-border);
  background: var(--term-surface);
  font-size: 0.8125rem;
  word-break: break-all;
  color: var(--term-text);
}
.hero__pattern-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--term-text-3);
  font-size: 0.75rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--term-text-3);
}
.meta-row strong {
  color: var(--term-primary);
}

.layout-split {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1rem;
  align-items: start;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--term-border);
  background: var(--term-surface);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.table th,
.table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid color-mix(in srgb, var(--term-text-3) 20%, transparent);
}
.table th {
  color: var(--term-text-3);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.table tbody tr:hover {
  background: color-mix(in srgb, var(--term-primary) 6%, transparent);
}
.table tbody tr.is-clickable {
  cursor: pointer;
}
.table__path .owner {
  color: var(--term-secondary);
}
.table__path .file {
  color: var(--term-primary);
}
.table .version {
  color: var(--term-primary);
  font-weight: 700;
}
.table__desc {
  color: var(--term-text-3);
  font-size: 0.75rem;
}

.code-canvas {
  border: 1px solid var(--term-border);
  overflow: hidden;
  background: var(--term-surface);
}
.code-canvas__titlebar {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0.75rem;
  background: var(--term-surface-2);
  border-bottom: 1px solid var(--term-border);
  font-size: 0.75rem;
  color: var(--term-text-3);
}
.code-canvas__btn {
  border: 1px solid color-mix(in srgb, var(--term-text-3) 35%, transparent);
  background: transparent;
  color: var(--term-text-2);
  font: inherit;
  font-size: 0.6875rem;
  padding: 0.1rem 0.4rem;
  cursor: pointer;
}
.code-canvas__body {
  margin: 0;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  white-space: pre;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--term-text-2);
}

.spec-list {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 0.25rem 0.75rem;
  margin: 0;
  font-size: 0.8125rem;
}
.spec-list dt {
  color: var(--term-text-3);
}
.spec-list dd {
  margin: 0;
  color: var(--term-text);
}

.route-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  font-size: 0.75rem;
  color: var(--term-text-3);
}
.route-list li {
  padding: 0.25rem 0;
  border-bottom: 1px dashed color-mix(in srgb, var(--term-text-3) 20%, transparent);
}
.route-list li:last-child {
  border-bottom: none;
}

.alert {
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--term-text-3);
  background: color-mix(in srgb, var(--term-text-3) 8%, transparent);
}
.alert--error {
  border-left-color: var(--term-error);
  color: var(--term-text-2);
}
.alert__title {
  margin: 0 0 0.25rem;
  color: var(--term-error);
  font-weight: 700;
}
.alert__body {
  margin: 0;
  font-size: 0.875rem;
}

.dialog {
  padding: 0;
  border: none;
  background: transparent;
  color: var(--term-text);
  max-width: min(560px, calc(100vw - 2rem));
  width: 100%;
}
.dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}
.dialog__shell {
  margin: 0;
  border: 1px solid var(--term-border);
  background: var(--term-surface);
}
.dialog__header,
.dialog__footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--term-text-3) 22%, transparent);
}
.dialog__footer {
  border-bottom: none;
  border-top: 1px solid color-mix(in srgb, var(--term-text-3) 22%, transparent);
}
.dialog__eyebrow {
  margin: 0;
  font-size: 0.75rem;
  color: var(--term-text-3);
}
.dialog__title {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--term-primary);
  word-break: break-all;
}
.dialog__close {
  border: 1px solid color-mix(in srgb, var(--term-text-3) 35%, transparent);
  background: transparent;
  color: var(--term-text-2);
  width: 1.75rem;
  height: 1.75rem;
  cursor: pointer;
  font: inherit;
}
.dialog__body {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--term-text-2);
}
.dialog__body dl {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 0.25rem 0.75rem;
  margin-top: 0.75rem;
}
.dialog__body dt {
  color: var(--term-text-3);
  font-size: 0.75rem;
}
.dialog__body dd {
  margin: 0;
  color: var(--term-text);
  word-break: break-word;
}

code {
  font: inherit;
  color: var(--term-primary);
}

.u-mt-4 {
  margin-top: 1rem;
}
.u-mb-3 {
  margin-bottom: 0.75rem;
}
.u-mb-4 {
  margin-bottom: 1rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 900px) {
  .layout-split {
    grid-template-columns: 1fr;
  }
  .table th:nth-child(4),
  .table td:nth-child(4) {
    display: none;
  }
}

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