/* NNI Intranet Use Guide — shared styles
 * Calico tokens + Fraunces (heading) + Manrope (body Latin) + Tinos (TC)
 * Bilingual blocks via [data-lang]; language toggle persists in localStorage.
 */

:root {
  --bg: #F6F3E7;
  --text: #202626;
  --muted: rgba(32, 38, 38, 0.6);
  --accent: #B89B4F;
  --border: #E8E3D0;
  --card: #FFFFFF;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --max-w: 760px;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* TC content uses Tinos for CJK readability */
[data-lang="tc"] {
  font-family: 'Tinos', 'Manrope', system-ui, serif;
  font-size: 17px;
  line-height: 1.75;
}

h1, h2, h3, h4 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  margin: 1.4em 0 0.6em;
}

h1 { font-size: 2rem; margin-top: 0.4em; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; }
a:hover { border-bottom-color: var(--accent); }

p, li { font-size: 1rem; }

code, pre {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 0.92em;
  background: rgba(0,0,0,0.04);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

/* Layout shell */
.guide-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.guide-sidebar {
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.guide-sidebar h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 1.5rem 0 0.5rem;
}
.guide-sidebar h2:first-of-type { margin-top: 0; }

.guide-sidebar ul { list-style: none; padding: 0; margin: 0 0 1rem; }
.guide-sidebar a {
  display: block;
  padding: 0.35rem 0;
  font-size: 0.92rem;
  border-bottom: none;
}
.guide-sidebar a.is-current { color: var(--accent); font-weight: 600; }

.guide-main {
  padding: 2.5rem 3rem;
  max-width: calc(var(--max-w) + 6rem);
}

.guide-breadcrumb {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

/* Bilingual blocks */
[data-lang] { display: none; }
html[lang="en"] [data-lang="en"] { display: block; }
html[lang="tc"] [data-lang="tc"] { display: block; }
html[lang="en"] [data-lang="en"].inline,
html[lang="tc"] [data-lang="tc"].inline { display: inline; }

/* Language toggle */
.lang-toggle {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  box-shadow: var(--shadow);
  z-index: 50;
}
.lang-toggle button {
  background: none;
  border: none;
  padding: 0.2rem 0.6rem;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  border-radius: 4px;
}
.lang-toggle button.is-active { color: var(--text); background: var(--bg); }

/* Lesson card on landing */
.track-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}
.track-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.track-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  border-bottom: 1px solid var(--border);
}
.track-card h3 { margin-top: 0; }
.track-card .lesson-count {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.6rem;
}

/* Lesson page bits */
.lesson-meta {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  gap: 1.25rem;
  margin: -0.5rem 0 1.5rem;
}
.lesson-meta .dot { color: var(--accent); }

.why-matters {
  background: rgba(184, 155, 79, 0.08);
  border-left: 3px solid var(--accent);
  padding: 0.85rem 1.1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.25rem 0 1.5rem;
  font-size: 0.97rem;
}

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
}
.steps li {
  counter-increment: step;
  padding: 0.65rem 0 0.65rem 2.4rem;
  position: relative;
  border-bottom: 1px solid var(--border);
}
.steps li:last-child { border-bottom: none; }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 1.8rem;
  height: 1.8rem;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-size: 0.95rem;
  font-weight: 600;
}

.lesson-screenshot {
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}
.lesson-screenshot img { display: block; width: 100%; height: auto; }
.lesson-screenshot.placeholder {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.lesson-cta {
  display: flex;
  gap: 0.75rem;
  margin: 1.5rem 0;
}
.btn {
  font: inherit;
  font-size: 0.95rem;
  padding: 0.55rem 1.05rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.btn.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn:hover { border-bottom: 1px solid var(--border); }

.lesson-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}

/* Gotchas */
.gotcha {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.2rem;
  margin: 0.85rem 0;
}
.gotcha .symptom { font-weight: 600; }
.gotcha .fix { margin-top: 0.4rem; font-size: 0.95rem; }

/* Feedback link on gotchas pages */
.lesson-feedback {
  margin-top: 2rem;
  padding: 1rem 1.2rem;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--muted);
}
.lesson-feedback a { font-weight: 600; }

/* Search */
.search-box {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1.05rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.search-results { margin-top: 1.5rem; }
.search-result {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}
.search-result a { font-weight: 600; }
.search-result .snippet {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Glossary */
.glossary dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.75rem 1.5rem;
  margin: 1.5rem 0;
}
.glossary dt { font-weight: 600; color: var(--accent); }
.glossary dd { margin: 0; }

/* Mobile */
@media (max-width: 720px) {
  .guide-shell { grid-template-columns: 1fr; }
  .guide-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .guide-main { padding: 1.5rem 1.25rem; }
  .lang-toggle { top: 0.5rem; right: 0.5rem; }
  h1 { font-size: 1.6rem; }
}

/* Annotation overlay (gold pin pattern) */
.annot-toggle {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 100;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.85rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.annot-toggle.is-active { background: var(--accent); color: white; border-color: var(--accent); }

body.annot-mode { cursor: crosshair; }
body.annot-mode * { cursor: crosshair !important; }

.annot-pin {
  position: absolute;
  width: 26px;
  height: 26px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 0.85rem;
  z-index: 90;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  cursor: pointer;
}

.annot-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  background: var(--card);
  border-left: 1px solid var(--border);
  padding: 3rem 1rem 1rem;
  overflow-y: auto;
  z-index: 80;
  box-shadow: -2px 0 8px rgba(0,0,0,0.05);
  transform: translateX(100%);
  transition: transform 0.2s ease;
}
.annot-panel.is-open { transform: translateX(0); }
.annot-panel h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0;
}
.annot-item {
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 0;
  font-size: 0.88rem;
}
.annot-item .num {
  display: inline-block;
  width: 1.4rem;
  height: 1.4rem;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  text-align: center;
  font-weight: 600;
  margin-right: 0.4rem;
  font-size: 0.78rem;
  line-height: 1.4rem;
}
.annot-dialog {
  position: fixed;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  width: 280px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.18);
  z-index: 95;
}
.annot-dialog textarea {
  width: 100%;
  min-height: 70px;
  font: inherit;
  font-size: 0.9rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  resize: vertical;
}
.annot-dialog .row { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.annot-dialog button { flex: 1; }

/* Stub badge — appears on lesson pages with no copy yet */
.stub-badge {
  display: inline-block;
  background: rgba(184, 155, 79, 0.18);
  color: var(--accent);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.55rem;
  border-radius: 12px;
  margin-left: 0.5rem;
  vertical-align: middle;
  font-family: 'Manrope', sans-serif;
  font-weight: 600;
}
