/* ═══════════════════════════════════════════════
   VOXEL CONSTRUCTION — 三下 LEGO 不插電 week pages
   專屬於 student_web_三下 目錄，不影響其他學期
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Silkscreen:wght@400;700&family=Noto+Serif+TC:wght@700;900&family=Noto+Sans+TC:wght@400;500;700&display=swap');

:root {
  --yellow: #FFD400;
  --yellow-soft: #FFEB7A;
  --red: #E63946;
  --blue: #1D4ED8;
  --blue-deep: #0C2B85;
  --green: #15803D;
  --ink: #0B0B0B;
  --ink-soft: #2A2520;
  --paper: #F6F1E1;
  --paper-deep: #ECE4CD;
  --grid: rgba(11,11,11,0.055);
  --grid-bold: rgba(11,11,11,0.13);
}

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

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Sans TC", -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  line-height: 1.75;
  overflow-x: hidden;
}

body {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(var(--grid-bold) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-bold) 1px, transparent 1px);
  background-size: 24px 24px, 24px 24px, 120px 120px, 120px 120px;
  position: relative;
}

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

.mono { font-family: "Silkscreen", "Courier New", ui-monospace, monospace; }
.display { font-family: "Noto Serif TC", "PingFang TC", serif; font-weight: 900; letter-spacing: -0.02em; }

/* ═══ TOP HAZARD MINI BAR ═══ */
.hazard-mini {
  background: var(--yellow);
  color: var(--ink);
  border-top: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  padding: 8px 0;
  position: relative;
  overflow: hidden;
  z-index: 3;
  font-family: "Silkscreen", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-align: center;
}
.hazard-mini::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(-45deg,
    var(--ink) 0 8px,
    transparent 8px 22px);
  opacity: 0.1;
  pointer-events: none;
}

/* ═══ MAIN ═══ */
main.site {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 28px 80px;
  position: relative;
  z-index: 2;
}

/* breadcrumb / inline nav */
.crumb {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 2px dashed var(--ink);
  font-family: "Silkscreen", monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  flex-wrap: wrap;
  gap: 14px;
}
.crumb a {
  color: var(--ink);
  text-decoration: none;
  padding: 6px 14px;
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.2s, box-shadow 0.2s;
}
.crumb a:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--red);
}
.crumb .muted {
  color: #908779;
  padding: 6px 14px;
}
.crumb .home {
  background: var(--yellow);
  font-weight: 700;
}

/* ═══ WEEK HEADER ═══ */
.wk-header {
  margin-bottom: 36px;
  padding: 28px 28px 24px;
  background: var(--paper);
  border: 3.5px solid var(--ink);
  position: relative;
  box-shadow: 8px 8px 0 var(--ink);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: center;
}
.wk-header::before {
  content: "▼ WORK ORDER ▼";
  position: absolute;
  top: -12px;
  left: 24px;
  background: var(--paper);
  padding: 0 12px;
  font-family: "Silkscreen", monospace;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--red);
}

.wk-num-box {
  width: 88px;
  height: 88px;
  background: var(--yellow);
  border: 3px solid var(--ink);
  display: grid;
  place-items: center;
  text-align: center;
  position: relative;
  box-shadow: 4px 4px 0 var(--ink);
  flex-shrink: 0;
}
.wk-num-box .label {
  font-family: "Silkscreen", monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--ink);
  margin-bottom: 2px;
}
.wk-num-box .num {
  font-family: "Noto Serif TC", serif;
  font-weight: 900;
  font-size: 38px;
  line-height: 0.9;
  color: var(--ink);
}

.wk-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-family: "Silkscreen", monospace;
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--ink-soft);
  flex-wrap: wrap;
}
.wk-meta .difficulty {
  color: var(--red);
  letter-spacing: 0.1em;
  font-size: 13px;
}
.wk-meta .tag {
  padding: 3px 10px;
  background: var(--ink);
  color: var(--paper);
  font-size: 9px;
}
.wk-title {
  font-family: "Noto Serif TC", serif;
  font-weight: 900;
  font-size: clamp(28px, 4.2vw, 42px);
  line-height: 1.15;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.wk-title .accent {
  color: var(--red);
  position: relative;
}
.wk-title .accent::after {
  content: "";
  position: absolute;
  left: -2%; right: -2%; bottom: 8%;
  height: 12px;
  background: var(--yellow);
  z-index: -1;
  transform: rotate(-1deg);
}

/* ═══ MODULE PANELS ═══ */
.module {
  background: var(--paper);
  border: 3px solid var(--ink);
  padding: 28px 30px 26px;
  margin-bottom: 28px;
  position: relative;
  box-shadow: 6px 6px 0 var(--ink);
}
.module h2 {
  font-family: "Noto Serif TC", serif;
  font-weight: 900;
  font-size: 24px;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ink);
  position: relative;
}
.module h2::before {
  content: "■";
  color: var(--red);
  margin-right: 10px;
}
.module p { margin-bottom: 14px; font-size: 16px; color: var(--ink-soft); }
.module p:last-child { margin-bottom: 0; }
.module strong { color: var(--ink); font-weight: 700; }
.module .note {
  background: var(--yellow-soft);
  padding: 12px 16px;
  border-left: 4px solid var(--red);
  font-size: 14.5px;
  margin: 14px 0;
}

/* corner studs (LEGO peg) */
.module::before, .module::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: var(--paper);
}
.module::before { top: -8px; left: 24px; }
.module::after  { top: -8px; right: 24px; }

