/* Pingwang Pickles — editorial archive UI */
:root {
  --pw-paper: #eee2cd;
  --pw-paper-light: #f8f1e4;
  --pw-paper-bright: #fffaf1;
  --pw-sauce: #6d3927;
  --pw-sauce-dark: #321d16;
  --pw-chili: #c73a2d;
  --pw-chili-dark: #8f251d;
  --pw-yellow: #e5bf28;
  --pw-ink: #211812;
  --pw-muted: #77685b;
  --pw-line: rgba(70, 42, 29, .2);
  --pw-line-light: rgba(255, 249, 238, .22);
  --pw-shadow: 0 26px 70px rgba(67, 37, 24, .12);
  --pw-serif: "Songti SC", "STSong", "Noto Serif SC", SimSun, serif;
  --pw-sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  --pw-max: 1240px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 15% 10%, rgba(199, 58, 45, .04), transparent 26rem),
    linear-gradient(rgba(90, 55, 35, .025) 1px, transparent 1px),
    var(--pw-paper-light);
  background-size: auto, 100% 7px, auto;
  color: var(--pw-ink);
  font-family: var(--pw-sans);
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  z-index: 100;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.08'/%3E%3C/svg%3E");
}
a { color: inherit; text-decoration: none; }
button, summary { font: inherit; }
p { margin: 0; }
::selection { background: var(--pw-yellow); color: var(--pw-ink); }

.pw-skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 200; background: var(--pw-yellow); padding: .75rem 1rem; font-weight: 800; }
.pw-skip-link:focus { top: 1rem; }

.pw-header {
  position: sticky;
  top: 0;
  z-index: 90;
  min-height: 76px;
  padding: 0 max(24px, 4vw);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  background: rgba(248, 241, 228, .88);
  border-bottom: 1px solid var(--pw-line);
  backdrop-filter: blur(16px);
}
.pw-brand { display: inline-flex; align-items: center; gap: 12px; font-family: var(--pw-serif); }
.pw-brand-mark { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; background: var(--pw-chili); color: white; font-size: 20px; font-weight: 900; box-shadow: 5px 5px 0 var(--pw-yellow); }
.pw-brand-copy { display: grid; line-height: 1.1; }
.pw-brand-copy strong { font-size: 17px; }
.pw-brand-copy small { margin-top: 5px; font-family: var(--pw-sans); font-size: 8px; font-weight: 800; letter-spacing: .15em; color: var(--pw-muted); }
.pw-nav { display: flex; align-items: center; gap: clamp(18px, 3vw, 42px); }
.pw-nav a { position: relative; padding: 28px 0 24px; font-size: 13px; font-weight: 750; }
.pw-nav a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: 18px; height: 2px; background: var(--pw-chili); transition: right .25s ease; }
.pw-nav a:hover::after, .pw-nav a.is-active::after { right: 0; }
.pw-menu-button { display: none; border: 0; background: transparent; font-weight: 800; cursor: pointer; }

