/* ═══════════════════════════════════════════════
   RISOGRAPH · BROADCAST POSTER — 四下 LEGO 通電 week pages
   專屬於 student_web_四下 目錄
   雙油墨：riso 青 + 朱紅 / 紙底奶油
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,600;0,9..144,800;0,9..144,900;1,9..144,500;1,9..144,600&family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;0,6..72,700;1,6..72,400&family=JetBrains+Mono:wght@400;500&family=Noto+Serif+TC:wght@500;700;900&display=swap');

:root {
  --paper:           #ece2cc;
  --paper-deep:      #e1d5b9;
  --paper-edge:      #c9bd9e;
  --pulp:            #faf2dc;
  --ink:             #1f1d18;
  --ink-soft:        #4a463c;
  --ink-dim:         #75705f;
  --teal:            #2b5560;
  --teal-soft:       #3d6e7a;
  --teal-haze:       rgba(43,85,96,0.10);
  --vermillion:      #c2402d;
  --vermillion-deep: #9c2e1f;
  --vermillion-haze: rgba(194,64,45,0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Newsreader", "Noto Serif TC", serif;
  font-size: 17px;
  line-height: 1.75;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  position: relative;
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(43,85,96,0.05), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(194,64,45,0.04), transparent 60%),
    var(--paper);
}

/* paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.95' seed='2' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.12 0 0 0 0 0.11 0 0 0 0 0.09 0 0 0 0.18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  opacity: 0.55;
  z-index: 1;
}

.mono { font-family: "JetBrains Mono", monospace; }
.digital { font-family: "Fraunces", serif; font-variation-settings: "opsz" 144; font-style: italic; font-weight: 600; }
.stencil { font-family: "Fraunces", serif; font-variation-settings: "opsz" 144; font-weight: 900; letter-spacing: -0.02em; }

/* ═══ MASTHEAD (.brass-mini, kept class name) ═══ */
.brass-mini {
  border-bottom: 2px solid var(--ink);
  padding: 16px 32px 14px;
  position: relative;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  background: var(--paper);
  color: var(--ink);
}
.brass-mini .left {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.brass-mini .left .seal {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  background: var(--vermillion);
  color: var(--pulp);
  font-family: "Fraunces", serif;
  font-weight: 900;
  font-size: 18px;
  transform: rotate(-3deg);
  box-shadow: 2px 2px 0 var(--ink);
}
.brass-mini .meters {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.brass-mini .led {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--vermillion);
  border-radius: 0;
}
.brass-mini .led.green { background: var(--teal); }

/* ═══ MAIN CONTAINER ═══ */
main.console {
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 32px 80px;
  position: relative;
  z-index: 2;
}

/* ═══ BREADCRUMB / NAV STRIP ═══ */
.crumb {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 18px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--paper-edge);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.crumb a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding: 2px 0;
  transition: border-color 0.2s, color 0.2s;
}
.crumb a:hover {
  color: var(--vermillion);
  border-bottom-color: var(--vermillion);
}
.crumb .home {
  font-family: "Fraunces", serif;
  font-style: italic;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--teal);
}
.crumb .muted { opacity: 0.45; }

/* ═══ WEEK HEADER ═══ */
.wk-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 32px;
  align-items: end;
  padding: 8px 0 36px;
  margin-bottom: 44px;
  border-bottom: 2px solid var(--ink);
  position: relative;
}
.wk-band {
  text-align: left;
  border-right: 1px solid var(--paper-edge);
  padding-right: 32px;
}
.wk-band .label {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--ink-dim);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.wk-band .num {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144;
  font-weight: 900;
  font-size: 108px;
  line-height: 0.82;
  color: var(--ink);
  letter-spacing: -0.05em;
  position: relative;
}
.wk-band .num::after {
  content: "";
  position: absolute;
  bottom: 8px; right: -2px;
  width: 18px; height: 18px;
  background: var(--vermillion);
  transform: rotate(-6deg);
  z-index: -1;
}
.wk-band .freq {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--vermillion);
  margin-top: 8px;
  text-transform: uppercase;
}

