:root {
  --font-heading: "Noto Serif TC", serif;
  --font-body: "Chiron Hei HK", "Microsoft JhengHei", sans-serif;

  --bg: #f4efe7;
  --paper: #fffaf2;
  --ink: #102a2e;
  --ink-soft: #35555b;
  --line: #d8cfc3;

  --brand: #0f5d66;
  --brand-deep: #07333a;
  --accent: #d95d39;
  --accent-soft: #ffd7c6;
  --sun: #f2b880;

  --radius: 16px;
  --shadow: 0 10px 24px rgba(13, 41, 46, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(217, 93, 57, 0.16), transparent 38%),
    radial-gradient(circle at 88% 18%, rgba(15, 93, 102, 0.16), transparent 40%),
    linear-gradient(180deg, #fbf5ea 0%, #f4efe7 45%, #f8f5ef 100%);
  line-height: 1.7;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: #000;
  color: #fff;
  padding: 10px 14px;
  z-index: 2000;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
}

a {
  color: var(--brand-deep);
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid #000;
  outline-offset: 3px;
}

.site-header {
  padding: 1rem clamp(1rem, 4vw, 3rem) 2rem;
}

.header-shell {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 2px 0;
  flex-shrink: 0;
  text-decoration: none;
  color: var(--ink);
}

.brand img {
  width: auto;
  height: 96px;
  max-width: 100%;
  box-shadow: none;
}

.brand span {
  display: flex;
  flex-direction: column;
  white-space: nowrap;
}

.brand strong {
  display: block;
  font-family: var(--font-heading);
  letter-spacing: 0.04em;
}

.brand small {
  color: var(--ink-soft);
}

.menu-toggle {
  display: none;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  padding: 0.5rem 0.95rem;
  font: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.menu-toggle:hover,
.menu-toggle:focus-visible {
  background: var(--brand-deep);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.site-nav a {
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 250, 242, 0.8);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  border-color: var(--accent);
  background: rgba(255, 250, 242, 1);
}

.hero {
  margin: 1.2rem auto 0;
  max-width: 1160px;
  background: linear-gradient(135deg, #0d5b64 0%, #0a3f45 48%, #7a391f 100%);
  color: #fff;
  border-radius: 22px;
  padding: clamp(1.2rem, 3vw, 2.1rem);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -90px;
  top: -90px;
  border-radius: 50%;
  background: rgba(242, 184, 128, 0.18);
}

.hero-kicker {
  margin: 0;
  color: #fff;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  opacity: 0.95;
}

.hero h1 {
  margin: 0.45rem 0 0.7rem;
  font-size: clamp(1.55rem, 3vw, 2.25rem);
  font-family: var(--font-heading);
  line-height: 1.3;
}

.hero p {
  margin: 0;
  max-width: 68ch;
}

.hero-notes {
  margin-top: 1rem;
  display: inline-block;
  border: 1px dashed rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  padding: 0.55rem 0.8rem;
  background: rgba(0, 0, 0, 0.15);
}

main {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 3rem) 3.5rem;
}

.section {
  margin-top: 2rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1rem, 2.6vw, 1.6rem);
  box-shadow: var(--shadow);
}

.topic-intro {
  margin-top: 0.8rem;
  color: var(--ink-soft);
}

.topic-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.topic-actions a {
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  background: #fff;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.topic-actions a:hover {
  background: #f9f5f0;
  border-color: var(--accent);
}

.topic-actions a:focus-visible {
  background: #f9f5f0;
}

.steps {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}

.steps li {
  margin-bottom: 0.42rem;
}

.note-box {
  margin-top: 0.8rem;
  padding: 0.75rem;
  border-left: 4px solid var(--accent);
  background: #fff6ef;
  border-radius: 8px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(1.3rem, 2.2vw, 1.8rem);
}

.section-head p {
  margin: 0.3rem 0 0;
  color: var(--ink-soft);
}

.cards-grid {
  margin-top: 1.05rem;
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.topic-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  background: #fff;
}

.topic-card h3 {
  margin: 0;
}

.topic-card p {
  margin: 0.55rem 0 0.8rem;
  color: var(--ink-soft);
}

.chip {
  display: inline-block;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  background: var(--accent-soft);
  color: #772e17;
  font-weight: 700;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.chip:hover,
.chip:focus-visible {
  background: #ffc4a8;
  color: #5a2211;
}

.home-page .hero a {
  color: #fff;
  font-weight: 700;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 6px;
  padding: 0 0.3rem;
  transition: background-color 0.2s ease;
}

.home-page .hero a:hover,
.home-page .hero a:focus-visible {
  background: rgba(0, 0, 0, 0.55);
}

.home-page .cards-grid .chip {
  background: #003a42;
  color: #fff;
  border: 1px solid #002930;
}

.home-page .cards-grid .chip:hover {
  background: #002530;
  color: #fff;
}

.faq-list {
  margin-top: 1rem;
  display: grid;
  gap: 0.8rem;
}

details {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.75rem 0.9rem;
}

summary {
  cursor: pointer;
  font-weight: 700;
  padding: 0.25rem 0;
  border-radius: 4px;
  transition: background-color 0.15s ease;
  user-select: none;
}

summary:hover {
  background: rgba(15, 93, 102, 0.05);
}

summary:focus-visible {
  background: rgba(15, 93, 102, 0.1);
}

details > *:not(summary) {
  margin-top: 0.75rem;
}

.image-row {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
  overflow-x: auto;
  justify-items: start;
}

figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: visible;
  background: #fff;
  width: fit-content;
  max-width: 100%;
  display: flex;
  flex-direction: column-reverse;
}

figure img {
  width: auto;
  max-width: none;
  height: auto;
}

figcaption {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 0.55rem 0.6rem;
}

.inline-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.inline-links a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  text-decoration: none;
  background: #fff;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.inline-links a:hover,
.inline-links a:focus-visible {
  border-color: var(--accent);
  background: #fef9f5;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

caption {
  text-align: left;
  padding: 0.8rem;
  font-weight: 700;
}

th,
td {
  border-bottom: 1px solid #e6ddd3;
  padding: 0.65rem 0.72rem;
  text-align: left;
}

thead th {
  background: #f2e9dc;
}

.video-grid {
  margin-top: 1rem;
  display: grid;
  gap: 0.95rem;
  grid-template-columns: 1fr;
  overflow-x: auto;
  justify-items: start;
}

.video-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: visible;
  background: #fff;
  width: fit-content;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

.video-card img {
  width: 100%;
  max-width: 100%;
  height: auto;
  background: none;
  padding: 0;
}

.video-card h3 {
  margin: 0;
  padding: 0.75rem 0.75rem 0.45rem;
  font-size: 1.15rem;
  font-weight: 700;
  order: 1;
}

.video-card img {
  order: 2;
}

.video-card a {
  display: block;
  margin: 0.7rem 0.75rem 0.9rem;
  text-decoration: none;
  color: #fff;
  background: var(--brand);
  border-radius: 8px;
  text-align: center;
  padding: 0.42rem 0.65rem;
  order: 3;
}

.tutorials-page .video-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow-x: visible;
  justify-items: stretch;
}

.tutorials-page .video-card {
  width: 100%;
  min-width: 0;
  height: 100%;
}

.tutorials-page .video-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.tutorials-page .video-card h3 {
  min-height: 3.2em;
}

.download-list {
  margin: 1rem 0 0;
  padding-left: 1.2rem;
}

.download-list li {
  margin-bottom: 0.5rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  margin: 2.2rem 0 0;
  padding: 1rem;
  text-align: center;
  color: var(--ink-soft);
}

.reveal {
  opacity: 1;
  transform: none;
}

@media (max-width: 900px) {
  .menu-toggle {
    display: inline-block;
  }

  .site-nav {
    display: none;
    width: 100%;
    padding-top: 0.35rem;
  }

  .site-nav.is-open {
    display: flex;
  }

  .header-shell {
    flex-wrap: wrap;
  }

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

@media (max-width: 640px) {
  .hero {
    border-radius: 16px;
  }

  .section {
    border-radius: 14px;
  }

  summary {
    font-size: 0.96rem;
  }

  .tutorials-page .video-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
