/* ============================================
   affai.upskill88.com — Tutorial Site
   LIGHT theme — easiest to read
   ============================================ */

:root {
  --bg: #faf6ed;
  --bg-elev: #f5eed8;
  --bg-elev-2: #ebe2c4;
  --bg-card: #ffffff;
  --bg-dark: #221710;       /* for diagram wrappers / hero accents */
  --border: #d8c8a8;
  --border-soft: #e8d8b8;
  --border-strong: #b8a274;
  --text: #2a1d10;
  --text-dim: #5a4530;
  --text-mute: #8a7050;
  --accent: #d97a0e;        /* slightly darker for better contrast on light */
  --accent-2: #e08a20;
  --accent-3: #2a9c75;      /* darker green */
  --blue: #4a6ed8;          /* darker blue */
  --pink: #c44580;          /* darker pink */
  --yellow: #a07a10;        /* darker yellow */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius: 14px;
  --radius-sm: 8px;
  --max-w: 980px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai", "Sarabun", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(217,122,14,0.06), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(42,156,117,0.04), transparent 40%);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: #b86608; text-decoration: underline; }

/* ============================================
   NAV
   ============================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250,246,237,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
}
.nav-brand:hover { text-decoration: none; }
.nav-brand .logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), #b86608);
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 18px;
  color: #fff;
}

.nav-links {
  display: flex;
  gap: 8px;
  margin-left: auto;
  align-items: center;
}
.nav-link {
  padding: 6px 14px;
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
}
.nav-link:hover { background: var(--bg-elev); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--bg-elev-2); color: var(--accent); }

.nav-cta {
  background: linear-gradient(135deg, var(--accent), #b86608);
  color: #fff !important;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
}
.nav-cta:hover { transform: translateY(-1px); }

/* ============================================
   CONTAINER
   ============================================ */
.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ============================================
   HERO (index)
   ============================================ */
.hero {
  padding: 80px 0 40px;
  text-align: center;
}
.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(217,122,14,0.1);
  color: var(--accent);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(217,122,14,0.25);
  margin-bottom: 24px;
}
.hero-title {
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.1;
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}
.hero-title .hl { color: var(--accent); }
.hero-sub {
  font-size: 18px;
  color: var(--text-dim);
  max-width: 600px;
  margin: 0 auto 32px;
}
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent), #b86608);
  color: #fff !important;
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(217,122,14,0.25);
  transition: all 0.2s;
}
.hero-cta:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(217,122,14,0.35); text-decoration: none; }

/* ============================================
   SECTION
   ============================================ */
.section {
  padding: 40px 0;
}
.section-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-title .num {
  width: 36px; height: 36px;
  background: var(--bg-elev-2);
  color: var(--accent);
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 16px;
  font-weight: 700;
  border: 1px solid var(--border);
}
.section-sub {
  color: var(--text-dim);
  font-size: 15px;
  margin-bottom: 28px;
  margin-left: 48px;
}

/* ============================================
   CHAPTER CARDS (index)
   ============================================ */
.chapters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.chapter-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.chapter-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
}
.chapter-card.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(217,122,14,0.06), var(--bg-card));
}
.chapter-card.disabled {
  opacity: 0.5;
  pointer-events: none;
}
.chapter-card .num {
  display: inline-block;
  background: var(--bg-elev-2);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}
