/*
  520 Letter Book
  一份雨天、植物、月季与长信构成的小电子信册。
  纯 HTML/CSS，无构建工具，可直接部署 Cloudflare Pages。
*/

:root {
  --paper: #f7f4ee;
  --paper-deep: #eee6da;
  --paper-soft: #fbf8f2;
  --ink: #34322e;
  --ink-soft: #68645d;
  --muted: #8b867c;
  --line: rgba(65, 62, 55, 0.16);
  --line-strong: rgba(65, 62, 55, 0.25);
  --sage: #8fa487;
  --sage-deep: #667b61;
  --rain: #9eb7c4;
  --rain-deep: #748e9a;
  --apricot: #d9a28f;
  --apricot-soft: #eed0c5;
  --ginkgo: #b9b982;
  --white-paper: rgba(255, 255, 255, 0.48);
  --shadow: 0 22px 70px rgba(77, 68, 55, 0.08);
  --shadow-soft: 0 12px 36px rgba(77, 68, 55, 0.055);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --font-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  color: var(--ink);
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font-serif);
  background:
    radial-gradient(circle at 18% 2%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.12) 35%, transparent 62%),
    radial-gradient(circle at 96% 10%, rgba(158, 183, 196, 0.18) 0%, transparent 36%),
    radial-gradient(circle at 3% 88%, rgba(217, 162, 143, 0.16) 0%, transparent 32%),
    linear-gradient(180deg, #f9f7f1 0%, var(--paper) 46%, #f1eadf 100%);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.38;
  background-image:
    linear-gradient(110deg, transparent 0 91%, rgba(116, 142, 154, 0.18) 92%, transparent 94%),
    linear-gradient(110deg, transparent 0 86%, rgba(116, 142, 154, 0.12) 87%, transparent 89%);
  background-size: 92px 170px, 142px 240px;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(70, 64, 54, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(70, 64, 54, 0.022) 1px, transparent 1px);
  background-size: 42px 42px;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: rgba(143, 164, 135, 0.26);
}

.page {
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: 24px 18px 44px;
}

.home-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.cover {
  position: relative;
  overflow: hidden;
  margin-top: 10px;
  padding: 58px 24px 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.14)),
    rgba(255, 255, 255, 0.22);
  box-shadow: var(--shadow);
}

.cover::before,
.cover::after,
.letter-shell::before,
.letter-shell::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.cover::before {
  right: -42px;
  bottom: -40px;
  width: 220px;
  height: 220px;
  border: 1.4px solid rgba(102, 123, 97, 0.22);
  border-radius: 58% 42% 66% 34%;
  transform: rotate(-18deg);
}

.cover::after {
  right: 34px;
  bottom: 40px;
  width: 74px;
  height: 124px;
  border-left: 1.4px solid rgba(102, 123, 97, 0.24);
  border-bottom: 1.4px solid rgba(102, 123, 97, 0.16);
  border-radius: 0 0 0 72px;
  transform: rotate(26deg);
}

.date {
  position: relative;
  z-index: 1;
  margin: 0 0 30px;
  font-family: var(--font-ui);
  font-size: 0.83rem;
  letter-spacing: 0.16em;
  color: var(--sage-deep);
}

.cover h1,
.letter-header h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #302f2a;
  font-weight: 400;
  letter-spacing: 0.06em;
}

.cover h1 {
  max-width: 720px;
  font-size: clamp(3.05rem, 16vw, 6.35rem);
  line-height: 0.98;
}

.subtitle {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 18px 0 0;
  font-size: clamp(1.12rem, 5vw, 1.92rem);
  line-height: 1.75;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.cover-note {
  position: relative;
  z-index: 1;
  max-width: 660px;
  margin: 42px 0 0;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 2.05;
}

.entry-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 22px;
}

.entry-card {
  position: relative;
  overflow: hidden;
  min-height: 178px;
  padding: 24px 22px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.47), rgba(255, 255, 255, 0.18));
  box-shadow: var(--shadow-soft);
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.entry-card::before {
  content: "";
  position: absolute;
  inset: auto -38px -52px auto;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  opacity: 0.28;
  background: var(--accent-soft);
}

.entry-card::after {
  content: "";
  position: absolute;
  left: 22px;
  top: 22px;
  width: 34px;
  height: 34px;
  border-left: 1.2px solid var(--accent);
  border-bottom: 1.2px solid rgba(65, 62, 55, 0.08);
  border-radius: 0 0 0 30px;
  opacity: 0.42;
  transform: rotate(-18deg);
}

