/* โคนยางคลับ ฝนพยากรณ์ — landing page
   Palette derived from the app (packages/mobile/constants/colors.ts). */

:root {
  --ground:      #F4F7F1;
  --surface:     #FFFFFF;
  --surface-2:   #F0F4EC;
  --ink:         #16241B;
  --muted:       #57685B;
  --line:        #E2E9DC;
  --primary:     #16A34A;
  --primary-ink: #0A6B32;
  --line-brand:  #06C755;
  --shadow:      0 1px 2px rgba(16,36,24,.06), 0 12px 28px -18px rgba(16,36,24,.25);
  --radius:      16px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground:      #0B1E0E;
    --surface:     #122A16;
    --surface-2:   #0F2412;
    --ink:         #E8F5E9;
    --muted:       #8FB89A;
    --line:        #24502B;
    --primary:     #22C55E;
    --primary-ink: #7EE7A6;
    --line-brand:  #06C755;
    --shadow:      0 1px 2px rgba(0,0,0,.4), 0 16px 34px -20px rgba(0,0,0,.6);
  }
}

:root[data-theme="dark"] {
  --ground:      #0B1E0E;
  --surface:     #122A16;
  --surface-2:   #0F2412;
  --ink:         #E8F5E9;
  --muted:       #8FB89A;
  --line:        #24502B;
  --primary:     #22C55E;
  --primary-ink: #7EE7A6;
  --line-brand:  #06C755;
  --shadow:      0 1px 2px rgba(0,0,0,.4), 0 16px 34px -20px rgba(0,0,0,.6);
}

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

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "IBM Plex Sans Thai", "IBM Plex Sans", -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-ink); }
img { max-width: 100%; display: block; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── top bar ─────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 880px;
  margin: 0 auto;
  padding: 16px 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
}
.brand img { border-radius: 7px; border: 1px solid var(--line); background: #fff; }
.topbar-admin {
  font: 500 13px/1 "IBM Plex Mono", ui-monospace, monospace;
  color: var(--muted);
  text-decoration: none;
}
.topbar-admin:hover { color: var(--ink); }

/* ── layout ──────────────────────────────────────────────────── */
main {
  max-width: 880px;
  margin: 0 auto;
  padding: 12px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

/* ── app header card ─────────────────────────────────────────── */
.appcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  grid-template-columns: 88px 1fr;
  grid-template-areas:
    "icon body"
    "cta  cta";
  column-gap: 20px;
  row-gap: 22px;
  align-items: start;
}
.appicon {
  grid-area: icon;
  width: 88px;
  height: 88px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #fff;
  object-fit: cover;
}
.appcard-body { grid-area: body; min-width: 0; }
.cta { grid-area: cta; }

.appcard h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.developer {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--primary-ink);
  font-weight: 500;
}
.developer a { text-decoration: none; }
.developer a:hover { text-decoration: underline; }
.tagline {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  max-width: 46ch;
}

.metachips {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
}
.metachips li {
  font: 500 11.5px/1 "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: .04em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  white-space: nowrap;
}

/* CTA */
.btn-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  max-width: 320px;
  background: var(--line-brand);
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  padding: 14px 20px;
  border-radius: 12px;
  transition: filter .15s ease;
}
.btn-line:hover { filter: brightness(1.06); }
.btn-line svg { flex: none; }

.stores {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.store {
  font: 500 12px/1.4 "IBM Plex Sans", "IBM Plex Sans Thai", sans-serif;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 9px 12px;
}

/* ── screenshots ─────────────────────────────────────────────── */
.shots {
  position: relative;
  margin: 0 -20px;
}
.shots-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 4px 20px 14px;
  scrollbar-width: none;
}
.shots-track::-webkit-scrollbar { display: none; }
.shots-track img {
  flex: none;
  width: 208px;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  scroll-snap-align: start;
  background: #0B1E0E;
}

