/* 六上 week pages — 工程藍圖 × 牛墟 視覺語言
   對應 index.html style tokens。沿用 week_*.html 既有 class。 */

@import url("https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Bebas+Neue&family=Big+Shoulders+Stencil+Display:wght@500;700;900&family=Long+Cang&family=Noto+Serif+TC:wght@700;900&family=Noto+Sans+TC:wght@400;500;700&display=swap");

* { box-sizing: border-box; }

:root {
  --bp-deep: #042037;
  --bp: #0a3a5e;
  --bp-mid: #145080;
  --bp-light: #2c6e9c;
  --line: #e0eef8;
  --line-dim: #7aa8c8;
  --line-faint: #4a7a9a;
  --grid: rgba(160, 200, 230, 0.10);
  --grid-major: rgba(160, 200, 230, 0.25);
  --tw-red: #c8232c;
  --tw-red-deep: #8b0e15;
  --tw-red-glow: #ff5161;
  --tan: #c89968;
  --tan-deep: #8a6840;
  --ivory: #ede2c4;
  --ivory-dim: #d4c5a4;
  --gold: #d4a942;
  --gold-soft: rgba(212, 169, 66, 0.12);
  --ink: #1a1209;
  --panel-bg: rgba(10, 58, 94, 0.55);
  --panel-bg-strong: rgba(10, 58, 94, 0.78);
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bp-deep);
  color: var(--line);
  font-family: "Noto Sans TC", "PingFang TC", -apple-system, sans-serif;
  font-size: 17px;
  line-height: 1.85;
  letter-spacing: 0.01em;
}

body {
  background:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    radial-gradient(ellipse at 50% 0%, var(--bp) 0%, var(--bp-deep) 65%);
  background-size: 24px 24px, 24px 24px, 120px 120px, 120px 120px, 100% 100%;
  min-height: 100vh;
  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.85' seed='6'/%3E%3CfeColorMatrix values='0 0 0 0 0.6 0 0 0 0 0.8 0 0 0 0 0.95 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: screen;
  opacity: 0.45;
  z-index: 0;
}

a { color: var(--gold); text-decoration: none; transition: color .2s; }
a:hover, a:focus-visible { color: var(--tw-red-glow); text-decoration: none; }
svg { display: block; }

.site-wrap {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 22px 80px;
}

/* ═══ NAV (上下兩條) ═══ */
.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 6px 0 22px;
  padding: 10px 14px;
  border: 1px dashed var(--line-faint);
  font-family: "Share Tech Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  background: rgba(4, 32, 55, 0.5);
}
.nav a, .nav span {
  padding: 6px 14px;
  border: 1px solid var(--line-faint);
  color: var(--line);
  background: rgba(20, 80, 128, 0.35);
  font-weight: 500;
  letter-spacing: 0.16em;
  transition: all .2s;
}
.nav a:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-soft);
}
.nav span.muted {
  color: var(--line-faint);
  border-style: dashed;
  background: transparent;
}

/* ═══ WEEK HEADER (drawing title block style) ═══ */
.week-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 22px;
  align-items: center;
  padding: 24px 28px;
  margin-bottom: 22px;
  background: var(--panel-bg-strong);
  border: 1.5px solid var(--line);
  position: relative;
}
.week-header::before {
  content: "SHEET · GR6-S2";
  position: absolute;
  top: -10px; left: 18px;
  padding: 0 10px;
  background: var(--bp-deep);
  font-family: "Share Tech Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--gold);
}
.week-header::after {
  content: "REV 114-S2";
  position: absolute;
  top: -10px; right: 18px;
  padding: 0 10px;
  background: var(--bp-deep);
  font-family: "Share Tech Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--tw-red-glow);
}
.week-icon {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--gold);
  background: var(--gold-soft);
  color: var(--gold);
}
.week-icon svg { width: 60px; height: 60px; color: var(--gold); }
.week-icon svg path[fill] { fill: var(--gold-soft) !important; stroke: var(--gold); }
.week-label {
  margin: 0 0 6px;
  font-family: "Share Tech Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--line-dim);
  text-transform: uppercase;
}
.week-header h1 {
  margin: 0;
  font-family: "Noto Serif TC", serif;
  font-weight: 900;
  font-size: clamp(24px, 4.2vw, 38px);
  line-height: 1.25;
  color: var(--line);
  letter-spacing: -0.01em;
}

/* corner index for week (visible on wide) */
.week-header .week-icon::after {
  display: none;
}

