/* Clearstream design system: tokens, reset and primitives (buttons, fields, icons, skeletons).
   Page and component layout lives in styles.css. */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/InterVariable.woff2?v=693b77d4f32ee9b8bfc9") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Latin uses the smaller subset. Other scripts retain the original full Inter font. */
@font-face {
  font-family: "Inter";
  src: url("/static/fonts/InterLatin.woff2?v=3d444d31cfc696df3e68") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F, U+20A0-20CF;
}

:root {
  /* Surfaces */
  --bg: #0a0a0c;
  --bg-elevated: #121216;
  --surface: #17171c;
  --surface-2: #1f1f26;
  --surface-3: #2a2a33;
  --overlay: rgb(10 10 12 / 0.72);
  --line: rgb(255 255 255 / 0.08);
  --line-strong: rgb(255 255 255 / 0.16);

  /* Text */
  --text: #f5f5f7;
  --text-2: #b4b4be;
  --text-3: #85858f;

  /* Accent + semantic */
  --accent: #8b9bff;
  --accent-strong: #6d7ef7;
  --accent-soft: rgb(139 155 255 / 0.14);
  --gold: #f5c451;
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --danger-soft: rgb(248 113 113 / 0.12);

  /* Type */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.375rem;
  --fs-xl: clamp(1.625rem, 1.2rem + 1.5vw, 2.25rem);
  --fs-hero: clamp(2.25rem, 1.4rem + 3.6vw, 4.25rem);

  /* Space, shape, depth */
  --gutter: clamp(1rem, 0.4rem + 2.6vw, 3.5rem);
  --content-max: 1680px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
  --shadow-lg: 0 24px 64px rgb(0 0 0 / 0.55);
  --appbar-h: 64px;
  --tabbar-h: 0px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --fast: 140ms;
  --base: 220ms;

  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--appbar-h) + 16px);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1,
h2,
h3,
h4 {
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-wrap: balance;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--accent-soft);
}

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

/* ---------- Utilities ---------- */

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

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

.small {
  font-size: var(--fs-sm);
}

.overline {
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hint {
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: 450;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition:
    background-color var(--fast) var(--ease),
    border-color var(--fast) var(--ease),
    color var(--fast) var(--ease),
    transform var(--fast) var(--ease);
}

.btn .icon {
  width: 18px;
  height: 18px;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--text);
  color: #0a0a0c;
}

.btn-primary:hover:not(:disabled) {
  background: #dcdce2;
}

.btn-secondary {
  background: rgb(255 255 255 / 0.1);
  border-color: rgb(255 255 255 / 0.06);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: rgb(255 255 255 / 0.16);
}

.btn-secondary[aria-pressed="true"] {
  border-color: var(--line-strong);
}

.btn-danger {
  background: #dc4c4c;
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #c43d3d;
}

.btn-quiet {
  background: transparent;
  color: var(--text-2);
  padding: 0 12px;
}

.btn-quiet:hover:not(:disabled) {
  background: rgb(255 255 255 / 0.07);
  color: var(--text);
}

.btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: var(--fs-sm);
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  transition:
    background-color var(--fast) var(--ease),
    color var(--fast) var(--ease);
}

.icon-btn:hover,
.icon-btn[aria-current="page"] {
  background: rgb(255 255 255 / 0.08);
  color: var(--text);
}

.icon-btn-float {
  background: rgb(10 10 12 / 0.6);
  color: var(--text);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.icon-btn-float:hover {
  background: rgb(10 10 12 / 0.85);
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #0a0a0c;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.icon-btn .badge {
  position: absolute;
  top: 4px;
  right: 2px;
}

/* ---------- Fields ---------- */

.field {
  display: grid;
  gap: 6px;
}

label,
.label {
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 550;
}

input:not([type="checkbox"], [type="file"]),
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: var(--fs-base);
  transition:
    border-color var(--fast) var(--ease),
    box-shadow var(--fast) var(--ease);
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-3);
}

input:not([type="checkbox"], [type="file"]):focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

select {
  appearance: none;
  padding-right: 38px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b4b4be' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}

input[type="file"] {
  width: 100%;
  min-height: 44px;
  color: var(--text-2);
  font-size: var(--fs-sm);
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: rgb(255 255 255 / 0.1);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

input[type="search"]::-webkit-search-cancel-button {
  filter: grayscale(1) brightness(1.6);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 450;
  cursor: pointer;
}

.check input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  flex: none;
  accent-color: var(--accent);
}

.form-error {
  color: var(--danger);
  font-size: var(--fs-sm);
}

.form-error:empty {
  display: none;
}

/* ---------- Skeletons ---------- */

.sk {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 40%, var(--surface) 80%) 0 0 / 300% 100%;
  animation: shimmer 1.6s linear infinite;
}

.sk-line {
  height: 12px;
  width: 100%;
}

.sk-short {
  width: 40%;
}

.sk-mid {
  width: 70%;
}

.sk-title {
  height: clamp(36px, 5vw, 56px);
  width: 60%;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -50% 0;
  }
}

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