/* Landing page styles. Every size resolves to the Tailwind type scale, every gap to the spacing tokens below,
   every radius to a Tailwind radius. No background gradients; the only gradient is the hero heading text. */

:root {
  --s-25: 2px;
  --s-50: 4px;
  --s-75: 8px;
  --s-100: 12px;
  --s-200: 16px;
  --s-300: 24px;
  --s-400: 32px;
  --s-500: 40px;
  --s-600: 48px;
  --s-700: 64px;
  --s-800: 80px;
  --s-900: 96px;

  --r: 4px;
  --r-lg: 8px;
  --r-xl: 12px;
  --r-2xl: 16px;
  --r-3xl: 24px;
  --r-full: 9999px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font:
    "Manrope", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui,
    sans-serif;

  --bg: #ffffff;
  --surface: #fafafa;
  --raised: #f4f4f5;
  --border: #e4e4e7;
  --text: #0a0a0a;
  --muted: #52525b;
  --accent: #0f7b5f;
  --accent-soft: #e6f4ee;
  --warn: #8a4b00;
  --warn-soft: #fdf1e1;
  --button-bg: #0a0a0a;
  --button-bg-hover: #2a2a2a;
  --button-text: #ffffff;
  --nav-bg: rgb(255 255 255 / 0.72);
  --panel-bg: rgb(255 255 255 / 0.94);
  --hero-from: #000000;
  --hero-to: #666666;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #181818;
    --raised: #1f1f1f;
    --border: #313131;
    --text: #ffffff;
    --muted: #a1a1aa;
    --accent: #3fd3a0;
    --accent-soft: #131209;
    --warn: #f5b25c;
    --warn-soft: #272727;
    --button-bg: #ffffff;
    --button-bg-hover: #d4d4d8;
    --button-text: #000000;
    --nav-bg: rgb(24 24 24 / 0.72);
    --panel-bg: rgb(0 0 0 / 0.94);
    --hero-from: #ffffff;
    --hero-to: #9b9b9b;
    color-scheme: dark;
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--s-900);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
  text-wrap: balance;
  word-break: auto-phrase;
}

/* Safari has no word-break: auto-phrase, so heading text is split into phrases that never break inside. */
.ph {
  display: inline-block;
}

p,
li,
summary {
  text-wrap: pretty;
}

p,
dt,
li,
figcaption,
summary {
  word-break: auto-phrase;
}

/* Short runs of copy carry <wbr> at their phrase boundaries; keep-all makes those the only break points, so neither
   engine leaves one or two characters on a line of their own. */
.hero-sub,
.hero-proof,
.section-lead,
.spec-label,
.cta-sub {
  word-break: keep-all;
}

p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-lg);
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--s-200);
}

@media (min-width: 768px) {
  .container {
    padding: 0 var(--s-400);
  }
}

.skip-link {
  position: fixed;
  top: var(--s-75);
  left: var(--s-75);
  z-index: 100;
  padding: var(--s-75) var(--s-100);
  background: var(--button-bg);
  color: var(--button-text);
  border-radius: var(--r-lg);
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  transform: translateY(-200%);
  transition: transform 500ms var(--ease);
}

.skip-link:focus {
  transform: none;
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  gap: var(--s-75);
  padding: var(--s-75) var(--s-100);
  border-radius: var(--r-full);
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 600;
  text-decoration: none;
  transition:
    background-color 300ms var(--ease),
    transform 500ms var(--ease);
}

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

.button-primary:hover {
  background: var(--button-bg-hover);
  transform: translateY(-1px);
}

.button:active {
  transform: scale(0.98);
}

.button-small {
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.button-large {
  padding: var(--s-100) var(--s-300);
}

/* Navigation */

.site-header {
  position: fixed;
  top: var(--s-200);
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  padding: 0 var(--s-200);
  pointer-events: none;
}

.nav {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--s-75);
  padding: var(--s-75);
  background: var(--nav-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-75);
  padding: var(--s-50) var(--s-100) var(--s-50) var(--s-50);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.5rem;
  text-decoration: none;
  border-radius: var(--r-full);
}

.brand-mark {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: var(--r-full);
  background: var(--text);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  left: var(--s-75);
  right: var(--s-75);
  height: 2px;
  background: var(--accent);
  border-radius: var(--r-full);
}

