/* 新北市體育總會 */
:root {
  --red: #e2231a;
  --orange: #f47b20;
  --yellow: #ffc20e;
  --purple: #7b3fa6;
  --blue: #1f6bc4;
  --green: #3e8e35;
  --ink: #1d1d1f;
  --ink-2: #4a4a4f;
  --muted: #8a8580;
  --line: #e9e2d6;
  --cream: #fbf6ec;
  --paper: #ffffff;
  --dark: #17171a;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(40, 30, 10, .10);
  --zh: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", sans-serif;
  --en: "Barlow Condensed", "Arial Narrow", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--zh);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--cream);
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { font: inherit; }
h1, h2, h3 { line-height: 1.3; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* ---------- top stripe & header ---------- */
.stripe-top { height: 6px; background: linear-gradient(90deg, var(--yellow) 0 33.3%, var(--orange) 33.3% 66.6%, var(--red) 66.6%); }
.site-header { background: var(--paper); position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 0 var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 76px; }
.logo img { height: 52px; width: auto; }
.site-nav ul { display: flex; gap: 32px; list-style: none; margin: 0; padding: 0; }
.site-nav a {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 16px; text-decoration: none; color: var(--ink);
  padding: 8px 0; border-bottom: 3px solid transparent;
}
.site-nav a::before { content: ""; width: 8px; height: 8px; transform: rotate(45deg); background: var(--c); }
.site-nav a:hover, .site-nav a.is-active { border-bottom-color: var(--c); }
.nav-red { --c: var(--red); } .nav-purple { --c: var(--purple); } .nav-blue { --c: var(--blue); } .nav-green { --c: var(--green); }
.menu-toggle { display: none; }

/* ---------- hero carousel ---------- */
.hero { position: relative; height: 520px; overflow: hidden; background: var(--dark); color: #fff; }
.slides, .slide { position: absolute; inset: 0; }
.slide {
  background-size: cover; background-position: center;
  opacity: 0; transition: opacity .8s ease; display: flex; align-items: center;
}
.slide::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(10, 12, 30, .72) 0%, rgba(10, 12, 30, .35) 55%, rgba(10, 12, 30, .15) 100%),
              linear-gradient(0deg, rgba(10, 12, 30, .55) 0%, rgba(10, 12, 30, 0) 40%);
}
.slide.is-active { opacity: 1; }
.slide-text { position: relative; padding-bottom: 90px; }
.slide-tag {
  display: inline-block; background: var(--yellow); color: var(--ink);
  font-weight: 700; font-size: 15px; padding: 6px 16px; border-radius: 6px;
}
.slide-title { margin: 18px 0 6px; font-size: clamp(36px, 6vw, 64px); font-weight: 900; letter-spacing: .02em; text-shadow: 0 2px 16px rgba(0, 0, 0, .35); }
.slide-sub { margin: 0; font-family: var(--en), var(--zh); font-style: italic; font-weight: 700; font-size: clamp(22px, 3vw, 32px); color: var(--yellow); }
.hero-controls {
  position: absolute; left: 0; right: 0; bottom: 120px; display: flex; align-items: center; gap: 18px;
}
.bars { display: flex; gap: 8px; }
.bar { width: 64px; height: 4px; padding: 0; border: 0; background: rgba(255, 255, 255, .3); cursor: pointer; position: relative; }
.bar i { position: absolute; inset: 0; width: 0; background: #fff; }
.bar.is-active i { animation: fill var(--dur, 6s) linear forwards; }
.hero.is-paused .bar.is-active i { animation-play-state: paused; }
@keyframes fill { to { width: 100%; } }
.counter { font-family: var(--en); font-weight: 700; font-size: 20px; color: rgba(255, 255, 255, .6); letter-spacing: .05em; }
.counter b { color: #fff; }
.arrow {
  width: 46px; height: 46px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .7);
  background: transparent; color: #fff; font-size: 20px; cursor: pointer; transition: background .2s;
}
.arrow:hover { background: rgba(255, 255, 255, .15); }
.stripes { position: absolute; right: -40px; bottom: 70px; width: 520px; pointer-events: none; }
.stripes i { display: block; height: 12px; border-radius: 12px; margin-top: 10px; transform: rotate(-12deg); transform-origin: right; }
.stripes i:nth-child(1) { background: var(--yellow); }
.stripes i:nth-child(2) { background: var(--orange); margin-left: 60px; }
.stripes i:nth-child(3) { background: var(--red); margin-left: 120px; }

/* ---------- tiles ---------- */
.tiles { position: relative; z-index: 5; margin-top: -84px; }
.tiles ul { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 18px; }
.tile {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 132px; padding: 22px 24px; border-radius: var(--radius);
  color: #fff; text-decoration: none; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
}
.tile:hover { transform: translateY(-4px); box-shadow: 0 16px 36px rgba(40, 30, 10, .18); }
.tile-en { font-family: var(--en); font-weight: 700; font-size: 15px; letter-spacing: .18em; opacity: .85; }
.tile-zh { font-size: 24px; font-weight: 900; letter-spacing: .04em; }
.tile svg { position: absolute; top: 18px; right: 18px; width: 28px; height: 28px; }
.tile-red { background: var(--red); } .tile-purple { background: var(--purple); }
.tile-blue { background: var(--blue); } .tile-green { background: var(--green); }

/* ---------- home ---------- */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 36px; padding-top: 56px; padding-bottom: 72px; }
.tabs { display: flex; gap: 28px; border-bottom: 2px solid var(--ink); }
.tabs [role="tab"] {
  background: none; border: 0; padding: 0 0 12px; cursor: pointer; text-align: left;
  font-size: 22px; font-weight: 900; color: #b5aca0; position: relative;
}
.tabs [role="tab"] small { display: block; font-family: var(--en); font-weight: 700; font-size: 13px; letter-spacing: .16em; color: inherit; }
.tabs [role="tab"][aria-selected="true"] { color: var(--ink); }
.tabs [role="tab"][aria-selected="true"] small { color: var(--red); }
.tabs [role="tab"][aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 4px; background: var(--orange); }
.more { display: inline-block; margin-top: 18px; font-weight: 700; font-size: 15px; text-decoration: none; }
.more:hover { color: var(--red); }