/* ═══ PANEL (each section) ═══ */
.panel {
  position: relative;
  padding: 22px 24px 20px;
  margin-bottom: 16px;
  background: var(--panel-bg);
  border: 1px solid var(--line-faint);
  backdrop-filter: blur(2px);
}
.panel::before {
  content: "";
  position: absolute;
  top: -1px; left: -1px;
  width: 16px; height: 16px;
  border-top: 2px solid var(--gold);
  border-left: 2px solid var(--gold);
}
.panel::after {
  content: "";
  position: absolute;
  bottom: -1px; right: -1px;
  width: 16px; height: 16px;
  border-bottom: 2px solid var(--gold);
  border-right: 2px solid var(--gold);
}
.panel h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 14px;
  padding-bottom: 10px;
  font-family: "Noto Serif TC", serif;
  font-weight: 900;
  font-size: 1.35rem;
  line-height: 1.45;
  color: var(--line);
  border-bottom: 1px dashed var(--line-faint);
}
.panel h2::before {
  content: "◢";
  color: var(--gold);
  font-size: 0.7em;
  flex: 0 0 auto;
}
.panel p { margin: 0 0 12px; color: var(--line); }
.panel p:last-child { margin-bottom: 0; }
.panel strong { color: var(--gold); font-weight: 700; }
.panel ul { margin: 6px 0 12px; padding-left: 22px; }
.panel ul li { margin-bottom: 6px; }
.panel ul li::marker { color: var(--gold); }

/* lego-panel variant — 牛墟 wood accent */
.panel.lego-panel {
  border-left: 4px solid var(--tw-red-glow);
  background:
    linear-gradient(90deg, rgba(200, 35, 44, 0.12), transparent 30%),
    var(--panel-bg);
}
.panel.lego-panel h2 { color: var(--tw-red-glow); }
.panel.lego-panel h2::before { color: var(--tw-red-glow); }

/* ═══ STEP LIST (panel > ol) — 用 absolute 而非 grid，避開 <strong> bug ═══ */
.panel > ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: lesson-step;
}
.panel > ol > li {
  position: relative;
  padding: 14px 16px 14px 70px;
  margin-bottom: 10px;
  border: 1px solid var(--line-faint);
  background: rgba(20, 80, 128, 0.3);
  color: var(--line);
}
.panel > ol > li::before {
  counter-increment: lesson-step;
  content: counter(lesson-step, decimal-leading-zero);
  position: absolute;
  top: 12px;
  left: 12px;
  width: 44px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--gold);
  background: var(--gold-soft);
  font-family: "Big Shoulders Stencil Display", sans-serif;
  font-size: 18px;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 0.08em;
}