.wk-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.wk-meta .tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid var(--teal);
  color: var(--teal);
  background: var(--teal-haze);
}
.wk-meta .difficulty {
  color: var(--vermillion);
  font-family: "Fraunces", serif;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

h1.wk-title {
  font-family: "Fraunces", "Noto Serif TC", serif;
  font-variation-settings: "opsz" 144, "SOFT" 50;
  font-weight: 900;
  font-size: clamp(48px, 6.8vw, 88px);
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--ink);
}
h1.wk-title .accent {
  font-style: italic;
  font-weight: 600;
  color: var(--vermillion);
  font-variation-settings: "opsz" 144, "SOFT" 100;
}

.wk-onair {
  align-self: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--pulp);
  background: var(--vermillion);
  padding: 8px 14px;
  text-transform: uppercase;
  animation: ink-pulse 1.8s ease-in-out infinite;
}
@keyframes ink-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.7; }
}

/* ═══ MODULE (paper cards with print-offset shadow) ═══ */
.module {
  background: var(--pulp);
  border: 1.5px solid var(--ink);
  padding: 30px 32px;
  margin-bottom: 24px;
  position: relative;
  box-shadow:
    4px 4px 0 var(--paper-edge),
    4px 4px 0 1.5px var(--ink);
}
.module h2 {
  font-family: "Fraunces", "Noto Serif TC", serif;
  font-variation-settings: "opsz" 60;
  font-weight: 800;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--paper-edge);
  position: relative;
}
.module h2::before {
  content: "";
  display: inline-block;
  width: 14px; height: 14px;
  background: var(--vermillion);
  vertical-align: -2px;
  margin-right: 12px;
  transform: rotate(-4deg);
}

.module p,
.module li {
  font-family: "Newsreader", "Noto Serif TC", serif;
  font-size: 16.5px;
  line-height: 1.75;
  color: var(--ink);
  text-wrap: pretty;
}
.module p + p { margin-top: 10px; }
.module strong {
  font-weight: 600;
  color: var(--vermillion-deep);
  background: linear-gradient(180deg, transparent 60%, rgba(194,64,45,0.16) 60%);
  padding: 0 2px;
}
.module em {
  font-style: italic;
  color: var(--teal);
  font-weight: 500;
}
.module ul, .module ol {
  padding-left: 0;
  list-style: none;
  margin: 12px 0;
}
.module ul li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
}
.module ul li::before {
  content: "";
  position: absolute;
  left: 0; top: 12px;
  width: 8px; height: 8px;
  background: var(--teal);
}
.module ol {
  counter-reset: step;
}
.module ol li {
  position: relative;
  padding-left: 36px;
  margin-bottom: 10px;
  counter-increment: step;
}
.module ol li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 1px;
  width: 24px; height: 24px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--pulp);
  font-family: "Fraunces", serif;
  font-style: italic;
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
}

/* corner stitches (replace screw rivets) — keep .screw class name */
.module .screw {
  position: absolute;
  width: 8px; height: 8px;
  background: var(--ink);
  border-radius: 0;
  opacity: 0.85;
}
.module .screw.tl { top: -5px; left: -5px; }
.module .screw.tr { top: -5px; right: -5px; }
.module .screw.bl { bottom: -5px; left: -5px; }
.module .screw.br { bottom: -5px; right: -5px; }
.module .screw::after {
  content: "";
  position: absolute;
  inset: -2px;
  border: 1px solid var(--ink);
  opacity: 0.4;
}

/* module variants */
.module--live {
  background: var(--pulp);
  border-color: var(--vermillion);
  box-shadow:
    4px 4px 0 var(--vermillion-haze),
    4px 4px 0 1.5px var(--vermillion);
}
.module--live h2::before { background: var(--teal); }
.module--live::before {
  content: "現場";
  position: absolute;
  top: -14px; right: 24px;
  background: var(--vermillion);
  color: var(--pulp);
  font-family: "Fraunces", serif;
  font-style: italic;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  transform: rotate(-3deg);
}

