/* Coding Buddy — official site v3
   Clean white developer-tool style: white background, neutral grays,
   single accent, card-based. Replaces the warm-orange v2 theme. */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-sunken: #f0f2f5;
  --card: #ffffff;
  --border: #e6e8ec;
  --border-strong: #d4d8de;
  --ink: #14171a;
  --ink-2: #3d434b;
  --muted: #6b727c;
  --muted-2: #9aa1ab;
  --accent: #2f6df6;
  --accent-soft: #eaf1ff;
  --accent-ink: #1b4fd1;
  --ok: #16a34a;
  --ok-soft: #e7f6ec;
  --warn: #d97706;
  --warn-soft: #fdf0dd;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(20, 23, 26, 0.05), 0 1px 3px rgba(20, 23, 26, 0.04);
  --shadow-md: 0 4px 16px rgba(20, 23, 26, 0.07), 0 1px 4px rgba(20, 23, 26, 0.05);
  --maxw: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body { overflow-x: hidden; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* height:auto so a width constraint never distorts an image's aspect ratio
   (the width/height HTML attributes would otherwise fix the height). */
img { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration: none; }

h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }

p { margin: 0; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand img { width: 30px; height: 30px; }
.nav { display: flex; align-items: center; gap: 22px; }
.nav a { color: var(--muted); font-size: 14px; font-weight: 500; transition: color 0.15s; }
.nav a:hover { color: var(--ink); }
.nav .lang-toggle {
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.nav .lang-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
}
.button:active { transform: translateY(1px); }
.button.primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.button.primary:hover { background: var(--accent-ink); }
.button.secondary { background: var(--card); color: var(--ink); border-color: var(--border-strong); }
.button.secondary:hover { border-color: var(--accent); color: var(--accent); }
.button .ic { width: 18px; height: 18px; }

/* ---------- Section scaffolding ---------- */
.section { padding: 84px 0; }
.section.alt { background: var(--bg-soft); }
.section-head { max-width: 680px; margin: 0 auto 48px; text-align: center; }
.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.section-head h2 { font-size: clamp(26px, 3.4vw, 36px); }
.section-head p { margin-top: 14px; color: var(--muted); font-size: 16px; }

/* ---------- Hero + video ---------- */
.hero { padding: 56px 0 72px; text-align: center; }
.hero h1 {
  font-size: clamp(30px, 5vw, 50px);
  font-weight: 800;
  letter-spacing: -0.02em;
  max-width: 16em;
  margin: 0 auto;
}
.hero .lead {
  margin: 18px auto 0;
  max-width: 40em;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 19px);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 28px; }
.hero-note { margin-top: 14px; font-size: 13px; color: var(--muted-2); }

.video-frame {
  margin: 44px auto 0;
  max-width: 960px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: #000;
  aspect-ratio: 16 / 9;
}
.video-frame video { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Feature cards (core) ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0; /* allow shrink below content width (PC shots are 1003px wide) */
}
/* Grid/flex children must be allowed to shrink, or a wide screenshot's
   intrinsic width forces the whole page wider than the viewport. */
.split-copy, .split-media, .showcase-item, .phone-row .item, .card .shot { min-width: 0; }
.card .tag {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
}
.card h3 { font-size: 19px; }
.card p { color: var(--muted); font-size: 15px; }
/* Uniform preview frame: every card's screenshot sits in the SAME-size 4:3 box.
   Landscape PC shots fill the frame; portrait iOS shots render smaller and
   centered as a phone (rounded + shadow), so mixed orientations stay balanced
   instead of leaving a tall narrow image with big empty gutters. */
