/* ============================================================
   D.I.G. — Democratic Information Governance
   Design system from brand/DIG_Brandboard.pdf:
     colors  #521a56 #f2c1af #593524 #eeaf23 #ca353c #fcefc0
     type    Noto Sans Mono (principal) / Work Sans (secondary)
   ============================================================ */

:root {
  --purple: #521a56;
  --pink:   #f2c1af;
  --brown:  #593524;
  --yellow: #eeaf23;
  --red:    #ca353c;
  --cream:  #fcefc0;

  --f-mono: 'Noto Sans Mono', 'Courier New', monospace;
  --f-sans: 'Work Sans', system-ui, -apple-system, sans-serif;

  --max-w: 1120px;
  --content-w: 760px;
  --radius: 22px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  font-family: var(--f-sans);
  background: var(--cream);
  color: var(--brown);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  /* clip (not hidden) so body doesn't become a scroll container */
  overflow-x: hidden;
  overflow-x: clip;
}
::selection { background: var(--yellow); color: var(--purple); }
img { max-width: 100%; }
a { color: var(--red); }

.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;
}

/* ===== NAV ===== */
#topnav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(252, 239, 192, .92);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 2px solid var(--purple);
  transition: box-shadow .3s;
}
#topnav.scrolled { box-shadow: 0 4px 24px rgba(82, 26, 86, .12); }
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
  height: 4.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  color: var(--purple);
  font-family: var(--f-mono);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: .04em;
}
.nav-brand img { height: 2.1rem; width: auto; }
.nav-quick { display: flex; gap: .2rem; align-items: center; }
.nav-quick > a {
  text-decoration: none;
  color: var(--purple);
  font-family: var(--f-mono);
  font-size: .8rem;
  font-weight: 500;
  padding: .45rem .75rem;
  border-radius: 999px;
  transition: all .25s;
  white-space: nowrap;
  letter-spacing: .02em;
}
.nav-quick > a:hover { background: var(--purple); color: var(--cream); }
.nav-quick > a.active { background: var(--purple); color: var(--cream); }

.nav-menu { position: relative; }
.nav-menu summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  transition: background .2s;
}
.nav-menu summary:hover { background: rgba(82,26,86,.1); }
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu summary::marker { content: ''; }
.hamburger { display: flex; flex-direction: column; gap: 5px; width: 20px; pointer-events: none; }
.hamburger span {
  display: block; height: 2.5px; width: 100%;
  background: var(--purple); border-radius: 2px;
  transition: transform .3s cubic-bezier(.22,1,.36,1), opacity .2s;
}
.nav-menu[open] .hamburger span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.nav-menu[open] .hamburger span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-menu[open] .hamburger span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

.nav-dropdown {
  position: absolute;
  top: calc(100% + .6rem);
  right: 0;
  min-width: 280px;
  max-height: 75vh;
  overflow-y: auto;
  background: var(--cream);
  border: 2px solid var(--purple);
  border-radius: 18px;
  padding: .5rem;
  box-shadow: 0 14px 44px rgba(82,26,86,.25);
  animation: dropIn .25s cubic-bezier(.22,1,.36,1);
}
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.nav-dropdown-label {
  font-family: var(--f-mono);
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--red);
  padding: .8rem .9rem .35rem;
}
.nav-dropdown a {
  display: flex;
  align-items: center;
  gap: .7rem;
  text-decoration: none;
  color: var(--purple);
  font-size: .88rem;
  padding: .55rem .9rem;
  border-radius: 12px;
  transition: all .2s;
}
.nav-dropdown a:hover { background: var(--pink); }
.nav-dropdown .nav-icon {
  width: 28px; height: 28px;
  border-radius: 9px;
  background: rgba(82,26,86,.08);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-mono);
  font-size: .72rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--purple);
}
.nav-dropdown a:hover .nav-icon { background: var(--purple); color: var(--cream); }
.nav-dropdown-divider { height: 2px; background: rgba(82,26,86,.12); margin: .35rem .5rem; border-radius: 2px; }

/* ===== HERO ===== */
#hero {
  background: var(--purple);
  color: var(--cream);
  min-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  text-align: center;
}
#hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 78% 18%, rgba(202,53,60,.28) 0%, transparent 65%),
    radial-gradient(ellipse 55% 60% at 15% 85%, rgba(238,175,35,.16) 0%, transparent 60%);
  pointer-events: none;
}
.hero-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 2rem 4rem;
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero-logo {
  width: min(300px, 60vw);
  height: auto;
  opacity: 0;
  animation: fadeUp .9s .2s ease forwards;
}
/* 01-hero.md: the logo already shows the name, so the markdown h1/h2 are
   kept for screen readers and search engines only; the tagline paragraph
   becomes the big display line. */
