/*
 * Tokens. Page colours follow ui-consistency (zinc, light). Notch colours match
 * the app's own src/styles.css so the page's notch looks like the real one.
 */
:root {
  --background: #ffffff;
  --foreground: #09090b;
  --muted: #f4f4f5;
  --muted-foreground: #71717b;
  --border: #e4e4e7;
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --ring: #9f9fa9;

  --notch-surface: #000000;
  --notch-raised: #1c1c1f;
  --notch-foreground: #fafafa;
  --notch-muted-foreground: #8e8e96;
  --notch-faint: #52525b;
  --notch-online: #34c759;
  --notch-attention: #ff9f0a;

  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-bubble: 20px;
  --radius-notch: 20px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;

  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 24px;
  /* Hero only: the one size above the 24px step. */
  --text-display: 48px;

  --notch-closed-w: 300px;
  --notch-closed-h: 38px;
  --notch-peek-h: 72px;
  --notch-open-w: 520px;
  --notch-open-h: 380px;
  --notch-ear: 10px;

  --content-w: 960px;
  --ease-spring: cubic-bezier(0.32, 1.25, 0.5, 1);
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

/* Language: both are in the HTML; the one not matching <html lang> is hidden. */
html[lang="ja"] [lang="en"]:not(.lang-option),
html[lang="en"] [lang="ja"]:not(.lang-option) { display: none !important; }

a { color: inherit; text-underline-offset: 3px; }
a:hover { color: var(--muted-foreground); }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

kbd, code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.9em;
}
kbd {
  padding: 0 var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  white-space: nowrap;
}

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

/* ---------- Notch ---------- */

.notch-stage {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.notch {
  position: relative;
  display: block;
  width: var(--notch-closed-w);
  height: var(--notch-closed-h);
  padding: 0;
  border: 0;
  border-radius: 0 0 var(--radius-notch) var(--radius-notch);
  background: var(--notch-surface);
  color: var(--notch-foreground);
  font: inherit;
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
  transition:
    width 420ms var(--ease-spring),
    height 420ms var(--ease-spring);
}

/* Concave "ears" where the notch meets the top edge, as on the real display. */
.notch::before,
.notch::after {
  content: "";
  position: absolute;
  top: 0;
  width: var(--notch-ear);
  height: var(--notch-ear);
  background: var(--notch-surface);
}
.notch::before {
  left: calc(var(--notch-ear) * -1);
  -webkit-mask: radial-gradient(circle at 0 100%, transparent var(--notch-ear), var(--notch-surface) var(--notch-ear));
  mask: radial-gradient(circle at 0 100%, transparent var(--notch-ear), var(--notch-surface) var(--notch-ear));
}
.notch::after {
  right: calc(var(--notch-ear) * -1);
  -webkit-mask: radial-gradient(circle at 100% 100%, transparent var(--notch-ear), var(--notch-surface) var(--notch-ear));
  mask: radial-gradient(circle at 100% 100%, transparent var(--notch-ear), var(--notch-surface) var(--notch-ear));
}

.notch[data-state="peek"] { height: var(--notch-peek-h); }
.notch[data-state="open"] {
  width: min(var(--notch-open-w), calc(100vw - var(--space-4)));
  height: var(--notch-open-h);
}

.notch-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--notch-closed-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4) 0 var(--space-3);
}

/* Muse's avatar, clipped to a circle as in the app. The plain dot underneath shows if the image fails to load. */
.notch-avatar {
  flex: none;
  position: relative;
  width: 22px;
  height: 22px;
  overflow: hidden;
  border-radius: 50%; /* ui-lint-disable-line radius */
  background: var(--notch-faint);
  box-shadow: inset 0 0 0 1px var(--notch-muted-foreground);
}
.notch-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Keep the alt text from drawing inside the dot while the image is missing. */
  color: transparent;
  font-size: 0;
}
.notch-avatar img[hidden] { display: none; }

.notch-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--notch-muted-foreground);
  white-space: nowrap;
}
.notch-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%; /* ui-lint-disable-line radius */
  background: var(--notch-online);
}
.notch[data-status="thinking"] .notch-status-dot { animation: pulse 1.2s ease-in-out infinite; }
.notch[data-status="unread"] .notch-status-dot,
.notch[data-status="approval"] .notch-status-dot { background: var(--notch-attention); }
.notch[data-status="unread"] .notch-status-text,
.notch[data-status="approval"] .notch-status-text { color: var(--notch-foreground); }

@keyframes pulse {
  50% { opacity: 0.25; }
}

.notch-peek {
  position: absolute;
  top: var(--notch-closed-h);
  left: var(--space-4);
  right: var(--space-4);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--notch-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 200ms ease;
}
.notch[data-state="peek"] .notch-peek { opacity: 1; transition-delay: 120ms; }

.notch-panel {
  position: absolute;
  top: var(--notch-closed-h);
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  padding: var(--space-3) var(--space-4) var(--space-4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 160ms ease, visibility 0s linear 160ms;
}
.notch[data-state="open"] .notch-panel {
  opacity: 1;
  visibility: visible;
  transition: opacity 240ms ease 140ms, visibility 0s;
}

.notch-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--space-3);
  overflow: hidden;
  font-size: var(--text-sm);
  line-height: 1.6;
}

.msg { display: block; }
.msg-you {
  align-self: flex-end;
  max-width: 80%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-bubble);
  background: var(--notch-raised);
}
.msg-muse {
  max-width: 92%;
  color: var(--notch-foreground);
}
.msg-source {
  margin-bottom: calc(var(--space-2) * -1);
  font-size: var(--text-sm);
  color: var(--notch-muted-foreground);
}

