:root {
  color-scheme: light;
  --paper: #f7f4ec;
  --sheet: #fffdf7;
  --ink: #151515;
  --muted: #68645b;
  --line: #1d1d1d;
  --red: #e34b3f;
  --blue: #2b68d8;
  --green: #15845f;
  --yellow: #f2c94c;
  --stone: #dfd8cb;
  --max: 1180px;
  --shadow: 0 12px 0 rgba(21, 21, 21, .08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(21, 21, 21, .045) 1px, transparent 1px) 0 0 / 36px 36px,
    linear-gradient(rgba(21, 21, 21, .04) 1px, transparent 1px) 0 0 / 36px 36px,
    var(--paper);
  font-family: Inter, "Noto Sans TC", "Microsoft JhengHei", Arial, sans-serif;
  font-size: 18px;
  line-height: 1.65;
  letter-spacing: 0;
  overflow-x: hidden;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

[data-lang="zh"] {
  display: none;
}

body.lang-zh [data-lang="en"] {
  display: none;
}

body.lang-zh [data-lang="zh"] {
  display: revert;
}

.skip-link {
  position: absolute;
  top: -48px;
  left: 18px;
  z-index: 30;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--sheet);
}

.skip-link:focus {
  top: 18px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 2px solid var(--line);
  background: rgba(247, 244, 236, .94);
  backdrop-filter: blur(12px);
}

.nav {
  width: min(var(--max), calc(100% - 32px));
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  font-weight: 850;
  text-decoration: none;
  line-height: 1.1;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: .88rem;
  font-weight: 750;
}

.nav-links a {
  text-decoration: none;
  text-underline-offset: 5px;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  text-decoration: underline;
}

.lang-toggle {
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--sheet);
  padding: 7px 12px;
  font: inherit;
  font-size: .84rem;
  font-weight: 850;
  cursor: pointer;
}

.notebook {
  width: min(var(--max), calc(100% - 32px));
  margin: 34px auto;
  background: var(--sheet);
  border: 2px solid var(--line);
  box-shadow: var(--shadow);
}

.hero {
  min-height: calc(100vh - 110px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, .7fr);
}

.hero-copy,
.hero-visual {
  min-width: 0;
}

.hero-copy {
  padding: clamp(40px, 7vw, 82px);
  display: grid;
  align-content: space-between;
  gap: 40px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .08em;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(3rem, 7.2vw, 7rem);
  max-width: 880px;
  font-weight: 900;
}

h2 {
  font-size: clamp(2.1rem, 5vw, 4.6rem);
  font-weight: 900;
}

h3 {
  font-size: clamp(1.25rem, 2.1vw, 1.75rem);
  font-weight: 850;
}

.lead {
  max-width: 760px;
  margin: 24px 0 0;
  color: #2d2b26;
  font-size: clamp(1.12rem, 1.8vw, 1.42rem);
  line-height: 1.55;
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 2px solid var(--line);
  border-left: 2px solid var(--line);
}

.meta-cell {
  min-height: 96px;
  padding: 14px;
  border-right: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  background: #fbf7e9;
}

.meta-cell strong {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.meta-cell span {
  display: block;
  margin-top: 6px;
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.25;
}

.hero-visual {
  border-left: 2px solid var(--line);
  background: var(--ink);
  color: var(--sheet);
  display: grid;
  align-content: stretch;
}

.visual-board {
  min-height: 100%;
  padding: 34px;
  display: grid;
  align-content: center;
  gap: 20px;
}

.screenshot-stack {
  display: grid;
  gap: 16px;
}

.screenshot-frame {
  overflow: hidden;
  border: 2px solid var(--sheet);
  background: #fff;
  box-shadow: 10px 10px 0 rgba(255,255,255,.15);
}

.screenshot-frame img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top left;
}

.caption {
  margin: 10px 0 0;
  color: rgba(255,255,255,.78);
  font-size: .86rem;
}

.page-section {
  border-top: 2px solid var(--line);
}

.section-inner {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(56px, 8vw, 108px) 0;
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(320px, .55fr);
  gap: 42px;
  align-items: end;
  margin-bottom: 34px;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 1.06rem;
}

.rule {
  width: min(420px, 100%);
  height: 10px;
  margin-top: 22px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 42px, transparent 42px 58px);
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 20px;
}

.grid-2 > *,
.grid-3 > *,
.grid-4 > * {
  min-width: 0;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.note-card,
.module-card,
.tool-card,
.activity-card {
  min-width: 0;
  border: 2px solid var(--line);
  background: var(--sheet);
}

.note-card {
  padding: 22px;
}

.note-card.accent-red {
  border-top: 10px solid var(--red);
}

.note-card.accent-blue {
  border-top: 10px solid var(--blue);
}

.note-card.accent-green {
  border-top: 10px solid var(--green);
}

.note-card.accent-yellow {
  border-top: 10px solid var(--yellow);
}

.note-card p,
.tool-card p,
.activity-card p,
.module-card p {
  margin: 12px 0 0;
  color: #34312c;
}

.module-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.module-index {
  padding: 12px 16px;
  border-bottom: 2px solid var(--line);
  background: var(--ink);
  color: var(--sheet);
  font-size: .82rem;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.module-body {
  padding: 22px;
}

.module-link {
  display: block;
  padding: 14px 18px;
  border-top: 2px solid var(--line);
  background: #f3eee2;
  font-weight: 850;
  text-decoration: none;
}

.module-link:hover,
.module-link:focus-visible {
  background: var(--yellow);
}

.schedule {
  border: 2px solid var(--line);
  background: var(--sheet);
}

.schedule-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) minmax(220px, .42fr);
  border-top: 2px solid var(--line);
}

