/*
  台灣社會農業學會 · 網站樣式
  Layout: sticky header (logo + five groups, sub-menu row), one routed page at a time,
  full-bleed bands for the hero and the call-to-action, cards on a 12-column-ish auto grid.
  Color: VIS olive #2B440C as the brand anchor, warm paper background, harvest gold accent.
  Type: Huninn (justfont 粉圓, same family feel as the VIS wordmark) for display, Noto Sans TC for text.
*/
:root {
  --brand: #2b440c;          /* VIS olive, from the logo and banner */
  --brand-strong: #1f3208;
  --brand-soft: #e6ecda;
  --on-brand: #ffffff;
  --accent: #7f560b;         /* harvest gold, darkened to pass AA for small text on paper */
  --accent-soft: #f4e8cc;
  --bg: #f7f5ee;             /* warm paper */
  --surface: #ffffff;
  --fg: #1d2712;
  --muted: #56604b;
  --line: #dcd8c8;
  --danger: #a3291f;
  --danger-soft: #f8e1dd;
  --ok: #2b6a1f;
  --radius-s: 10px;
  --radius-m: 18px;
  --radius-l: 28px;
  --shadow: 0 1px 2px rgba(29, 39, 18, 0.06), 0 6px 18px rgba(29, 39, 18, 0.06);
  --display: "Huninn", "jf open 粉圓", "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
  --text: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --wrap: 1120px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #a9c47c;
    --brand-strong: #c3d99c;
    --brand-soft: #26331a;
    --on-brand: #142008;
    --accent: #e2b456;
    --accent-soft: #3a2f17;
    --bg: #12170c;
    --surface: #1a2112;
    --fg: #eaeee0;
    --muted: #aab49c;
    --line: #34402a;
    --danger: #f19a8f;
    --danger-soft: #3d1f1b;
    --ok: #9bd17f;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #a9c47c;
  --brand-strong: #c3d99c;
  --brand-soft: #26331a;
  --on-brand: #142008;
  --accent: #e2b456;
  --accent-soft: #3a2f17;
  --bg: #12170c;
  --surface: #1a2112;
  --fg: #eaeee0;
  --muted: #aab49c;
  --line: #34402a;
  --danger: #f19a8f;
  --danger-soft: #3d1f1b;
  --ok: #9bd17f;
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 140px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--text);
  font-size: 1rem;
  line-height: 1.8;
}
img { max-width: 100%; height: auto; display: block; }
a, button, input, select, textarea, label { touch-action: manipulation; -webkit-tap-highlight-color: rgba(43, 68, 12, 0.15); }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-strong); }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.35; margin: 0; text-wrap: balance; color: var(--fg); }
h1 { font-size: clamp(2rem, 5.2vw, 3.2rem); letter-spacing: 0.02em; }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); letter-spacing: 0.02em; }
h3 { font-size: 1.2rem; }
p { margin: 0.6em 0; max-width: 62ch; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.skip-link { position: absolute; left: 12px; top: -60px; background: var(--brand); color: var(--on-brand); padding: 10px 16px; border-radius: var(--radius-s); z-index: 20; }
.skip-link:focus { top: 12px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); background: var(--surface); z-index: 10; }
.site-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 9; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; }
.brand-link { display: block; flex: 0 1 auto; min-width: 0; }
.brand-link img { height: 36px; width: auto; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-light { display: none; } :root:not([data-theme="light"]) .logo-dark { display: block; } }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
.header-cta { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px; background: var(--brand); color: var(--on-brand); text-decoration: none; font-weight: 500; font-size: 0.95rem; }
.header-cta:hover { background: var(--brand-strong); color: var(--on-brand); }