.hero-md h1, .hero-md h2 {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}
.hero-md p {
  font-family: var(--f-mono);
  font-size: clamp(.95rem, 1.9vw, 1.25rem);
  font-weight: 400;
  line-height: 1.45;
  max-width: 34em;
  margin-top: 1rem;
  color: var(--pink);
  opacity: 0;
  animation: fadeUp .9s .5s ease forwards;
}
.hero-md .hero-intro {
  max-width: 42em;
}
.hero-md p strong { color: var(--cream); font-weight: 400; }
.hero-cta {
  margin-top: 1.8rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  opacity: 0;
  animation: fadeUp .9s .8s ease forwards;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .9rem 1.9rem;
  font-family: var(--f-mono);
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-decoration: none;
  border-radius: 999px;
  transition: all .3s;
}
.btn-primary { background: var(--red); color: var(--cream); }
.btn-primary:hover { background: var(--yellow); color: var(--purple); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.btn-ghost { border: 2px solid var(--pink); color: var(--pink); }
.btn-ghost:hover { border-color: var(--yellow); color: var(--yellow); }
#hero .btn-ghost { color: var(--pink); }

.scroll-hint {
  position: absolute;
  bottom: 2.2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  color: var(--pink);
  font-family: var(--f-mono);
  font-size: .65rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  opacity: 0;
  animation: fadeIn 1s 1.4s ease forwards;
}
.scroll-line {
  width: 2px; height: 40px;
  background: linear-gradient(to bottom, var(--pink), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}
@keyframes scrollPulse { 0%,100% { opacity:.35; } 50% { opacity:1; } }

/* ===== STATS BAR (content/00-stats.md) ===== */
.stats-bar {
  background: var(--cream);
  border-bottom: 2px solid var(--purple);
}
.stats-bar ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  padding: 3.2rem 2rem;
  max-width: var(--max-w);
  margin: 0 auto;
  text-align: center;
}
.stats-bar li {
  font-family: var(--f-mono);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--brown);
  font-weight: 500;
}
.stats-bar li strong {
  display: block;
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--red);
  line-height: 1.1;
  margin-bottom: .35rem;
  font-weight: 700;
}

/* ===== SECTIONS ===== */
.section { padding: clamp(4.5rem, 10vw, 8rem) 2rem; position: relative; }
.section-inner { max-width: var(--max-w); margin: 0 auto; }

/* scroll-reveal only kicks in when JS is running (site.js adds html.js) */
html.js .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .7s cubic-bezier(.22,1,.36,1), transform .7s cubic-bezier(.22,1,.36,1);
}
html.js .reveal.visible { opacity: 1; transform: translateY(0); }

.section-label {
  font-family: var(--f-mono);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .22em;
  color: var(--red);
  margin: 0 auto 1.2rem;
  max-width: var(--content-w);
}
.section-label a { color: inherit; text-decoration: none; }

.section-content { max-width: var(--content-w); margin: 0 auto; }
.section-content h2 {
  font-family: var(--f-mono);
  font-size: clamp(1.9rem, 4.2vw, 3rem);
  line-height: 1.12;
  letter-spacing: -.02em;
  color: var(--purple);
  margin-bottom: 1.6rem;
  font-weight: 700;
}
.section-content h3 {
  font-family: var(--f-mono);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.3;
  margin: 2.2em 0 .5em;
  color: var(--red);
  font-weight: 700;
}
.section-content h3:first-child { margin-top: 0; }
.section-content p { margin-bottom: 1.15em; }
.section-content p:last-child { margin-bottom: 0; }
.section-content strong { color: var(--purple); font-weight: 600; }
.section-content ul { list-style: none; margin-bottom: 1.2em; }
.section-content li { position: relative; padding-left: 1.5em; margin-bottom: .7em; }
.section-content li::before {
  content: '';
  position: absolute;
  left: 0;
  top: .58em;
  width: 9px; height: 9px;
  border-radius: 50% 50% 50% 0;
  background: var(--red);
}
.section-content blockquote {
  font-family: var(--f-mono);
  font-size: clamp(1.25rem, 2.4vw, 1.7rem);
  line-height: 1.4;
  color: var(--purple);
  border-left: 4px solid var(--yellow);
  background: rgba(238,175,35,.14);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.4rem 1.8rem;
  margin: 2.2rem 0 0;
  font-weight: 500;
}
.section-content blockquote p { margin: 0; }

/* Bio photo (markdown image in 08-about.md) */
.bio .section-content img {
  float: left;
  width: min(260px, 42vw);
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius);
  border: 3px solid var(--purple);
  margin: .4rem 2rem 1rem 0;
  box-shadow: 8px 8px 0 var(--yellow);
}
.bio .section-content::after { content: ''; display: table; clear: both; }

/* ===== SECTION THEMES ===== */
.theme-pink { background: var(--pink); }
.theme-pink .section-content { color: var(--brown); }
.theme-pink .section-content blockquote { background: rgba(252,239,192,.5); }

.theme-yellow { background: var(--yellow); }
.theme-yellow .section-label { color: var(--purple); }
.theme-yellow .section-content { color: var(--brown); }
.theme-yellow .section-content h3 { color: var(--red); }

.theme-purple { background: var(--purple); }
.theme-purple .section-label { color: var(--yellow); }
.theme-purple .section-content { color: var(--cream); }
.theme-purple .section-content h2 { color: var(--cream); }
.theme-purple .section-content strong { color: var(--yellow); }
.theme-purple .section-content li::before { background: var(--yellow); }
.theme-purple .section-content a { color: var(--pink); }

