:root {
  --ink: #222222;
  --muted: #6f6f6f;
  --faint: #f7f5f2;
  --line: #e5e0da;
  --surface: #ffffff;
  --brand: #9e3b24;
  --brand-dark: #7b2a18;
  --teal: #147f8f;
  --sand: #c5a270;
  --focus: rgba(158, 59, 36, 0.36);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", Arial, sans-serif;
  line-height: 1.7;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  min-height: 78px;
  padding: 10px clamp(18px, 6vw, 120px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 3px 13px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-weight: 950;
}

.brand strong,
.brand small {
  display: block;
  white-space: nowrap;
}

.brand strong {
  line-height: 1.15;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topnav a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-bottom: 3px solid transparent;
  color: #666;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 0 12px;
  text-decoration: none;
  white-space: nowrap;
}

.topnav a:hover,
.topnav a.is-active {
  border-bottom-color: var(--brand);
  color: var(--brand);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.page {
  min-height: calc(100vh - 150px);
  padding: clamp(26px, 5vw, 72px) 0 48px;
}

.page[hidden] {
  display: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(360px, 1fr);
  gap: clamp(26px, 5vw, 58px);
  align-items: center;
  min-height: calc(100vh - 180px);
}

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

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p,
span,
small {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2.15rem, 4.4vw, 4.1rem);
  letter-spacing: 0;
  line-height: 1.12;
}

h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.24rem, 2vw, 1.68rem);
  letter-spacing: 0;
  line-height: 1.28;
}

h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.35;
}

.lead,
.page-heading p,
.template-copy p,
.flow-grid p,
.notice-panel li {
  color: var(--muted);
}

.lead {
  max-width: 620px;
  margin: 18px 0 26px;
  font-size: 1.06rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-action,
.secondary-action,
.search-row button,
.template-actions button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-weight: 900;
  text-decoration: none;
  padding: 0 18px;
}

.primary-action,
.search-row button,
.template-actions button {
  border: 0;
  background: var(--brand);
  color: #fff;
}

.primary-action:hover,
.search-row button:hover,
.template-actions button:hover {
  background: var(--brand-dark);
}

.secondary-action,
.template-actions button + button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand);
}

.hero-media {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--faint);
}

.hero-media img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 34px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.entry-card,
.category-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.entry-card {
  min-height: 122px;
  padding: 18px;
}

.entry-card span {
  display: block;
  color: var(--brand);
  font-size: 1.05rem;
  font-weight: 950;
  line-height: 1.3;
}

.entry-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.5;
}

.entry-card:hover,
.category-button:hover {
  border-color: var(--brand);
  background: #fffaf7;
}

.page-heading {
  display: grid;
  gap: 8px;
  max-width: 760px;
  margin-bottom: 24px;
}

.page-heading p {
  margin: 0;
  font-size: 1.02rem;
}

.search-panel {
  max-width: 840px;
  margin-bottom: 22px;
}

.search-panel label,
.field-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 900;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.search-row input,
.field-group input,
.field-group select,
.field-group textarea {
  width: 100%;
  border: 1px solid #d3ccc4;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}

.search-row input {
  min-height: 54px;
  padding: 0 15px;
}

.faq-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.category-panel,
.content-panel {
  min-width: 0;
}

.category-panel {
  position: sticky;
  top: 104px;
}

.panel-heading,
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-heading span,
.result-count {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
  white-space: nowrap;
}

.category-list {
  display: grid;
  gap: 8px;
}

.category-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
  width: 100%;
  border-radius: 4px;
  padding: 11px 12px;
}

.category-button span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}

.category-button small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.category-button.is-active {
  border-color: var(--brand);
  background: #fff3ed;
  color: var(--brand);
}

.faq-list {
  display: grid;
  gap: 10px;
}

.faq-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.faq-item[open] {
  border-color: rgba(158, 59, 36, 0.48);
}

.faq-item summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 14px 16px;
  color: var(--ink);
  font-weight: 950;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--faint);
  color: var(--brand);
  font-weight: 900;
}

.faq-item[open] summary::after {
  content: "-";
}

.faq-answer {
  border-top: 1px dashed var(--line);
  padding: 14px 16px 16px;
  color: #4c4c4c;
}

.faq-answer p {
  margin: 0;
}

.empty-state {
  border: 1px dashed #d4cdc5;
  border-radius: 4px;
  background: var(--faint);
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

.flow-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.flow-grid article {
  min-height: 190px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 20px;
}

.flow-grid span {
  display: inline-grid;
  width: 42px;
  height: 32px;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 999px;
  background: #f4e7df;
  color: var(--brand);
  font-weight: 950;
}

.flow-grid p {
  margin: 0;
}

.notice-panel,
.template-section {
  border: 1px solid var(--line);
  background: var(--faint);
}

.notice-panel {
  margin-top: 18px;
  padding: 22px;
}

.notice-panel ul {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-left: 20px;
}

.template-section {
  display: grid;
  grid-template-columns: minmax(250px, 0.5fr) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 44px);
  align-items: start;
  padding: 30px;
}

.template-copy p {
  margin: 12px 0 0;
}

.template-note {
  display: grid;
  gap: 3px;
  margin-top: 18px;
  border-left: 4px solid var(--brand);
  background: #fff;
  padding: 12px 14px;
  color: #5c4032;
}

.template-note strong {
  color: var(--brand);
}

.template-form {
  display: grid;
  gap: 14px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-group input,
.field-group select,
.field-group textarea {
  padding: 11px 12px;
}

.field-group textarea {
  resize: vertical;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #4c4c4c;
  font-weight: 800;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.template-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.template-output {
  display: block;
  min-height: 132px;
  border: 1px solid #d3ccc4;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  padding: 14px;
  white-space: pre-wrap;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 20px clamp(18px, 6vw, 120px);
  text-align: center;
}

.site-footer p {
  max-width: 980px;
  margin: 0 auto;
}

@media (max-width: 1040px) {
  .hero,
  .faq-layout,
  .template-section {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

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

  .category-panel {
    position: static;
  }

  .category-list {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .category-button {
    min-width: 178px;
  }
}

@media (max-width: 760px) {
  main {
    width: min(100% - 22px, 1180px);
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: auto;
  }

  .topnav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .topnav a {
    padding: 0 10px;
  }

  .brand strong,
  .brand small {
    white-space: normal;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
  }

  .page {
    padding-top: 24px;
  }

  .hero {
    gap: 22px;
  }

  .lead {
    font-size: 1rem;
  }

  .hero-actions,
  .search-row,
  .field-row {
    grid-template-columns: 1fr;
  }

  .hero-actions,
  .template-actions {
    flex-direction: column;
  }

  .primary-action,
  .secondary-action,
  .search-row button,
  .template-actions button {
    width: 100%;
  }

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

  .template-section,
  .notice-panel {
    padding: 20px;
  }

  .panel-heading,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}