.main-nav ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); }
.main-nav a { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 4px; text-decoration: none; color: var(--muted); font-weight: 500; white-space: nowrap; border-bottom: 3px solid transparent; transition: color 0.15s, border-color 0.15s; }
.main-nav a:hover { color: var(--fg); }
.main-nav a[aria-current="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.sub-nav { background: var(--bg); border-top: 1px solid var(--line); }
.sub-nav[hidden] { display: none; }
.sub-nav ul { list-style: none; margin: 0; padding: 10px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sub-nav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px; text-decoration: none; color: var(--fg); background: var(--surface); border: 1px solid var(--line); font-size: 0.95rem; }
.sub-nav a:hover { border-color: var(--brand); }
.sub-nav a[aria-current="page"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
@media (max-width: 600px) {
  .brand-link img { height: 28px; }
  .header-cta { min-height: 40px; padding: 0 14px; font-size: 0.88rem; }
  .main-nav a { font-size: 0.88rem; }
}

/* pages */
main { padding-block: 0 72px; min-height: 60vh; }
.page { display: none; }
.page.active { display: block; }
.page-head { padding-block: 48px 28px; }
.page-head p { color: var(--muted); font-size: 1.08rem; }
.eyebrow { display: inline-block; font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin-bottom: 10px; }
.section { padding-block: 40px; }
.section > h2 + p { color: var(--muted); }
.lede { font-size: 1.12rem; color: var(--muted); }

/* hero */
.hero { padding-block: 40px 56px; display: grid; gap: 32px; align-items: center; }
.hero h1 { color: var(--brand); }
.hero-photo { margin: 0; border-radius: var(--radius-l) var(--radius-l) var(--radius-l) 6px; overflow: hidden; aspect-ratio: 864 / 420; max-width: 100%; background: var(--brand-soft); }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
@media (min-width: 880px) { .hero { grid-template-columns: 1fr 1.05fr; padding-block: 64px 72px; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 999px; border: 2px solid var(--brand); background: transparent; color: var(--brand); font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; transition: background-color 0.15s, color 0.15s; }
.btn:hover { background: var(--brand-soft); color: var(--brand); }
.btn.solid { background: var(--brand); color: var(--on-brand); }
.btn.solid:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); }
.btn[disabled] { opacity: 0.6; cursor: progress; }

/* cards */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: 20px; }
.grid.five { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 22px; min-width: 0; }
.card h3 { margin-bottom: 6px; }
.card p { margin: 0.4em 0; color: var(--muted); }
.card .meta { color: var(--muted); font-size: 0.92rem; }
.card.link-card { display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: border-color 0.15s, transform 0.15s; }
.card.link-card:hover { border-color: var(--brand); }
.card.link-card .go { margin-top: auto; padding-top: 10px; color: var(--brand); font-weight: 500; }
.academy { border-top: 6px solid var(--brand); }
.academy .num { font-family: var(--display); color: var(--accent); font-size: 0.95rem; }

.tag { display: inline-block; font-size: 0.8rem; line-height: 1.6; padding: 2px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); margin: 0 6px 6px 0; }
.tag.gold { background: var(--accent-soft); color: var(--accent); }
.note { border-radius: var(--radius-s); background: var(--accent-soft); padding: 14px 18px; margin: 18px 0; max-width: 72ch; }
.note strong { color: var(--accent); }

/* call-to-action band, same message as the VIS banner */
.band { background: var(--brand); color: var(--on-brand); margin-top: 32px; }
.band .wrap { padding-block: 48px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; }
.band h2 { color: var(--on-brand); max-width: 18ch; }
.band .btn { border-color: var(--on-brand); color: var(--on-brand); }
.band .btn:hover { background: rgba(255, 255, 255, 0.12); color: var(--on-brand); }
.band .btn.solid { background: var(--on-brand); color: var(--brand); }

/* timeline */
.steps { counter-reset: s; list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 12px; max-width: 760px; }
.steps li { counter-increment: s; position: relative; padding: 16px 18px 16px 64px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.steps li::before { content: counter(s); position: absolute; left: 18px; top: 16px; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-family: var(--display); }
.timeline { list-style: none; margin: 16px 0; padding: 0 0 0 22px; border-left: 3px solid var(--brand-soft); display: grid; gap: 18px; max-width: 760px; }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: -31px; top: 9px; width: 15px; height: 15px; border-radius: 50%; background: var(--brand); border: 3px solid var(--bg); }
.timeline time { font-family: var(--display); color: var(--brand); }

