/* ============================================================
   The Pie Council — 馅饼议会
   左边一张甜甜圈图（六个饼各占一票），右边是档案卡，
   下面一排议员卡，点「CALL A VOTE」弹出当选结果。
   字体原本走 Google Fonts 的 @import，收录时改成本地文件。
   ============================================================ */

@font-face {
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/dm-mono-400.woff2") format("woff2");
}

@font-face {
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/dm-mono-500.woff2") format("woff2");
}

/* Fraunces 是可变字体，一个文件覆盖 500 和 650 两个字重 */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 500 650;
  font-display: swap;
  src: url("../assets/fraunces.woff2") format("woff2");
}

:root {
  --cream: #f6efe2;
  --paper: #fffaf0;
  --ink: #30261f;
  --muted: #7a6a5d;
  --line: #cdbca9;

  --apple: #b94135;
  --cherry: #7f2630;
  --blueberry: #485488;
  --lime: #8ba64a;
  --pecan: #9a673c;
  --pumpkin: #d17a35;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;

  color: var(--ink);

  background:
    radial-gradient(
      circle at top,
      rgba(255,255,255,.65),
      transparent 40%
    ),
    var(--cream);

  font-family: "Fraunces", serif;
}

button {
  font: inherit;
}

.app {
  width: min(1380px, 100%);
  margin: auto;
  padding: 32px clamp(18px, 4vw, 60px);
}

/* HEADER */

.hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 30px;

  padding-bottom: 25px;

  border-bottom: 1px solid var(--ink);
}

.eyebrow,
.label,
footer,
dt,
.vote-btn,
.reset-btn {
  font-family: "DM Mono", monospace;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.eyebrow {
  margin: 0 0 8px;

  color: var(--muted);

  font-size: 10px;
}

h1 {
  margin: 0;

  font-size: clamp(3rem, 7vw, 7rem);
  line-height: .85;

  font-weight: 650;
  letter-spacing: -.055em;
}

.intro {
  max-width: 280px;

  margin: 0;

  font-size: 1.2rem;
  line-height: 1.3;
}

/* COUNCIL */

.council {
  display: grid;
  grid-template-columns: 1.5fr .75fr;

  gap: 24px;

  padding: 34px 0;
}

.chart-panel,
.dossier {
  border: 1px solid var(--ink);

  background: rgba(255,250,240,.78);
}

/* CHART */

.chart-panel {
  padding: 24px;
}

.chart-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;

  gap: 20px;

  padding-bottom: 20px;

  border-bottom: 1px solid var(--line);
}

.label {
  color: var(--muted);

  font-size: 9px;
}

.chart-heading h2 {
  margin: 4px 0 0;

  font-size: 2rem;
  font-weight: 500;
}

.vote-btn,
.reset-btn {
  padding: 11px 15px;

  border: 1px solid var(--ink);

  background: var(--ink);
  color: var(--paper);

  cursor: pointer;

  font-size: 9px;

  transition:
    transform .18s ease,
    background .18s ease;
}

.vote-btn:hover,
.reset-btn:hover {
  transform: translateY(-2px);

  background: #4b3a2f;
}

/* DONUT */

.chart-area {
  display: grid;
  place-items: center;

  min-height: 480px;

  padding: 25px;
}

.donut-wrap {
  position: relative;

  width: min(430px, 78vw);
  aspect-ratio: 1;
}

.donut {
  display: block;

  width: 100%;
  height: 100%;

  transform: rotate(-90deg);
}

.slice {
  fill: none;

  stroke-width: 34;

  cursor: pointer;

  transition:
    stroke-width .25s ease,
    opacity .25s ease,
    filter .25s ease;
}

.slice:hover {
  stroke-width: 40;
}

.slice.dimmed {
  opacity: .34;
}

.slice.active {
  stroke-width: 43;

  filter:
    drop-shadow(0 5px 3px rgba(0,0,0,.14));
}

.donut-center {
  position: absolute;

  top: 50%;
  left: 50%;

  display: flex;
  flex-direction: column;
  align-items: center;

  width: 45%;

  text-align: center;

  transform: translate(-50%, -50%);
}

.donut-center span {
  font-family: "DM Mono", monospace;

  font-size: clamp(.55rem, 1vw, .8rem);
  letter-spacing: .1em;
}

.donut-center strong {
  margin: 2px 0;

  font-size: clamp(2.4rem, 5vw, 4.8rem);
  line-height: .9;
}

/* LEGEND */

.legend {
  display: grid;
  grid-template-columns: repeat(3, 1fr);

  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;

  padding: 11px;

  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);

  background: none;

  cursor: pointer;

  font-family: "DM Mono", monospace;

  font-size: 9px;

  transition: background .18s ease;
}

.legend-item:hover,
.legend-item.active {
  background: rgba(0,0,0,.045);
}

.legend-dot {
  width: 10px;
  height: 10px;

  border-radius: 50%;
}

/* DOSSIER */

.dossier {
  padding: 26px;

  position: relative;
}

.pie-symbol {
  display: grid;
  place-items: center;

  width: 78px;
  height: 78px;

  margin: 32px 0 18px;

  border: 1px solid var(--ink);

  font-size: 2.6rem;

  transform: rotate(-3deg);
}

.dossier h2 {
  margin: 0;

  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: .95;
}

.pie-title {
  margin: 10px 0 0;

  color: var(--muted);

  font-style: italic;
}