.news-list { list-style: none; margin: 0; padding: 0; }
.news-item { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 18px; padding: 20px 4px; border-bottom: 1px solid var(--line); }
.news-date b { display: block; font-family: var(--en); font-weight: 700; font-size: 26px; line-height: 1; color: var(--red); }
.news-date span { font-family: var(--en); font-weight: 600; font-size: 14px; color: var(--muted); }
.news-title { font-weight: 700; text-decoration: none; }
.news-title:hover { color: var(--red); }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  padding: 4px 10px 4px 4px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px;
  font-size: 13px; color: var(--ink-2); text-decoration: none;
}
.file-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip:hover { border-color: var(--red); color: var(--red); }
.badge { flex: none; font-family: var(--en); font-weight: 700; font-size: 12px; letter-spacing: .05em; color: #fff; padding: 1px 7px; border-radius: 4px; }
.badge-pdf { background: var(--red); } .badge-doc { background: var(--blue); }
.badge-xls { background: var(--green); } .badge-file { background: var(--muted); }
.empty { padding: 32px 0; color: var(--muted); }

.home-side { display: flex; flex-direction: column; gap: 24px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; font-size: 18px; font-weight: 900; display: flex; align-items: center; gap: 10px; }
.card-head a { font-size: 14px; font-weight: 700; text-decoration: none; }
.dot { width: 9px; height: 9px; transform: rotate(45deg); display: inline-block; }
.dot-red { background: var(--red); } .dot-blue { background: var(--blue); }
.card-album { display: block; text-decoration: none; }
.card-album img { aspect-ratio: 3 / 2; object-fit: cover; width: 100%; }
.card-album div { padding: 14px 20px 18px; }
.card-album time { font-family: var(--en); font-weight: 700; color: var(--red); }
.card-album h3 { margin: 2px 0 0; font-size: 16px; }
.card-album:hover h3 { color: var(--red); }
.card-legal { background: var(--yellow); border-color: var(--yellow); }
.card-legal .card-head { border-color: rgba(0, 0, 0, .12); }
.card-legal .en { font-family: var(--en); font-weight: 700; font-size: 13px; letter-spacing: .1em; }
.card-legal ul { list-style: none; margin: 0; padding: 6px 20px 16px; }
.card-legal li { padding: 10px 0; border-bottom: 1px dashed rgba(0, 0, 0, .2); font-size: 14px; }
.card-legal li:last-child { border: 0; }
.card-legal strong, .card-legal span { display: block; }
.card-legal strong { font-size: 16px; }
.card-links ul { list-style: none; margin: 0; padding: 8px 20px 14px; }
.card-links li { border-bottom: 1px solid var(--line); }
.card-links li:last-child { border: 0; }
.card-links a { display: block; padding: 8px 0; font-size: 14px; text-decoration: none; color: var(--ink-2); }
.card-links a:hover { color: var(--blue); }

/* ---------- inner pages ---------- */
.page-head { position: relative; overflow: hidden; color: #fff; padding: 36px 0 44px; }
.page-head-red { background: var(--red); } .page-head-purple { background: var(--purple); }
.page-head-blue { background: var(--blue); } .page-head-green { background: var(--green); }
.page-head .container { position: relative; z-index: 1; }
.page-head h1 { margin: 0; font-size: clamp(26px, 4vw, 40px); font-weight: 900; }
.page-head .stripes { bottom: 18px; width: 380px; opacity: .9; }
.eyebrow { margin: 18px 0 0; font-family: var(--en); font-weight: 700; letter-spacing: .2em; opacity: .85; }
.breadcrumb ol { display: flex; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; font-size: 14px; opacity: .9; }
.breadcrumb li + li::before { content: "›"; margin: 0 8px; }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb [aria-current] { display: inline-block; max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

.section { padding-top: 40px; padding-bottom: 72px; }
.page-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 36px; padding-top: 40px; padding-bottom: 72px; }
.side-nav { align-self: start; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.side-nav h2 { margin: 0; padding: 16px 20px; font-size: 17px; border-bottom: 1px solid var(--line); }
.side-nav ul { list-style: none; margin: 0; padding: 8px 0; }
.side-nav a { display: block; padding: 10px 20px; font-size: 15px; text-decoration: none; color: var(--ink-2); border-left: 4px solid transparent; }
.side-nav a:hover { color: var(--ink); background: var(--cream); }
.side-nav a[aria-current] { color: var(--ink); font-weight: 700; border-left-color: var(--orange); background: var(--cream); }
.page-main { min-width: 0; }
.article { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px 36px; }
.article-head { border-bottom: 2px solid var(--ink); padding-bottom: 14px; margin-bottom: 20px; }
.article-head time { font-family: var(--en); font-weight: 700; font-size: 18px; color: var(--red); }
.article-head h2 { margin: 4px 0 0; font-size: 24px; }
.attachments { margin-top: 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.attachments h2 { margin: 0; font-size: 16px; }
.attachments .file-chip { font-size: 15px; padding: 8px 14px 8px 8px; }
.back { margin: 32px 0 0; }
.back a { font-weight: 700; text-decoration: none; }
.back a:hover { color: var(--red); }
.meta { color: var(--muted); margin: 0 0 20px; }

.prose { overflow-wrap: anywhere; }
.prose-pre { white-space: pre-line; }
.prose p { margin: 0 0 .6em; }
.prose a { color: var(--blue); }
.prose table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 15px; }
.prose td, .prose th { border: 1px solid var(--line); padding: 6px 10px; text-align: center; vertical-align: middle; }
.prose th, .prose tr:first-child td { background: var(--cream); font-weight: 700; }
.prose td p, .prose th p { margin: 0; }
.prose img { margin: 12px 0; border-radius: 8px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.pager { display: flex; gap: 8px; margin-top: 28px; }
.pager a { min-width: 40px; height: 40px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); text-decoration: none; font-weight: 700; }
.pager a[aria-current] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* albums */
.album-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.album-card a { display: block; background: var(--paper); border-radius: var(--radius); overflow: hidden; text-decoration: none; border: 1px solid var(--line); transition: transform .2s, box-shadow .2s; }
.album-card a:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.album-cover img { aspect-ratio: 3 / 2; object-fit: cover; width: 100%; }
.album-info { padding: 16px 20px 20px; }
.album-info time { font-family: var(--en); font-weight: 700; color: var(--red); }
.album-info h2 { margin: 2px 0 6px; font-size: 18px; }
.count { font-size: 14px; color: var(--muted); }
.photo-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.photo { display: block; text-decoration: none; background: var(--paper); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.photo img { aspect-ratio: 3 / 2; object-fit: cover; width: 100%; transition: transform .3s; }
.photo:hover img { transform: scale(1.04); }
.photo span { display: block; padding: 8px 12px; font-size: 14px; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(10, 10, 14, .92); display: grid; place-items: center; padding: 56px 16px; }
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; text-align: center; color: #fff; }
.lightbox img { max-height: calc(100vh - 140px); width: auto; margin: 0 auto; border-radius: 6px; }
.lightbox figcaption { margin-top: 12px; }
.lightbox button { position: absolute; background: rgba(255, 255, 255, .12); color: #fff; border: 0; width: 48px; height: 48px; border-radius: 50%; font-size: 22px; cursor: pointer; }
.lightbox button:hover { background: rgba(255, 255, 255, .25); }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; } .lb-next { right: 16px; top: 50%; }

/* downloads */
.dl-list { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.dl-item { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.dl-item:last-child { border: 0; }
.dl-item .badge { text-align: center; padding: 4px 0; }
.dl-title { font-weight: 700; }
.dl-title time { display: block; font-family: var(--en); font-weight: 600; font-size: 14px; color: var(--muted); }
.btn-dl, .btn {
  display: inline-block; padding: 8px 20px; border-radius: 999px; background: var(--purple); color: #fff;
  font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap;
}
.btn-dl:hover, .btn:hover { filter: brightness(1.12); }
.btn { background: var(--red); }

.notfound { text-align: center; }
.notfound .eyebrow { color: var(--red); font-size: 48px; margin: 0; }

/* ---------- footer ---------- */
.site-footer { background: var(--dark); color: #d8d4cc; font-size: 15px; }
.stripe-footer { height: 6px; background: linear-gradient(90deg, var(--red) 0 25%, var(--purple) 25% 50%, var(--blue) 50% 75%, var(--green) 75%); }
.footer-inner { display: grid; grid-template-columns: 1.2fr 1.5fr 1fr; gap: 32px; padding-top: 44px; padding-bottom: 32px; }
.footer-brand strong { display: block; color: #fff; font-size: 22px; font-weight: 900; }
.footer-brand .en { font-family: var(--en); font-weight: 600; letter-spacing: .08em; color: #a19c93; }
.footer-contact, .footer-links { list-style: none; margin: 0; padding: 0; }
.footer-contact li { padding: 3px 0; }
.footer-contact span { display: inline-block; width: 3em; color: var(--yellow); font-weight: 700; }
.footer-contact a, .footer-links a { text-decoration: none; }
.footer-links { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; align-content: start; }
.footer-links a:hover, .footer-contact a:hover { color: #fff; text-decoration: underline; }
.copyright { border-top: 1px solid #2c2c31; padding-top: 18px; padding-bottom: 24px; font-size: 13px; color: #8f8a82; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .home-grid, .page-grid { grid-template-columns: minmax(0, 1fr); }
  .side-nav ul { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 12px; }
  .side-nav a { border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 14px; }
  .side-nav a[aria-current] { border-color: var(--orange); }
  .footer-inner { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 760px) {
  .container { padding-left: 16px; padding-right: 16px; }
  .header-inner { height: 68px; }
  .logo img { height: 44px; }
  .menu-toggle {
    display: grid; place-content: center; gap: 5px; width: 52px; height: 52px; border: 0; border-radius: 14px;
    background: var(--dark); cursor: pointer;
  }
  .menu-toggle span { display: block; width: 22px; height: 3px; border-radius: 2px; background: var(--orange); transition: transform .2s, opacity .2s; }
  .menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
  .site-nav { position: absolute; left: 0; right: 0; top: 100%; background: var(--paper); box-shadow: 0 12px 24px rgba(0, 0, 0, .12); display: none; }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; padding: 8px 16px 16px; }
  .site-nav a { width: 100%; padding: 14px 4px; border-bottom: 1px solid var(--line); font-size: 17px; }

  .hero { height: 560px; }
  .slide { align-items: flex-start; }
  .slide-text { padding-top: 120px; padding-bottom: 0; }
  .hero-controls { bottom: 150px; flex-wrap: wrap; gap: 12px; }
  .bars { flex: 1 1 100%; }
  .bar { flex: 1; width: auto; }
  .counter { order: 3; margin-left: auto; }
  .arrow { width: 52px; height: 52px; }
  .stripes { width: 340px; bottom: 120px; right: -60px; }
  .tiles { margin-top: -128px; }
  .tiles ul { grid-auto-flow: row; grid-template-columns: 1fr 1fr; gap: 12px; }
  .tiles li:last-child:nth-child(odd) { grid-column: span 2; }
  .tile { min-height: 120px; padding: 18px; }
  .tile-zh { font-size: 21px; }
  .tile-en { font-size: 13px; }
  .home-grid { padding-top: 40px; }
  .tabs { gap: 20px; }
  .tabs [role="tab"] { font-size: 19px; }
  .news-item { grid-template-columns: 62px minmax(0, 1fr); gap: 12px; }
  .news-date b { font-size: 22px; }
  .article { padding: 22px 18px; border-radius: 14px; }
  .dl-item { grid-template-columns: 44px minmax(0, 1fr); padding: 14px 16px; }
  .dl-item .btn-dl { grid-column: 2; justify-self: start; }
  .page-head .stripes { width: 240px; right: -60px; }
  .prose table { width: auto; min-width: 100%; font-size: 14px; }
  .prose td, .prose th { white-space: nowrap; overflow-wrap: normal; padding: 6px 8px; }
  .table-scroll { margin: 0 -18px; padding: 0 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
