/* Hello World, Softly — Styles */

/* Theme variables */
:root {
  --bg: #0a0a0a;
  --bg-secondary: #141414;
  --text: #e8e8e8;
  --text-muted: #b8b8b8;
  --text-dim: #888;
  --text-dimmer: #666;
  --border: #2a2a2a;
  --highlight-bg: #1a1a1a;
  --highlight-border: #444;
  --nav-bg: rgba(10,10,10,0.95);
  --btn-bg: #222;
  --btn-hover: #333;
  --link: #9cb8d8;
  --link-hover: #c8daf0;
  --accent: #7a9ec2;
}

html.light {
  --bg: #faf9f7;
  --bg-secondary: #f0efe9;
  --text: #1a1a1a;
  --text-muted: #444;
  --text-dim: #666;
  --text-dimmer: #888;
  --border: #ddd;
  --highlight-bg: #f5f4f0;
  --highlight-border: #999;
  --nav-bg: rgba(250,249,247,0.95);
  --btn-bg: #e8e6e0;
  --btn-hover: #dddbd5;
  --link: #4a6a8a;
  --link-hover: #2a4a6a;
  --accent: #5a7a9a;
}

/* Base */
* { box-sizing: border-box; }
html {
  font-size: 18px;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.7;
  transition: background 0.3s, color 0.3s;
}

/* Links */
a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: var(--link-hover);
}

/* Controls (top right) */
.controls {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 101;
}
.controls button {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text);
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.controls button:hover {
  background: var(--btn-hover);
}

/* Main content */
main {
  max-width: 600px;
  margin: 0 auto;
  padding: 60px 24px 100px;
}

/* Cover */
.cover {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 40px 20px;
}
.cover h1 {
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: normal;
  margin: 0 0 0.5rem;
  letter-spacing: 0.02em;
}
.cover .subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 0 0 1rem;
}
.cover .tagline {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin: 0 0 3rem;
}
.cover .author {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 2rem;
}
.cover .start-reading {
  display: inline-block;
  margin-top: 3rem;
  padding: 12px 32px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.9rem;
  transition: all 0.2s;
}
.cover .start-reading:hover {
  background: var(--btn-hover);
  border-color: var(--text-dim);
}

/* Part headers */
.part-header {
  text-align: center;
  padding: 80px 20px;
  border-top: 1px solid var(--border);
  margin-top: 60px;
}
.part-header:first-of-type {
  border-top: none;
  margin-top: 0;
}
.part-header h2 {
  font-size: 1.8rem;
  font-weight: normal;
  margin: 0;
  letter-spacing: 0.05em;
}

/* Chapters */
.chapter {
  padding: 40px 0;
  border-bottom: 1px solid var(--border);
}
.chapter:last-child {
  border-bottom: none;
}
.chapter h3 {
  font-size: 1.3rem;
  font-weight: normal;
  margin: 0 0 1.5rem;
  color: var(--text);
}
.chapter p {
  margin: 1rem 0;
  color: var(--text-muted);
}
.chapter p:first-of-type {
  margin-top: 0;
}
.chapter ul {
  margin: 1rem 0;
  padding-left: 1.5em;
  color: var(--text-muted);
}
.chapter li {
  margin: 0.5rem 0;
}
.chapter strong {
  color: var(--text);
  font-weight: 600;
}
.chapter em {
  font-style: italic;
}

/* The phrase - special styling */
.phrase {
  text-align: center;
  font-size: 1.2rem;
  color: var(--text);
  margin: 2rem 0;
  font-style: italic;
}

/* Highlight boxes */
.highlight {
  background: var(--highlight-bg);
  border-left: 3px solid var(--accent);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}
.highlight p {
  margin: 0;
}

/* Closing section */
.closing {
  text-align: center;
  padding: 60px 20px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.closing h2 {
  font-size: 1.5rem;
  font-weight: normal;
  margin: 0 0 2rem;
}
.closing p {
  color: var(--text-muted);
  margin: 1rem 0;
}
.closing .final-phrase {
  font-size: 1.3rem;
  font-style: italic;
  color: var(--text);
  margin: 2rem 0;
}

/* Footer */
footer {
  text-align: center;
  padding: 60px 20px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
footer p {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin: 0.5rem 0;
}
footer .tripod {
  margin-top: 2rem;
  font-size: 0.8rem;
}
footer .tripod a {
  margin: 0 1rem;
}

/* Navigation (bottom) */
nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--nav-bg);
  padding: 12px 20px;
  display: flex;
  justify-content: center;
  gap: 20px;
  border-top: 1px solid var(--border);
  z-index: 100;
  transition: all 0.2s;
}
nav a {
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 8px 12px;
}
nav a:hover {
  color: var(--text);
}

/* Table of contents */
.toc {
  padding: 40px 0;
}
.toc h2 {
  font-size: 1.2rem;
  font-weight: normal;
  margin: 0 0 1.5rem;
  text-align: center;
}
.toc-part {
  margin: 1.5rem 0;
}
.toc-part h3 {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin: 0 0 0.5rem;
  font-weight: normal;
}
.toc-part ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc-part li {
  margin: 0.3rem 0;
}
.toc-part a {
  font-size: 0.9rem;
  color: var(--text-muted);
}
.toc-part a:hover {
  color: var(--text);
}

/* Responsive */
@media (max-width: 600px) {
  html { font-size: 16px; }
  main { padding: 40px 20px 100px; }
  .cover h1 { font-size: 2.2rem; }
  .controls { top: 12px; right: 12px; }
  nav { padding: 10px 16px; gap: 12px; }
}

/* Print */
@media print {
  body { background: #fff; color: #000; }
  .controls, nav { display: none; }
  main { padding: 0; max-width: none; }
  .chapter { page-break-inside: avoid; }
}
