@layer reset, tokens, base, primitives;

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

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  body, h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ul, ol, li, pre, code, form, fieldset, legend, input, button, textarea, select {
    margin: 0;
    padding: 0;
  }

  h1, h2, h3, h4, h5, h6 {
    font-size: inherit;
    font-weight: inherit;
  }

  ul, ol {
    list-style: none;
  }

  img, picture, svg, video, canvas {
    display: block;
    max-width: 100%;
    height: auto;
  }

  input, button, textarea, select {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    border-radius: 0;
    appearance: none;
  }

  button {
    cursor: pointer;
  }

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

  table {
    border-collapse: collapse;
    border-spacing: 0;
  }

  blockquote, q {
    quotes: none;
  }

  blockquote::before, blockquote::after, q::before, q::after {
    content: "";
    content: none;
  }

  :focus {
    outline: none;
  }

  :focus-visible {
    outline: 2px solid var(--color-accent-lime);
    outline-offset: 2px;
  }

  [hidden] {
    display: none !important;
  }
}

@layer tokens {
  :root {
    --color-graphite-black: #15191D;
    --color-electric-lime: #C6F23A;
    --color-icy-blue: #69C7E8;
    --color-adrenaline-orange: #FF7845;
    --color-steel-gray: #89949C;
    --color-snow-white: #F5F7F7;

    --color-surface-raised: #1B2026;
    --color-surface-overlay: rgba(21, 25, 29, 0.8);
    --color-border-subtle: rgba(137, 148, 156, 0.35);
    --color-border-strong: rgba(137, 148, 156, 0.6);

    --font-heading: "Barlow Condensed", "Arial Narrow", sans-serif;
    --font-body: "Inter", "Helvetica Neue", Arial, sans-serif;

    --text-display-size: clamp(2rem, 4.5vw + 1rem, 4rem);
    --text-display-leading: 1.02;
    --text-display-weight: 800;
    --text-display-tracking: 0.02em;

    --text-h1-size: clamp(1.75rem, 3.5vw + 0.75rem, 3rem);
    --text-h1-leading: 1.08;
    --text-h1-weight: 800;
    --text-h1-tracking: 0.01em;

    --text-h2-size: clamp(1.5rem, 2.5vw + 0.5rem, 2.125rem);
    --text-h2-leading: 1.15;
    --text-h2-weight: 700;

    --text-h3-size: clamp(1.25rem, 1.5vw + 0.5rem, 1.625rem);
    --text-h3-leading: 1.2;
    --text-h3-weight: 700;

    --text-h4-size: 1.25rem;
    --text-h4-leading: 1.3;
    --text-h4-weight: 600;

    --text-lead-size: 1.25rem;
    --text-lead-leading: 1.55;
    --text-lead-weight: 400;

    --text-body-size: 1.0625rem;
    --text-body-leading: 1.65;
    --text-body-weight: 400;

    --text-small-size: 0.875rem;
    --text-small-leading: 1.5;
    --text-small-weight: 400;

    --text-label-size: 0.75rem;
    --text-label-leading: 1.4;
    --text-label-weight: 700;
    --text-label-tracking: 0.08em;

    --space-2xs: 0.25rem;
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1.25rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-2xl: 4.5rem;
    --space-3xl: 6.5rem;
    --space-4xl: 9rem;

    --container-main-max: 1240px;
    --container-wide-max: 1440px;
    --container-narrow-max: 720px;
    --container-padding-mobile: 1.5rem;
    --container-padding-desktop: 2.5rem;

    --radius-none: 0px;
    --radius-sm: 4px;
    --radius-md: 8px;

    --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.35);

    --motion-fast: 160ms;
    --motion-medium: 240ms;
    --motion-ease-out: cubic-bezier(0.22, 1, 0.36, 1);

    --touch-target-min: 44px;
  }
}