.chapter-card.active .num { background: var(--accent); color: #fff; }
.chapter-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}
.chapter-card p {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.5;
}
.chapter-card .meta {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-mute);
  flex-wrap: wrap;
}
.chapter-card .meta span { display: flex; align-items: center; gap: 4px; }
.chapter-card .badge-soon {
  position: absolute;
  top: 14px; right: 14px;
  background: var(--bg-elev-2);
  color: var(--text-mute);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* ============================================
   CHAPTER CONTENT (ch1, etc)
   ============================================ */
.chapter-header {
  padding: 50px 0 30px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.chapter-breadcrumb {
  font-size: 13px;
  color: var(--text-mute);
  margin-bottom: 16px;
}
.chapter-breadcrumb a { color: var(--text-dim); }
.chapter-breadcrumb .sep { margin: 0 6px; opacity: 0.5; }
.chapter-eyebrow {
  display: inline-block;
  background: rgba(217,122,14,0.1);
  color: var(--accent);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  border: 1px solid rgba(217,122,14,0.25);
}
.chapter-h1 {
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1.15;
  font-weight: 800;
  margin-bottom: 20px;
  letter-spacing: -0.025em;
  color: var(--text);
}
.chapter-h1 .hl { color: var(--accent); }
.chapter-lead {
  font-size: 19px;
  color: var(--text-dim);
  max-width: 760px;
  line-height: 1.7;
}
.chapter-meta {
  display: flex;
  gap: 16px;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-mute);
  flex-wrap: wrap;
}
.chapter-meta .pill {
  background: var(--bg-elev);
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--text-dim);
  border: 1px solid var(--border-soft);
}

/* ============================================
   VIDEO EMBED (real example)
   ============================================ */
.video-demo {
  margin: 32px 0 40px;
  background: var(--bg-dark);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-lg);
}
.video-frame {
  position: relative;
  max-width: 320px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 9 / 16;
  box-shadow: 0 12px 48px rgba(0,0,0,0.3);
}
.video-frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.video-meta {
  text-align: center;
  margin-top: 16px;
  color: #f5eed8;
  font-size: 13px;
  font-weight: 500;
}
.video-meta strong { color: var(--accent-2); font-weight: 600; }
.video-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: center;
  margin: 32px 0 40px;
}
@media (max-width: 720px) { .video-grid { grid-template-columns: 1fr; } }

.video-side {
  padding: 8px 0;
}
.video-side h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.video-side p {
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1.7;
  margin-bottom: 0;
}
.video-side ul {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
}
.video-side li {
  padding: 8px 0;
  color: var(--text-dim);
  font-size: 15px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.video-side li::before {
  content: "→";
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================================
   CONTENT BLOCKS
   ============================================ */
h2 {
  font-size: 28px;
  font-weight: 700;
  margin: 56px 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: -0.01em;
  color: var(--text);
}
h2 .num {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  background: rgba(217,122,14,0.1);
  color: var(--accent);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid rgba(217,122,14,0.3);
}
h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 32px 0 12px;
  color: var(--text);
}
h4 {
  font-size: 16px;
  font-weight: 600;
  margin: 20px 0 8px;
  color: var(--text);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
p { margin-bottom: 18px; color: var(--text-dim); }
.chapter-content p,
.callout p { color: inherit; }
p:last-child { margin-bottom: 0; }

strong { color: var(--text); font-weight: 600; }
em { color: var(--text-dim); font-style: normal; }
code {
  font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
  background: var(--bg-elev);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  border: 1px solid var(--border-soft);
}

/* ============================================
   CALLOUT BOXES
   ============================================ */
.callout {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 24px 28px;
  margin: 28px 0;
  box-shadow: var(--shadow-sm);
}
.callout-blue { border-left-color: var(--blue); }
.callout-green { border-left-color: var(--accent-3); }
.callout-pink { border-left-color: var(--pink); }
.callout-yellow { border-left-color: var(--yellow); }
.callout-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.callout-body { color: var(--text-dim); font-size: 15.5px; }
.callout-body p { margin-bottom: 8px; color: var(--text-dim); }
.callout-body p:last-child { margin-bottom: 0; }

/* ============================================
   STEP BLOCK (deep-dive)
   ============================================ */
.step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin: 28px 0;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.step-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.step-head .num {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), #b86608);
  color: #fff;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 18px;
  font-weight: 800;
  flex-shrink: 0;
}
.step-head h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  flex-grow: 1;
  color: var(--text);
}
.step-head .time {
  font-size: 12px;
  background: var(--bg-elev);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 600;
  border: 1px solid var(--border);
}
.step-body { color: var(--text-dim); font-size: 15.5px; }
.step-body p { color: var(--text-dim); margin-bottom: 10px; }
.step-body strong { color: var(--text); }