.pw-hero {
  position: relative;
  min-height: min(760px, calc(100vh - 76px));
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: clamp(72px, 9vw, 130px) max(24px, 8vw);
  background-image:
    linear-gradient(90deg, rgba(248, 241, 228, .98) 0%, rgba(248, 241, 228, .93) 33%, rgba(248, 241, 228, .48) 62%, rgba(248, 241, 228, .06) 100%),
    url("./assets/pingwang-hero-background.png");
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--pw-line);
}
.pw-hero::after { content: "平望"; position: absolute; left: 48%; top: 3%; color: rgba(109, 57, 39, .06); font-family: var(--pw-serif); font-size: clamp(180px, 30vw, 480px); line-height: 1; white-space: nowrap; pointer-events: none; }
.pw-hero-copy { position: relative; z-index: 2; width: min(650px, 100%); }
.pw-kicker, .pw-eyebrow { color: var(--pw-chili); font-size: 10px; font-weight: 900; letter-spacing: .19em; text-transform: uppercase; }
.pw-hero h1 { margin: 22px 0 28px; font-family: var(--pw-serif); font-size: clamp(76px, 10.5vw, 154px); font-weight: 800; letter-spacing: -.09em; line-height: .76; }
.pw-hero h1 span { display: block; }
.pw-hero h1 span:last-child { margin-left: .5em; color: var(--pw-chili); }
.pw-hero-intro { max-width: 570px; color: #594a3e; font-family: var(--pw-serif); font-size: clamp(17px, 1.5vw, 23px); line-height: 1.9; }
.pw-hero-actions { display: flex; align-items: center; gap: 28px; margin-top: 38px; }
.pw-button { min-height: 52px; padding: 0 24px; display: inline-flex; align-items: center; justify-content: center; gap: 36px; border: 1px solid transparent; font-size: 13px; font-weight: 800; transition: transform .22s ease, box-shadow .22s ease, background .22s ease; }
.pw-button:hover { transform: translateY(-3px); box-shadow: 8px 8px 0 rgba(50, 29, 22, .14); }
.pw-button-primary { background: var(--pw-chili); color: white; }
.pw-text-link { padding-bottom: 4px; border-bottom: 1px solid var(--pw-sauce); color: var(--pw-sauce); font-size: 13px; font-weight: 800; }
.pw-hero-meta { position: absolute; z-index: 3; right: max(24px, 4vw); bottom: 0; display: grid; grid-template-columns: repeat(3, auto); background: var(--pw-sauce-dark); color: var(--pw-paper-light); }
.pw-hero-meta div { min-width: 150px; padding: 22px 24px; border-left: 1px solid var(--pw-line-light); }
.pw-hero-meta strong { display: block; font-family: var(--pw-serif); font-size: 24px; }
.pw-hero-meta span { display: block; margin-top: 6px; color: rgba(255,255,255,.62); font-size: 10px; letter-spacing: .08em; }

.pw-manifesto { max-width: var(--pw-max); margin: 0 auto; padding: clamp(90px, 12vw, 170px) max(24px, 4vw); display: grid; grid-template-columns: .55fr 1.45fr; gap: clamp(40px, 8vw, 120px); align-items: start; }
.pw-manifesto-label { writing-mode: vertical-rl; color: var(--pw-muted); font-size: 10px; font-weight: 900; letter-spacing: .28em; }
.pw-manifesto-copy h2 { margin: 18px 0 30px; font-family: var(--pw-serif); font-size: clamp(38px, 5.2vw, 74px); letter-spacing: -.05em; line-height: 1.16; }
.pw-manifesto-copy > p:last-of-type { max-width: 780px; color: var(--pw-muted); font-size: 16px; line-height: 2; }
.pw-method-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; }
.pw-method-row span { padding: 9px 13px; border: 1px solid var(--pw-line); background: rgba(255,255,255,.3); font-size: 11px; font-weight: 800; }