.brand-mark::before {
  top: 8px;
}

.brand-mark::after {
  bottom: 8px;
}

.nav-links {
  display: none;
  align-items: center;
  gap: var(--s-50);
}

.nav-links a:not(.button) {
  display: inline-block;
  padding: var(--s-75) var(--s-100);
  border-radius: var(--r-full);
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  text-decoration: none;
  transition:
    color 300ms var(--ease),
    background-color 300ms var(--ease),
    transform 500ms var(--ease);
}

.nav-links a:not(.button):hover,
.nav-links a[aria-current] {
  color: var(--text);
  background: var(--raised);
}

.nav-links a:not(.button):active {
  transform: scale(0.98);
}

.nav-menu-cta {
  display: none;
}

.nav-back {
  padding: var(--s-75) var(--s-100);
  border-radius: var(--r-full);
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  text-decoration: none;
  transition:
    background-color 300ms var(--ease),
    transform 500ms var(--ease);
}

.nav-back:hover {
  background: var(--raised);
  color: var(--text);
}

.nav-back:active {
  transform: translateY(1px);
}

.menu-toggle {
  position: relative;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition:
    background-color 300ms var(--ease),
    transform 500ms var(--ease);
}

.menu-toggle:hover {
  background: var(--raised);
}

.menu-toggle:active {
  transform: scale(0.98);
}

.menu-toggle-line {
  position: absolute;
  left: 12px;
  right: 12px;
  height: 2px;
  border-radius: var(--r-full);
  background: currentColor;
  transition: transform 500ms var(--ease);
}

.menu-toggle-line:first-child {
  transform: translateY(-4px);
}

.menu-toggle-line:last-child {
  transform: translateY(4px);
}

.menu-open .menu-toggle-line:first-child {
  transform: rotate(45deg);
}

.menu-open .menu-toggle-line:last-child {
  transform: rotate(-45deg);
}

/* Mobile menu: a full height panel. The nav drops its own blur while open, because backdrop-filter would make it
   the containing block of the fixed panel. */
@media (max-width: 879px) {
  .menu-open,
  .menu-open body {
    overflow: hidden;
  }

  .menu-open .nav {
    background: transparent;
    border-color: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .menu-open .nav-links {
    position: fixed;
    inset: 0;
    z-index: -1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--s-75);
    padding: var(--s-900) var(--s-300) var(--s-400);
    background: var(--panel-bg);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
  }

  .menu-open .nav-links a:not(.button) {
    font-size: 1.5rem;
    line-height: 2rem;
    padding: var(--s-100) var(--s-200);
    color: var(--text);
  }

  .menu-open .nav-menu-cta {
    display: block;
    margin-top: var(--s-300);
  }

  .menu-open .nav-menu-cta .button {
    width: 100%;
    justify-content: center;
    padding: var(--s-100) var(--s-300);
  }

  .menu-open .nav-links li {
    opacity: 0;
    transform: translateY(24px);
    animation: menu-in 500ms var(--ease) forwards;
  }

  .menu-open .nav-links li:nth-child(1) {
    animation-delay: 0ms;
  }
  .menu-open .nav-links li:nth-child(2) {
    animation-delay: 60ms;
  }
  .menu-open .nav-links li:nth-child(3) {
    animation-delay: 120ms;
  }
  .menu-open .nav-links li:nth-child(4) {
    animation-delay: 180ms;
  }
  .menu-open .nav-links li:nth-child(5) {
    animation-delay: 240ms;
  }
  .menu-open .nav-links li:nth-child(6) {
    animation-delay: 300ms;
  }

  .menu-open .nav-cta {
    visibility: hidden;
  }
}

@keyframes menu-in {
  to {
    opacity: 1;
    transform: none;
  }
}

@media (min-width: 880px) {
  .nav-links {
    display: flex;
  }

  .menu-toggle {
    display: none;
  }
}

@media (max-width: 379px) {
  .nav-cta {
    display: none;
  }
}

/* Shared text */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-75);
  margin-bottom: var(--s-200);
  color: var(--accent);
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--accent);
}

.section {
  padding: var(--s-800) 0;
}

