/* ═══════════════════════════════════════════════════════════════
   Open Vietnamese — global.css
   Covers: reset, design tokens, layout shell, header, sidebar,
           footer, responsive breakpoints, progress bar.
   Section-specific styles live in: taskbook.css, read.css
   ═══════════════════════════════════════════════════════════════ */

/* ── Tokens ────────────────────────────────────────────────────── */
:root {
  /* Brand — Open Vietnamese primary: ink-navy. Warm gold as the single
     shared accent. Sub-projects (UNC Viet, etc.) get their own accent
     but inherit navy + gold + type system, so the whole site still
     reads as one institution. */
  --ink:         #14213D;
  --dark-blue:   #1A3E6F;
  --mid-blue:    #2E6DA4;
  --light-blue:  #EBF5FB;
  --gold:        #C08A1E;
  --light-gold:  #FBF3E1;
  --teal:        #1A7A6E;
  --light-teal:  #D5F0EC;
  --red:         #C0392B;
  --dark-red:    #922B21;

  --paper:       #FBFAF7;
  --gray-50:     #F8F9FA;
  --gray-100:    #F4F6F7;
  --gray-200:    #E8EAED;
  --gray-300:    #DADCE0;
  --gray-400:    #9AA0A6;
  --gray-700:    #3C4043;
  --white:       #FFFFFF;

  --font:        'Inter', -apple-system, Helvetica, Arial, sans-serif;
  --font-serif:  'Source Serif 4', Georgia, 'Times New Roman', serif;

  --header-h:    64px;
  --sidebar-w:   240px;
  --content-max: 820px;
  --marketing-max: 760px;
  --radius:      8px;
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--gray-700);
  background: var(--gray-100);
}
a { color: var(--mid-blue); }
img { max-width: 100%; height: auto; }

/* ── Marketing / institutional pages (no sidebar) ─────────────────
   Used by the homepage and other brand-level pages. Full-width header
   and footer, centered editorial column for content. */
.marketing-shell { min-height: calc(100vh - var(--header-h)); }
.marketing-main {
  max-width: var(--marketing-max);
  margin: 0 auto;
  padding: 0 24px 64px;
}
.eyebrow {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--gold);
}
.prose p { margin-bottom: 14px; }
.prose p:last-child { margin-bottom: 0; }

/* Masthead */
.masthead {
  background: linear-gradient(180deg, var(--ink) 0%, var(--dark-blue) 100%);
  color: white;
  padding: 72px 24px 56px;
  text-align: center;
}
.masthead-inner { max-width: 640px; margin: 0 auto; }
.masthead .eyebrow { color: rgba(255,255,255,.55); margin-bottom: 14px; display: block; }
.masthead h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 42px;
  line-height: 1.15;
  margin-bottom: 10px;
}
.masthead .tagline-vi {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 18px;
  color: rgba(255,255,255,.75);
  margin-bottom: 20px;
}
.masthead p.lede {
  font-size: 16px;
  line-height: 1.7;
  color: rgba(255,255,255,.88);
  margin: 0 auto 26px;
  max-width: 540px;
}

/* Framework chips */
.chip-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 30px; }
.chip {
  font-size: 12px; font-weight: 600; letter-spacing: .3px;
  padding: 5px 12px; border-radius: 999px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.22);
  color: rgba(255,255,255,.92);
}

/* CTA button */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600;
  padding: 11px 22px; border-radius: 999px;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { box-shadow: 0 6px 16px rgba(192,138,30,.35); }

/* Section framing on marketing pages */
.m-section { padding: 52px 0; border-bottom: 1px solid var(--gray-200); }
.m-section:last-of-type { border-bottom: none; }
.m-section-head { margin-bottom: 24px; }
.m-section-head .eyebrow { display: block; margin-bottom: 6px; }
.m-section-head h2 {
  font-family: var(--font-serif);
  font-size: 24px; font-weight: 600; color: var(--ink);
}