@layer base {
  html {
    background-color: var(--color-graphite-black);
    color: var(--color-snow-white);
    font-family: var(--font-body);
    font-size: 100%;
    line-height: var(--text-body-leading);
    scroll-behavior: smooth;
  }

  body {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    background-color: var(--color-graphite-black);
    color: var(--color-snow-white);
    font-size: var(--text-body-size);
    font-weight: var(--text-body-weight);
    line-height: var(--text-body-leading);
  }

  h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--color-snow-white);
  }

  h1 {
    font-size: var(--text-h1-size);
    line-height: var(--text-h1-leading);
    font-weight: var(--text-h1-weight);
    letter-spacing: var(--text-h1-tracking);
    text-transform: uppercase;
    margin-block-end: var(--space-md);
  }

  h2 {
    font-size: var(--text-h2-size);
    line-height: var(--text-h2-leading);
    font-weight: var(--text-h2-weight);
    margin-block-end: var(--space-md);
  }

  h3 {
    font-size: var(--text-h3-size);
    line-height: var(--text-h3-leading);
    font-weight: var(--text-h3-weight);
    margin-block-end: var(--space-sm);
  }

  h4 {
    font-size: var(--text-h4-size);
    line-height: var(--text-h4-leading);
    font-weight: var(--text-h4-weight);
    margin-block-end: var(--space-sm);
  }

  p {
    font-size: var(--text-body-size);
    line-height: var(--text-body-leading);
    margin-block-end: var(--space-md);
  }

  p:last-child {
    margin-block-end: 0;
  }

  a {
    color: var(--color-icy-blue);
    text-decoration: underline;
    text-decoration-color: rgba(105, 199, 232, 0.5);
    text-underline-offset: 3px;
    transition: color var(--motion-fast) var(--motion-ease-out),
                text-decoration-color var(--motion-fast) var(--motion-ease-out);
  }

  a:hover {
    color: var(--color-electric-lime);
    text-decoration-color: var(--color-electric-lime);
  }

  ul, ol {
    margin-block-end: var(--space-md);
    padding-inline-start: 1.25rem;
  }

  ul {
    list-style: disc;
  }

  ol {
    list-style: decimal;
  }

  ul:last-child, ol:last-child {
    margin-block-end: 0;
  }

  li {
    margin-block-end: var(--space-xs);
  }

  li:last-child {
    margin-block-end: 0;
  }

  blockquote {
    margin-block-end: var(--space-md);
    padding-inline-start: var(--space-md);
    border-inline-start: 3px solid var(--color-icy-blue);
    font-size: var(--text-lead-size);
    line-height: var(--text-lead-leading);
    color: var(--color-snow-white);
  }

  blockquote:last-child {
    margin-block-end: 0;
  }

  figure {
    margin-block-end: var(--space-md);
  }

  figure:last-child {
    margin-block-end: 0;
  }

  figcaption {
    font-size: var(--text-small-size);
    line-height: var(--text-small-leading);
    color: var(--color-steel-gray);
    margin-block-start: var(--space-xs);
  }

  small {
    font-size: var(--text-small-size);
    line-height: var(--text-small-leading);
  }

  strong, b {
    font-weight: 700;
  }

  em, i {
    font-style: italic;
  }

  code, pre {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.9em;
  }

  hr {
    border: none;
    border-block-start: 1px solid var(--color-border-subtle);
    margin-block: var(--space-lg);
  }

  img {
    max-width: 100%;
    height: auto;
  }

  table {
    width: 100%;
    margin-block-end: var(--space-md);
    font-size: var(--text-small-size);
    line-height: var(--text-small-leading);
  }

  table:last-child {
    margin-block-end: 0;
  }

  th {
    font-family: var(--font-body);
    font-size: var(--text-label-size);
    line-height: var(--text-label-leading);
    font-weight: var(--text-label-weight);
    letter-spacing: var(--text-label-tracking);
    text-transform: uppercase;
    text-align: start;
    color: var(--color-steel-gray);
    padding: var(--space-sm) var(--space-md);
    border-block-end: 1px solid var(--color-border-strong);
  }

  td {
    padding: var(--space-sm) var(--space-md);
    border-block-end: 1px solid var(--color-border-subtle);
    color: var(--color-snow-white);
  }

  tr:last-child td {
    border-block-end: none;
  }

  form {
    margin-block-end: var(--space-md);
  }

  form:last-child {
    margin-block-end: 0;
  }

  label {
    display: block;
    font-size: var(--text-label-size);
    line-height: var(--text-label-leading);
    font-weight: var(--text-label-weight);
    letter-spacing: var(--text-label-tracking);
    text-transform: uppercase;
    color: var(--color-steel-gray);
    margin-block-end: var(--space-2xs);
  }

  input, textarea, select {
    width: 100%;
    min-height: var(--touch-target-min);
    padding: var(--space-xs) var(--space-sm);
    background-color: rgba(245, 247, 247, 0.06);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-sm);
    color: var(--color-snow-white);
    font-size: var(--text-body-size);
    line-height: var(--text-body-leading);
    transition: border-color var(--motion-fast) var(--motion-ease-out),
                background-color var(--motion-fast) var(--motion-ease-out);
  }

  input::placeholder, textarea::placeholder {
    color: var(--color-steel-gray);
  }

  input:focus, textarea:focus, select:focus {
    border-color: var(--color-electric-lime);
    background-color: rgba(245, 247, 247, 0.08);
    outline: none;
  }

  textarea {
    min-height: 120px;
    resize: vertical;
  }

  select {
    cursor: pointer;
  }

  button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--touch-target-min);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: var(--text-label-size);
    line-height: var(--text-label-leading);
    font-weight: var(--text-label-weight);
    letter-spacing: var(--text-label-tracking);
    text-transform: uppercase;
    transition: background-color var(--motion-fast) var(--motion-ease-out),
                color var(--motion-fast) var(--motion-ease-out),
                border-color var(--motion-fast) var(--motion-ease-out),
                transform var(--motion-fast) var(--motion-ease-out);
  }

  button:hover {
    transform: translate(-1px, -1px);
  }

  button:active {
    transform: translate(0, 0);
  }

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

    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
}

