:root {
  color-scheme: light;
  --paper: #f5f6f3;
  --ink: #24383e;
  --muted: #5d6d70;
  --line: #ced7d5;
  --accent: #42717a;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif CJK JP", serif;
  --sans: "Avenir Next", "Helvetica Neue", "Hiragino Sans", "Yu Gothic", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 104px; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 630px;
  z-index: -1;
  background: radial-gradient(ellipse at 80% 15%, #e4eeed 0, transparent 67%);
  pointer-events: none;
}
::selection { background: #d5e4e2; color: #172b30; }
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 2px; }
.skip-link { position: absolute; left: 24px; top: -100px; z-index: 10; padding: 14px; background: var(--paper); }
.skip-link:focus { top: 12px; }
.masthead, main, .footer { width: min(100% - 96px, 1240px); margin-inline: auto; }
.masthead { display: flex; justify-content: space-between; align-items: center; padding-block: 12px; font-size: 13px; letter-spacing: .035em; }
.home-link { display: inline-flex; align-items: center; gap: 13px; min-height: 44px; }
.home-link:hover { color: var(--accent); }
.arrow { width: 25px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1; }
.opening { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 8px 0 22px; }
h1 { margin: 0; font: 400 34px/1.4 var(--serif); letter-spacing: .14em; white-space: nowrap; }
.reading-nav { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 72px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--paper); }
.months { display: flex; gap: 30px; }
.months a { display: inline-flex; align-items: baseline; gap: 9px; padding: 20px 6px; font-size: 14px; }
.months a:hover { color: var(--accent); }
.month { display: grid; grid-template-columns: 85px minmax(0, 1fr); gap: 32px; padding-top: 76px; }
.month + .month { margin-top: 48px; border-top: 1px solid var(--line); }
.month-heading { margin: 0; align-self: start; display: flex; align-items: baseline; gap: 9px; font-weight: 400; }
.month-heading .month-number { font-family: var(--serif); font-size: 42px; font-weight: 400; line-height: 1; }
.month-heading .month-unit { font-size: 12px; }
.poems { min-width: 0; margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); direction: rtl; gap: 65px 0; }
.poem { position: relative; direction: ltr; min-width: 0; padding: 0 12px 36px; border-left: 1px solid #dfe4e1; scroll-margin-top: 110px; }
.poem-meta { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 27px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.poem-line { display: flex; justify-content: center; min-width: 0; }
.poem p, .random-result p { writing-mode: vertical-rl; text-orientation: mixed; width: auto; height: max-content; flex: none; margin: 0; font: 400 21px/1.8 var(--serif); letter-spacing: .045em; white-space: pre; }
.random-poem { padding: 0 0 43px; }
.random-poem[hidden] { display: none; }
.random-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.random-heading-row h2 { margin: 0; font-size: 13px; font-weight: 400; letter-spacing: .09em; color: var(--muted); }
.random-button { display: inline-flex; align-items: center; gap: 14px; min-height: 44px; padding: 8px 15px; border: 1px solid #9bb1b2; border-radius: 2px; background: transparent; color: var(--ink); font: 12px var(--sans); cursor: pointer; }
.random-button span { font-size: 20px; line-height: 1; }
.random-button:hover { background: #e6eeeb; border-color: var(--accent); }
.random-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.random-result { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: start; gap: 24px; min-width: 0; padding-top: 22px; }
.random-result .poem-meta { grid-column: 3; grid-row: 1; justify-self: end; margin: 5px 0 0; align-items: flex-end; text-align: right; }
.random-result .poem-line { grid-column: 2; grid-row: 1; }
.random-result p { font-size: 22px; }
.random-footer { display: flex; justify-content: flex-start; margin-top: 18px; }
.random-footer a { min-height: 44px; display: inline-flex; align-items: center; gap: 12px; padding: 0; color: var(--muted); font-size: 12px; }
.random-footer a:hover { color: var(--accent); }
.footer { display: flex; justify-content: space-between; align-items: center; gap: 24px; border-top: 1px solid var(--line); margin-top: 65px; padding: 32px 0 44px; color: var(--muted); font-size: 12px; }
.top-link { min-height: 44px; display: inline-flex; align-items: center; gap: 14px; }
.top-link:hover { color: var(--accent); }
@media (min-width: 1000px) {
  .month-heading { position: sticky; top: 116px; }
}
@media (min-width: 701px) and (max-width: 999px) {
  .month { grid-template-columns: 1fr; gap: 36px; }
  .poems { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  html { scroll-padding-top: 90px; }
  .masthead, main, .footer { width: calc(100% - 48px); }
  .masthead { padding-block: 10px; }
  .opening { padding: 6px 0 20px; gap: 12px; }
  h1 { font-size: 28px; letter-spacing: .12em; }
  .reading-nav { min-height: 66px; }
  .months { gap: 22px; }
  .months a { padding-block: 18px; }
  .month { grid-template-columns: 1fr; gap: 39px; padding-top: 48px; }
  .month-heading .month-number { font-size: 33px; }
  .poems { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 48px 0; }
  .poem { padding: 0 8px 20px; }
  .poem-meta { margin-bottom: 22px; }
  .poem p, .random-result p { font-size: 20px; line-height: 1.8; letter-spacing: .035em; }
  .random-poem { padding-bottom: 30px; }
  .random-heading-row { margin-bottom: 18px; }
  .random-result { gap: 18px; }
  .month + .month { margin-top: 12px; }
  .footer { margin-top: 36px; font-size: 11px; }
}
@media (max-width: 360px) {
  .masthead, main, .footer { width: calc(100% - 36px); }
  .poem p, .random-result p { font-size: 19px; }
}
@media (prefers-reduced-motion: no-preference) {
  .opening { animation: arrive .75s ease-out both; }
  @keyframes arrive { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print {
  :root { --paper: white; --ink: black; --muted: #444; }
  body::before, .masthead, .reading-nav, .skip-link, .top-link, .random-poem { display: none; }
  main, .footer { width: 100%; }
  main { display: block; }
  .opening { padding: 0 0 24px; }
  h1 { font-size: 28pt; }
  .month { display: block; padding-top: 24px; }
  .month-heading { position: static; margin-bottom: 22px; }
  .poems { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 32px 0; }
  .poem { break-inside: avoid; padding-bottom: 18px; }
  .poem-meta { margin-bottom: 8px; }
  .poem p { font-size: 12pt; line-height: 1.9; }
  .footer { margin-top: 24px; padding-block: 20px; }
}
