/* Sunshine Charity Society — sunshine.timebank.tw
   Component structure/behavior follows the WSI/CES Federated App Top Nav
   Contract v1 (km-base/01_Governance/CIS-Presentation-Tier) and the working
   reference implementation in wsi-website/src/assets/css/output.css.
   Color tokens and typography are sampled directly from Sunshine's own
   public identity: the actual logo asset (sunshine-charity-logo-*.png,
   pixel-sampled: orange #ff7900, red #dc0202, gold #fed500) and the
   source site's rendered fonts (Outfit for headings, DM Sans for body) —
   not WSI blue or an invented palette. */

:root {
  --sun-gold-700: #ff7900;   /* primary orange — from logo wordmark outline */
  --sun-gold-600: #cc6200;   /* primary orange, darkened — hover/active shade */
  --sun-orange-500: #ffa50d; /* secondary orange — from logo sun rays */
  --sun-yellow-400: #fed500; /* accent gold/yellow — from logo sun center */
  --sun-red-600: #dc0202;    /* secondary accent — from logo "Charity Society" text */
  --sun-cream-50: #fffbeb;
  --sun-cream-100: #fff8e5;
  --text-body: #1d1e20;
  --text-muted: #52525b;
  --border-subtle: #e2e8f0;
  --focus-ring: #e56c00;
  --focus-shadow: rgba(229, 108, 0, 0.32);

  --font-sans: "DM Sans", "Noto Sans TC", "Noto Sans SC", "PingFang TC", "PingFang SC",
    "Microsoft JhengHei", "Microsoft YaHei", ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-heading: "Outfit", var(--font-sans);
  --layout-max-width: 1152px;
  --page-x-padding: 16px;
  --radius-pill: 9999px;
  --radius-card: 12px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text-body);
  background: #ffffff;
  line-height: 1.7;
  font-size: 16px;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-heading); }
a { color: inherit; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; overflow-wrap: anywhere; }
p { margin: 0 0 1em; overflow-wrap: anywhere; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--sun-gold-700);
  color: #fff; padding: 10px 16px; z-index: 100; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }
:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--focus-shadow);
}

.wrap {
  width: 100%;
  max-width: var(--layout-max-width);
  margin: 0 auto;
  padding-left: var(--page-x-padding);
  padding-right: var(--page-x-padding);
  min-width: 0;
}

/* ---------- Header / Top Nav (Top Nav Contract v1 structure) ---------- */
.wsi-header-shell {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
  min-height: 64px;
}
.wsi-header-inner {
  max-width: var(--layout-max-width);
  margin: 0 auto;
  padding: 10px var(--page-x-padding);
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  min-height: 64px;
}
.wsi-brand { display: flex; align-items: center; gap: 12px; margin-right: auto; min-width: 0; }
.wsi-brand-logo-link { display: flex; align-items: center; flex-shrink: 0; }
.wsi-brand-logo { height: 34px; width: auto; display: block; }

.wsi-desktop-nav { display: none; align-items: center; gap: 18px; order: 1; }
.wsi-nav-link, .wsi-nav-link-current {
  font-weight: 700; font-size: 0.92rem; text-decoration: none;
  color: var(--text-muted); padding: 6px 2px; border-bottom: 2px solid transparent;
}
.wsi-nav-link:hover, .wsi-nav-link-current { color: var(--sun-gold-700); }
.wsi-nav-link-current { border-bottom-color: var(--sun-orange-500); }

.wsi-header-actions { display: flex; align-items: center; gap: 10px; order: 2; flex-shrink: 0; margin-left: auto; }
.wsi-login-link {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--sun-gold-700); color: #fff !important;
  font-weight: 700; font-size: 0.85rem; text-decoration: none;
  padding: 8px 18px; border-radius: var(--radius-pill);
  white-space: nowrap;
  /* Hidden in the collapsed mobile header — the CTA lives in the mobile
     panel instead, so the mobile bar is exactly [logo] ... [hamburger]. */
  display: none;
}
.wsi-login-link:hover { background: var(--sun-gold-600); }

.wsi-lang-select {
  padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border-subtle);
  background: #fff; font-family: var(--font-sans); font-weight: 700; font-size: 0.82rem;
  color: var(--text-body); cursor: pointer;
  /* Same collapse rule as .wsi-login-link — the language selector lives in
     the mobile panel, not the collapsed bar, so mobile stays [logo] ... [hamburger]. */
  display: none;
}
.wsi-lang-select:hover { border-color: var(--sun-gold-700); }

.wsi-menu-toggle {
  width: 44px; height: 44px; border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle); background: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; margin-left: 4px;
}
.wsi-menu-icon, .wsi-menu-icon::before, .wsi-menu-icon::after {
  display: block; width: 16px; height: 2px; background: var(--sun-gold-700); position: relative;
}
.wsi-menu-icon::before, .wsi-menu-icon::after { content: ""; position: absolute; left: 0; }
.wsi-menu-icon::before { top: -5px; }
.wsi-menu-icon::after { top: 5px; }

.wsi-mobile-panel { display: none; width: 100%; order: 3; padding-top: 10px; }
.wsi-mobile-panel[data-open="true"] { display: block; }
.wsi-mobile-panel nav { display: flex; flex-direction: column; }
.wsi-mobile-panel nav a {
  padding: 12px 6px; text-decoration: none; color: var(--text-body);
  font-weight: 600; border-top: 1px solid var(--border-subtle);
}
.wsi-mobile-panel nav a:first-child { border-top: none; }
.wsi-mobile-panel .wsi-login-link-mobile {
  margin-top: 8px; text-align: center; color: #fff !important;
  background: var(--sun-gold-700); border-radius: var(--radius-pill); border-top: none;
}
.wsi-mobile-lang { padding-bottom: 10px; border-bottom: 1px solid var(--border-subtle); }
.wsi-mobile-lang .wsi-lang-select { display: block; width: 100%; padding: 10px 12px; font-size: 0.9rem; }