@media (min-width: 768px) {
  .section {
    padding: var(--s-900) 0;
  }
}

.section-title {
  max-width: 680px;
  font-size: 1.875rem;
  line-height: 2.25rem;
  font-weight: 700;
}

@media (min-width: 768px) {
  .section-title {
    font-size: 2.25rem;
    line-height: 2.5rem;
  }
}

.section-lead {
  max-width: 680px;
  margin-top: var(--s-200);
  color: var(--muted);
  font-size: 1.125rem;
  line-height: 1.75rem;
}

/* Hero */

/* The fixed nav overlaps the top: main adds 48px and each page adds 96px below it. */
main {
  padding-top: var(--s-600);
}

.hero {
  padding: var(--s-900) 0 var(--s-800);
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hero-title {
  max-width: 680px;
  font-size: 2.25rem;
  line-height: 2.5rem;
  font-weight: 700;
  background: linear-gradient(to right, var(--hero-from), var(--hero-to));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@media (max-width: 767px) {
  .hero-title {
    font-size: 1.875rem;
    line-height: 2.25rem;
  }
}

@media (min-width: 768px) {
  .hero-title {
    font-size: 3.75rem;
    line-height: 1;
  }
}

.phrase {
  display: inline-block;
}

@media (min-width: 768px) {
  .phrase {
    padding-bottom: var(--s-75);
  }
}

.hero-sub {
  max-width: 680px;
  margin-top: var(--s-300);
  color: var(--muted);
  font-size: 1.125rem;
  line-height: 1.75rem;
}

.hero-actions {
  margin-top: var(--s-400);
}

.hero-proof {
  display: flex;
  align-items: center;
  gap: var(--s-75);
  margin-top: var(--s-200);
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.hero-proof .icon {
  color: var(--accent);
}

.hero-visual {
  max-width: 880px;
  margin: var(--s-700) auto 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-50);
  padding: var(--s-50) var(--s-100);
  border-radius: var(--r-full);
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge .icon {
  width: 16px;
  height: 16px;
}

.badge-ok {
  color: var(--accent);
  background: var(--accent-soft);
}

.badge-wait {
  color: var(--warn);
  background: var(--warn-soft);
}

.badge-muted {
  color: var(--muted);
  background: var(--raised);
}

.caption {
  margin-top: var(--s-100);
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1rem;
  text-align: center;
}

/* Spec numbers under the hero */

.specs {
  padding: 0 0 var(--s-400);
}

.specs-title {
  margin-bottom: var(--s-200);
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
}

.spec-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-75);
  margin: 0;
}

.spec {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: var(--s-75);
  padding: var(--s-200);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
}

.spec-label {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.25rem;
  text-wrap: pretty;
}

.spec-value {
  display: flex;
  align-items: baseline;
  gap: var(--s-25);
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.spec-num {
  display: inline-block;
  font-size: 2.25rem;
  line-height: 2.5rem;
}

.spec-unit {
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 600;
}

@media (min-width: 768px) {
  .spec-list {
    gap: var(--s-200);
  }

  .spec {
    padding: var(--s-300);
  }
}

@media (min-width: 1024px) {
  .spec-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .spec-num {
    font-size: 3rem;
    line-height: 1;
  }
}

/* Cards */

.card {
  padding: var(--s-300);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
}

.card p,
.card li {
  color: var(--muted);
}

.card code {
  padding: 0 var(--s-50);
  background: var(--raised);
  border-radius: var(--r-lg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.875rem;
  line-height: 1.25rem;
  overflow-wrap: anywhere;
}

.card-accent {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.card-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-75);
  margin-bottom: var(--s-75);
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 600;
}

.card-title .icon {
  color: var(--accent);
}

.plain-list {
  display: grid;
  gap: var(--s-75);
}

.plain-list li {
  position: relative;
  padding-left: var(--s-300);
}

.plain-list li::before {
  content: "";
  position: absolute;
  left: var(--s-50);
  top: var(--s-75);
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--accent);
}

.split {
  display: grid;
  gap: var(--s-400);
}

.problem-grid {
  display: grid;
  gap: var(--s-200);
}

@media (min-width: 768px) {
  .problem-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.benefit-grid,
.steps {
  display: grid;
  gap: var(--s-200);
  margin-top: var(--s-600);
}

@media (min-width: 768px) {
  .benefit-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .benefit-grid > :nth-child(-n + 3) {
    grid-column: span 2;
  }

  .benefit-grid > :nth-child(n + 4) {
    grid-column: span 3;
  }

  .steps {
    grid-template-columns: repeat(3, 1fr);
  }
}

.icon-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: var(--s-200);
  border-radius: var(--r-lg);
  background: var(--accent-soft);
  color: var(--accent);
}

.icon-chip .icon {
  width: 24px;
  height: 24px;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-bottom: var(--s-200);
  border-radius: var(--r-full);
  background: var(--button-bg);
  color: var(--button-text);
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 700;
}

/* Tagline reveal */

.tagline {
  padding: var(--s-900) 0;
}

.tagline-text {
  max-width: 680px;
  font-size: 2.25rem;
  line-height: 2.5rem;
  font-weight: 700;
  text-wrap: balance;
}

@media (min-width: 768px) {
  .tagline-text {
    font-size: 3rem;
    line-height: 1;
  }

  .tagline-text .w {
    padding-bottom: var(--s-100);
  }
}

.tagline-text .w {
  display: inline-block;
}

/* Safety */

.safety-grid {
  display: grid;
  gap: var(--s-400) var(--s-300);
  margin-top: var(--s-600);
}

@media (min-width: 768px) {
  .safety-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.safety-item {
  display: flex;
  gap: var(--s-200);
}

.safety-item > .icon {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.item-title {
  margin-bottom: var(--s-50);
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 600;
}

.safety-item p {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.25rem;
}

/* Feature bento: one column on phones; two columns from 768px with the tiles that carry a mini mock spanning both;
   three columns from 1024px (two large tiles beside two small ones, the audit log across the full width). */

.bento {
  display: grid;
  gap: var(--s-200);
  margin-top: var(--s-600);
}

.feature {
  position: relative;
  isolation: isolate;
  transition: translate 500ms var(--ease);
}

/* The hover shadow lives on a pseudo element and only its opacity changes. */
.feature::after {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  box-shadow:
    0 0 0 1px var(--border),
    0 12px 32px rgb(0 0 0 / 0.08);
  opacity: 0;
  transition: opacity 300ms var(--ease);
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  .feature::after {
    box-shadow:
      0 0 0 1px var(--muted),
      0 12px 32px rgb(0 0 0 / 0.6);
  }
}

@media (hover: hover) {
  .feature:hover {
    translate: 0 -2px;
  }

  .feature:hover::after {
    opacity: 1;
  }
}

.feature-lg,
.feature-wide {
  display: grid;
  gap: var(--s-300);
  align-content: start;
}

@media (min-width: 768px) {
  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .feature-lg,
  .feature-wide {
    grid-column: span 2;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
}

@media (min-width: 1024px) {
  .bento {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .feature-wide {
    grid-column: span 3;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  }
}

.bento-caption {
  text-align: left;
}

/* Mini mocks are pictures: no pointer events, no selection, and role="img" with a description in the markup.
   Mock radius 12 with 4px padding, so inner rows use 8. */

.mini {
  min-width: 0;
  padding: var(--s-50);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  pointer-events: none;
  user-select: none;
}

.mini li {
  color: var(--text);
}

.mini-terms {
  display: grid;
  gap: var(--s-25);
}

.mini-term {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-100);
  padding: var(--s-75) var(--s-100);
  border-radius: var(--r-lg);
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
}

.mini-term:nth-child(odd),
.log-row:nth-child(odd) {
  background: var(--surface);
}

.mini-term-text {
  min-width: 0;
}

.chip {
  padding: var(--s-25) var(--s-75);
  border-radius: var(--r-full);
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 600;
  white-space: nowrap;
}

.chip-keyword {
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.chip-negated {
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--border);
}

.chip-uncovered {
  color: var(--warn);
  background: var(--warn-soft);
}

/* Dashboard panel: an ads account's name and write status, a KPI before and after, and its latest change. */

.mini-panel {
  display: grid;
  gap: var(--s-100);
  padding: var(--s-200);
}

.mini-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-75);
}

.mini-kind,
.mini-label {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 600;
}

.mini-diff {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--s-100);
}

.mini-value {
  display: grid;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.mini-value-after {
  color: var(--text);
}

.mini-arrow {
  display: inline-flex;
  padding-bottom: var(--s-50);
  color: var(--muted);
}

.card .mini-reason {
  font-size: 0.875rem;
  line-height: 1.25rem;
}

/* Change log rows: time, what changed and why, where the change came from. */

.log {
  display: grid;
  gap: var(--s-25);
}

.log-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--s-100);
  padding: var(--s-75) var(--s-100);
  border-radius: var(--r-lg);
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.log-time {
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.log-main {
  display: grid;
  min-width: 0;
}

.log-what {
  font-weight: 600;
  word-break: keep-all;
  font-variant-numeric: tabular-nums;
}

.log-why {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1rem;
}

.log-src {
  padding: 0 var(--s-75);
  border-radius: var(--r-full);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--border);
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 600;
  white-space: nowrap;
}

.nw {
  white-space: nowrap;
}

/* Below 640px the source gives its width to what changed (the reason line already says where it came from). */
@media (max-width: 639px) {
  .log-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .log-src {
    display: none;
  }
}

/* FAQ */

.faq-layout {
  display: grid;
  gap: var(--s-400);
}

@media (min-width: 900px) {
  .faq-layout {
    grid-template-columns: 1fr 2fr;
  }
}

.faq-list {
  display: grid;
  gap: var(--s-75);
}

.faq {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
}

.faq summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-200);
  padding: var(--s-200) var(--s-300);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  border-radius: var(--r-2xl);
  transition:
    background-color 300ms var(--ease),
    transform 500ms var(--ease);
}