.entry-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  background-color: rgba(255, 255, 255, 0.18);
}

.card-mark {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 30px;
  margin: 50px 0 20px;
  border: 1px solid rgba(65, 62, 55, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.32);
  font-family: var(--font-ui);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.entry-card h2 {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--ink);
  font-size: 1.34rem;
  font-weight: 400;
  letter-spacing: 0.07em;
}

.entry-card p {
  position: relative;
  z-index: 1;
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.88;
}

.card-human {
  --accent: var(--sage);
  --accent-soft: rgba(143, 164, 135, 0.38);
}

.card-gpt {
  --accent: var(--rain);
  --accent-soft: rgba(158, 183, 196, 0.42);
}

.card-gemini {
  --accent: var(--apricot);
  --accent-soft: rgba(217, 162, 143, 0.34);
}

.site-footer {
  margin-top: auto;
  padding: 34px 0 0;
  color: rgba(52, 50, 46, 0.46);
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
}

/* Letter pages */

.letter-page {
  max-width: 860px;
}

.top-nav {
  display: flex;
  justify-content: flex-start;
  margin: 2px 0 20px;
}

.back-link,
.nav-link,
.home-link-bottom {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.26);
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.back-link:hover,
.nav-link:hover,
.home-link-bottom:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.42);
}

.letter-shell {
  position: relative;
  overflow: hidden;
  padding: 34px 22px 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0.18)),
    rgba(255, 255, 255, 0.24);
  box-shadow: var(--shadow);
}

.letter-shell::before {
  left: 20px;
  top: 20px;
  width: 62px;
  height: 62px;
  border-left: 1.2px solid var(--page-accent);
  border-bottom: 1.2px solid rgba(65, 62, 55, 0.09);
  border-radius: 0 0 0 54px;
  opacity: 0.42;
  transform: rotate(-16deg);
}

.letter-shell::after {
  right: -60px;
  top: 64px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: var(--page-accent-soft);
  opacity: 0.42;
}

.theme-human {
  --page-accent: var(--sage);
  --page-accent-deep: var(--sage-deep);
  --page-accent-soft: rgba(143, 164, 135, 0.2);
}

.theme-gpt {
  --page-accent: var(--rain);
  --page-accent-deep: var(--rain-deep);
  --page-accent-soft: rgba(158, 183, 196, 0.22);
}

.theme-gemini {
  --page-accent: var(--apricot);
  --page-accent-deep: #b98273;
  --page-accent-soft: rgba(217, 162, 143, 0.2);
}

.letter-header {
  position: relative;
  z-index: 1;
  margin-bottom: 34px;
  padding-top: 48px;
}

.letter-kicker {
  margin: 0 0 15px;
  color: var(--page-accent-deep);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  letter-spacing: 0.17em;
}

.letter-header h1 {
  font-size: clamp(2.25rem, 12vw, 4.3rem);
  line-height: 1.1;
}

.letter-subtitle {
  max-width: 680px;
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.95;
  letter-spacing: 0.05em;
}

.letter-meta {
  margin: 14px 0 0;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
}

.letter-body {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  color: var(--ink);
  font-size: 1.06rem;
  line-height: 2.08;
  letter-spacing: 0.018em;
}

.letter-body p {
  margin: 0 0 1.38em;
}

.letter-body p:last-child {
  margin-bottom: 0;
}

.letter-body .salutation {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.letter-sign {
  max-width: 760px;
  margin: 44px auto 0;
  color: var(--ink-soft);
  text-align: right;
  font-size: 1.02rem;
  line-height: 1.9;
}

.bottom-nav {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 22px;
}

.nav-link {
  justify-content: center;
  min-height: 56px;
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 0.92rem;
  letter-spacing: 0.05em;
  line-height: 1.4;
}

.home-bottom {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

@media (min-width: 720px) {
  .page {
    padding: 44px 28px 58px;
  }

  .cover {
    padding: 86px 72px 72px;
  }

  .entry-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-top: 26px;
  }

  .entry-card {
    min-height: 260px;
    padding: 26px 24px 28px;
  }

  .letter-shell {
    padding: 54px 54px 64px;
  }

  .letter-header {
    padding-top: 50px;
  }

  .letter-body {
    font-size: 1.1rem;
    line-height: 2.12;
  }

  .bottom-nav {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