.module--warn {
  background: var(--paper-deep);
  border-color: var(--ink);
  box-shadow:
    4px 4px 0 rgba(194,64,45,0.18),
    4px 4px 0 1.5px var(--vermillion-deep);
}
.module--warn::before {
  content: "注意";
  position: absolute;
  top: -14px; right: 24px;
  background: var(--ink);
  color: var(--pulp);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.28em;
  padding: 5px 12px;
}

/* ═══ STEP FLOW (.step-flow / .step-card / .step-num) ═══ */
.step-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.step-card {
  background: var(--paper);
  border: 1.5px solid var(--ink);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}
.step-card strong {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 36;
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
  background: none;
  padding: 0;
}
.step-card span:not(.step-num) {
  font-family: "Newsreader", serif;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.step-num {
  position: absolute;
  top: -12px; left: 14px;
  width: 28px; height: 28px;
  display: grid;
  place-items: center;
  background: var(--vermillion);
  color: var(--pulp);
  font-family: "Fraunces", serif;
  font-style: italic;
  font-weight: 800;
  font-size: 15px;
  transform: rotate(-4deg);
  box-shadow: 1.5px 1.5px 0 var(--ink);
}

/* ═══ PARTS SHOT (figure.shot) ═══ */
.shot {
  margin: 6px 0 4px;
  padding: 14px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  box-shadow: 3px 3px 0 var(--paper-edge);
}
.shot img {
  display: block;
  width: 100%;
  background: white;
  border: 1px solid var(--paper-edge);
}
.shot figcaption {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--paper-edge);
  font-family: "Newsreader", serif;
  font-style: italic;
  font-size: 14.5px;
  color: var(--ink-soft);
}

/* ═══ STEPS GRID (folded from each week's inline style) ═══ */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 18px 0 22px;
}
@media (max-width: 720px) {
  .steps-grid { grid-template-columns: 1fr; }
}
.steps-grid figure {
  margin: 0;
  padding: 10px 10px 6px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  position: relative;
  box-shadow: 2px 2px 0 var(--paper-edge), 2px 2px 0 1.5px var(--ink);
}
.steps-grid figure img {
  display: block;
  width: 100%;
  background: white;
  border: 1px solid var(--paper-edge);
  cursor: zoom-in;
}
.steps-grid figure figcaption {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--vermillion);
  padding: 8px 2px 2px;
  text-align: center;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(31, 29, 24, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
  cursor: zoom-out;
}
.lightbox.show { display: flex; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  background: white;
  border: 6px solid var(--pulp);
  box-shadow: 0 0 0 1.5px var(--ink), 8px 8px 0 var(--vermillion);
}

/* ═══ MISC ═══ */
.credit {
  font-family: "Newsreader", serif;
  font-style: italic;
  font-size: 13px;
  color: var(--ink-dim);
  margin-top: 8px;
}
.note {
  font-family: "Newsreader", serif;
  font-style: italic;
  font-size: 15.5px;
  color: var(--vermillion-deep);
  background: rgba(194,64,45,0.08);
  border-left: 3px solid var(--vermillion);
  padding: 10px 14px;
  margin-top: 12px;
}

