:root {
  color-scheme: light;
  --bg: #f8fafc;
  --ink: #111827;
  --muted: #6b7280;
  --line: #d8dee8;
  --line-soft: #e8edf4;
  --accent: #6366f1;
  --accent-2: #a855f7;
  --footer: #6b7280;
  --toast-bg: rgba(17, 24, 39, 0.95);
  --toast-fg: #ffffff;
  --halo-opacity: 0.16;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #030405;
  --ink: #f8fafc;
  --muted: #8f98aa;
  --line: #1f2a36;
  --line-soft: #101820;
  --accent: #818cf8;
  --accent-2: #c084fc;
  --footer: #6f7583;
  --toast-bg: rgba(248, 250, 252, 0.94);
  --toast-fg: #030405;
  --halo-opacity: 0.2;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 52%, rgba(99, 102, 241, var(--halo-opacity)), transparent 38%),
    var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
}

a,
button {
  color: inherit;
}

a {
  text-decoration: none;
}

button {
  font: inherit;
}

.site-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 34px 40px;
}

.site-name {
  color: var(--footer);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: color 160ms ease;
}

.site-name:hover {
  color: var(--ink);
}

.theme-toggle {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  opacity: 0.78;
  transition:
    background 160ms ease,
    opacity 160ms ease;
}

.theme-toggle:hover {
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  opacity: 1;
}

.theme-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.theme-icon-sun,
:root[data-theme="dark"] .theme-icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-icon-sun {
  display: block;
}

.page-main {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 112px 24px 96px;
}

.subjects {
  display: grid;
  justify-items: center;
  width: min(100%, 700px);
  gap: 34px;
  text-align: center;
}

.subject-link {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: 100%;
  color: var(--muted);
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  font-weight: 300;
  line-height: 1.12;
  transition:
    color 180ms ease,
    text-shadow 180ms ease,
    transform 180ms ease;
}

.subject-link span {
  display: block;
}

.subject-link i {
  display: block;
  width: min(100%, 260px);
  height: 1px;
  overflow: hidden;
  background: var(--line);
}

.subject-link i::before {
  display: block;
  width: 0;
  height: 100%;
  content: "";
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: width 220ms ease;
}

.subject-link:hover,
.subject-link.is-active {
  color: var(--ink);
  font-weight: 650;
  text-shadow: 0 0 22px color-mix(in srgb, var(--accent) 42%, transparent);
}

.subject-link:hover i::before,
.subject-link.is-active i::before {
  width: 100%;
}

.subject-link.is-active {
  font-size: clamp(1.95rem, 3.2vw, 2.55rem);
  font-weight: 650;
}

.subject-link.is-active i {
  width: min(100%, 340px);
}

.site-footer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 34px 24px;
  color: var(--footer);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.site-footer a {
  transition: color 160ms ease;
}

.site-footer a:hover {
  color: var(--accent);
}

.site-footer span {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.7;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 88px;
  z-index: 30;
  max-width: min(340px, calc(100vw - 40px));
  padding: 11px 13px;
  border-radius: 6px;
  color: var(--toast-fg);
  background: var(--toast-bg);
  font-size: 0.94rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 44%, transparent);
  outline-offset: 5px;
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .site-header {
    padding: 22px 24px;
  }

  .page-main {
    min-height: 100svh;
    padding: 104px 20px 112px;
  }

  .subjects {
    gap: 28px;
  }

  .subject-link {
    font-size: 1.3rem;
  }

  .subject-link.is-active {
    font-size: 1.85rem;
  }

  .site-footer {
    gap: 16px;
    padding: 24px 18px;
    font-size: 0.66rem;
    letter-spacing: 0.16em;
  }
}

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