/* ============================================================
   PARTICLES — unit page styles
   Smell-line hero · diffusion simulator · particle model rules ·
   evidence cards · myth flips · flashcards · exit ticket
   ============================================================ */

/* the hidden attribute must always win over the display rules below */
[hidden] { display: none !important; }

/* ---------- hero ---------- */
.pa-hero {
  position: relative;
  padding-top: clamp(150px, 20vh, 200px);
  overflow: hidden;
  background: linear-gradient(180deg, #F7F2E4 0%, var(--sand-50) 60%, var(--sand-100) 100%);
}
.pa-hero-grid {
  position: relative; z-index: 1; /* above .sun */
  display: grid; grid-template-columns: 1.15fr 0.85fr;
  align-items: center; gap: clamp(30px, 5vw, 60px);
  padding-bottom: 70px;
}
.pa-hero-grid > * { min-width: 0; }
.pa-title { font-size: clamp(2.9rem, 6.5vw, 5.4rem); margin-bottom: 26px; }
.pa-title .char { display: inline-block; }
.pa-hero .lede em { font-style: italic; color: var(--iris-500); }
.pa-chips { display: flex; gap: 10px; margin-top: 30px; flex-wrap: wrap; }

.hero-smell {
  max-width: 420px; margin-left: auto; width: 100%;
  background: #FFFDF6; border: 1px solid rgb(13 13 17 / 0.08);
  border-radius: var(--radius); box-shadow: var(--shadow-card);
  padding: 18px 18px 10px;
}
.smell-svg { display: block; width: 100%; height: auto; }
.smell-dots circle { animation: smell-drift 3.4s ease-in-out infinite; }
.smell-dots circle:nth-child(2n) { animation-delay: -1.1s; }
.smell-dots circle:nth-child(3n) { animation-delay: -2.2s; }
@keyframes smell-drift {
  0%, 100% { transform: translate(0, 0); opacity: 0.9; }
  50% { transform: translate(6px, -5px); opacity: 0.5; }
}
.smell-cap { margin-top: 8px; text-align: center; }

/* ---------- the phenomenon: diffusion lab ---------- */
.pa-smell { background: var(--sand-100); }
.diff-lab { max-width: 860px; margin-inline: auto; }
.diff-stage { margin-bottom: 16px; }
.diff-svg { display: block; width: 100%; height: auto; border-radius: 14px; }
.diff-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.diff-read { margin-left: auto; }
.lab-reset {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.06em;
  color: var(--ink-500); background: none; border: 0; cursor: pointer;
  border-bottom: 1px dashed var(--ink-300); padding: 2px 0;
}
.lab-reset:hover { color: var(--amber-500); border-color: var(--amber-500); }
.smell-explain { max-width: 780px; margin: 30px auto 0; }
.smell-explain p { font-size: 16px; line-height: 1.75; color: var(--ink-700); }
.smell-explain strong { color: var(--ink-900); }

/* ---------- particle model rules ---------- */
.pa-particles { background: var(--sand-50); }
.rule-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.rule-card .rule-num {
  font-family: var(--font-display); font-size: 2rem; font-weight: 700;
  color: var(--amber-500); display: block; margin-bottom: 12px; line-height: 1;
}
.rule-card h3 { margin-bottom: 10px; }
.rule-card p { font-size: 14.5px; line-height: 1.65; color: var(--ink-700); }
.rule-card strong { color: var(--ink-900); }

/* ---------- evidence ---------- */
.pa-evidence { background: var(--sand-100); }
.ev-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.ev-num {
  font-family: var(--font-display); font-size: 1.6rem; font-weight: 700;
  color: var(--amber-500); display: block; margin-bottom: 12px; line-height: 1;
}
.ev-card h3 { margin-bottom: 10px; font-size: 1.05rem; }
.ev-card p { font-size: 13.5px; line-height: 1.6; color: var(--ink-700); }
.ev-card strong { color: var(--ink-900); }

.standards-note {
  margin-top: 44px;
  font-family: var(--font-mono); font-size: 11.5px; line-height: 1.7;
  color: var(--ink-300); max-width: 70ch;
}
.standards-note strong { color: var(--ink-500); }

/* ---------- myth flip cards ---------- */
.pa-myths { background: var(--sand-50); }
.myth-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.myth-flip {
  position: relative; min-height: 210px; padding: 0; border: 0;
  background: none; cursor: pointer; font: inherit; text-align: left;
  perspective: 1100px; border-radius: var(--radius);
}
.myth-flip:focus-visible { outline: 2px solid var(--iris-500); outline-offset: 3px; }
.myth-face {
  position: absolute; inset: 0; border-radius: var(--radius);
  padding: 28px; display: flex; flex-direction: column; justify-content: center; gap: 12px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transition: transform 0.65s cubic-bezier(0.3, 1.3, 0.4, 1);
  font-family: var(--font-display); font-weight: 600; font-size: 1.14rem;
  line-height: 1.3; letter-spacing: -0.01em;
}
.myth-front {
  background: #FFFDF6; border: 1px solid rgb(13 13 17 / 0.08);
  box-shadow: var(--shadow-card); color: var(--ink-900);
}
.myth-tag {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--amber-500);
  border: 1px solid rgb(232 112 58 / 0.4); border-radius: 999px;
  padding: 4px 10px; align-self: flex-start;
}
.myth-back {
  background: var(--ink-900); color: var(--sand-50);
  font-family: var(--font-body); font-weight: 400; font-size: 0.98rem;
  line-height: 1.55; letter-spacing: 0;
  transform: rotateY(180deg);
}
.myth-back strong { color: var(--amber-300); font-family: var(--font-display); font-size: 1.15rem; display: block; margin-bottom: 4px; }
.myth-flip.flipped .myth-front { transform: rotateY(-180deg); }
.myth-flip.flipped .myth-back { transform: rotateY(0deg); }