.faq summary:active {
  transform: translateY(1px);
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  flex: none;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1.75rem;
  transition: transform 500ms var(--ease);
}

.faq[open] summary::after {
  transform: rotate(45deg);
}

.faq summary:hover {
  background: var(--raised);
}

.faq p {
  padding: 0 var(--s-300) var(--s-300);
  color: var(--muted);
}

/* Final CTA */

.cta-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--s-700) var(--s-300);
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-3xl);
}

.cta-title {
  max-width: 680px;
  font-size: 1.875rem;
  line-height: 2.25rem;
  font-weight: 700;
}

@media (min-width: 768px) {
  .cta-title {
    font-size: 2.25rem;
    line-height: 2.5rem;
  }
}

.cta-sub {
  max-width: 680px;
  margin: var(--s-200) 0 var(--s-400);
  color: var(--muted);
  font-size: 1.125rem;
  line-height: 1.75rem;
}

/* Footer */

.site-footer {
  padding: var(--s-700) 0 var(--s-600);
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: grid;
  gap: var(--s-300);
}

.footer-note {
  max-width: 680px;
  margin-top: var(--s-100);
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-75) var(--s-300);
}

.footer-nav a,
.footer-meta {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.footer-nav a {
  text-decoration: none;
  transition: color 300ms var(--ease);
}

.footer-nav a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* Simple pages (404, legal drafts) */

.page-main {
  padding-bottom: var(--s-900);
}

.page-main > :first-child {
  padding-top: var(--s-900);
}

.not-found {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 50vh;
}

/* The single 404 serves every locale: English first, then the Japanese note. */
.not-found-alt {
  display: grid;
  gap: var(--s-75);
  max-width: 680px;
  margin-top: var(--s-600);
  padding-top: var(--s-300);
  border-top: 1px solid var(--border);
  color: var(--muted);
}

.not-found-alt-title {
  color: var(--text);
  font-weight: 600;
}

.not-found-alt a {
  color: var(--text);
}

.legal {
  max-width: 744px;
}

.legal-title {
  font-size: 2.25rem;
  line-height: 2.5rem;
}

.legal h2 {
  margin: var(--s-500) 0 var(--s-200);
  font-size: 1.25rem;
  line-height: 1.75rem;
}

.legal > p {
  margin-top: var(--s-400);
  color: var(--muted);
}

.notice {
  margin-top: var(--s-300);
  padding: var(--s-200) var(--s-300);
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid var(--warn);
  border-radius: var(--r-2xl);
}

/* Write flow timeline: vertical below 1024px, three columns in two rows from 1024px, six columns from 1280px. Each step
   draws the segment that leads to the next node (a grey track with an accent line on top that grows), so the line
   reaches a node just before it lights. In the two row layout the third step ends its row and draws no segment. */

.timeline {
  display: grid;
  margin-top: var(--s-600);
}

.tl-step {
  position: relative;
  padding: 0 0 var(--s-400) var(--s-600);
}

.tl-step:last-child {
  padding-bottom: 0;
}

.tl-step:not(:last-child)::before,
.tl-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 32px;
  bottom: 0;
  left: 15px;
  width: 2px;
  background: var(--border);
}