@layer primitives {
  .container {
    width: 100%;
    max-width: var(--container-main-max);
    margin-inline: auto;
    padding-inline: var(--container-padding-mobile);
  }

  .container-wide {
    width: 100%;
    max-width: var(--container-wide-max);
    margin-inline: auto;
    padding-inline: var(--container-padding-mobile);
  }

  .surface-raised {
    background-color: var(--color-surface-raised);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-md);
  }

  .surface-flat {
    background-color: var(--color-graphite-black);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-none);
  }

  .surface-inverted {
    background-color: var(--color-snow-white);
    color: var(--color-graphite-black);
    border-radius: var(--radius-md);
  }

  .surface-inverted h1,
  .surface-inverted h2,
  .surface-inverted h3,
  .surface-inverted h4,
  .surface-inverted h5,
  .surface-inverted h6 {
    color: var(--color-graphite-black);
  }

  .surface-inverted p,
  .surface-inverted li,
  .surface-inverted td {
    color: var(--color-graphite-black);
  }

  .surface-inverted a {
    color: #0B6E8A;
  }

  .surface-inverted a:hover {
    color: var(--color-graphite-black);
  }

  .surface-inverted label,
  .surface-inverted th,
  .surface-inverted figcaption {
    color: #4A555E;
  }

  .surface-inverted input,
  .surface-inverted textarea,
  .surface-inverted select {
    background-color: rgba(21, 25, 29, 0.06);
    border-color: rgba(21, 25, 29, 0.25);
    color: var(--color-graphite-black);
  }

  .surface-inverted input::placeholder,
  .surface-inverted textarea::placeholder {
    color: #4A555E;
  }

  .surface-inverted input:focus,
  .surface-inverted textarea:focus,
  .surface-inverted select:focus {
    border-color: var(--color-electric-lime);
    background-color: rgba(21, 25, 29, 0.08);
  }

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--touch-target-min);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: var(--text-label-size);
    line-height: var(--text-label-leading);
    font-weight: var(--text-label-weight);
    letter-spacing: var(--text-label-tracking);
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--motion-fast) var(--motion-ease-out),
                color var(--motion-fast) var(--motion-ease-out),
                border-color var(--motion-fast) var(--motion-ease-out),
                transform var(--motion-fast) var(--motion-ease-out);
  }

  .btn:hover {
    transform: translate(-1px, -1px);
  }

  .btn:active {
    transform: translate(0, 0);
  }

  .btn-primary {
    background-color: var(--color-electric-lime);
    color: var(--color-graphite-black);
    border: 1px solid var(--color-electric-lime);
  }

  .btn-primary:hover {
    background-color: color-mix(in srgb, var(--color-electric-lime) 90%, black);
    border-color: color-mix(in srgb, var(--color-electric-lime) 90%, black);
  }

  .btn-secondary {
    background-color: transparent;
    color: var(--color-snow-white);
    border: 1px solid var(--color-electric-lime);
  }

  .btn-secondary:hover {
    background-color: var(--color-electric-lime);
    color: var(--color-graphite-black);
  }

  .btn-ghost {
    background-color: transparent;
    color: var(--color-snow-white);
    border: 1px solid var(--color-border-subtle);
  }

  .btn-ghost:hover {
    border-color: var(--color-steel-gray);
    background-color: rgba(245, 247, 247, 0.06);
  }

  .label {
    display: inline-block;
    font-size: var(--text-label-size);
    line-height: var(--text-label-leading);
    font-weight: var(--text-label-weight);
    letter-spacing: var(--text-label-tracking);
    text-transform: uppercase;
    color: var(--color-steel-gray);
  }

  .label-accent {
    color: var(--color-icy-blue);
  }

  .label-warning {
    color: var(--color-adrenaline-orange);
  }

  .divider {
    border: none;
    border-block-start: 1px solid var(--color-border-subtle);
    margin-block: var(--space-md);
  }

  .divider-lime {
    border-block-start-color: var(--color-electric-lime);
  }

  .skip-link {
    position: absolute;
    inset-block-start: -100%;
    inset-inline-start: var(--space-md);
    z-index: 1000;
    padding: var(--space-sm) var(--space-md);
    background-color: var(--color-electric-lime);
    color: var(--color-graphite-black);
    font-weight: 700;
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: inset-block-start var(--motion-fast) var(--motion-ease-out);
  }

  .skip-link:focus {
    inset-block-start: var(--space-md);
  }

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

  .flex {
    display: flex;
    gap: var(--space-md);
  }

  .flex-wrap {
    flex-wrap: wrap;
  }

  .flex-center {
    align-items: center;
    justify-content: center;
  }

  .flex-between {
    align-items: center;
    justify-content: space-between;
  }

  .flex-column {
    flex-direction: column;
  }

  .flex-grow {
    flex: 1 1 0%;
    min-width: 0;
  }

  .flex-shrink-safe {
    min-width: 0;
  }

  .gap-2xs { gap: var(--space-2xs); }
  .gap-xs { gap: var(--space-xs); }
  .gap-sm { gap: var(--space-sm); }
  .gap-md { gap: var(--space-md); }
  .gap-lg { gap: var(--space-lg); }
  .gap-xl { gap: var(--space-xl); }

  .margin-block-0 { margin-block: 0; }
  .margin-block-xs { margin-block: var(--space-xs); }
  .margin-block-sm { margin-block: var(--space-sm); }
  .margin-block-md { margin-block: var(--space-md); }
  .margin-block-lg { margin-block: var(--space-lg); }
  .margin-block-xl { margin-block: var(--space-xl); }
  .margin-block-2xl { margin-block: var(--space-2xl); }
  .margin-block-3xl { margin-block: var(--space-3xl); }

  .margin-block-end-0 { margin-block-end: 0; }
  .margin-block-end-xs { margin-block-end: var(--space-xs); }
  .margin-block-end-sm { margin-block-end: var(--space-sm); }
  .margin-block-end-md { margin-block-end: var(--space-md); }
  .margin-block-end-lg { margin-block-end: var(--space-lg); }
  .margin-block-end-xl { margin-block-end: var(--space-xl); }
  .margin-block-end-2xl { margin-block-end: var(--space-2xl); }
  .margin-block-end-3xl { margin-block-end: var(--space-3xl); }

  .text-display {
    font-family: var(--font-heading);
    font-size: var(--text-display-size);
    line-height: var(--text-display-leading);
    font-weight: var(--text-display-weight);
    letter-spacing: var(--text-display-tracking);
    text-transform: uppercase;
    color: var(--color-snow-white);
  }

  .text-lead {
    font-size: var(--text-lead-size);
    line-height: var(--text-lead-leading);
    font-weight: var(--text-lead-weight);
    color: var(--color-snow-white);
  }

  .text-small {
    font-size: var(--text-small-size);
    line-height: var(--text-small-leading);
    font-weight: var(--text-small-weight);
  }

  .text-steel {
    color: var(--color-steel-gray);
  }

  .text-lime {
    color: var(--color-electric-lime);
  }

  .text-icy {
    color: var(--color-icy-blue);
  }

  .text-orange {
    color: var(--color-adrenaline-orange);
  }

  .text-uppercase {
    text-transform: uppercase;
  }

  .text-center {
    text-align: center;
  }

  .text-start {
    text-align: start;
  }

  .text-end {
    text-align: end;
  }

  .radius-none { border-radius: var(--radius-none); }
  .radius-sm { border-radius: var(--radius-sm); }
  .radius-md { border-radius: var(--radius-md); }

  .shadow-soft {
    box-shadow: var(--shadow-soft);
  }


}