/* highlighted module variant (yellow accent) */
.module--highlight {
  background:
    repeating-linear-gradient(45deg, transparent 0 14px, rgba(255,212,0,0.15) 14px 28px),
    var(--paper);
  border-color: var(--ink);
  box-shadow: 6px 6px 0 var(--red);
}
.module--highlight h2::before { color: var(--blue); content: "★"; }

/* danger module (warning) */
.module--warn {
  background: var(--yellow-soft);
  border-color: var(--red);
  box-shadow: 6px 6px 0 var(--red);
}
.module--warn h2 { color: var(--red); }

/* ═══ FIGURE / CODE-SHOT ═══ */
.shot {
  margin: 18px 0 22px;
  padding: 14px 14px 0;
  background: var(--paper-deep);
  border: 2.5px dashed var(--ink);
  position: relative;
}
.shot::before {
  content: "▣ FIG.";
  position: absolute;
  top: -10px;
  left: 18px;
  background: var(--paper);
  padding: 0 8px;
  font-family: "Silkscreen", monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--red);
}
.shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 2px solid var(--ink);
  background: white;
}
.shot figcaption {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 14px;
  color: var(--ink-soft);
  padding: 10px 4px 14px;
  text-align: center;
  font-weight: 500;
}
.shot figcaption strong { color: var(--ink); }

/* placeholder when image missing */
.shot-pending {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 36px 18px;
  background: var(--paper-deep);
  border: 2px dashed var(--ink);
  font-family: "Silkscreen", monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
}
.shot-pending .ph-icon { font-size: 24px; }
.shot-pending code { font-family: "Silkscreen", monospace; color: var(--red); }
.shot-pending small { color: #888; font-size: 10px; }

/* ═══ TIP / RULE GRID ═══ */
.tip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin: 18px 0 8px;
}
.tip-card {
  background: var(--paper);
  border: 2.5px solid var(--ink);
  padding: 18px 16px 16px 56px;
  position: relative;
  box-shadow: 4px 4px 0 var(--ink);
}
.tip-card .tip-icon {
  position: absolute;
  top: 14px;
  left: 12px;
  width: 36px;
  height: 36px;
  background: var(--yellow);
  border: 2.5px solid var(--ink);
  display: grid;
  place-items: center;
  color: var(--ink);
}
.tip-card .tip-icon svg {
  width: 22px;
  height: 22px;
}
.tip-card strong {
  display: block;
  font-family: "Noto Serif TC", serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 4px;
}
.tip-card span {
  font-size: 14px;
  color: var(--ink-soft);
  display: block;
}

/* second-color variants */
.tip-card:nth-child(3n+2) .tip-icon { background: var(--red); color: var(--paper); }
.tip-card:nth-child(3n+3) .tip-icon { background: var(--blue); color: var(--paper); }

/* ═══ LISTS ═══ */
.module ol {
  list-style: none;
  counter-reset: vox;
  margin: 14px 0 6px;
}
.module ol > li {
  counter-increment: vox;
  position: relative;
  padding: 8px 0 8px 56px;
  margin-bottom: 4px;
  border-bottom: 1px dashed rgba(0,0,0,0.15);
  font-size: 15.5px;
  color: var(--ink-soft);
}
.module ol > li::before {
  content: counter(vox, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 8px;
  width: 42px;
  text-align: center;
  font-family: "Silkscreen", monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--red);
  background: var(--yellow);
  border: 2px solid var(--ink);
  padding: 2px 4px;
  letter-spacing: 0.1em;
}
.module ol > li strong { color: var(--ink); font-weight: 700; }

.module ul {
  list-style: none;
  margin: 12px 0;
  padding-left: 0;
}
.module ul > li {
  position: relative;
  padding: 5px 0 5px 28px;
  font-size: 15px;
  color: var(--ink-soft);
}
.module ul > li::before {
  content: "▸";
  position: absolute;
  left: 4px;
  color: var(--red);
  font-weight: 700;
}

/* ═══ FLOW TABLE ═══ */
.flow-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 16px 0 8px;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  font-size: 14.5px;
}
.flow-table th, .flow-table td {
  padding: 10px 14px;
  border-bottom: 1.5px solid var(--ink);
  text-align: left;
  vertical-align: top;
}
.flow-table tr:last-child th, .flow-table tr:last-child td { border-bottom: none; }
.flow-table th {
  background: var(--ink);
  color: var(--paper);
  font-family: "Silkscreen", monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  font-weight: 400;
}
.flow-table td:first-child {
  font-family: "Silkscreen", monospace;
  font-size: 12px;
  color: var(--red);
  font-weight: 700;
  border-right: 1.5px solid var(--ink);
  background: var(--yellow);
  width: 80px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* ═══ BOTTOM NAV ═══ */
.bot-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 2px dashed var(--ink);
  gap: 14px;
  flex-wrap: wrap;
}
.bot-nav a, .bot-nav span {
  display: inline-block;
  padding: 12px 18px;
  border: 3px solid var(--ink);
  background: var(--paper);
  font-family: "Silkscreen", monospace;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 0.2s, box-shadow 0.2s;
}
.bot-nav a:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--red);
}
.bot-nav .home { background: var(--yellow); }
.bot-nav .muted {
  color: #908779;
  background: transparent;
  border-color: rgba(0,0,0,0.2);
  box-shadow: none;
  cursor: default;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 720px) {
  main.site { padding: 24px 18px 60px; }
  .wk-header {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 22px 20px 20px;
    box-shadow: 6px 6px 0 var(--ink);
  }
  .wk-num-box { width: 72px; height: 72px; }
  .wk-num-box .num { font-size: 32px; }
  .module { padding: 22px 22px 20px; box-shadow: 5px 5px 0 var(--ink); }
  .module ol > li { padding-left: 50px; }
  .crumb { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
  }
}
