@import './global.css';

:root {
  color-scheme: light;
  --bg: #fbf8ef;
  --surface: #fffdf8;
  --text: #171712;
  --muted: #66675d;
  --line: rgba(23, 23, 18, 0.14);
  --accent: #315f4f;
  --accent2: #b84d63;
  --cobalt: #2d56b3;
  --font: 'IBM Plex Sans', 'Noto Sans TC', sans-serif;
  --serif: 'Playfair Display', 'Noto Sans TC', serif;
  --mono: 'Azeret Mono', 'Noto Sans TC', monospace;
  --radius: 8px;
  --max-w: 1120px;
  --intel-bg: #f6f0e4;
  --intel-text: var(--text);
  --intel-muted: var(--muted);
  --intel-surface: rgba(255, 253, 248, 0.84);
  --intel-line: var(--line);
}

body {
  min-width: 320px;
  overflow-x: hidden;
  color: var(--text);
  font-family: var(--font);
  background:
    linear-gradient(90deg, rgba(49, 95, 79, 0.055) 1px, transparent 1px),
    linear-gradient(0deg, rgba(184, 77, 99, 0.045) 1px, transparent 1px),
    var(--bg);
  background-size: 58px 58px, 58px 58px, auto;
}

.archive-shell {
  width: min(var(--max-w), calc(100% - 40px));
  margin: 0 auto;
}

.archive-nav,
.archive-nav div,
.archive-contact div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.archive-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 248, 239, 0.9);
  backdrop-filter: blur(16px);
}

.archive-nav div,
.archive-contact div {
  justify-content: flex-end;
  gap: 0.5rem;
}

.archive-nav a,
.archive-contact a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem;
  font-size: 0.84rem;
  font-weight: 900;
}

.archive-hero {
  min-height: calc(100dvh - 72px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.48fr);
  gap: 3rem;
  align-items: center;
  padding: 4rem 0;
}

.archive-kicker,
.essay-grid span,
.paper-shelf span,
.archive-index time {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.archive-hero h1,
.archive-section-head h2,
.archive-contact h2 {
  max-width: 13ch;
  font-family: var(--serif);
  font-size: 4.4rem;
  font-weight: 800;
  letter-spacing: 0;
}

.archive-hero p,
.archive-section-head p,
.essay-grid p,
.paper-shelf p,
.archive-index p {
  color: var(--muted);
  line-height: 1.75;
}

.archive-hero > div > p:not(.archive-kicker) {
  max-width: 56ch;
  margin-top: 1.2rem;
  font-size: 1.12rem;
}

.archive-hero figure {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem;
  background: var(--surface);
  box-shadow: 12px 12px 0 rgba(49, 95, 79, 0.12);
}

.archive-hero img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  object-fit: cover;
  filter: sepia(8%) contrast(1.06);
}

.archive-hero figcaption {
  margin-top: 0.8rem;
  color: var(--muted);
  font-weight: 900;
}

.archive-section {
  padding: 5.5rem 0;
  border-top: 1px solid var(--line);
}

.archive-section-head {
  margin-bottom: 2rem;
}

.essay-grid,
.paper-shelf,
.archive-index {
  display: grid;
  gap: 1rem;
}

.essay-grid {
  grid-template-columns: 1.2fr 0.8fr 0.8fr;
}

.essay-grid article,
.paper-shelf a,
.paper-shelf article,
.archive-index article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem;
  background: var(--surface);
}

.essay-grid .feature {
  grid-row: span 2;
}

.essay-grid h3,
.paper-shelf h3,
.archive-index h3 {
  margin: 0.8rem 0 0.5rem;
  font-size: 1.35rem;
}

.essay-grid div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.essay-grid small {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.35rem 0.55rem;
  color: var(--cobalt);
  font-weight: 900;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.74fr) minmax(0, 1.26fr);
  gap: 3rem;
}

.sticky {
  position: sticky;
  top: 96px;
}

.paper-shelf {
  grid-template-columns: 1fr;
}

.paper-shelf strong {
  display: block;
  margin-top: 0.8rem;
  color: var(--accent2);
}

.archive-index {
  grid-template-columns: repeat(5, 1fr);
}

.archive-contact {
  margin: 4rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem;
  background: linear-gradient(135deg, rgba(49, 95, 79, 0.12), rgba(184, 77, 99, 0.08));
}

.archive-contact h2 {
  max-width: 16ch;
}

.archive-contact div {
  margin-top: 1.5rem;
  justify-content: flex-start;
}

.archive-contact a:first-child {
  color: #fff;
  background: var(--accent);
}

@media (max-width: 980px) {
  .archive-hero,
  .split,
  .essay-grid,
  .archive-index {
    grid-template-columns: 1fr;
  }

  .essay-grid .feature {
    grid-row: auto;
  }

  .sticky {
    position: static;
  }
}

@media (max-width: 640px) {
  .archive-shell {
    width: min(100% - 28px, var(--max-w));
  }

  .archive-hero h1,
  .archive-section-head h2,
  .archive-contact h2 {
    font-size: 2.45rem;
  }
}