/* ===== CARDS built by site.js ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.6rem;
  margin: 2.4rem auto 0;
  max-width: var(--max-w);
}
.phase-card {
  background: var(--cream);
  border: 2px solid var(--brown);
  border-radius: var(--radius);
  padding: 1.9rem;
  transition: transform .3s, box-shadow .3s;
}
.phase-card:hover { transform: translateY(-4px); box-shadow: 8px 8px 0 var(--purple); }
.phase-num {
  font-family: var(--f-mono);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--red);
  line-height: 1;
  margin-bottom: .8rem;
}
.phase-card h3 { margin: 0 0 .8rem !important; color: var(--purple) !important; font-size: 1.1rem !important; }
.phase-card p { font-size: .92rem; margin-bottom: .9em; }

.partner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.4rem;
  margin-top: 2.2rem;
}
.partner-card {
  background: rgba(252,239,192,.12);
  border: 2px solid rgba(252,239,192,.4);
  border-radius: var(--radius);
  padding: 1.5rem;
  color: var(--cream);
  transition: all .3s;
}
.partner-card:hover { background: rgba(252,239,192,.2); border-color: var(--yellow); }
.partner-card strong { display: block; margin-bottom: .3rem; color: var(--yellow); }
.partner-card a { color: var(--pink); }

/* ===== PROJECT PAGES ===== */
.project-hero {
  background: var(--purple);
  color: var(--cream);
  padding: clamp(4rem, 9vw, 7rem) 2rem 3.5rem;
}
.project-hero-inner { max-width: var(--content-w); margin: 0 auto; }
.project-hero .section-label { color: var(--yellow); margin-left: 0; }
.project-hero h1 {
  font-family: var(--f-mono);
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: -.02em;
  font-weight: 700;
}
.project-lead {
  margin-top: 1.2rem;
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  color: var(--pink);
  max-width: 40em;
}
.project-body { padding: clamp(3rem, 7vw, 5rem) 2rem; }
.project-body .section-inner { max-width: var(--content-w); }
.project-cover {
  width: 100%;
  border-radius: var(--radius);
  border: 3px solid var(--purple);
  margin-bottom: 2.5rem;
}
.project-body .section-content img { border-radius: var(--radius); border: 2px solid var(--purple); }
.project-back { margin-top: 3rem; }
.project-back .btn-ghost { border-color: var(--purple); color: var(--purple); }
.project-back .btn-ghost:hover { background: var(--purple); color: var(--cream); }

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.6rem;
}
.project-card {
  display: block;
  background: #fff;
  border: 2px solid var(--purple);
  border-radius: var(--radius);
  padding: 1.8rem;
  text-decoration: none;
  color: var(--brown);
  transition: transform .3s, box-shadow .3s;
}
.project-card:hover { transform: translateY(-4px); box-shadow: 8px 8px 0 var(--yellow); }
.project-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 1.2rem;
}
.project-card h2 {
  font-family: var(--f-mono);
  font-size: 1.25rem;
  color: var(--purple);
  line-height: 1.25;
  margin-bottom: .6rem;
  font-weight: 700;
}
.project-card p { font-size: .92rem; margin-bottom: 1rem; }
.project-more {
  font-family: var(--f-mono);
  font-size: .78rem;
  font-weight: 700;
  color: var(--red);
  letter-spacing: .04em;
}

/* ===== FOOTER ===== */
footer { background: var(--purple); color: var(--pink); padding: 4rem 2rem 2.5rem; }
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
}
.footer-logo { width: 220px; height: auto; }
.footer-links { display: flex; gap: 1.6rem; flex-wrap: wrap; }
.footer-links a {
  color: var(--pink);
  text-decoration: none;
  font-family: var(--f-mono);
  font-size: .82rem;
  transition: color .2s;
}
.footer-links a:hover { color: var(--yellow); }
.footer-copy {
  font-family: var(--f-mono);
  font-size: .72rem;
  width: 100%;
  text-align: center;
  margin-top: 2.2rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(252,239,192,.25);
  letter-spacing: .06em;
}

/* ===== KEYFRAMES ===== */
@keyframes fadeUp { from { opacity:0; transform:translateY(25px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .hero-logo, .hero-md p, .hero-cta, .scroll-hint { opacity: 1; }
  .reveal { opacity: 1; transform: none; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .cards-grid { grid-template-columns: 1fr; }
  .stats-bar ul { grid-template-columns: repeat(2, 1fr); gap: 1.6rem; }
}
@media (max-width: 640px) {
  .nav-quick > a { display: none; }
  .hero-inner { padding: 5rem 1.5rem 4rem; }
  .section { padding: clamp(3rem, 8vw, 5rem) 1.4rem; }
  .partner-grid, .project-grid { grid-template-columns: 1fr; }
  .bio .section-content img { float: none; display: block; margin: 0 0 1.6rem; width: min(240px, 70vw); box-shadow: 6px 6px 0 var(--yellow); }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}
