/* ============================================================
   Shared styles — matched to amirhkarimi.com
   (Raleway, white bg, #33c3f0 accent, 12px card radius)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Harmattan:wght@400;700&display=swap');
:root {
  --accent-primary: #33c3f0;
  --accent-secondary: #3C9D9B;
  --accent-dark: #1EAEDB;
  --text: #222;
  --muted: #777;
  --line: #e8e8e8;
  --card: #ffffff;
  --bg: #ffffff;
  --radius-card: 12px;
  --radius-pill: 8px;
  --shadow-card: 0 6px 16px rgba(0, 0, 0, 0.12);
  --shadow-card-hover: 0 10px 22px rgba(0, 0, 0, 0.16);
  --live: #2e9e5b;
  --live-soft: #eef9f2;
  --wip: #b8842b;
  --wip-soft: #fdf6ea;
  --planned: #9a9a9a;
  --planned-soft: #f2f2f2;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: "Raleway", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}
html[lang="fa"] body {
  direction: ltr; /* layout stays LTR; FA text flows naturally inline */
  /* font-family intentionally NOT overridden — Raleway stays for UI chrome */
}
/* Apply Harmattan to all content-bearing text in FA mode
   (UI chrome — nav brand, pills, lang-btn — stays in Raleway) */
html[lang="fa"] .modal,
html[lang="fa"] .module-hero,
html[lang="fa"] .step-card,
html[lang="fa"] #popup,
html[lang="fa"] #path,
html[lang="fa"] section.flow,
html[lang="fa"] .step-nav,
html[lang="fa"] .next-prev,
html[lang="fa"] .resource,
html[lang="fa"] .placeholder,
html[lang="fa"] .resources-empty,
html[lang="fa"] .ingredients-strip,
html[lang="fa"] .ing-option {
  direction: rtl;
  text-align: right;
  font-family: "Harmattan", "Tahoma", "Arial", sans-serif;
}
html[lang="fa"] .node .t,
html[lang="fa"] .node .s,
html[lang="fa"] .subtitle,
html[lang="fa"] h1,
html[lang="fa"] h2,
html[lang="fa"] .eyebrow,
html[lang="fa"] .desc,
html[lang="fa"] .blurb,
html[lang="fa"] .crumb,
html[lang="fa"] footer.site-footer {
  font-family: "Harmattan", "Tahoma", "Arial", sans-serif;
}
a { color: var(--accent-primary); text-decoration: none; }
a:hover { color: var(--accent-dark); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ---------- Site nav ---------- */
.site-nav {
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.95); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 90;
}
.site-nav .inner {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0;
}
.site-nav .brand { font-weight: 600; letter-spacing: 0.4px; color: var(--text); font-size: 15px; }
.site-nav .brand .teaching { color: var(--accent-primary); font-weight: 600; }
.site-nav .links { display: flex; gap: 18px; font-size: 13.5px; align-items: center; }
.site-nav .links a { color: var(--muted); }
.site-nav .links a:hover { color: var(--accent-dark); }

/* ---------- Chips & dots ---------- */
.chip {
  display: inline-block; font-size: 12px; border-radius: var(--radius-pill);
  padding: 2px 10px; margin: 4px 6px 0 0; font-weight: 600; letter-spacing: 0.2px;
}
.chip.live { background: var(--live-soft); color: var(--live); }
.chip.wip { background: var(--wip-soft); color: var(--wip); }
.chip.planned { background: var(--planned-soft); color: var(--muted); }
.chip.aud { background: #e9f7fc; color: var(--accent-dark); font-weight: 500; }
.chip.aud.public { background: #f0f4ff; color: #5a72c0; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.live { background: var(--live); }
.dot.wip { background: var(--wip); }
.dot.planned { background: #fff; border: 1.5px dashed var(--planned); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; border: 1px solid #bbb; border-radius: var(--radius-pill);
  background: #fff; color: var(--text); padding: 7px 18px; font-size: 13px;
  font-weight: 600; letter-spacing: 0.4px; cursor: pointer; transition: all .15s;
  font-family: inherit;
}
.btn:hover { border-color: var(--accent-primary); color: var(--accent-dark); }
.btn.primary { background: var(--accent-primary); border-color: var(--accent-primary); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ---------- Overlay / modal ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(20, 24, 32, 0.45);
  display: none; z-index: 200; align-items: center; justify-content: center; padding: 20px;
}
.overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius-card); max-width: 520px; width: 100%;
  max-height: 88vh; overflow-y: auto; padding: 28px 30px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.28);
}
.modal .close { float: right; border: none; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }

