/* ============================================================
   VaroAdmap - paper map / road atlas theme
   Accent colors are driven by --acc (space-separated RGB triplet)
   set per milestone, e.g. style="--acc:37 99 235"
   ============================================================ */

:root {
  --paper: #f3efe4;
  --card: #fbf9f2;
  --ink: #201d19;
  --signal: #e2480f;
}

html {
  scroll-padding-top: 5rem;
}

body {
  background-color: var(--paper);
  color: #3a352d;
  /* graph-paper grid, like a map */
  background-image:
    linear-gradient(rgb(32 29 25 / 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgb(32 29 25 / 0.05) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ---------- textures ---------- */

.dot-grid {
  background-image:
    linear-gradient(rgb(32 29 25 / 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgb(32 29 25 / 0.06) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* dashed route line (the "road" down the middle) */
.guide-line {
  background-image: linear-gradient(to bottom, rgb(32 29 25 / 0.75) 0 9px, transparent 9px 17px);
  background-size: 3px 17px;
  background-repeat: repeat-y;
  background-position: center top;
}

/* scroll-driven fill: same dash rhythm, colored by route gradient */
#guideFill {
  background: linear-gradient(
    to bottom,
    #2563eb,
    #0f766e,
    #b45309,
    #7c3aed,
    #ea580c,
    #be123c
  );
  -webkit-mask-image: linear-gradient(#000 0 9px, transparent 9px 17px);
  mask-image: linear-gradient(#000 0 9px, transparent 9px 17px);
  -webkit-mask-size: 3px 17px;
  mask-size: 3px 17px;
  -webkit-mask-repeat: repeat-y;
  mask-repeat: repeat-y;
  -webkit-mask-position: center top;
  mask-position: center top;
}

/* ---------- header ---------- */

#siteHeader.is-scrolled {
  background: var(--paper);
}

/* ---------- roadmap nodes ---------- */

.node-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;   /* 36px mobile, centers on the 3px line at left 17px */
  height: 2.25rem;
  border-radius: 9999px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: rgb(var(--acc, 32 29 25));
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  box-shadow: 0 0 0 4px rgb(var(--acc, 32 29 25) / 0.12);
  transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

@media (min-width: 768px) {
  .node-dot {
    width: 2.75rem;
    height: 2.75rem;
    font-size: 11px;
  }
}

/* node gets a hard offset shadow when its card scrolls into view */
.milestone.is-active .node-dot {
  box-shadow:
    0 0 0 5px rgb(var(--acc, 32 29 25) / 0.16),
    3px 3px 0 rgb(var(--acc, 32 29 25) / 0.4);
}

/* node fills when every step in the phase is checked */
.milestone.is-done .node-dot {
  background: rgb(var(--acc, 32 29 25));
  color: var(--paper);
  border-color: var(--ink);
  box-shadow: 3px 3px 0 rgb(var(--acc, 32 29 25) / 0.45);
}

/* prize phase stays dimmed until the whole roadmap is complete */
.milestone.is-locked .card {
  opacity: 0.55;
}

.milestone.is-locked .node-dot {
  color: rgb(32 29 25 / 0.4);
  box-shadow: 0 0 0 4px rgb(32 29 25 / 0.07);
}

.milestone.is-unlocked .node-dot {
  background: rgb(var(--acc, 32 29 25));
  color: var(--paper);
  box-shadow: 3px 3px 0 rgb(var(--acc, 32 29 25) / 0.45);
}

/* ---------- cards ---------- */

.phase-tag {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgb(var(--acc, 32 29 25));
}

.card {
  transition: translate 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.card:hover {
  border-color: rgb(var(--acc, 32 29 25));
  translate: -2px -2px;
  box-shadow: 8px 8px 0 var(--ink);
}

/* thin progress bar at the bottom of each card */
.phase-bar {
  height: 4px;
  margin-top: 1.1rem;
  border-radius: 9999px;
  background: rgb(32 29 25 / 0.1);
  overflow: hidden;
}

.phase-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: rgb(var(--acc, 32 29 25));
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- checklist ---------- */

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.check-row .check-item {
  flex: 1;
  min-width: 0;
}

.check-link {
  flex: none;
  margin-top: 0.6rem;
  padding: 0.15rem 0.45rem;
  border-radius: 0.35rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: rgb(32 29 25 / 0.4);
  transition: color 0.15s ease, background 0.15s ease;
}

.check-link:hover {
  color: rgb(var(--acc, 32 29 25));
  background: rgb(var(--acc, 32 29 25) / 0.1);
}

.check-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0 -0.5rem;
  padding: 0.45rem 0.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.check-item:hover {
  background: rgb(32 29 25 / 0.04);
}

.check-item input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Homepage roadmap: checkboxes are read-only, state syncs from articles */
.check-item:has(input[type="checkbox"]:disabled) {
  cursor: default;
}

.check-item:has(input[type="checkbox"]:disabled):hover {
  background: transparent;
}

.check-box {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.15rem;
  border-radius: 0.35rem;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--paper);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.check-box svg {
  width: 0.7rem;
  height: 0.7rem;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.15s ease, transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.check-item:has(input[type="checkbox"]:checked) .check-box {
  background: rgb(var(--acc, 21 128 61));
  border-color: var(--ink);
}

.check-item:has(input[type="checkbox"]:checked) .check-box svg {
  opacity: 1;
  transform: scale(1);
}

.check-text {
  font-size: 0.875rem;
  line-height: 1.55;
  color: #4d473d;
  transition: color 0.2s ease;
}

.check-item:has(input[type="checkbox"]:checked) .check-text {
  color: rgb(32 29 25 / 0.45);
  text-decoration: line-through;
  text-decoration-color: rgb(32 29 25 / 0.3);
}

.check-item input[type="checkbox"]:focus-visible + .check-box {
  outline: 2px solid rgb(var(--acc, 21 128 61));
  outline-offset: 2px;
}

.guide-link {
  color: rgb(32 29 25 / 0.5);
  transition: color 0.15s ease;
}

.guide-link:hover {
  color: rgb(var(--acc, 32 29 25));
}

/* ---------- hero mini map ---------- */

.mini-line {
  width: 2px;
  background-image: linear-gradient(to bottom, rgb(32 29 25 / 0.6) 0 8px, transparent 8px 14px);
  background-size: 2px 14px;
  background-repeat: repeat-y;
  background-position: center top;
}

.mini-node {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* vertical rhythm for the 4 decorative nodes */
.mini-road > div:nth-of-type(1) { top: 15%; }
.mini-road > div:nth-of-type(2) { top: 38%; }
.mini-road > div:nth-of-type(3) { top: 61%; }
.mini-road > div:nth-of-type(4) { top: 84%; }

.mini-dot {
  flex: none;
  width: 0.875rem;
  height: 0.875rem;
  margin-left: 1.7rem; /* centers on the line at left 34px */
  border-radius: 9999px;
  border: 2px solid var(--ink);
  background: rgb(var(--acc, 32 29 25));
  box-shadow: 0 0 0 3px rgb(var(--acc, 32 29 25) / 0.15);
}

.mini-node.is-end .mini-dot {
  box-shadow: 0 0 0 3px rgb(var(--acc, 32 29 25) / 0.15), 0 0 14px rgb(var(--acc, 32 29 25) / 0.55);
}

/* ---------- FAQ ---------- */

.faq-item[open] {
  background: var(--paper);
}

.faq-item[open] .faq-chev {
  transform: rotate(180deg);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

/* ---------- scroll reveal (animation so card hover transitions stay intact) ---------- */

.reveal {
  opacity: 0;
}

.reveal.is-visible {
  animation: reveal-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- article checklist & confirm modal ---------- */

.article-checklist {
  border: 2px solid var(--ink);
  background: var(--card);
  box-shadow: 6px 6px 0 var(--ink);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(32 29 25 / 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 26rem;
  border: 2px solid var(--ink);
  background: var(--card);
  box-shadow: 8px 8px 0 var(--ink);
  padding: 1.5rem;
}

/* quick-check quiz (built by article.js) */
.quiz-card {
  max-width: 30rem;
  max-height: 85vh;
  overflow-y: auto;
}

.quiz-list {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quiz-item {
  border: 1.5px solid rgb(32 29 25 / 0.8);
  border-radius: 0.6rem;
  background: #fffdf7;
  padding: 0.75rem 1rem;
}

.quiz-q {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink);
}

.quiz-toggle {
  margin-top: 0.4rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--signal);
  transition: opacity 0.15s ease;
}

.quiz-toggle:hover {
  opacity: 0.75;
}

.quiz-a {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed rgb(32 29 25 / 0.25);
  font-size: 0.82rem;
  line-height: 1.55;
  color: #4d473d;
}

/* ---------- article prose ---------- */

.prose h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

.prose h3 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

.prose p {
  margin-bottom: 1rem;
  line-height: 1.75;
  color: #4d473d;
}

.prose ul,
.prose ol {
  margin-bottom: 1rem;
  padding-left: 1.4rem;
  line-height: 1.75;
  color: #4d473d;
}

.prose ul {
  list-style: disc;
}

.prose ol {
  list-style: decimal;
}

.prose li {
  margin-bottom: 0.4rem;
}

.prose strong {
  color: var(--ink);
  font-weight: 600;
}

.prose a {
  color: var(--signal);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose a:hover {
  color: var(--ink);
}

.prose blockquote {
  border-left: 3px solid var(--signal);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: #5c564c;
  font-style: italic;
}

/* ---------- focus & misc ---------- */

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: rgb(226 72 15 / 0.25);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal {
    opacity: 1;
  }
  .reveal.is-visible {
    animation: none;
  }
  .phase-fill,
  #guideFill {
    transition: none;
  }
}
