/*
  iGo landing page.
  Palette is drawn from sơn mài (Vietnamese lacquerware): warm paper and
  ink-black grounds, a lacquer-red accent, and a brass-gold trim used only
  for small decorative details.
*/

:root {
  --bg: #f7f3ec;
  --bg-soft: #f1ebe0;
  --surface: #ffffff;
  --fg: #201b16;
  --muted: #6b6155;
  --border: #e6dccb;
  --accent: #a3271f;
  --accent-fg: #fff8f4;
  --accent-soft: #f3e1dc;
  --gold: #a97a2e;
  --shadow: 0 1px 2px rgba(32, 27, 22, 0.04), 0 8px 24px rgba(32, 27, 22, 0.06);
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    Roboto, Helvetica, Arial, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo,
    Consolas, monospace;
}

/* Tối theo hệ điều hành — trừ khi người dùng ép Sáng.
   LƯU Ý: 11 biến dưới đây lặp lại ở khối :root[data-theme="dark"] ngay bên dưới
   (CSS không có mixin, dự án không có build step) — SỬA CẢ HAI khi đổi màu. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1512;
    --bg-soft: #221b16;
    --surface: #241d18;
    --fg: #f3ece1;
    --muted: #b0a496;
    --border: #3a2f26;
    --accent: #e2564a;
    --accent-fg: #201008;
    --accent-soft: #3a1f1a;
    --gold: #d9a94f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

/* Người dùng ép Tối, bất kể hệ điều hành (bản sao của khối trên) */
:root[data-theme="dark"] {
  --bg: #1a1512;
  --bg-soft: #221b16;
  --surface: #241d18;
  --fg: #f3ece1;
  --muted: #b0a496;
  --border: #3a2f26;
  --accent: #e2564a;
  --accent-fg: #201008;
  --accent-soft: #3a1f1a;
  --gold: #d9a94f;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

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

/* ---------- layout shell ---------- */

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 24px 8px;
}

.brand {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--accent);
}

.nav-right {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
}

.link-ghost {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.link-ghost:hover {
  color: var(--fg);
}

.btn-ghost {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.nav a.btn-ghost {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

main {
  overflow-x: hidden;
}

section {
  max-width: 780px;
  margin: 0 auto;
  padding: 56px 24px;
}

section h2 {
  font-size: clamp(1.5rem, 3vw, 1.875rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  text-wrap: balance;
}

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

.hero {
  max-width: 700px;
  padding-top: 48px;
  padding-bottom: 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: clamp(2.25rem, 5.5vw, 3.5rem);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
  text-wrap: balance;
}

.hero .lead {
  font-size: clamp(1.0625rem, 2vw, 1.1875rem);
  line-height: 1.65;
  color: var(--muted);
  max-width: 46ch;
  margin: 0 0 32px;
}

.cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.btn {
  display: inline-block;
  padding: 13px 24px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-fg);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.btn-ghost {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- công tắc Sáng/Tối ---------- */
/* LƯU Ý: khối này nhân bản ở style.css và guide/docs.css (mỗi trang chỉ nạp một
   file) — SỬA CẢ HAI khi đổi. */

.theme-toggle {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle svg {
  display: none;
  width: 18px;
  height: 18px;
}

/* Chưa có JS (hoặc JS tắt) → coi như Tự động */
:root:not([data-theme]) .theme-icon-auto,
:root[data-theme="auto"] .theme-icon-auto,
:root[data-theme="light"] .theme-icon-light,
:root[data-theme="dark"] .theme-icon-dark {
  display: block;
}

/* ---------- terminal demo ---------- */

/* Khung "cửa sổ" dùng chung: demo gõ thử (hero) + ảnh app (showcase) */
.demo,
.showcase-frame {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.demo {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  text-align: left;
}

.demo-bar {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}

.demo-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border);
}

.demo-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 15px;
}

.demo-pair {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.demo-label {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
}

.demo-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.demo-mark {
  width: 18px;
  flex: none;
  text-align: center;
  font-size: 13px;
}

.demo-mark--bad {
  color: var(--muted);
}

.demo-mark--good {
  color: var(--accent);
  font-weight: 700;
}

.demo-row--bad .demo-text {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--border);
}

.demo-row--good .demo-text {
  color: var(--fg);
  font-weight: 600;
}

.demo-typed {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--accent);
  width: 4.5em;
}

@media (prefers-reduced-motion: no-preference) {
  .demo-typed {
    width: 0;
    animation: type-in 1.1s 0.5s steps(8, end) forwards,
      caret-blink 0.8s steps(1, end) 1.6s 4;
  }
}

@keyframes type-in {
  from {
    width: 0;
  }
  to {
    width: 4.5em;
  }
}

@keyframes caret-blink {
  50% {
    border-color: transparent;
  }
}

.demo-caption {
  max-width: 420px;
  margin: 16px auto 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- why ---------- */

.why p {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--muted);
  max-width: 62ch;
}

/* ---------- features ---------- */

.feature-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
  margin: 0 0 16px;
}

.feature-icon svg {
  width: 24px;
  height: 24px;
}

.feature-card h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -0.005em;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* ---------- showcase ---------- */
.showcase {
  text-align: center;
}

/* Nền/viền/bóng thừa hưởng từ khung "cửa sổ" dùng chung (xem .demo, .showcase-frame).
   Thanh 3 chấm dùng luôn .demo-bar trong markup — không nhân bản rule. */
.showcase-frame {
  margin: 24px auto 12px;
  max-width: 380px;
}

.showcase-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.showcase-caption {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 46ch;
  margin: 0 auto;
}

/* ---------- learn (teaser học gõ) ---------- */

.learn {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 32px;
}

.learn > p {
  color: var(--muted);
  max-width: 62ch;
  margin: 0 0 24px;
}

.learn-tables {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.learn-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}

.learn-col h3 {
  margin: 0 0 12px;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--accent);
}

.learn-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.learn-col li {
  font-size: 0.9375rem;
  color: var(--fg);
}

.learn-col code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ---------- install timeline ---------- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.timeline li {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 16px;
  padding-bottom: 28px;
  position: relative;
}

.timeline li:last-child {
  padding-bottom: 0;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 32px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.timeline li:last-child::before {
  display: none;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  z-index: 1;
}

.step-text {
  padding-top: 4px;
  line-height: 1.65;
}

.timeline kbd {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
}

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

footer {
  max-width: 780px;
  margin: 24px auto 48px;
  padding: 28px 24px 0;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 14px;
}

.footer-brand span {
  color: var(--fg);
  font-weight: 700;
}

.footer-brand .tagline {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 400;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links-title {
  color: var(--fg);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 2px;
}

.footer-links a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--accent);
}

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

@media (max-width: 560px) {
  .feature-grid {
    grid-template-columns: 1fr;
  }

  .nav {
    padding: 20px 20px 4px;
  }

  section {
    padding: 40px 20px;
  }

  .learn {
    padding: 32px 20px;
  }
}