/* ═══ HARDWARE GRID (recap cards) ═══ */
.hardware-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.hardware-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 12px;
  background: rgba(4, 32, 55, 0.6);
  border: 1px solid var(--line-faint);
  position: relative;
}
.hardware-card::before {
  content: "";
  position: absolute;
  top: -1px; left: -1px;
  width: 10px; height: 10px;
  border-top: 1.5px solid var(--gold);
  border-left: 1.5px solid var(--gold);
}
.hardware-card .hw-art {
  width: 100px;
  height: 100px;
  display: grid;
  place-items: center;
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  color: var(--gold);
  margin-bottom: 12px;
  overflow: hidden;
}
.hardware-card .hw-art svg { width: 70px; height: 70px; }
.hardware-card .hw-art img.shot {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hardware-card strong {
  display: block;
  font-family: "Noto Serif TC", serif;
  font-size: 1rem;
  margin-bottom: 4px;
  color: var(--line);
  font-weight: 700;
}
.hardware-card span.hw-desc {
  font-size: 0.88rem;
  color: var(--line-dim);
  line-height: 1.5;
  letter-spacing: 0.02em;
}

/* ═══ SHOT PENDING (image fallback) ═══ */
.shot-pending {
  display: grid;
  place-items: center;
  gap: 6px;
  width: 100%;
  height: 100%;
  min-height: 96px;
  padding: 10px;
  background:
    repeating-linear-gradient(45deg,
      transparent 0 8px,
      rgba(212, 169, 66, 0.08) 8px 16px),
    rgba(4, 32, 55, 0.6);
  border: 1px dashed var(--gold);
  color: var(--gold);
  text-align: center;
  font-family: "Share Tech Mono", monospace;
}
.shot-pending .ph-icon { font-size: 24px; line-height: 1; }
.shot-pending code {
  font-size: 0.72rem;
  background: var(--bp-deep);
  padding: 2px 6px;
  color: var(--line);
  word-break: break-all;
  letter-spacing: 0.08em;
}
.shot-pending small {
  font-size: 0.7rem;
  color: var(--line-dim);
  line-height: 1.4;
  letter-spacing: 0.05em;
}

/* ═══ CODE SHOTS ═══ */
.code-shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.code-shot {
  margin: 0;
  padding: 12px;
  background: rgba(4, 32, 55, 0.6);
  border: 1px solid var(--line-faint);
  position: relative;
}
.code-shot::after {
  content: "DETAIL";
  position: absolute;
  top: -1px; right: 8px;
  padding: 1px 6px;
  background: var(--bp-deep);
  font-family: "Share Tech Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--line-faint);
}
.code-shot img.shot {
  width: 100%;
  display: block;
  border: 1px solid var(--line-faint);
}
.code-shot .shot-pending { min-height: 180px; }
.code-shot figcaption {
  margin: 10px 4px 0;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.82rem;
  color: var(--line-dim);
  text-align: center;
  line-height: 1.5;
  letter-spacing: 0.06em;
}

/* ═══ STEP FLOW (numbered process cards) ═══ */
.step-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.step-card {
  padding: 16px 14px;
  background: rgba(20, 80, 128, 0.3);
  border: 1px solid var(--line-faint);
  text-align: center;
  position: relative;
}
.step-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: var(--gold);
  opacity: 0.6;
}
.step-card .step-num {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: var(--gold);
  color: var(--bp-deep);
  font-family: "Big Shoulders Stencil Display", sans-serif;
  font-weight: 900;
  font-size: 18px;
  margin-bottom: 10px;
  letter-spacing: 0;
}
.step-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--line);
  font-family: "Noto Serif TC", serif;
  font-weight: 700;
}
.step-card span {
  color: var(--line-dim);
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

/* ═══ TIP GRID (warning callouts — 牛墟 amber) ═══ */
.tip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.tip-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(212, 169, 66, 0.12), transparent 60%),
    rgba(4, 32, 55, 0.6);
  border: 1px solid var(--gold);
  border-left-width: 3px;
}
.tip-card .tip-icon {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  color: var(--gold);
}
.tip-card .tip-icon svg { width: 28px; height: 28px; }
.tip-card strong {
  display: block;
  margin-bottom: 2px;
  color: var(--gold);
  font-family: "Noto Serif TC", serif;
  font-weight: 700;
}
.tip-card span {
  font-size: 0.9rem;
  color: var(--line-dim);
  line-height: 1.5;
  letter-spacing: 0.02em;
}

/* ═══ RESOURCES GRID (external links) ═══ */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.resource-link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: rgba(20, 80, 128, 0.3);
  border: 1px solid var(--line-faint);
  color: var(--line) !important;
  transition: all .2s;
}
.resource-link:hover {
  background: var(--gold-soft);
  border-color: var(--gold);
  text-decoration: none;
}
.resource-link::after {
  content: "↗";
  margin-left: auto;
  color: var(--gold);
  align-self: center;
  font-size: 1.1rem;
}
.resource-link .res-tag {
  flex: 0 0 auto;
  padding: 4px 10px;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  border: 1px solid;
  background: rgba(4, 32, 55, 0.5);
}
.resource-link .res-tag.video { color: var(--tw-red-glow); border-color: var(--tw-red-glow); }
.resource-link .res-tag.web { color: var(--line); border-color: var(--line); }
.resource-link .res-tag.wiki { color: var(--gold); border-color: var(--gold); }
.resource-link .res-tag.lego { color: var(--tw-red-glow); border-color: var(--tw-red-glow); }
.resource-link strong {
  display: block;
  margin-bottom: 2px;
  color: var(--line);
  font-family: "Noto Serif TC", serif;
  font-weight: 700;
}
.resource-link span {
  font-size: 0.86rem;
  color: var(--line-dim);
  display: block;
  letter-spacing: 0.02em;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 700px) {
  body { font-size: 16px; }
  .site-wrap { padding: 18px 14px 50px; }
  .week-header {
    grid-template-columns: 1fr;
    text-align: left;
    padding: 22px 18px;
  }
  .week-icon { width: 64px; height: 64px; }
  .week-icon svg { width: 50px; height: 50px; }
  .panel { padding: 18px 16px; }
  .panel > ol > li { padding: 12px 14px 12px 60px; }
  .panel > ol > li::before { width: 38px; height: 28px; font-size: 15px; left: 10px; top: 11px; }
}

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