/* ── content blocks ──────────────────────────────────────────── */
.block h2 {
  margin: 0 0 12px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.block p {
  margin: 0 0 12px;
  max-width: 64ch;
}
.block p:last-child { margin-bottom: 0; }
.block strong { font-weight: 600; }

details {
  margin: 4px 0 0;
  max-width: 64ch;
}
details summary {
  cursor: pointer;
  color: var(--primary-ink);
  font-weight: 500;
  font-size: 14px;
  list-style: none;
  padding: 6px 0;
}
details summary::-webkit-details-marker { display: none; }
details summary::after { content: " ▾"; }
details[open] summary::after { content: " ▴"; }
details[open] summary { margin-bottom: 8px; }
details p { margin-bottom: 10px; }

/* rain-level legend */
.legend {
  margin-top: 22px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.legend-title {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}
.legend-band {
  display: flex;
  height: 14px;
  border-radius: 5px;
  overflow: hidden;
}
.legend-band span { display: block; }
.legend-keys {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
}
.legend-keys li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13.5px;
}
.legend-keys i {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  transform: translateY(1px);
}
.legend-keys span {
  margin-left: auto;
  font: 500 12px/1 "IBM Plex Mono", ui-monospace, monospace;
  color: var(--muted);
}

/* how it works */
.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  column-gap: 14px;
}
.steps li:first-child { border-top: 0; padding-top: 0; }
.steps li::before {
  content: counter(step);
  grid-column: 1;
  grid-row: 1 / -1;
  align-self: start;
  width: 26px;
  height: 26px;
  font: 500 13px/26px "IBM Plex Mono", ui-monospace, monospace;
  color: var(--primary-ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
}
.steps h3 {
  grid-column: 2;
  margin: 2px 0 3px;
  font-size: 15px;
  font-weight: 600;
}
.steps p {
  grid-column: 2;
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
}

/* data safety + info */
.safety, .info { margin: 0; }
.safety div, .info div {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 6px 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.safety div:first-child, .info div:first-child { border-top: 0; padding-top: 0; }
.safety dt, .info dt {
  font: 500 12.5px/1.5 "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: .02em;
  color: var(--muted);
}
.safety dd, .info dd { margin: 0; font-size: 14.5px; }
.info dd { font-variant-numeric: tabular-nums; }
.safety-links { margin: 16px 0 0; font-size: 13.5px; color: var(--muted); }
.safety-links a { color: var(--primary-ink); text-decoration: none; }
.safety-links a:hover { text-decoration: underline; }

/* ── legal / prose documents (privacy.html, terms.html) ──────── */
.doc {
  max-width: 720px;
  gap: 0;
  padding-bottom: 24px;
}
.doc .back {
  font: 500 13px/1 "IBM Plex Mono", ui-monospace, monospace;
  color: var(--muted);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 24px;
}
.doc .back:hover { color: var(--ink); }
.doc h1 {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  text-wrap: balance;
}
.doc .updated {
  color: var(--muted);
  font: 500 12.5px/1.5 "IBM Plex Mono", ui-monospace, monospace;
  margin: 0 0 24px;
}
.doc .draft-note {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid #EAB308;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13.5px;
  color: var(--muted);
  margin: 0 0 32px;
}
.doc h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 32px 0 10px;
  padding-top: 4px;
}
.doc h2:first-of-type { margin-top: 0; }
.doc h3 { font-size: 14.5px; font-weight: 600; margin: 18px 0 6px; }
.doc p { margin: 0 0 12px; }
.doc ul, .doc ol { margin: 0 0 12px; padding-left: 22px; }
.doc li { margin: 0 0 6px; }
.doc li::marker { color: var(--muted); }
.doc strong { font-weight: 600; }
.doc .contact {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  margin-top: 8px;
}
.doc .contact p { margin: 0 0 4px; }

/* ── footer ──────────────────────────────────────────────────── */
footer {
  max-width: 880px;
  margin: 48px auto 0;
  padding: 24px 20px 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}
footer p { margin: 0 0 4px; }
footer a { color: var(--muted); text-decoration: underline; }
footer a:hover { color: var(--ink); }
.copyline {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.copyline a { text-decoration: none; }
.copyline a:hover { text-decoration: underline; }

/* ── responsive ──────────────────────────────────────────────── */
@media (max-width: 560px) {
  .appcard {
    grid-template-columns: 64px 1fr;
    grid-template-areas:
      "icon body"
      "cta  cta";
    padding: 20px;
  }
  .appicon { width: 64px; height: 64px; border-radius: 15px; }
  .appcard h1 { font-size: 22px; }
  .btn-line { max-width: none; }
  .steps li, .safety div, .info div { display: block; }
  .steps li::before {
    display: inline-block;
    margin-bottom: 8px;
  }
  .safety dt, .info dt { color: var(--muted); }
  .legend-keys span { margin-left: 0; }
  .legend-keys li { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
