/* Komai landing page styles. Amber brand, theme-aware, WCAG-tuned. */

/* --- Tokens: light (default) ------------------------------------------- */
:root {
  color-scheme: light;

  --primary:        #F49300;
  --primary-hover:  #D97E00;
  --on-primary:     #243040;
  --secondary:      #334258;

  --bg:             #FFFFFF;
  --surface:        #F5F5F5;
  --surface-2:      #ECECEC;
  --text:           #334258;
  --text-muted:     #4B5462;
  --border:         #E3E6EA;
  --link:           #A44600;

  --focus:          #F49300;
  --shadow:         0 8px 30px rgba(16, 24, 40, 0.12);
  --shadow-sm:      0 1px 3px rgba(16, 24, 40, 0.10);
  --radius:         12px;
  --radius-sm:      8px;

  --container:      1140px;
  --font-sans:      system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:      ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* --- Tokens: dark ------------------------------------------------------- */
/* Amber holds in both modes; only the surfaces flip. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --primary:        #F49300;
  --primary-hover:  #FFA722;
  --on-primary:     #061621;
  --secondary:      #A3ACB8;

  --bg:             #010409;
  --surface:        #171D25;
  --surface-2:      #1D242D;
  --text:           #F0F6FC;
  --text-muted:     #A3ACB8;
  --border:         #2A3138;
  --link:           #FFC060;

  --focus:          #F49300;
  --shadow:         0 8px 30px rgba(0, 0, 0, 0.45);
  --shadow-sm:      0 1px 3px rgba(0, 0, 0, 0.40);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;

    --primary:        #F49300;
    --primary-hover:  #FFA722;
    --on-primary:     #061621;
    --secondary:      #A3ACB8;

    --bg:             #010409;
    --surface:        #171D25;
    --surface-2:      #1D242D;
    --text:           #F0F6FC;
    --text-muted:     #A3ACB8;
    --border:         #2A3138;
    --link:           #FFC060;

    --focus:          #F49300;
    --shadow:         0 8px 30px rgba(0, 0, 0, 0.45);
    --shadow-sm:      0 1px 3px rgba(0, 0, 0, 0.40);
  }
}

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

html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; color: var(--text); }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

code, kbd {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1em 0.4em;
}

/* --- Accessibility helpers --------------------------------------------- */
.skip-link {
  position: absolute;
  top: -120%;
  left: 16px;
  z-index: 1000;
  background: var(--primary);
  color: var(--on-primary);
  padding: 0.6em 1em;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: 600;
}
.skip-link:focus { top: 0; text-decoration: none; }

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

:where(a, button, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Layout ------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.section-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin: 0 0 0.75rem;
  text-align: center;
}
.section-intro {
  text-align: center;
  color: var(--text-muted);
  margin: 0 auto 2.5rem;
}

/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  padding: 0.6em 1.15em;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn-lg { padding: 0.8em 1.5em; font-size: 1.05rem; }

.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); color: var(--on-primary); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--text-muted); }

/* --- Header / nav ------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0.7rem 24px;
}
.brand-group { display: inline-flex; align-items: center; gap: 0.6rem; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--text); font-weight: 700; }
.brand-badge {
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1em 0.7em;
  white-space: nowrap;
}
.brand-badge:hover { color: var(--text); border-color: var(--text-muted); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-logo { border-radius: 8px; }
.brand-name { font-size: 1.2rem; letter-spacing: -0.02em; }

.nav-right { display: flex; align-items: center; gap: 0.5rem 1.1rem; flex-wrap: wrap; justify-content: flex-end; }
.nav-link { color: var(--text-muted); font-weight: 500; }
.nav-link:hover { color: var(--text); text-decoration: none; }

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.theme-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  padding: 0.3em 0.8em;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.theme-btn[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.theme-btn:hover:not([aria-pressed="true"]) { color: var(--text); }

/* --- Hero --------------------------------------------------------------- */
.hero { padding: clamp(1.5rem, 3vw, 2.75rem) 0 clamp(2.5rem, 6vw, 5rem); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 3.5rem);
}
.hero-copy { max-width: 100%; margin-inline: auto; text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0 0 1rem; }
.lede { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--text-muted); margin: 0 0 1.75rem; }
.hero .lede { margin-inline: auto; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.25rem; justify-content: center; }
.hero-meta { color: var(--text-muted); margin: 0; }

/* --- Screenshots (single-theme; no light/dark swap) --------------------- */
/* Break the shot out past the text column so the dense app captures read at
   a usable size. Capped at 1200px and 94vw-bounded so no horizontal scroll. */
