/* =========================
   BUTTONS & CONTROLS
========================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border: 1px solid var(--ink);
  border-radius: 1px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease,
    transform 0.25s var(--ease);
}

.btn svg {
  transition: transform 0.3s var(--ease);
}

.btn:hover svg {
  transform: translateX(4px);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
  box-shadow: 3px 3px 0 var(--highlight);
}

.btn-primary:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: var(--paper);
  transform: translate(-1px, -2px);
  box-shadow: 5px 5px 0 var(--highlight);
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition:
    border-color 0.25s ease,
    color 0.25s ease,
    background-color 0.25s ease,
    transform 0.25s var(--ease);
}

.icon-btn:hover {
  border-color: var(--ink);
  background: var(--highlight);
  color: var(--highlight-ink);
  transform: rotate(-5deg);
}

.theme-icon-moon {
  display: none;
}

[data-theme="dark"] .theme-icon-sun {
  display: none;
}

[data-theme="dark"] .theme-icon-moon {
  display: block;
}

/* =========================
   SHARED PIECES
========================= */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

/* Animated sketch icons */
.draw-icon path,
.draw-icon circle,
.draw-icon polyline,
.draw-icon polygon {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.reveal.visible .draw-icon path,
.reveal.visible .draw-icon circle,
.reveal.visible .draw-icon polyline,
.reveal.visible .draw-icon polygon {
  animation: drawIcon 1.15s var(--ease) 0.2s forwards;
}

.section-doodle path,
.section-doodle circle {
  stroke: var(--ink-soft);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.section-doodle .doodle-accent,
.draw-icon .doodle-accent {
  stroke: var(--accent-2);
}

.reveal.visible .section-doodle path,
.reveal.visible .section-doodle circle {
  animation: drawIcon 1.5s var(--ease) 0.35s forwards;
}

.reveal.visible .section-doodle path:nth-child(2),
.reveal.visible .section-doodle circle:nth-child(2) {
  animation-delay: 0.55s;
}

.reveal.visible .section-doodle path:nth-child(3) {
  animation-delay: 0.75s;
}

@keyframes drawIcon {
  to { stroke-dashoffset: 0; }
}

/* =========================
   MODAL — A CASE NOTE
========================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(18, 32, 30, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.open {
  display: grid;
}

.modal-box {
  width: min(100%, 620px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 30px;
  border: 1px solid var(--line-strong);
  border-top: 6px solid var(--accent);
  border-radius: 1px;
  background: var(--card);
  box-shadow: 10px 10px 0 var(--highlight);
  animation: fadeSlide 0.28s var(--ease);
}

.modal-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
}

.modal-top .mono {
  color: var(--accent-2);
}

.modal-title {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.modal-desc {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.chart-bars {
  display: grid;
  gap: 13px;
  margin: 24px 0;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  background: var(--paper-2);
}

.chart-row {
  display: grid;
  grid-template-columns: 128px 1fr 68px;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chart-track {
  height: 8px;
  border: 1px solid var(--line-strong);
  background: transparent;
  overflow: hidden;
}

.chart-bar {
  height: 100%;
  background: var(--accent);
}

.chart-value {
  text-align: right;
  color: var(--accent);
  font-weight: 700;
}

.modal-outcome {
  padding-top: 14px;
  border-top: 2px solid var(--ink);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(12px) rotate(-0.4deg); }
  to { opacity: 1; transform: none; }
}

/* =========================
   TOAST
========================= */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 600;
  max-width: min(360px, calc(100vw - 48px));
  padding: 12px 18px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  box-shadow: 4px 4px 0 var(--accent-2);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s var(--ease);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}
