/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== Palette ===== */
:root {
  --bg-page:     #f5f0eb;
  --bg-card:     #fffdf9;
  --bg-header:   #3b2f2f;
  --bg-nav:      #4a3c34;
  --bg-aside:    #ece6df;
  --bg-footer:   #3b2f2f;

  --text-body:   #3a322c;
  --text-muted:  #7a6e63;
  --text-light:  #c4b8aa;
  --text-inv:    #f0ebe5;

  --accent:      #8b5e3c;
  --accent-hover:#6d4528;
  --link:        #6b4226;
  --link-hover:  #4a2c14;
  --border:      #d6cec4;
  --border-dark: #b8aa98;
  --shadow:      rgba(59, 47, 47, 0.08);

  --max-w:       820px;
  --font-body:   Georgia, "Times New Roman", Times, serif;
  --font-sans:   "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius:      6px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--text-body);
  background: var(--bg-page);
  line-height: 1.8;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--link); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--link-hover); text-decoration: underline; }

/* ===== Site Header ===== */
.site-header {
  background: var(--bg-header);
  border-bottom: 3px solid var(--accent);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 24px 24px 0;
  text-align: center;
}

.header-image { display: inline-block; margin-bottom: 12px; }

.header-image img {
  width: 100%;
  max-width: 540px;
  height: auto;
  display: block;
  border-radius: var(--radius);
  border: 2px solid rgba(255,255,255,0.12);
}

.site-title {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0;
  letter-spacing: 0.01em;
}

.site-title a { color: var(--text-inv); text-decoration: none; }
.site-title a:hover { color: var(--text-light); text-decoration: none; }

/* ===== Navigation ===== */
.main-nav {
  background: var(--bg-nav);
  padding: 0;
}

.main-nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 6px 14px;
  color: var(--text-inv);
  border-radius: var(--radius);
}

.nav-links {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
}

.nav-links a {
  color: var(--text-light);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 12px 10px;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
  text-decoration: none;
}

.nav-links a:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
  text-decoration: none;
}

.nav-links a.active {
  color: #fff;
  border-bottom: 2px solid var(--accent);
}

/* ===== Sonnet Jump Bar ===== */
.sonnet-nav {
  background: var(--bg-aside);
  border-bottom: 1px solid var(--border);
}

.sonnet-nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sonnet-nav label {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.sonnet-nav select {
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 5px 10px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-body);
  cursor: pointer;
}

/* ===== Page Wrapper ===== */
.page-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px 24px 48px;
  flex: 1;
}

/* ===== Content Card ===== */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 40px;
  box-shadow: 0 2px 8px var(--shadow);
}

.page-title {
  font-size: 1.65rem;
  font-weight: 700;
  margin-bottom: 24px;
  line-height: 1.3;
  color: var(--bg-header);
  border-bottom: 2px solid var(--border);
  padding-bottom: 12px;
}

.content-card p { margin-bottom: 1em; }

.content-card hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

/* ===== Sonnet Image ===== */
.sonnet-image {
  text-align: center;
  margin-bottom: 24px;
}

.sonnet-image img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px var(--shadow);
}

/* ===== Sonnet Verse ===== */
.sonnet-verse {
  font-style: italic;
  font-size: 1rem;
  line-height: 2;
  margin: 0 0 28px 0;
  padding: 20px 28px;
  background: var(--bg-aside);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-body);
}

/* ===== Footnotes ===== */
.footnotes {
  margin-top: 36px;
}

.footnote-rule {
  border: none;
  border-top: 2px solid var(--accent);
  margin: 0 0 20px 0;
  width: 40%;
}

.footnote {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-left: 1em;
  text-indent: -1em;
}

.footnote strong {
  color: var(--text-body);
  font-weight: 600;
}

/* ===== Prev / Next ===== */
.prev-next {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  gap: 20px;
}

.prev-next a {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--accent);
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
}

.prev-next a:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  text-decoration: none;
}

.prev-next .next { margin-left: auto; }

/* ===== Footer ===== */
.site-footer {
  background: var(--bg-footer);
  border-top: 3px solid var(--accent);
  text-align: center;
  padding: 20px 24px;
  font-size: 0.82rem;
  color: var(--text-light);
  margin-top: auto;
}

/* ===== Landing Page ===== */
.landing-hero {
  text-align: center;
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.landing-hero .intro-text {
  max-width: 620px;
  margin: 0 auto;
  font-size: 1.02rem;
  color: var(--text-muted);
  line-height: 1.8;
}

.landing-hero .intro-text p { margin-bottom: 0.8em; }

.landing-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(139, 94, 60, 0.25);
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border-dark);
}

.btn-secondary:hover {
  background: var(--bg-aside);
  color: var(--accent-hover);
  text-decoration: none;
}

/* ===== Sonnet Grid (landing page) ===== */
.sonnets-section {
  margin-top: 4px;
}

.sonnets-section h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--bg-header);
  margin-bottom: 16px;
  text-align: center;
}

.sonnet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  gap: 6px;
}

.sonnet-grid a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-body);
  background: var(--bg-aside);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sonnet-grid a:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  text-decoration: none;
}

/* ===== Essays Section (landing page) ===== */
.essays-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.essays-section h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--bg-header);
  margin-bottom: 14px;
  text-align: center;
}

.essays-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.essays-list a {
  display: block;
  padding: 12px 16px;
  background: var(--bg-aside);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-body);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.essays-list a:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  text-decoration: none;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .header-inner { padding: 16px 16px 0; }
  .site-title { font-size: 1.2rem; }

  .nav-toggle { display: block; margin: 10px 0; }
  .main-nav-inner { flex-wrap: wrap; padding: 8px 16px; }
  .nav-links { display: none; flex-direction: column; width: 100%; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }

  .content-card { padding: 24px 20px; }
  .page-title { font-size: 1.3rem; }
  .page-wrap { padding: 20px 16px 32px; }

  .sonnet-grid { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 4px; }
  .sonnet-grid a { padding: 6px 2px; font-size: 0.78rem; }

  .prev-next { flex-direction: column; gap: 10px; }
  .prev-next .next { margin-left: 0; }

  .landing-actions { flex-direction: column; align-items: center; }
}