.shot {
  position: relative;
  left: 50%;
  width: min(94vw, 1200px);
  margin-left: calc(min(94vw, 1200px) / -2);
}
.shot img {
  display: block;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
/* Thin UI-strip captures (tab bar, selection toolbar) read better narrower
   and left-aligned than blown to full breakout width. */
.shot-strip { width: min(94vw, 900px); margin-left: calc(min(94vw, 900px) / -2); }

/* --- Why native (three text blocks) ------------------------------------ */
.why { padding: clamp(2.5rem, 6vw, 4.5rem) 0; background: var(--surface); border-block: 1px solid var(--border); }
.why-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}
.why-item h3 { font-size: 1.15rem; margin: 0 0 0.5rem; }
.why-item p { color: var(--text-muted); margin: 0; font-size: 1rem; }
.why-item p + p { margin-top: 0.9rem; }

/* --- Showcase rows (screenshot-paired features) ------------------------- */
.showcase { padding: clamp(2rem, 5vw, 4rem) 0; }
.showcase-alt { background: var(--surface); border-block: 1px solid var(--border); }
.showcase-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.75rem, 4vw, 2.75rem);
}
.showcase-copy { max-width: 760px; margin-inline: auto; text-align: center; }
.showcase-copy h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin: 0 0 1rem; }
.showcase-copy p { color: var(--text-muted); margin: 0; font-size: 1.08rem; }
.showcase-copy p + p { margin-top: 0.9rem; }
.showcase-copy .callout { display: inline-block; margin-top: 0.9rem; color: var(--text); }

/* --- Compact feature grid (text only) ---------------------------------- */
.features { padding: clamp(2.5rem, 6vw, 5rem) 0; }
.feature-grid {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem 1.75rem;
}
.feature-card h3 { font-size: 1.05rem; margin: 0 0 0.35rem; }
.feature-card p { color: var(--text-muted); margin: 0; }

/* --- Download matrix ---------------------------------------------------- */
.download { padding: clamp(2.5rem, 6vw, 5rem) 0; background: var(--surface); border-top: 1px solid var(--border); }
.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.25rem;
}
.platform-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.platform-head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.platform-head h3 { font-size: 1.2rem; margin: 0; }
.platform-arch { color: var(--text-muted); }
.platform-formats { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.35rem; }
.platform-formats li { color: var(--text-muted); }
.platform-formats strong { color: var(--text); font-weight: 600; }

/* Install caveats: visible per-platform, never fine print. */
.platform-note {
  color: var(--text-muted);
  background: color-mix(in srgb, var(--primary) 9%, var(--surface));
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  margin: 0;
}
.platform-note strong { color: var(--text); }
.platform-note + .platform-note { margin-top: -0.3rem; }
.platform-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: auto; }
.platform-actions .btn { flex: 1 1 auto; }
.download-escape { text-align: center; margin: 2.25rem 0 0; color: var(--text-muted); }

/* --- Made by etke.cc (soft trust section) ------------------------------- */
.trust { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.trust-inner { margin: 0 auto; text-align: center; }
.trust-logo { border-radius: var(--radius-sm); margin-bottom: 1rem; }
.trust h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0 0 1rem; }
.trust p { color: var(--text-muted); font-size: 1.08rem; margin: 0 0 1.25rem; }
.trust-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; margin-top: 1.75rem; }

/* --- Footer ------------------------------------------------------------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 2.5rem 0; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem; justify-content: space-between; }
.footer-brand { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 700; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 1rem 1.25rem; }
.footer-nav a { color: var(--text-muted); }
.footer-nav a:hover { color: var(--text); }
.footer-legal { width: 100%; margin: 0; color: var(--text-muted); }

/* --- Error page --------------------------------------------------------- */
.error {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 0;
}
.error-code { font-size: clamp(4rem, 14vw, 7rem); line-height: 1; margin: 0; color: var(--primary); }
.error h1 { font-size: clamp(1.5rem, 4vw, 2rem); margin: 0.5rem 0 1rem; }
.error p { color: var(--text-muted); font-size: 1.1rem; margin: 0 0 1.75rem; }
.error-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; }

/* --- Wider layout: side-by-side showcase rows -------------------------- */
@media (min-width: 861px) {
  .showcase-row { grid-template-columns: 1fr 1fr; align-items: center; }
  .showcase-copy { text-align: left; margin-inline: 0; }
  .showcase-row.reverse .showcase-copy { order: 2; }
  /* In-column shots don't break out of the grid cell. */
  .showcase-row .shot,
  .showcase-row .shot-strip {
    position: static; left: auto; width: 100%; margin-left: 0;
  }
}

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 860px) {
  .nav-cta { display: none; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .nav-link { display: none; }
  .brand-badge { display: none; }
  .nav { flex-wrap: wrap; }
}

/* --- Motion / contrast preferences ------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .btn, .feature-card, .platform-card, .shot img, .theme-toggle { border: 1px solid CanvasText; }
  .theme-btn[aria-pressed="true"] { background: Highlight; color: HighlightText; }
  .platform-note { border-left-color: CanvasText; }
  :where(a, button, [tabindex]):focus-visible { outline: 3px solid Highlight; }
}
