:root {
  --paper: #f1eee8;
  --paper-deep: #d9d1c6;
  --ink: #201d1a;
  --ink-soft: #6e675f;
  --cinnabar: #a44735;
  --cinnabar-bright: #c7654e;
  --line: rgba(32, 29, 26, 0.14);
  --display: "FZKai-Z03", "Kaiti SC", "STKaiti", "LXGW WenKai", serif;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", sans-serif;
}

body {
  background: var(--paper);
  color: var(--ink);
}

.grain { opacity: .08; }
.site-header {
  width: min(1240px, calc(100% - 56px));
  padding: 22px 0;
  border-bottom: 0;
  background: transparent;
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 20;
  transform: translateX(-50%);
  color: #f5f0e8;
}
.brand { color: inherit; font-family: var(--sans); font-size: .82rem; font-weight: 600; letter-spacing: .18em; }
.brand-seal { width: 31px; background: var(--cinnabar); color: #fff8ee; font-family: var(--display); }
.site-nav { display: flex; align-items: center; gap: 28px; }
.site-nav > a, .admin-access summary { color: rgba(255, 250, 241, .82); font-family: var(--sans); font-size: .72rem; letter-spacing: .14em; text-decoration: none; }
.site-nav > a:hover, .admin-access summary:hover { color: #fff; }
.admin-access summary { border-bottom-color: rgba(255,255,255,.55); }
.admin-popover { color: var(--ink); background: rgba(246,242,235,.96); box-shadow: 0 20px 70px rgba(0,0,0,.28); }
main { width: 100%; }
.hero {
  position: relative;
  min-height: min(760px, 88vh);
  height: 760px;
  max-height: 88vh;
  overflow: hidden;
  padding: 0;
  color: #f8f3eb;
  background: #241d19;
}
.hero-image, .hero-shade { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-image { object-fit: cover; object-position: center; }
.hero-shade { background: linear-gradient(90deg, rgba(18,14,12,.82) 0%, rgba(18,14,12,.5) 34%, rgba(18,14,12,.04) 78%), linear-gradient(0deg, rgba(18,14,12,.4), transparent 38%); }
.hero-copy { position: absolute; z-index: 1; left: max(28px, calc((100vw - 1240px) / 2)); bottom: clamp(60px, 11vw, 132px); max-width: 500px; }
.hero .kicker { margin-bottom: 20px; color: #d98a70; font-family: var(--sans); font-size: .68rem; letter-spacing: .28em; }
.hero h1 { margin: 0; font-family: var(--display); font-size: clamp(4.7rem, 10vw, 9.5rem); font-weight: 400; letter-spacing: .02em; line-height: .9; }
.hero-caption { margin: 26px 0 30px; color: rgba(248,243,235,.82); font-family: var(--serif); font-size: 1.12rem; }
.hero-link { display: inline-flex; gap: 20px; align-items: center; color: #f8f3eb; font-family: var(--sans); font-size: .76rem; letter-spacing: .12em; text-decoration: none; }
.hero-link span { color: #d98a70; font-size: 1.15rem; transition: transform .2s ease; }
.hero-link:hover span { transform: translateY(4px); }
.library { width: min(1240px, calc(100% - 56px)); margin: 0 auto; padding: 110px 0 130px; border-top: 0; }
.library::before { display: none; }
.section-heading { margin-bottom: 44px; align-items: end; }
.section-heading h2 { margin-top: 8px; font-size: clamp(2.5rem, 5vw, 4.8rem); line-height: .9; }
.section-heading p { letter-spacing: .13em; }
.file-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 56px; }
.file-item { min-width: 0; padding: 8px 0; border-top: 1px solid var(--line); transition: border-color .2s ease, transform .2s ease; }
.file-item:last-child { border-bottom: 0; }
.file-item:hover { padding-inline: 0; border-color: var(--cinnabar); background: transparent; transform: translateX(6px); }
.file-button { grid-template-columns: 52px minmax(0,1fr) 30px; min-height: 78px; padding: 10px 0; }
.file-button::before { font-size: .67rem; }
.file-name { font-size: 1.08rem; }
.file-arrow { font-size: 1.2rem; }
.delete-button { margin-left: 10px; border-color: var(--line); }
.empty-state { padding: 56px 0; border-top: 1px solid var(--line); }
.upload-section { margin: 0; padding: 70px max(28px, calc((100vw - 1240px) / 2)); }
footer { width: min(1240px, calc(100% - 56px)); padding-top: 0; }
.download-dialog, .reader-dialog { border-radius: 0; }
.dialog-shell, .reader-shell { border-top-width: 4px; box-shadow: 0 24px 90px rgba(0,0,0,.24); }
.reader-header { padding-top: 24px; }

@media (max-width: 720px) {
  .site-header { width: calc(100% - 32px); padding: 18px 0; }
  .site-nav { gap: 18px; }
  .hero { min-height: 650px; height: 78vh; max-height: none; }
  .hero-image { object-position: 62% center; }
  .hero-shade { background: linear-gradient(0deg, rgba(18,14,12,.82) 0%, rgba(18,14,12,.28) 68%, rgba(18,14,12,.16)); }
  .hero-copy { left: 24px; bottom: 68px; }
  .hero h1 { font-size: clamp(4.3rem, 22vw, 7rem); }
  .library { width: calc(100% - 32px); padding: 74px 0 88px; }
  .section-heading { margin-bottom: 26px; }
  .file-list { grid-template-columns: 1fr; }
  .file-item:hover { transform: none; }
  .file-button { min-height: 70px; }
  footer { width: calc(100% - 32px); }
}

/* The portrait stays behind the whole page; content bands preserve contrast. */
body {
  position: relative;
  isolation: isolate;
  background: #e7eaf0;
}
body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background: url("images/archive-background.jpg") center 38% / cover no-repeat;
  opacity: .82;
  pointer-events: none;
  content: "";
}
.grain { display: none; }
.site-header { color: #272b39; }
.site-nav > a, .admin-access summary { color: #272b39; }
.site-nav > a:hover, .admin-access summary:hover { color: #923f4c; }
.admin-access summary { border-bottom-color: rgba(39,43,57,.5); }
.hero {
  height: min(670px, 74svh);
  min-height: 480px;
  max-height: none;
  color: #242938;
  background: transparent;
}
.hero::after { display: none; }
.hero-copy {
  right: max(28px, calc((100vw - 1240px) / 2));
  left: auto;
  bottom: clamp(52px, 10vh, 110px);
  text-align: right;
}
.hero .kicker { color: #854557; }
.hero h1 { font-size: clamp(1.65rem, 3vw, 2.8rem); line-height: 1.55; text-wrap: balance; text-shadow: 0 1px 8px rgba(255,255,255,.95); }
.hero-caption { color: #242938; font-size: .92rem; text-shadow: 0 1px 6px #fff; }
.hero-link { color: #272b39; }
.hero-link span { color: #923f4c; }
.library {
  width: 100%;
  padding-inline: max(28px, calc((100vw - 1240px) / 2));
  background: rgba(249, 249, 251, .32);
  backdrop-filter: none;
}
.upload-section { background: rgba(32, 29, 38, .9); }
footer {
  width: 100%;
  padding: 26px max(28px, calc((100vw - 1240px) / 2)) 36px;
  background: rgba(249, 249, 251, .32);
}
@media (max-width: 720px) {
  body::before { background-position: center top; opacity: .82; }
  .hero { height: 68svh; min-height: 470px; }
  .hero-copy { right: 22px; left: 22px; bottom: 42px; max-width: none; }
  .hero h1 { font-size: clamp(1.45rem, 5.5vw, 2rem); }
  .hero-caption { margin: 14px 0 20px; }
  .library { width: 100%; padding: 68px 16px 84px; }
  footer { width: 100%; padding: 24px 16px 34px; }
}

/* Local reading surfaces keep the full-screen artwork visible around text. */
.hero-copy {
  padding: 28px 32px;
  max-width: 540px;
  text-align: left;
  background: linear-gradient(90deg, rgba(250,250,252,.96), rgba(250,250,252,.86) 72%, rgba(250,250,252,0));
  border: 0;
  border-left: 3px solid #854557;
  border-radius: 0;
}
.hero h1 { color: #202430; font-size: 2.25rem; line-height: 1.45; font-weight: 600; letter-spacing: 0; text-shadow: none; }
.title-prefix { display: block; margin-bottom: 10px; color: #854557; font-size: 1.1rem; }
.title-main { display: block; overflow-wrap: anywhere; }
.hero-caption { margin: 20px 0 24px; color: #343846; font-size: .92rem; line-height: 1.8; text-shadow: none; }
.hero-link { padding: 10px 0; border-bottom: 1px solid #854557; letter-spacing: 0; }
.site-header {
  background: rgba(250, 250, 252, .92);
  padding: 16px 20px;
  top: 12px;
  border-radius: 10px;
}
.section-heading {
  padding: 18px 20px;
  background: rgba(250, 250, 252, .9);
  border-radius: 10px;
}
.section-heading p, footer { color: #393c46; }
.file-list { gap: 10px 28px; }
.file-item, .file-item:hover {
  padding: 8px 16px;
  background: rgba(250, 250, 252, .92);
  border-color: rgba(32, 36, 48, .18);
  border-radius: 8px;
}
.file-name { color: #202430; font-weight: 600; }
footer { background: rgba(249, 249, 251, .86); }
@media (max-width: 720px) {
  .hero-copy { padding: 20px 18px; }
  .hero h1 { font-size: 1.65rem; }
  .title-prefix { font-size: 1rem; margin-bottom: 8px; }
  .hero-caption { font-size: .85rem; }
  .site-header { padding: 12px 14px; }
  .section-heading { padding: 16px; }
}