/* bottom nav (between weeks) */
.bot-nav {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 2px solid var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.bot-nav a {
  color: var(--ink);
  text-decoration: none;
  font-family: "Fraunces", serif;
  font-style: italic;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.02em;
  text-transform: none;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.bot-nav a:hover {
  color: var(--vermillion);
  border-bottom-color: var(--vermillion);
}

/* phase icon (if used) */
.ph-icon {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  background: var(--vermillion);
  color: var(--pulp);
  font-family: "Fraunces", serif;
  font-style: italic;
  font-weight: 700;
  font-size: 13px;
  margin-right: 6px;
  vertical-align: -3px;
  transform: rotate(-4deg);
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 880px) {
  main.console { padding: 24px 22px 60px; }
  .wk-header {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .wk-band {
    border-right: none;
    border-bottom: 1px solid var(--paper-edge);
    padding-right: 0;
    padding-bottom: 14px;
  }
  .wk-band .num { font-size: 72px; }
  .wk-onair { justify-self: start; }
  .module { padding: 24px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══ SPIKE 積木排列圖（.blocks）— W20 感應器闖關 ═══
   顏色對齊 SPIKE App 積木分類，學生照顏色找抽屜 */
.blk-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 14px 0 4px;
  font-size: 14px;
  color: var(--ink-soft);
}
.blk-legend span { display: inline-flex; align-items: center; gap: 6px; }
.blk-legend i {
  width: 16px; height: 16px;
  background: var(--c);
  border: 1px solid var(--ink);
  border-radius: 3px;
}
.evt { --c: #f2c230; --t: var(--ink); }
.ctl { --c: #e8902a; --t: #fff; }
.mot { --c: #2f86cc; --t: #fff; }
.sen { --c: #63c6df; --t: var(--ink); }
.lit { --c: #8a5fcf; --t: #fff; }
.op  { --c: #4fa84f; --t: #fff; }
.mov { --c: #e0509f; --t: #fff; }
.rep {
  display: inline-block;
  margin: 0 3px;
  padding: 2px 10px;
  background: var(--c);
  color: var(--t);
  border-radius: 999px;
  border: 1px solid rgba(31,29,24,0.35);
}

.blocks {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  max-width: 100%;
  overflow-x: auto;
  margin: 16px 0 6px;
  padding: 18px 20px 20px;
  background: var(--paper);
  border: 1.5px dashed var(--paper-edge);
  font-family: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.35;
}
.blk, .blk-c {
  background: var(--c);
  color: var(--t);
  border-radius: 5px;
  box-shadow: 2px 2px 0 var(--ink);
  white-space: nowrap;
}
.blk { padding: 8px 14px; }
.blk.hat { border-radius: 18px 18px 5px 5px; padding-top: 12px; }
.blk-c { display: flex; flex-direction: column; min-width: 240px; }
.blk-h { padding: 8px 14px; }
.blk-in {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  margin-left: 18px;
  padding: 4px 8px 4px 0;
  background: var(--paper);
  border-radius: 4px 0 0 4px;
}
.blk-in .blk, .blk-in .blk-c { box-shadow: 1.5px 1.5px 0 var(--ink); }
.blk-f { height: 12px; }
.blk b { font-weight: 800; padding: 0 2px; }
.slot {
  display: inline-block;
  margin: 0 4px;
  padding: 3px 16px;
  background: var(--c);
  color: var(--t);
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0 50%);
}

/* 闖關卡：關卡標頭 */
.level-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  margin-bottom: 6px;
}
.level-tag {
  font-family: "Fraunces", "Noto Serif TC", serif;
  font-style: italic;
  font-weight: 800;
  font-size: 15px;
  color: var(--pulp);
  background: var(--teal);
  padding: 3px 12px;
  transform: rotate(-2deg);
}
.level-tag.must { background: var(--vermillion); }
.level-io {
  font-size: 15px;
  color: var(--ink-soft);
}
.module .level-io strong { background: none; padding: 0; }

.color-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 15.5px;
}
.color-table th, .color-table td {
  border-bottom: 1px dashed var(--paper-edge);
  padding: 8px 10px;
  text-align: left;
}
.color-table th { font-family: "Fraunces", "Noto Serif TC", serif; font-weight: 700; border-bottom: 1.5px solid var(--ink); }
.swatch {
  display: inline-block;
  width: 14px; height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 1px solid var(--ink);
}

@media (max-width: 640px) {
  .blocks { font-size: 14px; padding: 14px 12px 16px; }
  .blk-c { min-width: 0; }
}
