/* FirstPulse — www.firstpulse.org
   Brand: deep blue (#0d6efd) → emerald (#10b981). */

:root {
  --blue: #0d6efd;
  --blue-dark: #0a4f9e;
  --blue-deep: #0b1220;
  --green: #10b981;
  --cyan: #2dd4bf;
  --ink: #0f172a;
  --muted: #55637a;
  --line: #e2e8f0;
  --surface: #ffffff;
  --tint: #f4f8fc;
  --radius: 18px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 6px 18px rgba(15, 23, 42, .05);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, .14);
  --font-en: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-th: "Sarabun", "Kanit", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-en);
  color: var(--ink);
  background: var(--surface);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body.lang-th { font-family: var(--font-th); }

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

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

h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 4.4vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 2.8vw, 2.2rem); font-weight: 700; }
h3 { font-size: 1.12rem; font-weight: 700; }
p { margin: 0 0 1em; }

.wrap { width: min(1160px, 100% - 2.5rem); margin-inline: auto; }
.wrap.narrow { width: min(860px, 100% - 2.5rem); }

.grad-text {
  background: linear-gradient(90deg, var(--blue), var(--cyan) 55%, var(--green));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .6rem 0;
}

.brand { display: flex; align-items: center; gap: .65rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 11px; box-shadow: var(--shadow-sm); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 800; font-size: 1.16rem; letter-spacing: -.02em; }
.brand-sub { font-size: .74rem; color: var(--muted); }

.site-nav { display: flex; align-items: center; gap: .35rem; }
.nav-link {
  padding: .5rem .85rem;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  font-size: .95rem;
  white-space: nowrap;
}
.nav-link:hover { background: var(--tint); color: var(--ink); text-decoration: none; }
.nav-link.active {
  color: var(--blue);
  background: rgba(13, 110, 253, .09);
}
body.lang-th .nav-link { font-family: var(--font-th); }

/* language toggle */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-left: .35rem;
  padding: .5rem .9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 700;
  font-size: .9rem;
  white-space: nowrap;
}
.lang-toggle:hover {
  background: var(--tint);
  color: var(--ink);
  text-decoration: none;
  border-color: #cdd8e6;
}
.lang-globe { font-size: .95rem; line-height: 1; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .72rem 1.35rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .18s ease, background .18s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-lg { padding: .9rem 1.75rem; font-size: 1.02rem; }

.btn-primary {
  background: linear-gradient(90deg, var(--blue-dark), var(--blue) 55%, var(--green));
  color: #fff;
  box-shadow: 0 8px 22px rgba(13, 110, 253, .28);
}
.btn-primary:hover { box-shadow: 0 12px 30px rgba(13, 110, 253, .36); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--tint); }

/* ---------- hero ---------- */

.hero, .origin-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(13, 110, 253, .16), transparent 60%),
    radial-gradient(1000px 520px at 88% 0%, rgba(16, 185, 129, .16), transparent 62%),
    linear-gradient(180deg, #f7fbff, #ffffff 72%);
}
.hero-bg {
  position: absolute;
  right: -8%;
  top: -18%;
  width: min(680px, 70%);
  opacity: .16;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.02fr 1fr;
  align-items: center;
  gap: 2.5rem;
  padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(2rem, 5vw, 4rem);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .38rem .85rem;
  border-radius: 999px;
  background: rgba(13, 110, 253, .09);
  color: var(--blue-dark);
  font-size: .82rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.eyebrow .dot {
  width: .5rem; height: .5rem; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, .18);
}

.hero h1 { margin-bottom: .6rem; }
.hero .lead { font-size: 1.09rem; color: var(--muted); max-width: 40ch; }
.hero .lead strong { color: var(--ink); }

.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.4rem 0 1.2rem; }

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.25rem;
  margin: 0; padding: 0; list-style: none;
  font-size: .88rem; color: var(--muted); font-weight: 600;
}
.hero-points li { display: flex; align-items: center; gap: .45rem; }
.hero-points li::before {
  content: ""; width: .42rem; height: .42rem; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--green));
}

/* ---------- pen showcase (iPad + Apple Pencil) ---------- */

.pen-showcase {
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.pen-showcase-inner {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3.5rem);
}
.pen-copy h2 { margin-bottom: .6rem; }
.pen-lead { color: var(--muted); font-size: 1.02rem; margin-bottom: 1.1rem; max-width: 46ch; }
.pen-art { position: relative; }
.pen-art img { width: 100%; filter: drop-shadow(0 24px 44px rgba(13, 110, 253, .16)); }

@media (max-width: 860px) {
  .pen-showcase-inner { grid-template-columns: 1fr; }
  .pen-art { order: -1; }
}

/* ---------- sections ---------- */