@media (min-width: 768px) {
  .wsi-desktop-nav { display: flex; }
  .wsi-login-link { display: inline-flex; }
  .wsi-lang-select { display: inline-block; }
  .wsi-menu-toggle { display: none; }
  .wsi-mobile-panel { display: none !important; }
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(120deg, #fff8e5 0%, #ffe9b8 55%, #ffd98a 100%);
  border-bottom: 1px solid var(--border-subtle);
}
.hero-inner {
  width: 100%; max-width: var(--layout-max-width); margin: 0 auto; padding: 56px var(--page-x-padding) 48px;
  min-width: 0;
}
.hero h1 { font-size: 2.1rem; font-weight: 800; color: #9a3412; max-width: 40rem; }
.hero p.lead { font-size: 1.05rem; color: #78350f; max-width: 38rem; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  font-weight: 700; padding: 11px 22px; border-radius: var(--radius-pill); font-size: 0.95rem;
  max-width: 100%; white-space: normal; text-align: center; justify-content: center;
}
.btn-primary { background: var(--sun-gold-700); color: #fff !important; }
.btn-primary:hover { background: var(--sun-gold-600); }
.btn-secondary { background: #fff; color: var(--sun-gold-700) !important; border: 1px solid var(--sun-gold-700); }
.btn-secondary:hover { background: var(--sun-cream-50); }

@media (min-width: 768px) {
  .hero h1 { font-size: 2.75rem; }
}

@media (max-width: 767px) {
  .hero h1 { font-size: 1.85rem; max-width: 100%; }
  .hero p.lead { max-width: 100%; }
  .hero-ctas { flex-direction: column; align-items: flex-start; }
  .section h2 { font-size: 1.38rem; }
}

/* ---------- Sections / cards ---------- */
.section { padding: 48px 0; }
.section-alt { background: var(--sun-cream-50); }
.section h2 { font-size: 1.6rem; font-weight: 800; color: var(--text-body); }
.section .eyebrow {
  text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem;
  font-weight: 800; color: var(--sun-gold-700); margin-bottom: 6px; display: block;
}
.grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.card {
  border: 1px solid var(--border-subtle); border-radius: var(--radius-card);
  padding: 22px; background: #fff;
  min-width: 0;
}
.card h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 8px; }
.card p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 0; }
.card .tag {
  display: inline-block; font-size: 0.72rem; font-weight: 700; color: var(--sun-gold-700);
  background: var(--sun-cream-100); border-radius: var(--radius-pill); padding: 3px 10px; margin-bottom: 10px;
}

.person { display: flex; gap: 14px; align-items: flex-start; }
.person-avatar {
  width: 48px; height: 48px; border-radius: 999px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--sun-orange-500), var(--sun-gold-700));
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800;
}
.person h3 { font-size: 1rem; margin-bottom: 2px; }
.person .role { font-size: 0.85rem; color: var(--sun-gold-700); font-weight: 700; margin-bottom: 6px; }
.person p { font-size: 0.9rem; color: var(--text-muted); }

blockquote.testimonial {
  border-left: 3px solid var(--sun-red-600); margin: 0; padding: 4px 0 4px 16px;
  font-size: 1.02rem; color: var(--text-body); font-style: italic;
}
blockquote.testimonial cite { display: block; margin-top: 10px; font-style: normal; font-size: 0.85rem; color: var(--text-muted); }

.note-box {
  border: 1px dashed var(--border-subtle); border-radius: var(--radius-card);
  padding: 14px 16px; font-size: 0.85rem; color: var(--text-muted); background: #fafafa;
}

.section-intro {
  max-width: 48rem;
  color: var(--text-muted);
  font-size: 1.02rem;
}

.intelligence-flow {
  list-style: none;
  padding: 0;
  margin: 24px 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  counter-reset: flow-step;
}

.intelligence-flow li {
  counter-increment: flow-step;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 121, 0, 0.24);
  border-radius: 8px;
  background: #fff;
  color: var(--text-body);
  font-weight: 800;
}

.intelligence-flow li::before {
  content: counter(flow-step);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: var(--sun-gold-700);
  color: #fff;
  font-size: 0.8rem;
}

.intelligence-flow li span {
  min-width: 0;
}

.intelligence-notes {
  margin-top: 10px;
}

.governance-callout {
  margin: 22px 0;
  padding: 16px 18px;
  border-left: 4px solid var(--sun-red-600);
  border-radius: 8px;
  background: #fff;
  color: var(--text-muted);
}

.governance-callout strong {
  color: var(--text-body);
}

@media (min-width: 640px) {
  .intelligence-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .intelligence-flow {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ---------- Footer ---------- */
footer.site-footer {
  border-top: 1px solid var(--border-subtle); padding: 32px 0; background: #fff;
}
footer.site-footer .wrap {
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center;
  font-size: 0.85rem; color: var(--text-muted);
}
footer.site-footer a { color: var(--sun-gold-700); text-decoration: none; font-weight: 700; }
footer.site-footer a:hover { text-decoration: underline; }

.breadcrumb-back {
  display: inline-block; margin: 20px 0 0; font-size: 0.85rem; font-weight: 700;
  color: var(--sun-gold-700); text-decoration: none;
}