.tl-step:not(:last-child)::after {
  background: var(--accent);
  transform-origin: 50% 0;
}

.tl-node {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 700;
}

.tl-node::before,
.tl-node::after {
  position: absolute;
  inset: -1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-full);
}

.tl-node::before {
  content: "";
  background: var(--accent);
}

.tl-node::after {
  content: attr(data-n);
  color: var(--bg);
}

.tl-body {
  padding-top: var(--s-50);
}

.tl-title {
  margin-bottom: var(--s-50);
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 600;
}

.tl-body p {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.25rem;
}

@media (min-width: 1024px) {
  .timeline {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--s-600) var(--s-200);
  }

  .tl-step,
  .tl-step:last-child {
    padding: var(--s-600) 0 0;
  }

  .tl-step:not(:last-child)::before,
  .tl-step:not(:last-child)::after {
    top: 15px;
    bottom: auto;
    left: 32px;
    right: calc(-1 * var(--s-200));
    width: auto;
    height: 2px;
  }

  .tl-step:not(:last-child)::after {
    transform-origin: 0 50%;
  }

  .tl-body {
    padding-top: 0;
  }
}

@media (min-width: 1024px) and (max-width: 1279px) {
  .tl-step:nth-child(3n)::before,
  .tl-step:nth-child(3n)::after {
    display: none;
  }
}