.section { padding: clamp(2.8rem, 6vw, 4.8rem) 0; }
.section-tint { background: var(--tint); }

.section-head { max-width: 640px; margin-bottom: 2.2rem; }
.section-head p { color: var(--muted); margin: 0; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.15rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.4rem;
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card h3 { margin-bottom: .35rem; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }

.card-icon {
  display: inline-grid;
  place-items: center;
  width: 46px; height: 46px;
  border-radius: 13px;
  margin-bottom: .9rem;
  background: linear-gradient(135deg, rgba(13, 110, 253, .13), rgba(16, 185, 129, .15));
  color: var(--blue-dark);
}
.card-icon svg { width: 24px; height: 24px; }

/* ---------- student journey steps ---------- */

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.15rem;
  counter-reset: step;
}

.step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.6rem 1.4rem 1.4rem;
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .2s ease;
}
.step:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.step-no {
  position: absolute;
  top: -0.85rem; left: 1.3rem;
  width: 2rem; height: 2rem;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-dark), var(--green));
  color: #fff;
  font-weight: 800;
  font-size: .9rem;
  box-shadow: 0 6px 16px rgba(13, 110, 253, .3);
}

.step-icon {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  margin-bottom: .8rem;
  background: linear-gradient(135deg, rgba(13, 110, 253, .13), rgba(16, 185, 129, .15));
  color: var(--blue-dark);
}
.step-icon svg { width: 22px; height: 22px; }

.step h3 { margin-bottom: .3rem; font-size: 1.06rem; }
.step p { margin: 0; color: var(--muted); font-size: .93rem; }

/* ---------- downloads (compact hero panel) ---------- */

.dl-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.35rem 1.4rem;
}
.dl-title { font-size: 1.2rem; margin-bottom: .2rem; }
.dl-lead { color: var(--muted); font-size: .84rem; margin-bottom: .9rem; }

.dl-list { display: grid; gap: .5rem; }
.dl-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: .7rem;
  padding: .55rem .8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.dl-info { display: flex; flex-direction: column; min-width: 0; }
.dl-platform { font-weight: 700; font-size: .95rem; display: flex; align-items: center; gap: .45rem; }
.dl-note { color: var(--muted); font-size: .78rem; line-height: 1.35; }
.dl-side { display: flex; align-items: center; gap: .6rem; flex: none; }
.size { color: var(--muted); font-size: .8rem; font-weight: 600; }
.platform-icon { width: 16px; height: 16px; color: var(--muted); }