.step-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}
.step-detail-block {
  background: var(--bg-elev);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
}
.step-detail-block .lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  font-weight: 600;
  margin-bottom: 6px;
}
.step-detail-block .val { font-size: 14.5px; color: var(--text); }

@media (max-width: 720px) {
  .step-detail { grid-template-columns: 1fr; }
}

/* ============================================
   SCREENSHOT
   ============================================ */
.shot {
  display: block;
  width: 100%;
  max-width: 720px;
  margin: 24px auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.shot img { display: block; width: 100%; height: auto; }
.shot-cap {
  font-size: 13px;
  color: var(--text-mute);
  text-align: center;
  margin-top: -12px;
  margin-bottom: 24px;
  font-style: italic;
}

.shot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 24px 0;
}
.shot-grid .shot { margin: 0; }
@media (max-width: 720px) { .shot-grid { grid-template-columns: 1fr; } }

/* ============================================
   DIAGRAM (dark wrapper for SVG)
   ============================================ */
.diagram {
  display: block;
  width: 100%;
  max-width: 920px;
  margin: 32px auto;
  border-radius: var(--radius);
  background: var(--bg-dark);
  border: 1px solid var(--border-strong);
  padding: 20px;
  box-shadow: var(--shadow);
}
.diagram img, .diagram svg { display: block; width: 100%; height: auto; }
.diagram-cap {
  text-align: center;
  font-size: 13px;
  color: var(--text-mute);
  font-style: italic;
  margin-top: -16px;
  margin-bottom: 24px;
}

/* ============================================
   TEAM ANALOGY CARDS
   ============================================ */
.team {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.team-member {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.team-member .avatar { font-size: 32px; margin-bottom: 8px; }
.team-member .name { font-weight: 600; color: var(--text); font-size: 14px; margin-bottom: 4px; }
.team-member .role { font-size: 12px; color: var(--text-dim); }

/* ============================================
   PROS / CONS / USE CASES
   ============================================ */
.use-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.use-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.use-card .icon { font-size: 24px; margin-bottom: 8px; }
.use-card h4 {
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
  margin: 0 0 6px;
  color: var(--text);
}
.use-card p { font-size: 13.5px; color: var(--text-dim); margin: 0; }

/* ============================================
   CHAPTER NAV (prev/next)
   ============================================ */
.chapter-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 60px 0 30px;
  padding-top: 30px;
  border-top: 1px solid var(--border);
}
.chapter-nav a {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.chapter-nav a:hover { border-color: var(--accent); transform: translateY(-1px); text-decoration: none; box-shadow: var(--shadow); }
.chapter-nav .lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  margin-bottom: 4px;
}
.chapter-nav .ttl { font-weight: 600; color: var(--text); font-size: 15px; }
.chapter-nav .next { text-align: right; }
.chapter-nav .disabled { opacity: 0.4; pointer-events: none; }
@media (max-width: 600px) { .chapter-nav { grid-template-columns: 1fr; } }

/* ============================================
   FOOTER
   ============================================ */
footer {
  border-top: 1px solid var(--border);
  margin-top: 60px;
  padding: 30px 0;
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
  background: var(--bg-elev);
}
footer a { color: var(--text-dim); }
footer .links { display: flex; gap: 16px; justify-content: center; margin-bottom: 8px; flex-wrap: wrap; }

/* ============================================
   UTIL
   ============================================ */
.center { text-align: center; }
.muted { color: var(--text-mute); }
.dim { color: var(--text-dim); }
.spacer-sm { height: 16px; }
.spacer-md { height: 32px; }
.spacer-lg { height: 60px; }

.hl { color: var(--accent); }
.hl-g { color: var(--accent-3); }
.hl-b { color: var(--blue); }
