/*
 * GrailVault sites: shared design system. Same palette as the app: neutral graphite surfaces with
 * the logo's emerald as the one accent. Dark by default; light follows the system unless the
 * visitor chooses (data-theme on <html>, set by /js/theme.js).
 */
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand-from: #01da81;
  --brand-to: #02a863;
  --background: #0b0d10;
  --surface: #12151a;
  --surface-2: #1a1e25;
  --border: #272c35;
  --primary: #34d399;
  --on-primary: #04130c;
  --link: #34d399;
  --foreground: #f2f4f7;
  --muted: #9aa3b2;
  --danger: #f87171;
  --warning: #fbbf24;
  --info: #7dd3fc;
  --code-bg: #0f1216;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.45), 0 12px 32px rgb(0 0 0 / 0.3);
  --panel: #0a0d10;
  --radius: 1rem;
  --container: 72rem;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --background: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #eef0f3;
    --border: #e1e5ea;
    --primary: #047857;
    --on-primary: #ffffff;
    --link: #047857;
    --foreground: #0f1419;
    --muted: #55606f;
    --danger: #b91c1c;
    --warning: #92400e;
    --info: #0369a1;
    --code-bg: #f1f3f6;
    --shadow: 0 1px 2px rgb(15 20 25 / 0.05), 0 12px 32px rgb(15 20 25 / 0.08);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --background: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --border: #e1e5ea;
  --primary: #047857;
  --on-primary: #ffffff;
  --link: #047857;
  --foreground: #0f1419;
  --muted: #55606f;
  --danger: #b91c1c;
  --warning: #92400e;
  --info: #0369a1;
  --code-bg: #f1f3f6;
  --shadow: 0 1px 2px rgb(15 20 25 / 0.05), 0 12px 32px rgb(15 20 25 / 0.08);
  color-scheme: light;
}

/* ---------- reset & base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img,
svg {
  display: block;
  max-width: 100%;
}
h1,
h2,
h3,
h4 {
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0;
}
p {
  margin: 0 0 1rem;
}
a {
  color: var(--link);
  text-underline-offset: 0.2em;
}
a:hover {
  text-decoration-thickness: 2px;
}
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}
::selection {
  background: color-mix(in srgb, var(--primary) 35%, transparent);
}
.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  background: var(--primary);
  color: var(--on-primary);
  padding: 0.6rem 1rem;
  border-radius: 0.6rem;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  top: 1rem;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.icon {
  display: inline-block;
  vertical-align: -0.2em;
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
}
/* an arrow after link text stays on the same line */
a:not(.btn) > .icon {
  margin-left: 0.35rem;
}
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1.25rem;
}
code,
kbd,
pre {
  font-family: var(--mono);
  font-size: 0.9em;
}
:not(pre) > code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  padding: 0.12em 0.4em;
  overflow-wrap: anywhere;
}
kbd {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 0.4rem;
  padding: 0.1em 0.45em;
}

/* ---------- logo and screenshot theme switching ---------- */
.logo-for-light,
.shot-light {
  display: none;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .logo-for-light,
  :root:not([data-theme="dark"]) .shot-light {
    display: block;
  }
  :root:not([data-theme="dark"]) .logo-for-dark,
  :root:not([data-theme="dark"]) .shot-dark {
    display: none;
  }
}
:root[data-theme="light"] .logo-for-light,
:root[data-theme="light"] .shot-light {
  display: block;
}
:root[data-theme="light"] .logo-for-dark,
:root[data-theme="light"] .shot-dark {
  display: none;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.9rem;
  padding: 0 1.3rem;
  border-radius: 0.8rem;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.97rem;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    filter 0.12s ease,
    background 0.12s ease;
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary {
  background-image: linear-gradient(135deg, var(--brand-from), var(--brand-to));
  color: #03140c;
  box-shadow: 0 6px 24px -8px rgb(1 218 129 / 0.55);
}
.btn-primary:hover {
  filter: brightness(1.08);
  text-decoration: none;
}
.btn-secondary {
  background: var(--surface);
  color: var(--foreground);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.btn-ghost {
  color: var(--muted);
  background: transparent;
}
.btn-ghost:hover {
  color: var(--foreground);
  background: var(--surface-2);
  text-decoration: none;
}
.btn-sm {
  min-height: 2.4rem;
  padding: 0 1rem;
  font-size: 0.9rem;
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--background) 80%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 4rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--foreground);
  text-decoration: none;
}
.brand img {
  height: 1.7rem;
  width: auto;
}
.brand .accent {
  background-image: linear-gradient(135deg, var(--brand-from), var(--brand-to));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-tag {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
}
.header-spacer {
  flex: 1;
}

/* theme switch */
.theme-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}
.theme-switch button {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.theme-switch button:hover {
  background: var(--surface-2);
  color: var(--foreground);
}
.theme-switch button[aria-checked="true"] {
  background-image: linear-gradient(135deg, var(--brand-from), var(--brand-to));
  color: #03140c;
}
.theme-switch .icon {
  width: 1rem;
  height: 1rem;
}

/* ---------- cards, callouts, tables, code ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.callout {
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 0.8rem;
  background: var(--surface);
  padding: 0.9rem 1.1rem;
  margin: 1.4rem 0;
}
.callout > :last-child {
  margin-bottom: 0;
}
.callout-title {
  margin: 0 0 0.3rem;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.callout-note {
  border-left-color: var(--info);
}
.callout-note .callout-title {
  color: var(--info);
}
.callout-tip {
  border-left-color: var(--primary);
}
.callout-tip .callout-title {
  color: var(--primary);
}
.callout-warning {
  border-left-color: var(--warning);
}
.callout-warning .callout-title {
  color: var(--warning);
}

.table-wrap {
  overflow-x: auto;
  margin: 1.4rem 0;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}
th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
}
thead th {
  background: var(--surface-2);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
tbody tr:last-child td {
  border-bottom: 0;
}

.code-block {
  position: relative;
  margin: 1.2rem 0;
}
pre {
  margin: 0;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  line-height: 1.6;
  font-size: 0.88rem;
}
.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  min-height: 1.9rem;
  padding: 0 0.7rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.copy-btn:hover {
  color: var(--foreground);
  background: var(--surface-2);
}

/* screenshots */
.shot-figure {
  margin: 1.6rem 0;
}
.shot {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  box-shadow: var(--shadow);
  background: var(--surface);
}
.shot-figure figcaption {
  margin-top: 0.6rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.93rem;
}
.footer-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .footer-grid {
    grid-template-columns: 1.6fr 1fr 1fr 1fr;
  }
}
.site-footer h2 {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--foreground);
  margin-bottom: 0.8rem;
}
.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--foreground);
  text-decoration: underline;
}
.footer-note {
  margin-top: 2.2rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