/* antenna wiggle — applies to every <use> of the beetle symbol */
.beetle-antenna { transform-origin: 11px 54px; animation: ant-wig 2.6s ease-in-out infinite; }
@keyframes ant-wig {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-7deg); }
}

/* ============================================================
   FLASHCARDS (spaced repetition)
   ============================================================ */
.pa-cards { background: var(--sand-100); }
.deck-wrap {
  display: grid; grid-template-columns: 300px 1fr;
  gap: 22px; align-items: start; max-width: 980px; margin-inline: auto;
}
.deck-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.deck-stat { text-align: center; }
.deck-stat-num {
  display: block; font-family: var(--font-display); font-weight: 700;
  font-size: 1.9rem; line-height: 1.05; color: var(--ink-900);
}
.deck-stat-label {
  display: block; font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-300);
  margin-top: 5px;
}
.deck-bar {
  grid-column: 1 / -1; height: 8px; border-radius: 4px;
  background: var(--sand-200); overflow: hidden; margin-top: 6px;
}
.deck-bar-fill {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--iris-500), var(--amber-500));
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.deck-next { grid-column: 1 / -1; margin-top: 4px; line-height: 1.6; }
.deck-stats .sorter-reset { grid-column: 1 / -1; justify-self: start; }
.deck-main { min-width: 0; }
.flashcard {
  position: relative; display: block; width: 100%; height: 270px;
  padding: 0; border: 0; background: none; cursor: pointer; font: inherit;
  perspective: 1300px; border-radius: var(--radius);
}
.flashcard:focus-visible { outline: 2px solid var(--iris-500); outline-offset: 3px; }
.fc-face {
  position: absolute; inset: 0; border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 30px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transition: transform 0.62s cubic-bezier(0.3, 1.25, 0.4, 1);
}
.fc-front {
  background: #FFFDF6; border: 1px solid rgb(13 13 17 / 0.08);
  box-shadow: var(--shadow-card);
}
.fc-back {
  background: var(--ink-900); color: var(--sand-50);
  transform: rotateY(180deg);
}
.flashcard.flipped .fc-front { transform: rotateY(-180deg); }
.flashcard.flipped .fc-back { transform: rotateY(0deg); }
.fc-kicker {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--iris-500);
}
.fc-back .fc-kicker { color: var(--amber-300); }
.fc-term {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.7rem, 4vw, 2.5rem); letter-spacing: -0.02em;
  color: var(--ink-900); text-align: center;
}
.fc-def {
  font-size: clamp(0.98rem, 2vw, 1.2rem); line-height: 1.55;
  color: rgb(250 246 235 / 0.88); text-align: center; max-width: 46ch;
}
.fc-hint {
  position: absolute; bottom: 18px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em;
  color: var(--ink-300);
}
.deck-controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.grade-btn {
  font: inherit; font-weight: 700; font-size: 15px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 10px; border-radius: 14px; cursor: pointer;
  border: 1.5px solid; background: none;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.grade-btn small { font-family: var(--font-mono); font-weight: 400; font-size: 10px; opacity: 0.75; }
.grade-btn:hover { transform: translateY(-2px); }
.grade-btn:disabled { opacity: 0.35; pointer-events: none; }
.grade-again { border-color: var(--amber-500); color: var(--amber-500); }
.grade-again:hover { box-shadow: 0 8px 20px -8px rgb(232 112 58 / 0.5); }
.grade-good { border-color: var(--iris-500); background: var(--iris-500); color: #fff; }
.grade-good:hover { box-shadow: 0 8px 20px -8px rgb(91 84 214 / 0.6); }
.grade-easy { border-color: var(--ink-900); color: var(--ink-900); }
.grade-easy:hover { box-shadow: 0 8px 20px -8px rgb(13 13 17 / 0.4); }
.deck-status { margin-top: 14px; text-align: center; }
.sorter-reset {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.06em;
  color: var(--ink-500); background: none; border: 0; cursor: pointer;
  border-bottom: 1px dashed var(--ink-300); padding: 2px 0;
}
.sorter-reset:hover { color: var(--amber-500); border-color: var(--amber-500); }

/* ============================================================
   EXIT TICKET
   ============================================================ */
.pa-quiz { background: var(--sand-50); }
.quiz { max-width: 780px; margin-inline: auto; }
.quiz-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 14px; margin-bottom: 20px; flex-wrap: wrap;
}
.quiz-dots { display: flex; gap: 7px; }
.quiz-dots i {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--sand-300); transition: background 0.3s;
}
.quiz-dots i.current { background: var(--amber-500); }
.quiz-dots i.answered { background: var(--iris-500); }
.quiz-q {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.2rem, 2.6vw, 1.55rem); line-height: 1.25;
  letter-spacing: -0.01em; margin-bottom: 20px;
}
.quiz-opts { display: grid; gap: 10px; }
.quiz-opt {
  font: inherit; font-size: 15px; text-align: left;
  padding: 13px 16px; border-radius: 14px; cursor: pointer;
  border: 1.5px solid rgb(13 13 17 / 0.14);
  background: var(--sand-50); color: var(--ink-900);
  transition: border-color 0.25s, background 0.25s, transform 0.2s, opacity 0.25s;
}
.quiz-opt:hover { border-color: var(--iris-500); transform: translateY(-1px); }
.quiz-opt:focus-visible { outline: 2px solid var(--iris-500); outline-offset: 2px; }
.quiz-opt.correct { border-color: #2F9E5F; background: rgb(123 227 154 / 0.14); }
.quiz-opt.wrong { border-color: #D64545; background: rgb(214 69 69 / 0.08); animation: shake 0.42s; }
.quiz-opt.dim { opacity: 0.45; pointer-events: none; }
.quiz-opt.locked { pointer-events: none; }
.quiz-feedback {
  min-height: 1.7em; margin-top: 14px;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6;
  color: var(--ink-500);
}
.quiz-feedback.ok { color: #2F9E5F; }
.quiz-feedback.no { color: #C26A2B; }
.quiz-foot { display: flex; justify-content: flex-end; margin-top: 8px; }
.quiz-result { text-align: center; padding-top: 10px; }
.quiz-stamp { width: 150px; margin: 0 auto 20px; color: var(--iris-500); animation: stamp-in 0.55s cubic-bezier(0.2, 1.4, 0.4, 1); }
.quiz-stamp svg { width: 100%; height: auto; display: block; }
@keyframes stamp-in {
  from { transform: rotate(-9deg) scale(2.3); opacity: 0; }
}
.quiz-score {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.6rem, 4vw, 2.3rem); letter-spacing: -0.02em;
}
.quiz-note { color: var(--ink-500); font-size: 15px; margin-top: 8px; }
.quiz-result .sorter-reset { margin-top: 18px; }
@keyframes shake {
  20% { transform: translateX(-6px); } 40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(4px); }
}

/* ---------- closer ---------- */
.pa-closer { padding: clamp(80px, 10vw, 130px) 0; text-align: center; background: var(--sand-100); }
.pa-closer .btn { margin: 6px; }
.pa-closer-big {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1.05; letter-spacing: -0.03em;
  margin-bottom: 34px;
}

/* ---------- chapter dots ---------- */
.chapters {
  position: fixed; right: 20px; top: 50%; transform: translateY(-50%);
  z-index: 900; display: flex; flex-direction: column; gap: 13px;
}
.chapters a {
  position: relative; width: 10px; height: 10px; border-radius: 50%;
  border: 1.5px solid var(--ink-500);
  box-shadow: 0 0 0 3px rgb(250 246 235 / 0.5);
  transition: background 0.3s, border-color 0.3s, transform 0.3s;
}
.chapters a:hover { transform: scale(1.35); }
.chapters a.active { background: var(--amber-500); border-color: var(--amber-500); }
.chapters a span {
  position: absolute; right: 22px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; white-space: nowrap;
  background: var(--ink-900); color: var(--sand-50);
  padding: 4px 9px; border-radius: 7px;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.chapters a:hover span, .chapters a:focus-visible span { opacity: 1; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .chapters { display: none; }
}
@media (max-width: 1020px) {
  .pa-hero-grid { grid-template-columns: 1fr; }
  .hero-smell { margin: 10px auto 0; }
  .rule-grid { grid-template-columns: 1fr; }
  .ev-grid { grid-template-columns: 1fr; }
  .myth-grid { grid-template-columns: 1fr; }
  .myth-flip { min-height: 170px; }
  .deck-wrap { grid-template-columns: 1fr; }
  .deck-stats { max-width: 460px; }
}
@media (max-width: 640px) {
  .flashcard { height: 300px; }
  .diff-read { margin-left: 0; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .beetle-antenna, .smell-dots circle { animation: none !important; }
}