.schedule-row:first-child {
  border-top: 0;
}

.schedule-time,
.schedule-topic,
.schedule-output {
  padding: 16px;
  min-width: 0;
}

.schedule-time {
  border-right: 2px solid var(--line);
  background: #f3eee2;
  font-weight: 850;
}

.schedule-topic {
  border-right: 2px solid var(--line);
}

.schedule-topic strong {
  display: block;
  font-size: 1.08rem;
}

.schedule-topic span,
.schedule-output {
  color: var(--muted);
  font-size: .94rem;
}

.flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
  gap: 0;
  border: 2px solid var(--line);
  background: var(--sheet);
}

.flow-step {
  position: relative;
  padding: 22px 18px;
  min-height: 160px;
  border-right: 2px solid var(--line);
}

.flow-step:last-child {
  border-right: 0;
}

.flow-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -11px;
  width: 20px;
  height: 20px;
  border-top: 2px solid var(--line);
  border-right: 2px solid var(--line);
  background: var(--sheet);
  transform: translateY(-50%) rotate(45deg);
  z-index: 2;
}

.flow-step strong {
  display: block;
  margin-bottom: 10px;
}

.image-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
}

.image-note {
  border: 2px solid var(--line);
  background: var(--sheet);
}

.image-note[id],
.template-box[id] {
  scroll-margin-top: 96px;
}

.image-note img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: top left;
  border-bottom: 2px solid var(--line);
}

.image-note figcaption {
  padding: 14px 16px;
  color: var(--muted);
  font-size: .9rem;
}

.template-box {
  min-width: 0;
  overflow: hidden;
  border: 2px solid var(--line);
  background:
    linear-gradient(rgba(21,21,21,.05) 1px, transparent 1px) 0 0 / 100% 32px,
    var(--sheet);
  padding: 26px;
}

.template-box pre {
  max-width: 100%;
  margin: 16px 0 0;
  padding: 16px;
  overflow-x: auto;
  border: 2px solid var(--line);
  background: #1e1e1e;
  color: #f4efe6;
  font-size: .88rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.template-box code {
  font-family: Consolas, "Liberation Mono", monospace;
}

.template-box ol,
.template-box ul,
.note-card ul,
.activity-card ul {
  margin: 14px 0 0;
  padding-left: 1.25rem;
}

.template-box li,
.note-card li,
.activity-card li {
  margin: 7px 0;
}

.unit-hero {
  width: min(var(--max), calc(100% - 32px));
  min-height: 78vh;
  margin: 34px auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, .58fr);
  border: 2px solid var(--line);
  background: var(--sheet);
  box-shadow: var(--shadow);
}

.unit-hero-copy {
  padding: clamp(34px, 6vw, 74px);
}

.unit-hero h1 {
  font-size: clamp(2.8rem, 6vw, 5.6rem);
  overflow-wrap: break-word;
}

.unit-side {
  border-left: 2px solid var(--line);
  background: #f3eee2;
  padding: 28px;
  display: grid;
  align-content: center;
}

.side-box {
  border: 2px solid var(--line);
  background: var(--sheet);
  padding: 20px;
}

.side-box + .side-box {
  margin-top: 16px;
}

.footer {
  border-top: 2px solid var(--line);
  background: var(--ink);
  color: var(--sheet);
}

.footer-inner {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  font-size: .9rem;
}

.next-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 12px 18px;
  border: 2px solid var(--line);
  background: var(--ink);
  color: var(--sheet);
  font-weight: 850;
  text-decoration: none;
}

.button-link.secondary {
  background: var(--sheet);
  color: var(--ink);
}

@media (prefers-reduced-motion: no-preference) {
  .note-card,
  .module-card,
  .image-note,
  .tool-card {
    transition: transform .18s ease, box-shadow .18s ease;
  }

  .note-card:hover,
  .module-card:hover,
  .image-note:hover,
  .tool-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 0 rgba(21,21,21,.08);
  }
}

@media (max-width: 980px) {
  .nav {
    align-items: flex-start;
    padding: 12px 0;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .hero,
  .unit-hero,
  .section-head,
  .grid-2,
  .grid-3,
  .grid-4,
  .image-grid {
    grid-template-columns: 1fr;
  }

  .hero-visual,
  .unit-side {
    border-left: 0;
    border-top: 2px solid var(--line);
  }

  .flow {
    grid-template-columns: 1fr;
  }

  .flow-step {
    border-right: 0;
    border-bottom: 2px solid var(--line);
  }

  .flow-step:last-child {
    border-bottom: 0;
  }

  .flow-step:not(:last-child)::after {
    top: auto;
    right: 50%;
    bottom: -11px;
    transform: translateX(50%) rotate(135deg);
  }
}

@media (max-width: 700px) {
  body {
    font-size: 16px;
  }

  .notebook,
  .unit-hero {
    width: calc(100% - 20px);
    margin: 18px auto;
  }

  h1 {
    font-size: clamp(2.1rem, 12vw, 3.2rem);
  }

  h2 {
    font-size: clamp(1.75rem, 9vw, 2.4rem);
  }

  .nav {
    display: grid;
    gap: 10px;
  }

  .nav-links {
    justify-content: flex-start;
    gap: 10px;
  }

  .hero-copy,
  .unit-hero-copy {
    padding: 28px;
  }

  .hero-meta,
  .schedule-row {
    grid-template-columns: 1fr;
  }

  .schedule-time,
  .schedule-topic {
    border-right: 0;
    border-bottom: 2px solid var(--line);
  }

  .next-nav {
    flex-direction: column;
  }
}