.notch-input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--notch-faint);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  color: var(--notch-muted-foreground);
}
.notch-input kbd { border-color: var(--notch-faint); }

/* ---------- Page ---------- */

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 var(--space-6);
}
.wordmark {
  font-weight: 600;
  text-decoration: none;
}
.topnav {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  font-size: var(--text-sm);
}
.topnav a { text-decoration: none; }
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--muted-foreground);
}
.lang-option {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted-foreground);
  font: inherit;
  cursor: pointer;
}
.lang-option:hover { color: var(--foreground); }
.lang-option[aria-pressed="true"] {
  color: var(--foreground);
  font-weight: 600;
}

main {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.hero {
  padding: 160px 0 var(--space-24);
}
.eyebrow {
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  color: var(--muted-foreground);
}
h1 {
  margin: 0;
  font-size: var(--text-display);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
}
/* Keeps a Japanese phrase on one line, so headings wrap between phrases. */
.phrase { display: inline-block; }
.lead {
  max-width: 600px;
  margin: var(--space-6) 0 0;
  font-size: var(--text-lg);
  color: var(--foreground);
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-8);
}
.button {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 var(--space-6);
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  font-weight: 500;
  text-decoration: none;
}
.button-primary {
  background: var(--primary);
  color: var(--primary-foreground);
}
.button-primary:hover { color: var(--primary-foreground); opacity: 0.88; }
.button-secondary {
  border: 1px solid var(--border);
  color: var(--foreground);
}
.button-secondary:hover { background: var(--muted); color: var(--foreground); }

.disclaimer {
  max-width: 600px;
  margin: var(--space-8) 0 0;
  padding-left: var(--space-3);
  border-left: 2px solid var(--border);
  font-size: var(--text-sm);
  color: var(--muted-foreground);
}
.hint {
  margin: var(--space-6) 0 0;
  font-size: var(--text-sm);
  color: var(--muted-foreground);
}
.hint-touch { display: none; }
@media (hover: none) {
  .hint-hover { display: none; }
  .hint-touch { display: inline; }
}

section + section { border-top: 1px solid var(--border); }

.section-title {
  margin: 0;
  font-size: var(--text-2xl);
  line-height: 1.4;
  font-weight: 600;
}
.section-lead {
  max-width: 680px;
  margin: var(--space-4) 0 0;
  color: var(--muted-foreground);
}

.features { padding: var(--space-16) 0; }
.features .section-title { margin-bottom: var(--space-8); }

.feature {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: var(--space-6);
  padding: var(--space-8) 0;
  border-top: 1px solid var(--border);
  /* Tall enough that each one gets its turn driving the notch while scrolling. */
  min-height: 30vh;
}
.feature-index {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
  line-height: 2;
}
.feature h3 {
  margin: 0;
  font-size: var(--text-xl);
  line-height: 1.5;
  font-weight: 600;
}
.feature p:not(.feature-index) {
  max-width: 600px;
  margin: var(--space-3) 0 0;
  color: var(--muted-foreground);
}
.feature.is-active .feature-index { color: var(--foreground); }
@media (min-width: 721px) {
  .js .feature h3 { color: var(--muted-foreground); transition: color 200ms ease; }
  .js .feature.is-active h3 { color: var(--foreground); }
}

.build { padding: var(--space-16) 0; }
.build-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-12);
  margin-top: var(--space-12);
}
.build-col { min-width: 0; }
.build-col h3 {
  margin: 0 0 var(--space-4);
  font-size: var(--text-lg);
  font-weight: 600;
}
.plain-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.plain-list li {
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
}
.plain-list li:last-child { border-bottom: 1px solid var(--border); }

.code {
  margin: 0;
  padding: var(--space-4);
  overflow-x: auto;
  border-radius: var(--radius-lg);
  background: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.7;
}
.code code { font-size: inherit; }
.note {
  margin: var(--space-4) 0 0;
  font-size: var(--text-sm);
  color: var(--muted-foreground);
}
.note a { color: var(--foreground); }

.terms { padding: var(--space-16) 0; }
.terms-list { margin: var(--space-8) 0 0; }
.terms-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: var(--space-6);
  padding: var(--space-6) 0;
  border-top: 1px solid var(--border);
}
.terms-row dt { font-weight: 600; }
.terms-row dd {
  margin: 0;
  max-width: 680px;
  color: var(--muted-foreground);
}
.terms-row dd a { color: var(--foreground); }

.footer {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-12);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--muted-foreground);
}
.footer p { margin: 0; }
.footer-note { margin-top: var(--space-2) !important; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  margin-top: var(--space-4) !important;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 720px) {
  :root {
    --text-display: 32px;
    --notch-closed-w: 240px;
    --notch-closed-h: 34px;
    --notch-peek-h: 64px;
    --notch-open-h: 360px;
  }
  /* Below the notch, so the wordmark and language switch stay clear of it, even while it peeks. */
  .topbar {
    top: var(--notch-peek-h);
    height: 48px;
    padding: 0 var(--space-4);
  }
  main { padding: 0 var(--space-4); }
  .hero { padding: 144px 0 var(--space-16); }
  .lead { font-size: var(--text-base); }
  .feature { grid-template-columns: 1fr; gap: var(--space-2); min-height: 0; }
  .build-grid { grid-template-columns: 1fr; gap: var(--space-8); }
  .terms-row { grid-template-columns: 1fr; gap: var(--space-2); }
  .footer { padding-left: var(--space-4); padding-right: var(--space-4); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .notch,
  .notch-peek,
  .notch-panel { transition: none; }
  .notch-status-dot { animation: none !important; }
}
