/* tessera-programming — app-specific overrides on top of the
 * shared tessera components (cmap, pane-layout, tree-list) and the
 * sc-family motif chrome. The graph + 3-pane layout + LHS list
 * styling live in /static/tessera/*.css; this file holds only what
 * is specific to the programming app — the RHS detail composition,
 * the regime picker, the small chrome touches. */

#root { padding: 0; }

.muted { color: var(--ink-soft, #4d574a); }
.muted.small { font-size: 12px; }
.btn-sm { font-size: 13px; padding: 4px 10px; }

/* Top-bar Track + Language picker. Built on motif's .dropdown chrome;
 * .dropdown-radio-item adds the leading ○/● indicator + selected state
 * that motif's .dropdown-item alone doesn't provide. .dropdown-section-header
 * separates Track from Language inside the same menu. */
#track-picker .dropdown-toggle {
  font-size: 13px;
  padding: 4px 12px 4px 10px;
  border: 1px solid var(--rule, #ddd6c5);
  border-radius: 4px;
  background: var(--surface, white);
  color: var(--ink, #1f2a1c);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
#track-picker .dropdown-toggle::after {
  content: '▾';
  font-size: 9px;
  color: var(--ink-soft, #4d574a);
}
#track-picker .dropdown-toggle:hover { border-color: var(--accent, #355e2a); }
#track-picker .dropdown-menu {
  min-width: 220px;
  padding: 4px 0;
  /* motif's .dropdown-menu defaults to display:none; .show flips it.
   * If motif's family.css doesn't already define this we provide a
   * fallback so the menu actually appears. */
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: var(--surface, white);
  border: 1px solid var(--rule, #ddd6c5);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 30;
}
#track-picker .dropdown-menu.show { display: block; }
#track-picker { position: relative; }
.dropdown-section-header {
  padding: 8px 14px 4px 14px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft, #4d574a);
  font-weight: 600;
  user-select: none;
}
.dropdown-radio-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  font-size: 13px;
  color: var(--ink, #1f2a1c);
  cursor: pointer;
  user-select: none;
}
.dropdown-radio-item:hover { background: #ecf0e6; }
.dropdown-radio-item .radio-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px; height: 14px;
  font-size: 10px;
  color: var(--ink-soft, #4d574a);
  flex-shrink: 0;
}
.dropdown-radio-item.selected {
  background: #ecf0e6;
  font-weight: 500;
}
.dropdown-radio-item.selected .radio-indicator { color: var(--accent, #355e2a); }

/* ---- pane-section: the inner-of-the-pane shell. The shared
 * pane-layout sets the column structure; this gives the LHS
 * heading + scroll, plus the tree-list a heading area above it. */
.pane-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  padding: 14px 16px;
  overflow-y: auto;
}
.pane-section h2 {
  margin: 0 0 8px 0;
  font-family: var(--serif, 'IBM Plex Serif'), Georgia, serif;
  font-style: italic;
  font-size: 18px;
  font-weight: 600;
  color: var(--accent, #355e2a);
}

/* ---- center pane scope chip + buttons (host-rendered above the
 * shared graph SVG). */
.graph-toolbar {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  gap: 6px;
  align-items: center;
  z-index: 2;
}
.graph-toolbar button {
  font-size: 12px;
  padding: 4px 10px;
  background: var(--surface, white);
  border: 1px solid var(--rule, #ddd6c5);
  border-radius: 4px;
  cursor: pointer;
}
.graph-toolbar button:hover { border-color: var(--accent, #355e2a); }
.graph-toolbar button:disabled { opacity: 0.5; cursor: default; }
.graph-toolbar .scope-chip {
  font-size: 12px;
  color: var(--ink-soft);
  margin-left: 6px;
}
.graph-wrap {
  position: relative;
  flex: 1;
  height: 100%;
  background: var(--surface, white);
  overflow: hidden;
}
.graph-wrap svg { width: 100%; height: 100%; display: block; cursor: grab; }
.graph-wrap svg:active { cursor: grabbing; }

/* ---- RHS detail panel (programming-app specific composition) ---- */
.detail-panel { padding: 14px 16px; overflow-y: auto; flex: 1; }
.detail-panel .breadcrumb {
  font-size: 12px;
  color: var(--ink-soft, #4d574a);
  margin-bottom: 4px;
}
.detail-panel .breadcrumb a { color: var(--accent, #355e2a); text-decoration: none; }
.detail-panel .breadcrumb a:hover { text-decoration: underline; }
.detail-panel h1 {
  margin: 0 0 6px 0;
  font-size: 22px;
  font-weight: 600;
}
.detail-panel h2 {
  margin: 0 0 8px 0;
  font-family: var(--serif, 'IBM Plex Serif'), Georgia, serif;
  font-style: italic;
  font-size: 18px;
  font-weight: 600;
  color: var(--accent, #355e2a);
}
.detail-panel h3 {
  margin: 14px 0 6px 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft, #4d574a);
  font-weight: 600;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px 0; }
.tag {
  font-size: 11px;
  background: #f3efe6;
  color: var(--ink-soft, #4d574a);
  padding: 2px 8px;
  border-radius: 999px;
}
.difficulty-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid;
  background: transparent;
  font-weight: 500;
}
.difficulty-badge.d1 { color: #4f7c40; border-color: #b3c486; }
.difficulty-badge.d2 { color: var(--ink-soft, #4d574a); border-color: var(--rule, #ddd6c5); }
.difficulty-badge.d3 { color: #b03a2a; border-color: #fca5a5; }

.featured-note {
  margin: 0 0 10px 0;
  font-size: 12px;
  color: #8a5a1f;
  background: #fff7e6;
  border-left: 3px solid #b78240;
  padding: 5px 9px;
  border-radius: 2px;
}
.summary { font-size: 14px; line-height: 1.55; margin: 0 0 12px 0; }

.where-am-i {
  background: #f3efe6;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 13px;
  margin: 0 0 12px 0;
  line-height: 1.5;
}
.where-am-i .pill { margin-right: 6px; }

.pill {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  vertical-align: middle;
}
.pill.learning  { background: #b78240; color: white; }
.pill.mastered  { background: #4f7c40; color: white; }
.pill.stuck     { background: #b03a2a; color: white; }
.pill.unseen    { background: var(--rule, #ddd6c5); color: var(--ink, #1f2a1c); }

.state-buttons { display: flex; gap: 6px; margin: 8px 0 16px 0; }
.state-buttons button {
  flex: 1;
  font-size: 12px;
  padding: 6px 8px;
  border: 1px solid var(--rule, #ddd6c5);
  border-radius: 4px;
  background: var(--surface, white);
  cursor: pointer;
}
.state-buttons button:hover { border-color: var(--accent, #355e2a); }
.state-buttons button.active.learning { background: #b78240; color: white; border-color: #b78240; }
.state-buttons button.active.mastered { background: #4f7c40; color: white; border-color: #4f7c40; }
.state-buttons button.active.stuck    { background: #b03a2a; color: white; border-color: #b03a2a; }

.resource-list { list-style: none; padding: 0; margin: 0; }
.resource-list li {
  padding: 6px 0;
  border-top: 1px dashed var(--rule, #ddd6c5);
  font-size: 13px;
}
.resource-list li:first-child { border-top: none; }
.resource-list .res-meta {
  font-size: 11px;
  color: var(--ink-soft, #4d574a);
  margin-top: 2px;
}
.resource-list .res-kind {
  display: inline-block;
  font-size: 10px;
  background: #f3efe6;
  padding: 1px 6px;
  border-radius: 3px;
  margin-right: 4px;
  text-transform: lowercase;
}

.edges { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.edges li { padding: 3px 0; }
.edges .edge-kind {
  display: inline-block;
  width: 60px;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--ink-soft, #4d574a);
  letter-spacing: 0.04em;
}
.edges a { color: var(--ink, #1f2a1c); text-decoration: none; }
.edges a:hover { color: var(--accent, #355e2a); text-decoration: underline; }

.path-list { list-style: none; padding: 0; margin: 0; }
.path-list li { padding: 6px 0; border-top: 1px dashed var(--rule); font-size: 13px; }
.path-list li:first-child { border-top: none; }
.path-list a { color: var(--ink); text-decoration: none; font-weight: 500; }
.path-list a:hover { color: var(--accent); text-decoration: underline; }
.path-list .path-meta { display: block; font-size: 11px; color: var(--ink-soft); margin-top: 2px; }

/* ---- footer ---- */
.footnote {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 32px;
  padding: 0 16px;
  font-size: 11px;
  color: var(--ink-soft);
  background: var(--page-bg, #fbfaf6);
  border-top: 1px solid var(--rule);
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}
.footnote .sep { opacity: 0.4; }
.loading { padding: 24px; color: var(--ink-soft); }

/* ---- landing (unauth front door) ----------------------------------- */
/* Built on motif's .hero (rounded green band) + spakit's .landing
   max-width frame, but inlined here to keep tessera-programming
   independent of spakit/landing.js's required pricing tiers. */
.landing-page {
  max-width: 44rem;
  margin: 1.25rem auto 4rem;
  padding: 0 1rem;
}
.landing-page .hero {
  border-radius: 14px;
  padding: 2rem 1.75rem;
}
.landing-page .hero h1 {
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
  margin: 0 0 0.5rem;
  line-height: 1.2;
}
.landing-page .hero .lede {
  font-size: 1.05rem;
  margin: 0 0 1.25rem;
  max-width: 36rem;
}
.landing-page .cta-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.landing-page .landing-stat {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  opacity: 0.85;
}
.landing-page .lp-section {
  margin-top: 1.75rem;
  padding: 1.25rem 1.5rem;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 10px;
}
.landing-page .lp-section h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: var(--ink);
}
.landing-page .steps,
.landing-page .use-cases {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--ink);
  line-height: 1.55;
}
.landing-page .steps li,
.landing-page .use-cases li { margin-bottom: 0.35rem; }
.landing-page .landing-footer {
  text-align: center;
  margin-top: 1.5rem;
}
.landing-page .landing-footer a { color: var(--ink-soft); text-decoration: none; }
.landing-page .landing-footer a:hover { color: var(--accent); text-decoration: underline; }

/* ---- about page ---------------------------------------------------- */
.about-page {
  max-width: 42rem;
  margin: 1.25rem auto 4rem;
  padding: 0 1.25rem;
  color: var(--ink);
  line-height: 1.6;
}
.about-page h1 { margin: 0 0 0.5rem; font-size: 1.6rem; }
.about-page h2 { margin: 1.5rem 0 0.4rem; font-size: 1.1rem; color: var(--ink); }
.about-page p, .about-page ul { margin: 0.4rem 0; }
.about-page p.lead { font-size: 1.05rem; color: var(--ink); }
.about-page ul { padding-left: 1.25rem; }
.about-page ul li { margin-bottom: 0.3rem; }
.about-page .btn { margin-top: 0.5rem; }

/* ---- error card ---------------------------------------------------- */
.error-card {
  max-width: 32rem;
  margin: 3rem auto;
  padding: 1.5rem 1.5rem 1.25rem;
  background: #fff;
  border: 1px solid var(--rule);
  border-left: 4px solid #b03a2a;
  border-radius: 8px;
}
.error-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: #b03a2a;
}
.error-card .error-msg {
  margin: 0 0 1rem;
  color: var(--ink);
  font-size: 0.95rem;
  word-break: break-word;
}
.error-card .error-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ---- feedback icon (small chat glyph) ---------------------------- */
.feedback-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 6px;
  margin-left: 0.4rem;
  vertical-align: middle;
  opacity: 0.45;
  transition: opacity 0.15s ease;
}
.feedback-icon:hover { opacity: 1; }
.feedback-icon.nav-feedback {
  margin-left: 0.5rem;
  font-size: 16px;
  opacity: 0.7;
}

/* ---- modal (shared, single instance) ----------------------------- */
.tessera-modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 18, 0.42);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8vh;
  z-index: 1000;
}
.tessera-modal[hidden] { display: none; }
.tessera-modal-body {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  width: min(560px, 92vw);
  max-height: 84vh;
  overflow-y: auto;
  padding: 1.25rem 1.5rem 1rem;
}
.tessera-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}
.tessera-modal-head h3 { margin: 0; font-size: 1.05rem; }
.tessera-modal-head button {
  background: none; border: none; cursor: pointer;
  font-size: 22px; line-height: 1; padding: 0 4px;
  color: var(--ink-soft);
}
.tessera-modal-head button:hover { color: var(--ink); }
.tessera-modal-context {
  margin: 0 0 1rem;
  padding: 0.4rem 0.6rem;
  background: #f4f1ea;
  border-radius: 6px;
  font-style: italic;
}
#tessera-modal-form label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
#tessera-modal-form input,
#tessera-modal-form textarea {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 5px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  box-sizing: border-box;
}
#tessera-modal-form textarea { resize: vertical; min-height: 96px; }
.tessera-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.tessera-modal-status {
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  min-height: 1.2em;
}
.tessera-modal-status.error { color: #b03a2a; }

/* ---- materials list (teacher-added) ------------------------------ */
.material-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
}
.material-list li {
  padding: 6px 0;
  border-top: 1px dashed var(--rule);
  font-size: 13px;
}
.material-list li:first-child { border-top: none; }
.material-list a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}
.material-list a:hover { color: var(--accent); text-decoration: underline; }
.btn.small { font-size: 11px; padding: 2px 8px; margin-left: 0.4rem; vertical-align: middle; }

/* ---- sc-family brand row -----------------------------------------
   Mirrors stonecamp.us's .brand .brand-mark pattern (uppercase SC
   text in a small chip), but inverts the colours so it reads on
   our DARK navbar: cream chip + dark text instead of dark-green
   chip + white text. The app name stays plain text so screen
   readers and search results see "Programming". */
.navbar-brand.sc-brand {
  gap: 0.5rem;
  align-items: center;
}
.sc-brand-mark {
  display: inline-block;
  background: #fbf8ee;
  color: #2d3a1f;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.78em;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
}
.sc-brand-name {
  font-style: normal;
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: 0.005em;
}