footer.site-footer {
  border-top: 1px solid var(--line); padding: 24px 0 40px; text-align: center;
  color: var(--muted); font-size: 12.5px; margin-top: 48px;
}

/* ---------- Tier-coloured nodes — 3-tier system ---------- */
.node[data-tier="foundations"] {
  border-left: 4px solid var(--accent-secondary);
  background: linear-gradient(110deg, #eaf7f5 0%, #ffffff 55%);
  padding-left: 8px;
}
.node[data-tier="concepts"] {
  border-left: 4px solid var(--accent-primary);
  background: linear-gradient(110deg, #e8f4fc 0%, #ffffff 55%);
  padding-left: 8px;
}
.node[data-tier="applied"] {
  border-left: 4px solid #c08030;
  background: linear-gradient(110deg, #fdf5e6 0%, #ffffff 55%);
  padding-left: 8px;
}

/* ---------- Mini nodes (Intro to AI gateway — concepts tier) ---------- */
.node.mini {
  width: 122px; height: 52px;
  border-style: solid; border-color: #c5dce8; border-width: 1px;
  border-left-width: 4px; border-left-color: var(--accent-primary);
  background: linear-gradient(110deg, #ddf0fa 0%, #f8fdff 55%);
  box-shadow: 0 3px 10px rgba(51,195,240,0.15);
  opacity: 0.92;
}
.node.mini .t { font-size: 11px; }
.node.mini .s { font-size: 9px; }
.node.mini:hover { box-shadow: var(--shadow-card-hover); opacity: 1; }
.node.mini.inactive { opacity: 0.18; }

/* ---------- Swimlane labels — rotated vertical ---------- */
/* Override the inline-style positioning in index.html */

/* ---------- Tier legend strip ---------- */
.tier-legend {
  display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
  padding: 8px 0 2px; font-size: 11.5px;
}
.tier-legend-item {
  display: flex; align-items: center; gap: 5px; color: var(--muted); font-weight: 500;
}
.tier-legend-item .swatch {
  width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0;
}
.tier-legend-item.foundations .swatch { background: var(--accent-secondary); }
.tier-legend-item.concepts    .swatch { background: var(--accent-primary); }
.tier-legend-item.applied     .swatch { background: #c08030; }

/* ---------- Audience tagline (kept for compat; tag now inside pill) ---------- */
.aud-tagline { display: none; }

/* ---------- Language toggle in nav ---------- */
.lang-btn {
  border: 1px solid #ccc; background: #fff; border-radius: var(--radius-pill);
  padding: 3px 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.4px;
  cursor: pointer; color: var(--muted); transition: all .15s;
  font-family: "Harmattan", "Tahoma", "Arial", sans-serif;
}
.lang-btn:hover { border-color: var(--accent-primary); color: var(--accent-dark); }

/* ---------- PDF chooser (Listen section) ---------- */
.pdf-chooser { margin-top: 16px; }
.pdf-chooser .choose-label {
  font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px; font-weight: 600;
}
.pdf-options { display: flex; gap: 10px; flex-wrap: wrap; }
.pdf-opt {
  flex: 1; min-width: 180px; border: 1px solid var(--line); border-radius: var(--radius-card);
  padding: 13px 16px; cursor: pointer; transition: all .15s; position: relative;
}
.pdf-opt:hover { border-color: var(--accent-primary); box-shadow: var(--shadow-card); }
.pdf-opt.selected { border-color: var(--accent-primary); background: #f2fbfe; }
.pdf-opt .opt-title { font-weight: 600; font-size: 13.5px; }
.pdf-opt .opt-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pdf-opt .opt-action { margin-top: 10px; }
.pdf-opt input[type="file"] { display: none; }
.pdf-viewer {
  margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius-card);
  overflow: hidden; display: none;
}
.pdf-viewer .pdf-label {
  padding: 7px 12px; font-size: 12px; color: var(--muted); background: #f8f8f8;
  border-bottom: 1px solid var(--line); display: flex; justify-content: space-between;
}
.pdf-viewer iframe { width: 100%; height: 520px; border: none; display: block; }

/* ---------- Quiz section ---------- */
.quiz-q { margin-top: 22px; font-weight: 600; font-size: 14.5px; line-height: 1.4; }
.quiz-q .marks { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 6px; }
.quiz-opts { display: flex; flex-direction: column; gap: 7px; margin-top: 9px; }
.quiz-opts button {
  text-align: left; border: 1px solid var(--line); background: #fff;
  border-radius: var(--radius-pill); padding: 9px 14px; font-size: 13.5px;
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.quiz-opts button:hover:not(.correct):not(.wrong) { border-color: var(--accent-primary); background: #f2fbfe; }
.quiz-opts button.correct { border-color: #2e9e5b; background: #eef9f2; color: #1d7a45; }
.quiz-opts button.wrong   { border-color: #c0626a; background: #fdf0f1; color: #963b43; }
.quiz-open { margin-top: 22px; }
.quiz-open .open-q { font-weight: 600; font-size: 14.5px; line-height: 1.4; }
.quiz-open .open-hint {
  margin-top: 8px; border: 1.5px dashed #d5d5d5; border-radius: var(--radius-card);
  padding: 12px 14px; font-size: 13px; color: var(--muted); background: #fcfcfc;
}
.quiz-score { margin-top: 14px; font-size: 14px; font-weight: 600; color: var(--accent-dark); }

/* ---------- Farsi RTL / layout overrides ---------- */

/* Skill tree nodes: text flush right, accent border on right */
html[lang="fa"] .node {
  align-items: flex-end;
  padding: 6px 8px 6px 12px;
  border-left-width: 1px;
  border-right-width: 4px;
  border-right-style: solid;
  border-right-color: var(--line);
}
html[lang="fa"] .node[data-tier="foundations"] { border-right-color: var(--accent-secondary); }
html[lang="fa"] .node[data-tier="concepts"]    { border-right-color: var(--accent-primary); }
html[lang="fa"] .node[data-tier="applied"]     { border-right-color: #c08030; }
html[lang="fa"] .node.mini { border-right-color: var(--accent-primary); }
html[lang="fa"] .node .t { font-size: 13px; text-align: right; }
html[lang="fa"] .node .s { font-size: 11px; text-align: right; }

/* Swimlane labels: move to right side, top-to-bottom, larger */
html[lang="fa"] .swimlane-label {
  left: auto;
  right: 3px;
  font-size: 11px;
  writing-mode: vertical-rl;
  transform: translateY(-50%);
}

/* Path view: step-num on the right, connector line on right */
html[lang="fa"] #path .step { flex-direction: row-reverse; }
html[lang="fa"] #path .step::before { left: auto; right: 26px; }
html[lang="fa"] #path .step-card { text-align: right; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  #minimap { display: none !important; }
}

@media (max-width: 720px) {
  .wrap { padding: 0 16px; }

  .site-nav .inner { flex-wrap: wrap; gap: 6px; padding: 10px 0; }
  .site-nav .brand { font-size: 13.5px; }
  .site-nav .links { font-size: 12px; gap: 10px; }

  header.hero { padding: 32px 0 12px; }

  .controls-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .controls-inner > div:last-child { align-self: flex-start; }

  .pills { gap: 6px; flex-wrap: wrap; }

  .tier-legend { gap: 10px; font-size: 11px; }

  .ingredients-strip { gap: 6px; }
  .ingredients-strip span { font-size: 11.5px; padding: 4px 10px; }

  .modal { padding: 20px 16px; max-width: calc(100vw - 32px); }

  .step-nav { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .step-nav::-webkit-scrollbar { display: none; }
  .step-nav a { white-space: nowrap; padding: 5px 10px; font-size: 12px; flex-shrink: 0; }
  .step-nav a span.muted-tag { display: none; }

  .next-prev { flex-direction: column; }
  .next-prev .btn { text-align: center; }

  .pdf-viewer iframe { height: 380px; }

  section.flow { padding: 26px 0 6px; }
  .module-hero { padding: 28px 0 6px; }
}

@media (max-width: 480px) {
  h1 { font-size: clamp(22px, 7vw, 32px); }
  .subtitle { font-size: 14.5px; }
  .pill .pill-name { font-size: 12px; }
  .pill .pill-tag  { font-size: 9.5px; }
}
