:root {
  color-scheme: only light;
  --bg: #7f63ff;
  --ink: #0b0720;
  --accent: #f4f1ff;
  --rule: 2px solid var(--ink);
  --font-display: "Inter Tight", "Noto Sans JP", system-ui, -apple-system, sans-serif;
  --font-body: "Space Grotesk", "Noto Sans JP", system-ui, -apple-system, sans-serif;
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 48px;
  --space-hero-top: clamp(56px, 8vw, 104px);
  --space-hero-bottom: clamp(48px, 7vw, 88px);
  --space-section: clamp(48px, 6vw, 80px);
  --gutter: 20px;
  --max-width: 1100px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: var(--space-md) var(--gutter);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body > * {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
}

main {
  flex: 1;
}

.accent {
  color: var(--accent);
}

.nowrap {
  white-space: nowrap;
}

a {
  color: var(--ink);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: text-decoration-color 150ms cubic-bezier(0.22, 1, 0.36, 1);
}

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

a:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  a {
    transition: none;
  }
}

/* Japanese: the display face has no kana, so tracking and leading are set for Noto Sans JP */

:lang(ja) {
  line-break: strict;
}

:lang(ja) h1,
:lang(ja) .feature h2 {
  letter-spacing: -0.02em;
  font-feature-settings: "palt";
}

:lang(ja) h1 {
  line-height: 1.15;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

:lang(ja) .feature h2 {
  line-height: 1.3;
  word-break: keep-all;
}

/* Phrase-based wrapping (Chrome 119+); other browsers drop the declaration and wrap per character.
   Only the lead is wide enough for it; in the feature columns it leaves the right edge too ragged. */

:lang(ja) .lead {
  word-break: auto-phrase;
}

/* Header */

.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-xs) var(--space-sm);
}

.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.25rem;
  line-height: 1;
  letter-spacing: -0.04em;
}

.site-header-aside {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--space-lg);
  font-size: 0.875rem;
}

.protocols {
  margin: 0;
  white-space: nowrap;
}

.lang {
  display: inline-block;
  padding: 12px 0;
  white-space: nowrap;
}

/* Hero */

.hero {
  padding: var(--space-hero-top) 0 var(--space-hero-bottom);
}

h1 {
  margin: 0;
  max-width: 11em;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.5rem, 8vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.lead {
  max-width: 32em;
  margin: var(--space-md) 0 0;
  font-size: 1.125rem;
  text-wrap: pretty;
}

/* Features */

.features {
  display: grid;
  grid-template-columns: 1fr;
  border-top: var(--rule);
}

.feature {
  padding: var(--space-sm) 0 var(--space-lg);
}

.feature + .feature {
  border-top: var(--rule);
}

.feature h2 {
  margin: 0 0 var(--space-xs);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.feature p:last-child {
  margin: 0;
  text-wrap: pretty;
}

/* Footer */

.site-footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-top: var(--space-section);
  padding-top: var(--space-sm);
  border-top: var(--rule);
  font-size: 0.9375rem;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  display: inline-block;
  padding: var(--space-xs) 0;
  font-size: 1.125rem;
}

/* Tablet: each feature becomes a row, heading beside its text */

@media (min-width: 760px) {
  :root {
    --gutter: 40px;
  }

  body {
    padding: var(--space-lg) var(--gutter);
  }

  .feature {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    column-gap: var(--space-xl);
    align-items: start;
    padding: var(--space-md) 0 var(--space-lg);
  }

  .feature h2 {
    margin: 0;
  }

  .site-footer {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

/* Desktop: three columns divided by vertical rules */

@media (min-width: 1024px) {
  .features {
    grid-template-columns: repeat(3, 1fr);
    column-gap: var(--space-xl);
  }

  .feature {
    display: block;
  }

  .feature h2 {
    margin: 0 0 var(--space-xs);
  }

  .feature + .feature {
    border-top: none;
    border-left: var(--rule);
    margin-left: calc(var(--space-xl) / -2 - 1px);
    padding-left: calc(var(--space-xl) / 2 - 1px);
  }
}