.card .shot {
  margin-top: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(155deg, #f4f6f9, #e8ecf1);
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}
.card .shot img {
  object-fit: contain;
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}
/* iOS: scale down to a centered phone with a device-like rounded frame. */
.card .shot.phone img {
  max-height: 90%;
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(20, 23, 26, 0.18);
}

/* ---------- Split rows (image + text) ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
.split.reverse .split-media { order: 2; }
.split-copy h2 { font-size: clamp(24px, 3vw, 32px); }
.split-copy .eyebrow { text-align: left; }
.split-copy p { margin-top: 14px; color: var(--muted); font-size: 16px; }
.split-copy ul { margin: 18px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.split-copy li { position: relative; padding-left: 26px; color: var(--ink-2); font-size: 15px; }
.split-copy li::before {
  content: "";
  position: absolute;
  left: 0; top: 8px;
  width: 14px; height: 14px;
  border-radius: 4px;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* ---------- Device frames ---------- */
.phone-shot {
  margin: 0 auto;
  max-width: 320px;
  border: 1px solid var(--border-strong);
  border-radius: 30px;
  padding: 8px;
  background: var(--card);
  box-shadow: var(--shadow-md);
}
.phone-shot img { width: 100%; border-radius: 22px; }
.desk-shot {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: var(--card);
}

/* gallery of phone shots */
.phone-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.phone-row .item.wide { grid-column: span 2; }
.phone-row .item { text-align: center; }
.phone-row .item figcaption { margin-top: 12px; font-size: 14px; color: var(--muted); }
.phone-row .item h4 { margin: 0 0 4px; font-size: 15px; }

/* ---------- Status showcase (light, four touchpoints) ---------- */
.showcase-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; }
.showcase-item { text-align: center; }
/* Uniform-height stage so the four touchpoints align even though their shots
   differ (wide island banner, widget, tall phone, landscape StandBy). */
.showcase-stage {
  height: 270px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
}
.showcase-stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(20, 23, 26, 0.16);
}
.showcase-item h3 { margin-top: 18px; font-size: 16px; color: var(--ink); }
.showcase-item p { margin-top: 6px; font-size: 13px; color: var(--muted); }

/* ---------- Tool wall ---------- */
.tool-wall {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.tool-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
}

/* ---------- Platform ---------- */
.platform-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.platform-grid article {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-sm);
}
.platform-grid h3 { font-size: 18px; margin-bottom: 8px; }
.platform-grid p { color: var(--muted); font-size: 15px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: var(--bg-soft);
}
.site-footer a { color: var(--muted); text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; gap: 32px; }
  .split.reverse .split-media { order: 0; }
  .cards { grid-template-columns: 1fr; }
  .showcase-grid { grid-template-columns: repeat(3, 1fr); }
  .tool-wall { grid-template-columns: repeat(3, 1fr); }
  .phone-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .section { padding: 60px 0; }
  .nav { gap: 14px; }
  .nav a:not(.lang-toggle) { display: none; }
  .tool-wall { grid-template-columns: repeat(2, 1fr); }
  .phone-row { grid-template-columns: 1fr; }
  .phone-row .item.wide { grid-column: auto; }
  .showcase-grid { grid-template-columns: 1fr; }
  .showcase-stage { height: 260px; }
}

/* ---------- Legal / document pages (terms, privacy) ---------- */
.legal { max-width: 760px; margin: 0 auto; padding: 52px 24px 80px; }
.legal h1 { font-size: clamp(28px, 4vw, 38px); font-weight: 800; letter-spacing: -0.02em; }
.legal .updated { margin: 12px 0 32px; color: var(--muted); font-size: 14px; }
.legal h2 { font-size: 20px; font-weight: 700; margin: 36px 0 12px; color: var(--ink); }
.legal p { margin: 12px 0; color: var(--ink-2); }
.legal ul { margin: 12px 0; padding-left: 22px; }
.legal li { margin: 6px 0; color: var(--ink-2); }
.legal strong { color: var(--ink); font-weight: 600; }
.legal a { color: var(--accent); }
.legal a:hover { color: var(--accent-ink); }
.legal .back {
  display: inline-block;
  margin-top: 44px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.legal .back:hover { color: var(--accent); }
.legal h3 { font-size: 16px; font-weight: 700; margin: 22px 0 8px; color: var(--ink); }
.legal table { width: 100%; border-collapse: collapse; margin: 14px 0 20px; font-size: 14px; }
.legal th, .legal td {
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--border);
  vertical-align: top;
  color: var(--ink-2);
}
.legal th { background: var(--bg-soft); color: var(--ink); font-weight: 700; white-space: nowrap; }
@media (max-width: 560px) {
  .legal th, .legal td { white-space: normal; }
}

/* ---------- Lightbox (click screenshots to enlarge) ---------- */
.zoomable { cursor: zoom-in; transition: transform 0.12s ease; }
.zoomable:hover { transform: scale(1.015); }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 4vmin;
  background: rgba(10, 12, 15, 0.9);
  backdrop-filter: blur(4px);
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 94vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.6);
}
.lightbox .close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.lightbox .close:hover { background: rgba(255, 255, 255, 0.28); }

/* language visibility handled by [lang] on <html> + JS textContent swap;
   elements that are language-specific use .i18n-hide fallback */
[hidden] { display: none !important; }