.divider {
  height: 1px;

  margin: 26px 0;

  background: var(--line);
}

dl {
  margin: 0;
}

dl div {
  display: grid;
  grid-template-columns: .85fr 1.15fr;

  gap: 16px;

  padding: 13px 0;

  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);

  font-size: 8px;
}

dd {
  margin: 0;

  font-size: .96rem;
}

blockquote {
  margin: 27px 0 0;
  padding-left: 16px;

  border-left: 3px solid var(--ink);

  font-size: 1.15rem;
  font-style: italic;
  line-height: 1.4;
}

/* MEMBERS */

.members {
  padding: 30px 0;

  border-top: 1px solid var(--ink);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;

  margin-bottom: 18px;

  color: var(--muted);

  font-family: "DM Mono", monospace;
  font-size: 9px;
}

.member-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);

  gap: 10px;
}

.member {
  min-height: 175px;

  padding: 16px;

  border: 1px solid var(--line);

  background: rgba(255,250,240,.5);

  cursor: pointer;

  transition:
    transform .18s ease,
    border-color .18s ease,
    background .18s ease;
}

.member:hover {
  transform: translateY(-4px);

  border-color: var(--ink);

  background: var(--paper);
}

.member.active {
  border-color: var(--ink);

  background: var(--paper);

  box-shadow:
    4px 4px 0 rgba(48,38,31,.11);
}

.member .emoji {
  display: block;

  margin-bottom: 20px;

  font-size: 2rem;
}

.member h3 {
  margin: 0;

  font-size: 1.15rem;
  font-weight: 500;
}

.member p {
  margin: 6px 0 0;

  color: var(--muted);

  font-size: .85rem;
  line-height: 1.3;
}

/* FOOTER */

footer {
  display: flex;
  justify-content: space-between;

  gap: 20px;

  padding-top: 20px;

  border-top: 1px solid var(--ink);

  color: var(--muted);

  font-size: 8px;
}

/* =========================
   WINNER OVERLAY
========================= */

.winner-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
}

.winner-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(255, 248, 230, 0.08), transparent 30%),
    rgba(24, 17, 12, 0.78);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.winner-modal {
  position: relative;
  z-index: 2;
  width: min(680px, calc(100% - 30px));
  padding: 34px 24px 28px;
  border: 1px solid var(--ink);
  background: rgba(255, 250, 240, 0.96);
  color: var(--ink);
  text-align: center;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  animation: winnerIn 0.45s cubic-bezier(.2, .8, .2, 1);
}

@keyframes winnerIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.winner-art {
  position: relative;
  width: min(280px, 70vw);
  margin: 24px auto 20px;
  display: grid;
  place-items: center;
}

.winner-aura {
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 218, 130, 0.7) 0%, rgba(255, 190, 90, 0.35) 35%, rgba(255, 170, 60, 0.15) 55%, rgba(255, 150, 40, 0) 75%);
  filter: blur(12px);
  animation: auraPulse 2.4s ease-in-out infinite;
}

@keyframes auraPulse {
  0%, 100% {
    transform: scale(0.96);
    opacity: 0.85;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

#winnerImage {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: auto;
  filter:
    drop-shadow(0 0 16px rgba(255, 210, 120, 0.45))
    drop-shadow(0 0 34px rgba(255, 186, 72, 0.28))
    drop-shadow(0 10px 18px rgba(0, 0, 0, 0.16));
  animation: pieFloat 2.8s ease-in-out infinite;
}

@keyframes pieFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* 冠军不是苹果派时用它的 emoji 顶上（手头只有苹果派的立绘） */
#winnerEmoji {
  position: relative;
  z-index: 2;
  font-size: min(9rem, 30vw);
  line-height: 1;
  filter:
    drop-shadow(0 0 16px rgba(255, 210, 120, 0.45))
    drop-shadow(0 10px 18px rgba(0, 0, 0, 0.16));
  animation: pieFloat 2.8s ease-in-out infinite;
}

.winner-modal h2 {
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 5rem);
  line-height: 0.9;
  font-weight: 650;
}

.winner-modal p:not(.label) {
  max-width: 520px;
  margin: 14px auto 24px;
  font-size: 1.18rem;
  line-height: 1.35;
}

.winner-modal .reset-btn {
  background: var(--ink);
  color: var(--paper);
}

.winner-modal .reset-btn:hover {
  background: #4b3a2f;
}

@media (max-width: 620px) {
  .winner-modal {
    padding: 28px 16px 22px;
  }

  .winner-aura {
    width: 190px;
    height: 190px;
  }

  .winner-modal p:not(.label) {
    font-size: 1.05rem;
  }
}

/* MOBILE */

@media (max-width: 900px) {
  .council {
    grid-template-columns: 1fr;
  }

  .member-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 620px) {
  .app {
    padding: 20px 14px 30px;
  }

  .hero {
    display: block;
  }

  .intro {
    margin-top: 18px;
  }

  .chart-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .chart-area {
    min-height: 360px;
    padding: 15px 0;
  }

  .legend {
    grid-template-columns: repeat(2, 1fr);
  }

  .member-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .section-heading {
    display: block;
  }

  .section-heading span:last-child {
    display: block;

    margin-top: 7px;
  }

  footer {
    flex-direction: column;
  }
}

/* 必须放在 .winner-overlay 之后：两者都是单类选择器、权重相同，
   靠靠后的位置才能盖住 overlay 的 display: grid。 */
.hidden {
  display: none;
}