/* tables */
.table-wrap { overflow-x: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.97rem; background: var(--surface); border-radius: var(--radius-m); overflow: hidden; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 0.88rem; background: var(--bg); }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* org chart */
.org { display: grid; gap: 10px; max-width: 760px; }
.org .node { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 18px; }
.org .node.top { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.org .row { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.person h3 { font-size: 1.15rem; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.filters button { font: inherit; font-size: 0.93rem; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; }
.filters button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.event-date { font-family: var(--display); color: var(--brand); font-size: 1.1rem; font-variant-numeric: tabular-nums; }

/* accordion */
details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 0 20px; margin: 10px 0; max-width: 820px; }
details > summary { cursor: pointer; padding: 16px 0; font-weight: 500; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: "＋"; color: var(--brand); }
details[open] > summary::after { content: "－"; }
details > div { padding-bottom: 16px; color: var(--muted); }

/* SDGs: official UN icons are shown unaltered on a white tile, per the UN guidelines */
.sdg-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-top: 20px; }
.sdg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 12px; display: grid; gap: 10px; align-content: start; }
.sdg .icon { background: #ffffff; border-radius: 6px; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; }
.sdg .icon img { width: 100%; height: 100%; object-fit: contain; }
.sdg .icon .fallback { white-space: pre-line; font-family: var(--display); font-size: 0.95rem; color: #1d2712; text-align: center; padding: 10px; line-height: 1.4; }
.sdg p { margin: 0; font-size: 0.9rem; color: var(--muted); }
.sdg strong { display: block; color: var(--fg); font-size: 0.95rem; }
.sdg-disclaimer { font-size: 0.85rem; color: var(--muted); margin-top: 18px; max-width: 80ch; }

/* forms */
.form { display: grid; gap: 18px; max-width: 720px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: clamp(18px, 4vw, 32px); }
.form fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 16px; min-width: 0; }
.form legend { font-family: var(--display); font-size: 1.15rem; margin-bottom: 4px; padding: 0; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .field .label { font-weight: 500; }
.field .hint { font-size: 0.88rem; color: var(--muted); }
.req { color: var(--danger); margin-left: 2px; }
.row-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
input, select, textarea { font: inherit; font-size: 1rem; width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--brand-soft); border-color: var(--brand); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
.error-text { color: var(--danger); font-size: 0.9rem; }
.error-text:empty { display: none; }
.choices { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.choice { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--bg); cursor: pointer; }
.choice input { width: 20px; height: 20px; min-height: 0; margin: 3px 0 0; accent-color: var(--brand); flex: none; }
.consent { font-size: 0.92rem; color: var(--muted); background: var(--bg); border-radius: var(--radius-s); padding: 14px 16px; max-height: 220px; overflow: auto; }
.consent p { margin: 0.4em 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-status { border-radius: var(--radius-s); padding: 14px 16px; }
.form-status:empty { display: none; }
.form-status.ok { background: var(--brand-soft); color: var(--ok); }
.form-status.err { background: var(--danger-soft); color: var(--danger); }
.error-summary { border: 2px solid var(--danger); background: var(--danger-soft); border-radius: var(--radius-s); padding: 14px 18px; }
.error-summary h3 { font-family: var(--text); font-weight: 700; font-size: 1rem; color: var(--danger); }
.error-summary ul { margin: 6px 0 0; padding-left: 1.2em; }
.error-summary a { color: var(--danger); }

/* footer */
.site-footer { background: var(--brand); color: var(--on-brand); }
.site-footer .wrap { padding-block: 40px 48px; display: grid; gap: 22px; }
.site-footer img { height: 40px; width: auto; }
.site-footer a { color: var(--on-brand); }
.site-footer nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; }
.site-footer small { opacity: 0.85; font-size: 0.85rem; line-height: 1.7; }
.footer-logo-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .footer-logo-light { display: none; } :root:not([data-theme="light"]) .footer-logo-dark { display: block; } }
:root[data-theme="dark"] .footer-logo-light { display: none; }
:root[data-theme="dark"] .footer-logo-dark { display: block; }

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