/* Three pillars — editorial numbered list, not colored boxes */
.pillars { display: flex; flex-direction: column; gap: 22px; }
.pillar { display: flex; gap: 18px; }
.pillar-num {
  font-family: var(--font-serif);
  font-size: 26px; font-weight: 600; color: var(--gray-300);
  flex-shrink: 0; width: 34px; line-height: 1.3;
}
.pillar-name { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.pillar-body { font-size: 14px; color: var(--gray-700); line-height: 1.7; }

/* Project directory */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.project-card {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: var(--white);
  position: relative;
}
.project-card.is-live {
  border-color: transparent;
  background: linear-gradient(var(--white), var(--white)) padding-box,
              linear-gradient(135deg, var(--dark-red), var(--gold)) border-box;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.project-dot {
  width: 9px; height: 9px; border-radius: 50%;
  display: inline-block; margin-right: 7px;
}
.project-name { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 6px; display: flex; align-items: center; }
.project-desc { font-size: 12.5px; color: var(--gray-400); line-height: 1.6; margin-bottom: 12px; }
.project-status {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  padding: 3px 9px; border-radius: 999px;
  display: inline-block;
}
.project-status.live { background: var(--light-gold); color: #8A6414; }
.project-status.dev  { background: var(--gray-100); color: var(--gray-400); }
.project-link {
  position: absolute; inset: 0; border-radius: var(--radius);
}

/* ── Marketing footer ──────────────────────────────────────────── */
.site-footer.footer-marketing {
  height: auto; background: var(--ink); flex-direction: column;
  padding: 30px 24px; gap: 10px;
}
.footer-meta { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* Language switcher */
.lang-row {
  display: flex; gap: 6px; justify-content: center; flex-wrap: wrap;
  margin-top: 28px;
}
.lang-pill {
  font-family: var(--font);
  font-size: 12.5px; font-weight: 600;
  padding: 5px 13px; border-radius: 999px;
  background: transparent;
  border: 1px solid rgba(255,255,255,.22);
  color: rgba(255,255,255,.65);
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.lang-pill:hover { border-color: rgba(255,255,255,.4); color: rgba(255,255,255,.9); }
.lang-pill.active { background: var(--gold); border-color: var(--gold); color: var(--ink); }

/* ── Skip link (accessibility) ─────────────────────────────────── */
.skip-link {
  position: absolute; top: -100px; left: 16px;
  background: var(--ink); color: white;
  padding: 8px 16px; border-radius: 0 0 6px 6px;
  font-size: 13px; font-weight: 600; z-index: 9999;
  transition: top .2s;
}
.skip-link:focus { top: 0; }

/* ── Header ────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 200;
  height: var(--header-h);
  background: var(--ink);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

/* Hamburger — hidden on desktop */
.menu-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  padding: 6px; color: white;
  flex-direction: column; gap: 5px;
}
.menu-toggle span {
  display: block; width: 22px; height: 2px;
  background: white; border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
/* Animated X when open */
.menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.site-logo {
  text-decoration: none;
  display: flex; align-items: center; gap: 9px;
  flex-shrink: 0;
}
.logo-mark { color: var(--gold); flex-shrink: 0; }
.logo-ov   { font-family: var(--font-serif); font-weight: 600; font-size: 17px; color: white; letter-spacing: .2px; }
.logo-sep  { color: var(--gold); }
.logo-section { font-size: 13px; color: rgba(255,255,255,.75); }

.site-nav {
  display: flex; gap: 2px; align-items: center;
  margin-left: auto;
  overflow-x: auto;
}
.nav-link {
  text-decoration: none; font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,.8);
  padding: 6px 10px; border-radius: 4px;
  white-space: nowrap; transition: background .15s;
}
.nav-link:hover, .nav-link.active {
  background: rgba(255,255,255,.15); color: white;
}

/* ── Progress bar (global, below header) ───────────────────────── */
.progress-bar-wrap {
  height: 3px; background: var(--gray-200);
  position: sticky; top: var(--header-h); z-index: 199;
}
.progress-bar-fill {
  height: 100%; background: var(--gold);
  width: 0%; transition: width .4s ease;
}

/* ── Page shell ────────────────────────────────────────────────── */
.page-shell {
  display: flex;
  min-height: calc(100vh - var(--header-h) - 3px - 48px);
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  padding: 24px 14px;
  position: sticky;
  top: calc(var(--header-h) + 3px);
  height: calc(100vh - var(--header-h) - 3px);
  overflow-y: auto;
  transition: transform .25s ease;
}
.sidebar-module-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--red); margin-bottom: 2px;
}
.sidebar-module-vi {
  font-size: 14px; font-weight: 600; color: var(--dark-blue);
  margin-bottom: 16px;
}
.sidebar-tasks { list-style: none; }
.sidebar-tasks li { margin-bottom: 3px; }
.sidebar-tasks a {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; font-size: 13px;
  color: var(--gray-700); padding: 7px 10px; border-radius: 5px;
  transition: background .12s, color .12s; line-height: 1.3;
}
.sidebar-tasks a:hover { background: var(--light-blue); color: var(--dark-blue); }
.sidebar-tasks a.active { background: var(--dark-blue); color: white; font-weight: 600; }

/* Completion dot in sidebar */
.sidebar-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--gray-200); margin-left: auto;
  transition: background .3s;
}
.sidebar-dot.done { background: var(--teal); }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 149;
  background: rgba(0,0,0,.4);
}

