:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --border: rgba(0, 0, 0, 0.06);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --logo-filter: none;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --text: #f5f5f7;
    --text-secondary: #a1a1a6;
    --border: rgba(255, 255, 255, 0.08);
    --accent: #2997ff;
    --accent-hover: #47a6ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.4);
      /* The logo is black, so it is inverted to white on dark backgrounds */
    --logo-filter: invert(1);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Navigation */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 22px;
  height: 52px;
  display: flex;
  align-items: center;
}

.nav-logo {
  display: flex;
}

.nav-logo img {
  height: 20px;
  filter: var(--logo-filter);
}

/* Layout */

main {
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 22px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.011em;
}

.headline {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: clamp(40px, 7vw, 64px);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.015em;
}

.gradient {
  background: linear-gradient(90deg, #0071e3 0%, #7d48e6 50%, #e3477c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  max-width: 600px;
  margin: 20px auto 0;
  font-size: clamp(19px, 2.4vw, 23px);
  line-height: 1.38;
  color: var(--text-secondary);
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 980px;
  font: inherit;
  font-size: 17px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.button:hover {
  text-decoration: none;
}

.button-primary {
  background: var(--accent);
  color: #ffffff;
}

.button-primary:hover {
  background: var(--accent-hover);
}

.button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent);
  outline-offset: 2px;
}

/* Centered page content */

.centered {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 96px 0;
}

.error-code {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: clamp(96px, 20vw, 180px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}

.centered .lead {
  margin-bottom: 36px;
}

/* Internal subscription page */

.intro {
  padding: 72px 0 40px;
  text-align: center;
}

.panel {
  margin-bottom: 24px;
  padding: 28px;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.section-title {
  margin: 0 0 16px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.optional {
  font-weight: 400;
  color: var(--text-secondary);
}

.field {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.field:focus {
  outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent);
  outline-offset: 0;
}

#me {
  width: 120px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hint {
  margin: 12px 0 0;
  font-size: 15px;
  color: var(--text-secondary);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.tile {
  display: flex;
  flex-direction: column;
  padding: 28px;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.tile-icon {
  font-size: 36px;
  line-height: 1;
}

.tile h2 {
  margin: 16px 0 6px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tile p {
  flex: 1;
  margin: 0 0 20px;
  color: var(--text-secondary);
}

.tile-url {
  display: flex;
  gap: 8px;
}

.field-token {
  width: 100%;
  margin-bottom: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
}

.field-url.field-placeholder {
  font-family: inherit;
  font-size: 15px;
  color: var(--text-secondary);
}

.button:disabled {
  opacity: 0.4;
  cursor: default;
}

.field-url {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
}

.steps code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--bg);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 15px;
}

.steps {
  margin: 0;
  padding-left: 22px;
}

.steps li {
  margin-bottom: 8px;
}

.notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin-bottom: 72px;
}

.note h3 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 600;
}

.note p {
  margin: 0;
  font-size: 15px;
  color: var(--text-secondary);
}

@media (max-width: 600px) {
  .intro {
    padding: 48px 0 32px;
  }

  .panel,
  .tile {
    padding: 22px;
  }
}

/* Footer */

.footer {
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 22px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Entrance animation */

.fade-in {
  animation: fade-in 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fade-in {
    animation: none;
  }
}
