@import url("tokens.css");

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

html {
  min-width: 320px;
  background: var(--color-bg);
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--color-text);
  background:
    radial-gradient(circle at 12% -10%, rgba(53, 200, 230, 0.13), transparent 32rem),
    radial-gradient(circle at 92% 2%, rgba(138, 124, 244, 0.11), transparent 34rem),
    linear-gradient(180deg, #071322 0%, var(--color-bg) 48%, #050c16 100%);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

img,
svg,
canvas {
  max-width: 100%;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

p,
ul,
ol {
  margin-block: 0 1rem;
}

h1,
h2,
h3,
h4 {
  margin-block: 0;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.12;
}

h1 {
  font-size: clamp(2rem, 4vw, 4.5rem);
}

h2 {
  font-size: clamp(1.65rem, 3vw, 3rem);
}

h3 {
  font-size: 1.125rem;
}

::selection {
  color: #021017;
  background: var(--color-primary);
}

:focus-visible {
  outline: 3px solid rgba(53, 200, 230, 0.72);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 1000;
  padding: 10px 14px;
  color: #041018;
  background: var(--color-primary);
  border-radius: var(--radius-sm);
  font-weight: 800;
  transform: translateY(-180%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.wrap {
  width: min(var(--content-max), calc(100% - 40px));
  margin-inline: auto;
}

.surface,
.panel,
.labcard,
.admin-card,
.repeat-box,
.eq,
.metric,
.readout,
.equation,
.substitution,
.notice,
.pill,
.hero-card,
.read,
.modebox,
.scenario {
  border: 1px solid var(--color-border);
  background: linear-gradient(180deg, rgba(18, 34, 55, 0.94), rgba(10, 23, 39, 0.96));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.eyebrow,
.kicker,
.tag,
.pro-kicker,
.metric span,
.readout .k,
.badge,
.status-label {
  color: #afeef9;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.btn,
.pro-tool,
.tab,
.segmented button,
.modebox button,
.scenario .btn {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 15px;
  color: #03131a;
  background: linear-gradient(135deg, var(--color-primary), #64d9ee);
  box-shadow: 0 10px 24px rgba(17, 174, 208, 0.16);
  font-weight: 800;
  line-height: 1.1;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.btn:hover,
.pro-tool:hover,
.segmented button:hover,
.modebox button:hover,
.scenario .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(17, 174, 208, 0.22);
}

.btn.secondary,
.pro-tool,
.tab,
.segmented button,
.modebox button,
.scenario .btn {
  color: var(--color-text-soft);
  background: rgba(255, 255, 255, 0.035);
  border-color: var(--color-border);
  box-shadow: none;
}

.btn.secondary:hover,
.pro-tool:hover,
.tab:hover,
.segmented button:hover,
.modebox button:hover,
.scenario .btn:hover {
  color: var(--color-text);
  border-color: var(--color-border-strong);
  background: rgba(255, 255, 255, 0.065);
}

.btn.warn,
.btn.warning {
  color: #241600;
  background: var(--color-warning);
  box-shadow: none;
}

.btn.danger,
.danger.btn {
  color: #fff;
  background: rgba(243, 111, 138, 0.16);
  border-color: rgba(243, 111, 138, 0.38);
  box-shadow: none;
}

.btn[disabled],
.btn.disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.field {
  display: grid;
  gap: var(--space-2);
  margin-block: var(--space-5);
}

.field label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin: 0;
  color: var(--color-text-soft);
  font-size: 0.88rem;
  font-weight: 750;
}

.field label > span:last-child,
.value {
  color: #9eeaf5;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  white-space: nowrap;
}

.field input[type="number"],
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="file"],
.field textarea,
.field select,
select,
input[type="number"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--color-text);
  background: rgba(3, 11, 20, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.field textarea {
  min-height: 116px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
select:focus,
input[type="number"]:focus {
  border-color: rgba(53, 200, 230, 0.62);
}

input[type="range"] {
  width: 100%;
  min-height: 24px;
  margin: 0;
  accent-color: var(--color-primary);
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(53, 200, 230, 0.48), rgba(255, 255, 255, 0.2));
}

input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
}

.math,
.formula,
.pro-formula,
.equation-strip,
.sub,
.eq-sub,
.substitution {
  font-family: var(--font-mono);
  font-size: 0.83rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.72;
}

.status-message,
.success,
.warnbox,
.notice,
.pro-callout {
  border-radius: var(--radius-md);
  padding: var(--space-4);
  line-height: 1.55;
}

.status-message.success,
.success,
.notice.good,
.pro-callout.good {
  color: #cffff0;
  background: rgba(77, 214, 164, 0.09);
  border: 1px solid rgba(77, 214, 164, 0.28);
}

.status-message.warning,
.warnbox,
.notice.warn,
.audit,
.pro-callout {
  color: #ffe7b2;
  background: rgba(242, 189, 85, 0.08);
  border: 1px solid rgba(242, 189, 85, 0.27);
}

.status-message.danger,
.notice.danger,
.bad,
.pro-callout.danger {
  color: #ffdbe3;
  background: rgba(243, 111, 138, 0.08);
  border: 1px solid rgba(243, 111, 138, 0.28);
}

.error-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-6);
}

.error-page .surface {
  width: min(680px, 100%);
  padding: var(--space-8);
}

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

@media (max-width: 700px) {
  .wrap {
    width: min(100% - 24px, var(--content-max));
  }
}

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