:root {
  color-scheme: light;
  --page: #f7fafb;
  --paper: #ffffff;
  --ink: #243241;
  --muted: #657181;
  --line: #d8e2ea;
  --accent: #2d6f8f;
  --accent-strong: #1d526b;
  --warm: #d99f76;
  --shadow: 0 20px 60px rgba(36, 50, 65, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(204, 227, 238, 0.58), rgba(247, 250, 251, 0) 360px),
    var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0;
}

.brand {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  font-weight: 700;
  text-decoration: none;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 0.95rem;
}

.top-nav a {
  text-decoration: none;
}

.top-nav a:hover {
  color: var(--accent-strong);
}

.site-main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.viewer {
  min-height: calc(100vh - 90px);
  display: grid;
  grid-template-columns: minmax(240px, 0.82fr) minmax(320px, 1.18fr);
  align-items: center;
  gap: clamp(32px, 6vw, 76px);
  padding: 22px 0 56px;
}

.viewer-copy {
  max-width: 440px;
}

.label {
  margin: 0 0 14px;
  color: var(--accent-strong);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.5rem, 7vw, 5.6rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.date-line {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  line-height: 1.6;
}

.advice-frame {
  margin: 0;
}

.advice-frame img {
  display: block;
  width: min(100%, 660px);
  aspect-ratio: 1;
  object-fit: cover;
  margin-left: auto;
  border: 1px solid rgba(216, 226, 234, 0.84);
  border-radius: 8px;
  box-shadow: var(--shadow);
  background: #d6e8f2;
}

.advice-frame figcaption {
  margin-top: 14px;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.5;
  text-align: right;
}

.advice-controls {
  grid-column: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}

button,
.permalink {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

button {
  padding: 0 18px;
}

.permalink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
}

button:hover,
.permalink:hover,
.archive-button:hover {
  border-color: rgba(45, 111, 143, 0.55);
  color: var(--accent-strong);
}

button:disabled {
  color: #9aa7b3;
  cursor: default;
  opacity: 0.72;
}

.archive {
  padding: 44px 0 76px;
  border-top: 1px solid var(--line);
}

.archive h2 {
  margin: 0 0 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  letter-spacing: 0;
}

.archive-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.archive-button {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-start;
  min-height: 76px;
  padding: 14px 16px;
}

.archive-button.is-current {
  border-color: rgba(45, 111, 143, 0.78);
  background: #eef7fb;
}

.archive-edition {
  color: var(--accent-strong);
  font-size: 0.84rem;
  font-weight: 700;
}

.archive-date {
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 34px;
  color: var(--muted);
  font-size: 0.92rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 820px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .viewer {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 28px;
    padding-top: 34px;
  }

  .viewer-copy {
    max-width: none;
  }

  .advice-frame img {
    width: 100%;
    margin-left: 0;
  }

  .advice-frame figcaption {
    text-align: left;
  }

  .advice-controls {
    grid-column: 1;
    grid-template-columns: 1fr 1fr;
  }

  .permalink {
    grid-column: 1 / -1;
    order: 3;
  }
}

@media (max-width: 480px) {
  .site-header,
  .site-main,
  .site-footer {
    width: min(100% - 24px, 1120px);
  }

  .top-nav {
    width: 100%;
    justify-content: space-between;
  }

  .archive-list {
    grid-template-columns: 1fr;
  }
}