@media (min-width: 1280px) {
  .timeline {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: var(--s-200);
  }
}

/* Entrance states. They apply from the first paint, but only where scripting is on, so a browser without JS renders
   the final state and nothing flashes before the deferred script runs. site.js adds .motion to <html> once it has
   taken over; until then a safety animation shows everything after 2.5s, so content never stays hidden when the
   script fails to load or run. */

@media (scripting: enabled) {
  /* Safety net while JS has not taken over. An animation wins over the declarations below whatever their
     specificity, so :where() keeps these selectors at zero weight. */

  :where(html:not(.motion)) :where(section[data-reveal], .tagline-text .w, .tl-body),
  :where(html:not(.motion) .tl-step)::after,
  :where(html:not(.motion) .tl-node)::before,
  :where(html:not(.motion) .tl-node)::after {
    animation: safety-show 600ms var(--ease) 2500ms forwards;
  }

  /* section[...], not a bare [data-reveal]: the demos' kit uses data-reveal on its own elements. */
  section[data-reveal] {
    opacity: 0;
    transform: translateY(32px);
    transition:
      opacity 700ms var(--ease),
      transform 700ms var(--ease);
  }

  section[data-reveal].is-visible {
    opacity: 1;
    transform: none;
  }

  .tagline-text .w {
    opacity: 0.3;
    transition: opacity 500ms var(--ease);
  }

  .tagline-text .w.is-on {
    opacity: 1;
  }

  /* Write flow timeline. JS sets --seg-delay and --node-delay per step, adds .is-linked to a step when the line toward
     the next node should grow, and .is-on when its node lights. */

  .tl-step:not(:last-child)::after {
    transform: scaleY(0);
    transition: transform 400ms var(--ease) var(--seg-delay, 0ms);
  }

  .tl-node::before {
    opacity: 0;
    transform: scale(0.6);
    transition:
      opacity 500ms var(--ease) var(--node-delay, 0ms),
      transform 500ms var(--ease) var(--node-delay, 0ms);
  }

  .tl-node::after {
    opacity: 0;
    transition: opacity 500ms var(--ease) var(--node-delay, 0ms);
  }

  .tl-body {
    opacity: 0;
    transform: translateY(var(--s-200));
    transition:
      opacity 600ms var(--ease) var(--node-delay, 0ms),
      transform 600ms var(--ease) var(--node-delay, 0ms);
  }

  .tl-step.is-linked::after,
  .tl-step.is-on .tl-node::before,
  .tl-step.is-on .tl-body {
    opacity: 1;
    transform: none;
  }

  .tl-step.is-on .tl-node::after {
    opacity: 1;
  }
}