/* wireframe placeholder row (platform not published yet) */
.dl-row.is-soon {
  background: repeating-linear-gradient(135deg, #fbfdff 0 10px, #f4f8fd 10px 20px);
  border-style: dashed;
  border-color: #c3d2e6;
}
.dl-row.is-soon .dl-platform,
.dl-row.is-soon .dl-note { color: #6b7d94; }

.dl-fineprint { color: var(--muted); font-size: .72rem; line-height: 1.45; margin: .8rem 0 0; }
.dl-fineprint + .dl-fineprint { margin-top: .3rem; }

.soon-tag {
  padding: .12rem .5rem;
  border-radius: 999px;
  border: 1px dashed #9fb4cf;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: #6b7d94;
}

.btn-sm { padding: .42rem .85rem; font-size: .82rem; }

.fineprint { color: var(--muted); font-size: .88rem; margin-top: 1.4rem; }

.cta-band {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 2rem;
  padding: clamp(1.6rem, 4vw, 2.6rem);
  border-radius: 26px;
  background: linear-gradient(120deg, #0b1220, #0c2f63 52%, #0a6b52);
  color: #fff;
  box-shadow: var(--shadow-lg);
}
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255, 255, 255, .78); margin-bottom: 1rem; max-width: 54ch; }
.cta-band img {
  width: min(200px, 32vw);
  max-height: 300px;
  object-fit: cover;
  object-position: top;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
}
.cta-band .btn-primary { background: #fff; color: var(--blue-dark); box-shadow: none; }

/* ---------- origin ---------- */

.origin-hero { padding: clamp(1rem, 2.2vw, 1.6rem) 0 clamp(.6rem, 1.4vw, 1rem); }
.origin-hero h1 { margin-bottom: .2rem; }
.origin-hero .lead { color: var(--muted); max-width: 52ch; margin: 0; }
.lang-th-inline { font-family: var(--font-th); font-weight: 700; }

/* page-scoped compaction: trim vertical rhythm so the page stays dense */
.page-origin .origin-hero .eyebrow { font-size: .74rem; padding: .3rem .7rem; margin-bottom: .6rem; }
.page-origin .origin-hero h1 { font-size: clamp(1.5rem, 2.6vw, 2.05rem); }
.page-origin .origin-hero .lead { font-size: .95rem; }
.page-origin .origin-body { padding: clamp(.8rem, 1.8vw, 1.2rem) 0 clamp(1.5rem, 3vw, 2.2rem); }

.banner {
  display: flex; gap: .85rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid rgba(13, 110, 253, .22);
  background: linear-gradient(120deg, rgba(13, 110, 253, .07), rgba(16, 185, 129, .08));
}
.banner-icon {
  flex: none;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: #fff; font-size: 1rem;
}
.banner h2 { font-size: 1.05rem; margin-bottom: .25rem; }
.banner p { margin: 0 0 .4rem; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.banner p:last-child { margin-bottom: 0; }
.banner-warn { color: #9a5b00 !important; font-weight: 600; }

/* ---------- tabs ---------- */

.tabs { margin-top: 1rem; }
.tablist {
  display: inline-flex;
  gap: .25rem;
  padding: .28rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  margin-bottom: .8rem;
}
.tab {
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  color: var(--muted);
  padding: .5rem 1.5rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}
.tab:hover { color: var(--ink); }
.tab.is-active {
  color: #fff;
  background: linear-gradient(90deg, var(--blue-dark), var(--blue) 60%, var(--green));
}

.panel { display: none; }
.panel.is-active { display: block; animation: fade .28s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .6rem;
  margin-bottom: .7rem;
}
.panel-head h2 { margin: 0; }
.panel-head p { color: var(--muted); font-size: .96rem; }

.story {
  margin: 0;
  padding: .95rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  border-image: linear-gradient(180deg, var(--blue), var(--green)) 1;
  border-radius: 4px var(--radius) var(--radius) 4px;
  box-shadow: var(--shadow-sm);
  font-family: var(--font-th);
  font-size: .9rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}
#panel-en .story { font-family: var(--font-en); font-size: .88rem; line-height: 1.6; }

.copy-btn { margin: 0; }
.copy-btn.is-copied { background: var(--green); }

/* ---------- models ---------- */

.models-head { margin: 1.3rem 0 .8rem; }
.models { display: grid; gap: .7rem; }
.model-group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  box-shadow: var(--shadow-sm);
}
.model-group h3 { margin-bottom: .7rem; }
.model-sub { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }
.model-sub + .model-sub { margin-top: .7rem; }
.model-label {
  font-size: .78rem; font-weight: 800; letter-spacing: .02em;
  text-transform: uppercase;
  padding: .28rem .7rem; border-radius: 999px;
}
.model-label.ok { color: #06704d; background: rgba(16, 185, 129, .13); }
.model-label.part { color: #9a5b00; background: rgba(245, 158, 11, .14); }

.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.chip {
  padding: .4rem .85rem;
  border-radius: 999px;
  background: var(--tint);
  border: 1px solid var(--line);
  font-size: .9rem; font-weight: 600;
  color: var(--ink);
}

/* ---------- App Store badge ---------- */

.btn-appstore {
  background: #0b1220;
  color: #fff;
  box-shadow: 0 10px 26px rgba(11, 18, 32, .35);
  padding: .55rem 1.2rem;
}
.btn-appstore:hover { background: #1a2740; }
.btn-appstore .apple-logo { width: 26px; height: 26px; flex: none; }
.btn-appstore .appstore-text {
  display: flex; flex-direction: column; align-items: flex-start;
  line-height: 1.12; text-align: left;
}
.btn-appstore .appstore-text small {
  font-size: .62rem; font-weight: 500;
  letter-spacing: .02em; opacity: .8;
}
.btn-appstore .appstore-text strong { font-size: 1.05rem; font-weight: 700; }
.btn-appstore.btn-lg { padding: .62rem 1.4rem; }
.btn-appstore.btn-lg .apple-logo { width: 30px; height: 30px; }
.btn-appstore.btn-lg .appstore-text strong { font-size: 1.18rem; }

/* ---------- screenshot gallery ---------- */

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.15rem;
}

.shot {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
  transition: transform .16s ease, box-shadow .2s ease;
}
.shot:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; }

/* ---------- footer ---------- */

.site-footer {
  margin-top: 2rem;
  border-top: 1px solid var(--line);
  background: var(--tint);
}
.footer-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0;
}
.footer-brand { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .9rem; }
.footer-brand img { border-radius: 8px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.1rem; font-size: .9rem; font-weight: 600; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-bg { right: -20%; top: -12%; }
  .cta-band { grid-template-columns: 1fr; }
  .cta-band img { width: 170px; }
}

@media (max-width: 620px) {
  .brand-sub { display: none; }
  .nav-link { padding: .5rem .6rem; font-size: .88rem; }
  .dl-row { flex-wrap: wrap; }
  .tabs .tablist { display: flex; width: 100%; }
  .tab { flex: 1; padding: .55rem .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .card { transition: none; }
  .panel.is-active { animation: none; }
}