.pw-portals { max-width: var(--pw-max); margin: 0 auto; padding: 0 max(24px, 4vw) clamp(100px, 12vw, 170px); display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.pw-portal { min-height: 420px; padding: 28px; display: flex; flex-direction: column; border: 1px solid var(--pw-line); transition: transform .25s ease, box-shadow .25s ease; }
.pw-portal:hover { transform: translateY(-8px); box-shadow: var(--pw-shadow); }
.pw-portal-number { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-size: 11px; font-weight: 900; }
.pw-portal > div:nth-child(2) { margin-top: auto; }
.pw-portal small { font-size: 8px; font-weight: 900; letter-spacing: .17em; opacity: .62; }
.pw-portal h3 { margin: 12px 0 14px; font-family: var(--pw-serif); font-size: clamp(34px, 3.3vw, 48px); line-height: 1.15; }
.pw-portal p { font-size: 13px; line-height: 1.8; opacity: .74; }
.pw-portal-link { margin-top: 28px; padding-top: 16px; display: flex; justify-content: space-between; border-top: 1px solid currentColor; font-size: 12px; font-weight: 900; }
.pw-portal-paper { background: var(--pw-paper); color: var(--pw-sauce-dark); }
.pw-portal-dark { background: var(--pw-sauce-dark); color: var(--pw-paper-light); }
.pw-portal-yellow { background: var(--pw-yellow); color: var(--pw-ink); }

.pw-content-section { padding: clamp(90px, 11vw, 150px) max(24px, 4vw); border-top: 1px solid var(--pw-line); }
.pw-section-dark { background: var(--pw-sauce-dark); color: var(--pw-paper-light); }
.pw-section-yellow { background: #e6c33a; }
.pw-section-heading { max-width: var(--pw-max); margin: 0 auto clamp(52px, 7vw, 90px); display: grid; grid-template-columns: 120px minmax(0, 850px); gap: 34px; }
.pw-section-number { width: 82px; height: 82px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-family: var(--pw-serif); font-size: 28px; }
.pw-section-heading h2 { margin: 12px 0 18px; font-family: var(--pw-serif); font-size: clamp(44px, 6vw, 82px); letter-spacing: -.06em; line-height: 1.05; }
.pw-section-heading > div:last-child > p:last-child { max-width: 720px; color: var(--pw-muted); line-height: 1.9; }
.pw-section-dark .pw-section-heading > div:last-child > p:last-child { color: rgba(255,255,255,.62); }
.pw-section-dark .pw-eyebrow { color: #f2c750; }
.pw-section-yellow .pw-eyebrow { color: var(--pw-chili-dark); }
.pw-story-grid { max-width: var(--pw-max); margin: 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.pw-story-card { position: relative; min-width: 0; padding: clamp(24px, 3vw, 38px); border: 1px solid var(--pw-line); background: rgba(255, 250, 241, .58); overflow: hidden; }
.pw-story-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--pw-chili); transform: scaleX(0); transform-origin: left; transition: transform .3s ease; }
.pw-story-card:hover::before, .pw-story-card:has(details[open])::before { transform: scaleX(1); }
.pw-section-dark .pw-story-card { border-color: var(--pw-line-light); background: rgba(255,255,255,.045); }
.pw-section-yellow .pw-story-card { background: rgba(255,250,235,.55); }
.pw-story-topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.pw-story-index { font-family: var(--pw-serif); font-size: 36px; color: var(--pw-chili); }
.pw-section-dark .pw-story-index { color: #f2c750; }
.pw-source-tag { padding: 7px 10px; border: 1px solid currentColor; font-size: 9px; font-weight: 900; letter-spacing: .08em; opacity: .68; }
.pw-story-card h3 { margin: 24px 0 14px; font-family: var(--pw-serif); font-size: clamp(25px, 2.5vw, 38px); line-height: 1.25; }
.pw-story-lead { min-height: 3.8em; color: var(--pw-muted); font-size: 14px; line-height: 1.9; }
.pw-section-dark .pw-story-lead { color: rgba(255,255,255,.64); }
.pw-story-card details { margin-top: 28px; }
.pw-story-card summary { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 0; border-top: 1px solid currentColor; list-style: none; cursor: pointer; font-size: 12px; font-weight: 900; }
.pw-story-card summary::-webkit-details-marker { display: none; }
.pw-story-card summary span:last-child { font-size: 20px; line-height: 1; transition: transform .25s ease; }
.pw-story-card details[open] summary span:last-child { transform: rotate(45deg); }
.pw-story-detail { padding-top: 28px; animation: pw-open .32s ease both; }
@keyframes pw-open { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.pw-story-body { display: grid; gap: 16px; }
.pw-story-body p { font-size: 14px; line-height: 2; }
.pw-facts { margin: 28px 0 0; display: grid; gap: 1px; background: var(--pw-line); border: 1px solid var(--pw-line); }
.pw-facts div { display: grid; grid-template-columns: minmax(90px, .34fr) 1fr; background: var(--pw-paper-bright); }
.pw-section-dark .pw-facts { background: var(--pw-line-light); border-color: var(--pw-line-light); }
.pw-section-dark .pw-facts div { background: #42271e; }
.pw-section-yellow .pw-facts div { background: #f6dd76; }
.pw-facts dt, .pw-facts dd { margin: 0; padding: 12px 14px; font-size: 11px; line-height: 1.65; }
.pw-facts dt { font-weight: 900; color: var(--pw-chili); }
.pw-section-dark .pw-facts dt { color: #f2c750; }
.pw-citation-box { margin-top: 20px; padding: 18px; border-left: 3px solid var(--pw-chili); background: rgba(109,57,39,.06); }
.pw-section-dark .pw-citation-box { border-left-color: #f2c750; background: rgba(255,255,255,.05); }
.pw-citation-box p { font-size: 11px; line-height: 1.8; color: var(--pw-muted); }
.pw-section-dark .pw-citation-box p { color: rgba(255,255,255,.62); }
.pw-citation-box p + p { margin-top: 8px; }
.pw-citation-box strong { display: inline-block; margin-right: 8px; color: currentColor; }

.pw-sources { padding: clamp(90px, 11vw, 150px) max(24px, 4vw); background: var(--pw-paper); border-top: 1px solid var(--pw-line); }
.pw-source-heading { margin-bottom: 56px; }
.pw-source-grid { max-width: var(--pw-max); margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.pw-source-card { min-height: 360px; padding: 30px; border: 1px solid var(--pw-line); background: var(--pw-paper-bright); }
.pw-source-card > span { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--pw-chili); color: white; font-family: var(--pw-serif); font-size: 20px; }
.pw-source-card h3 { margin: 54px 0 20px; font-family: var(--pw-serif); font-size: 30px; }
.pw-source-card p { color: var(--pw-muted); font-size: 13px; line-height: 1.95; }
.pw-verify { max-width: var(--pw-max); margin: 18px auto 0; padding: 30px; display: grid; grid-template-columns: .55fr 1.45fr; gap: 40px; background: var(--pw-yellow); }
.pw-verify h3 { margin: 10px 0 0; font-family: var(--pw-serif); font-size: 31px; }
.pw-verify > p { align-self: center; line-height: 1.9; }

.pw-footer { padding: 46px max(24px, 4vw); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 38px; background: var(--pw-sauce-dark); color: var(--pw-paper-light); }
.pw-brand-footer .pw-brand-mark { box-shadow: 5px 5px 0 var(--pw-yellow); }
.pw-footer > p { max-width: 640px; justify-self: center; color: rgba(255,255,255,.55); font-size: 11px; line-height: 1.8; text-align: center; }
.pw-back-top { font-size: 12px; font-weight: 900; }

.reveal { opacity: 1; transform: none; }
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}

@media (max-width: 980px) {
  .pw-hero-meta { grid-template-columns: repeat(3, 1fr); left: 0; right: 0; }
  .pw-hero-meta div { min-width: 0; }
  .pw-portals, .pw-source-grid { grid-template-columns: 1fr; }
  .pw-portal { min-height: 330px; }
  .pw-story-grid { grid-template-columns: 1fr; }
  .pw-story-lead { min-height: auto; }
  .pw-manifesto { grid-template-columns: 80px 1fr; }
  .pw-source-card { min-height: auto; }
  .pw-source-card h3 { margin-top: 34px; }
}

@media (max-width: 760px) {
  html { scroll-padding-top: 70px; }
  .pw-header { min-height: 68px; padding-inline: 18px; }
  .pw-brand-copy small { display: none; }
  .pw-menu-button { display: block; }
  .pw-nav { position: absolute; left: 0; right: 0; top: 100%; display: none; padding: 18px; background: var(--pw-paper-light); border-bottom: 1px solid var(--pw-line); box-shadow: 0 18px 36px rgba(50,29,22,.12); }
  .pw-nav.is-open { display: grid; }
  .pw-nav a { padding: 12px; border-bottom: 1px solid var(--pw-line); }
  .pw-nav a::after { display: none; }
  .pw-hero { min-height: 720px; align-items: flex-start; padding: 76px 22px 170px; background-image: linear-gradient(180deg, rgba(248,241,228,.98) 0%, rgba(248,241,228,.86) 48%, rgba(248,241,228,.22) 100%), url("./assets/pingwang-hero-background.png"); background-position: 66% center; }
  .pw-hero::after { display: none; }
  .pw-hero h1 { font-size: clamp(70px, 23vw, 110px); }
  .pw-hero-intro { font-size: 16px; line-height: 1.8; }
  .pw-hero-actions { align-items: flex-start; flex-direction: column; gap: 18px; }
  .pw-hero-meta { grid-template-columns: 1fr 1fr; }
  .pw-hero-meta div { padding: 16px 18px; }
  .pw-hero-meta div:last-child { grid-column: span 2; }
  .pw-manifesto { grid-template-columns: 1fr; padding-inline: 22px; }
  .pw-manifesto-label { writing-mode: initial; }
  .pw-manifesto-copy h2 br { display: none; }
  .pw-portals, .pw-content-section, .pw-sources { padding-left: 18px; padding-right: 18px; }
  .pw-section-heading { grid-template-columns: 1fr; gap: 22px; }
  .pw-section-number { width: 62px; height: 62px; font-size: 21px; }
  .pw-story-card { padding: 23px; }
  .pw-story-index { font-size: 30px; }
  .pw-story-card h3 { font-size: 28px; }
  .pw-facts div { grid-template-columns: 1fr; }
  .pw-facts dt { padding-bottom: 0; }
  .pw-verify { grid-template-columns: 1fr; gap: 18px; }
  .pw-footer { grid-template-columns: 1fr; justify-items: start; }
  .pw-footer > p { justify-self: start; text-align: left; }
}

/* Homepage — keeps the original pingwang-ui-template.html content as a separate portal page */
.pw-home-page {
  min-height: 100vh;
  background: var(--pw-paper-light);
}
.pw-home-page::before { opacity: .16; }
.pw-home-page .pw-header {
  position: relative;
  min-height: 72px;
  height: 72px;
  padding: 0 5vw;
  background: rgba(248, 243, 233, .94);
}
.pw-home-page .pw-brand {
  gap: 12px;
  font-family: var(--pw-serif);
  font-weight: 800;
}
.pw-home-page .pw-brand-mark {
  width: 38px;
  height: 38px;
  box-shadow: none;
}
.pw-button-outline {
  border-color: var(--pw-sauce);
  color: var(--pw-sauce);
  background: transparent;
}
.pw-button-yellow { background: var(--pw-yellow); color: var(--pw-ink); }

.pw-home-page .pw-hero {
  min-height: 620px;
  padding: 8vw;
  align-items: center;
  background-image:
    linear-gradient(90deg, rgba(244, 234, 216, .97), rgba(244, 234, 216, .72) 46%, rgba(244, 234, 216, .06)),
    url("./assets/pingwang-hero-background.png");
  background-position: center;
  background-size: cover;
}
.pw-home-page .pw-hero::after { display: none; }
.pw-home-page .pw-hero-copy { max-width: 620px; }
.pw-home-page .pw-hero h1 {
  margin: 20px 0;
  font-size: clamp(58px, 8vw, 112px);
  letter-spacing: -.06em;
  line-height: .95;
}
.pw-home-page .pw-hero h1::after {
  content: "";
  display: block;
  width: 64px;
  height: 4px;
  margin-top: 28px;
  background: var(--pw-chili);
}
.pw-home-page .pw-hero p {
  max-width: 520px;
  color: var(--pw-muted);
  font-family: var(--pw-sans);
  font-size: 15px;
  line-height: 1.8;
}
.pw-home-page .pw-hero .pw-button { margin-top: 30px; }

.pw-home-page .pw-portals {
  max-width: 1180px;
  margin: 0 auto;
  padding: 100px 5vw;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.pw-card {
  min-height: 360px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--pw-line);
  transition: transform .22s ease, box-shadow .22s ease;
}
.pw-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--pw-shadow);
}
.pw-card small {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .18em;
}
.pw-card h2 {
  margin: auto 0 12px;
  font-family: var(--pw-serif);
  font-size: 44px;
}
.pw-card p { font-size: 13px; line-height: 1.75; }
.pw-card span {
  margin-top: 24px;
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid currentColor;
  font-size: 12px;
  font-weight: 800;
}
.pw-card-paper { background: var(--pw-paper); color: var(--pw-sauce-dark); }
.pw-card-dark { background: var(--pw-sauce-dark); color: var(--pw-paper-light); }
.pw-card-yellow { background: var(--pw-yellow); color: var(--pw-ink); }

@media (max-width: 760px) {
  .pw-home-page .pw-header { min-height: 68px; height: 68px; padding-inline: 18px; }
  .pw-home-page .pw-hero {
    min-height: 560px;
    padding: 82px 6vw 72px;
    background-image:
      linear-gradient(180deg, rgba(244, 234, 216, .97), rgba(244, 234, 216, .78) 55%, rgba(244, 234, 216, .24)),
      url("./assets/pingwang-hero-background.png");
    background-position: 66% center;
  }
  .pw-home-page .pw-hero h1 { font-size: clamp(58px, 19vw, 88px); }
  .pw-home-page .pw-portals { grid-template-columns: 1fr; padding: 70px 5vw; }
  .pw-card { min-height: 300px; }
}