/* ── Main content ──────────────────────────────────────────────── */
.main-content {
  flex: 1; min-width: 0;
  padding: 36px 40px;
  max-width: var(--content-max);
}

/* ── Footer ────────────────────────────────────────────────────── */
.site-footer {
  height: 48px;
  background: var(--ink);
  color: rgba(255,255,255,.55);
  display: flex; align-items: center; justify-content: center;
  gap: 10px; font-size: 12px; flex-wrap: wrap;
  padding: 0 16px;
}
.site-footer a { color: rgba(255,255,255,.45); text-decoration: none; }
.site-footer a:hover { color: white; }

/* ── Learner progress widget ───────────────────────────────────── */
.progress-widget {
  background: white; border: 1.5px solid var(--gray-200);
  border-radius: var(--radius); padding: 14px 18px;
  margin-bottom: 28px;
  display: flex; align-items: center; gap: 16px;
}
.progress-ring-wrap { flex-shrink: 0; }
.progress-ring { transform: rotate(-90deg); }
.progress-ring-bg    { fill: none; stroke: var(--gray-200); stroke-width: 4; }
.progress-ring-fill  { fill: none; stroke: var(--teal); stroke-width: 4;
  stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.progress-info { flex: 1; }
.progress-title { font-size: 13px; font-weight: 700; color: var(--dark-blue); margin-bottom: 2px; }
.progress-sub   { font-size: 12px; color: var(--gray-400); }
.progress-pct   { font-size: 22px; font-weight: 700; color: var(--teal); }

/* ── Responsive ────────────────────────────────────────────────── */

/* Tablet: 768px – 1024px */
@media (max-width: 1024px) {
  .main-content { padding: 28px 28px; }
  :root { --sidebar-w: 210px; }
}

/* Mobile: ≤ 767px */
@media (max-width: 767px) {
  /* Show hamburger, hide desktop nav */
  .menu-toggle { display: flex; }
  .site-nav    { display: none; }

  /* Sidebar becomes an off-canvas drawer */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 150;
    width: 280px;
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0,0,0,.2);
    padding-top: calc(var(--header-h) + 16px);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  /* Full-width content */
  .main-content { padding: 20px 18px; max-width: 100%; }

  /* Smaller header text */
  .logo-ov   { font-size: 14px; }
  .logo-section { display: none; }

  /* Progress widget stacks */
  .progress-widget { flex-direction: column; align-items: flex-start; gap: 10px; }

  /* Footer wraps */
  .site-footer { height: auto; padding: 12px 16px; gap: 6px; }
}

/* Small mobile: ≤ 480px */
@media (max-width: 480px) {
  .main-content { padding: 16px 14px; }
}
