@layer base {
  :root {
    --color-bg: oklch(15.5% 0.015 50);
    --color-surface: oklch(19% 0.018 45);
    --color-raised: oklch(22% 0.02 40);
    --color-border: oklch(33% 0.025 45);
    --color-text: oklch(95% 0.01 70);
    --color-muted: oklch(70% 0.025 60);
    --color-primary: oklch(75% 0.12 70);
    --color-primary-strong: oklch(68% 0.14 62);
    --color-primary-text: oklch(15% 0.015 50);
    --color-danger: oklch(68% 0.15 25);
    --color-success: oklch(68% 0.1 150);
    --radius-sm: 0.375rem;
    --radius-md: 0.625rem;
    --radius-lg: 1rem;
    --shadow-panel: 0 1rem 3rem oklch(5% 0.015 50 / 0.22);
    --shadow-button: 0 0.4rem 1rem oklch(5% 0.015 50 / 0.2);
    --content-width: 64rem;
  }

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

  html {
    min-width: 20rem;
    background: var(--color-bg);
  }

  body {
    min-height: 100vh;
    margin: 0;
    color: var(--color-text);
    background:
      radial-gradient(circle at 8% 0%, oklch(30% 0.035 55 / 0.25), transparent 32rem),
      var(--color-bg);
    font-family: ui-sans-serif, system-ui, sans-serif;
    line-height: 1.5;
  }

  a {
    color: inherit;
  }

  button, input {
    font: inherit;
  }
}

@layer components {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--color-border);
    background: oklch(15.5% 0.015 50 / 0.92);
    backdrop-filter: blur(1rem);
  }

  .site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: min(100% - 2rem, var(--content-width));
    min-height: 4.5rem;
    margin: 0 auto;
  }

  .brand {
    color: var(--color-primary);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    text-decoration: none;
  }

  .nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
  }

  .nav-link, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.875rem;
    font-size: 0.9375rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: 150ms ease;
  }

  .nav-link {
    color: var(--color-muted);
  }

  .nav-link:hover, .nav-link:focus-visible {
    color: var(--color-text);
    background: var(--color-raised);
  }

  .button {
    color: var(--color-primary-text);
    background: var(--color-primary);
    box-shadow: var(--shadow-button);
  }

  .button:hover, .button:focus-visible {
    background: var(--color-primary-strong);
    transform: translateY(-1px);
  }

  .button-secondary {
    color: var(--color-text);
    background: var(--color-raised);
    border-color: var(--color-border);
    box-shadow: none;
  }

  .button-danger {
    color: var(--color-danger);
    background: transparent;
    border-color: oklch(68% 0.15 25 / 0.35);
    box-shadow: none;
  }

  .button-danger:hover, .button-danger:focus-visible {
    background: oklch(68% 0.15 25 / 0.12);
  }

  .page-shell {
    width: min(100% - 2rem, var(--content-width));
    margin: 0 auto;
    padding: 4rem 0 6rem;
  }

  .page-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
  }

  .eyebrow {
    margin: 0 0 0.5rem;
    color: var(--color-primary);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }

  h1, h2, p {
    margin-top: 0;
  }

  h1 {
    margin-bottom: 0.5rem;
    font-size: clamp(2rem, 5vw, 3.25rem);
    line-height: 1.05;
    letter-spacing: -0.045em;
  }

  h2 {
    font-size: 1.25rem;
  }

  .lede {
    max-width: 38rem;
    color: var(--color-muted);
    font-size: 1.125rem;
  }

  .panel {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: clamp(1.25rem, 4vw, 2rem);
    background: linear-gradient(145deg, oklch(23% 0.022 45), var(--color-surface));
    box-shadow: var(--shadow-panel);
  }

  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(14rem, 0.7fr);
    align-items: center;
    gap: 3rem;
    min-height: 28rem;
  }

  .hero-mark {
    display: grid;
    place-items: center;
    min-height: 14rem;
    border: 1px solid oklch(75% 0.12 70 / 0.25);
    border-radius: 50%;
    color: var(--color-primary);
    background: radial-gradient(circle, oklch(75% 0.12 70 / 0.14), transparent 65%);
    font-size: 5rem;
    font-weight: 800;
    box-shadow: inset 0 0 3rem oklch(75% 0.12 70 / 0.08);
  }

  .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .collection {
    display: grid;
    gap: 0.75rem;
    padding: 0;
    list-style: none;
  }

  .collection-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    background: var(--color-surface);
  }

  .item-title {
    font-weight: 700;
  }

  .item-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: end;
    gap: 0.5rem;
  }

  .form-panel {
    max-width: 38rem;
  }

  .field {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
  }

  .field label {
    color: var(--color-muted);
    font-size: 0.875rem;
    font-weight: 700;
  }

  .field input[type="text"], .field select, .item-actions select {
    width: 100%;
    min-height: 3rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    color: var(--color-text);
    background: var(--color-bg);
    outline: none;
  }

  .field input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px oklch(75% 0.12 70 / 0.2);
  }

  .notice, .error-explanation {
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    padding: 1rem;
  }

  .notice {
    color: var(--color-success);
    border: 1px solid oklch(68% 0.1 150 / 0.35);
    background: oklch(68% 0.1 150 / 0.1);
  }

  .error-explanation {
    color: var(--color-danger);
    border: 1px solid oklch(68% 0.15 25 / 0.35);
    background: oklch(68% 0.15 25 / 0.1);
  }

  .error-explanation h2 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
  }

  .error-explanation ul {
    margin: 0;
    padding-left: 1.25rem;
  }
}

@media (max-width: 42rem) {
  .site-nav, .page-shell {
    width: min(100% - 1.25rem, var(--content-width));
  }

  .site-nav {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.75rem 0;
  }

  .nav-links {
    width: 100%;
    overflow-x: auto;
  }

  .page-shell {
    padding-top: 2.5rem;
  }

  .page-header, .hero {
    display: block;
  }

  .page-header .button, .hero-mark {
    margin-top: 1.5rem;
  }

  .hero-mark {
    min-height: 10rem;
  }

  .collection-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .item-actions {
    justify-content: start;
  }
}