@media (scripting: enabled) and (min-width: 1024px) {
  .tl-step:not(:last-child)::after {
    transform: scaleX(0);
  }

  .tl-step.is-linked:not(:last-child)::after {
    transform: none;
  }
}

/* Feature bento entrances. site.js sets --tile-delay and --pop-delay and adds .is-in to the bento. The hover lift uses
   the separate translate property, so the entrance delay on transform never delays it. */

@media (scripting: enabled) {
  :where(html:not(.motion)) :where(.bento .feature, .bento [data-pop]) {
    animation: safety-show 600ms var(--ease) 2500ms forwards;
  }

  .bento .feature {
    opacity: 0;
    transform: translateY(var(--s-300));
    transition:
      opacity 700ms var(--ease) var(--tile-delay, 0ms),
      transform 700ms var(--ease) var(--tile-delay, 0ms),
      translate 500ms var(--ease);
  }

  .bento [data-pop] {
    opacity: 0;
    transition:
      opacity 500ms var(--ease) var(--pop-delay, 0ms),
      transform 500ms var(--ease) var(--pop-delay, 0ms);
  }

  .bento .chip[data-pop] {
    transform: scale(0.6);
  }

  .bento .mini-value[data-pop] {
    transform: translateY(var(--s-75));
  }

  .bento .mini-arrow[data-pop] {
    transform: translateX(calc(-1 * var(--s-75)));
  }

  .bento .log-row[data-pop] {
    transform: translateX(calc(-1 * var(--s-200)));
  }

  .bento.is-in .feature,
  .bento.is-in [data-pop] {
    opacity: 1;
    transform: none;
  }
}

@keyframes safety-show {
  to {
    opacity: 1;
    transform: none;
  }
}

/* Reduced motion: movement becomes a plain opacity change. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .button:hover,
  .button:active,
  .nav-links a:not(.button):active,
  .nav-back:active,
  .menu-toggle:active,
  .faq summary:active {
    transform: none;
  }

  .menu-open .nav-links li {
    transform: none;
    animation-name: menu-fade;
  }

  .menu-toggle-line {
    transition: opacity 300ms var(--ease);
  }
}

@media (scripting: enabled) and (prefers-reduced-motion: reduce) {
  section[data-reveal],
  .tl-node::before,
  .tl-body {
    transform: none;
  }

  section[data-reveal] {
    transition: opacity 700ms var(--ease);
  }

  .tl-step:not(:last-child)::after {
    opacity: 0;
    transform: none;
    transition: opacity 400ms var(--ease) var(--seg-delay, 0ms);
  }

  .tl-step.is-linked::after {
    opacity: 1;
  }

  .tl-node::before {
    transition: opacity 500ms var(--ease) var(--node-delay, 0ms);
  }

  .tl-body {
    transition: opacity 600ms var(--ease) var(--node-delay, 0ms);
  }
}

@media (scripting: enabled) and (prefers-reduced-motion: reduce) and (min-width: 1024px) {
  .tl-step:not(:last-child)::after {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .feature:hover {
    translate: none;
  }
}

@media (scripting: enabled) and (prefers-reduced-motion: reduce) {
  .bento .feature,
  .bento [data-pop],
  .bento .chip[data-pop],
  .bento .mini-value[data-pop],
  .bento .mini-arrow[data-pop],
  .bento .log-row[data-pop] {
    transform: none;
  }

  .bento .feature {
    transition: opacity 700ms var(--ease) var(--tile-delay, 0ms);
  }

  .bento [data-pop] {
    transition: opacity 500ms var(--ease) var(--pop-delay, 0ms);
  }
}

@keyframes menu-fade {
  to {
    opacity: 1;
  }
}
