/* --------- Theme Variables --------- */
:root {
  --bg: #fafafa;
  --text: #111;
  --muted: #666;
  --border: #ddd;
  --accent: #000;
}

html.dark {
  --bg: #0f0f0f;
  --text: #f2f2f2;
  --muted: #aaa;
  --border: #2a2a2a;
  --accent: #fff;
}


/* --------- Base --------- */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Georgia", "Times New Roman", serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

/* --------- Safe Area Insets --------- */
body {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}


/* --------- Layout --------- */
.layout {
  display: flex;
  min-height: calc(100vh - 60px);
}

.sidebar {
  width: 260px;
  padding: 24px;
  border-right: 1px solid var(--border);
}

.content {
  flex: 1;
  padding: 48px;
  max-width: 900px;
}

/* --------- Sidebar --------- */
.site-title {
  font-size: 1.6rem;
  margin-bottom: 32px;
}

.nav-section {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 24px 0 8px;
  color: var(--muted);
}

.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 0;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
}

.nav-item:hover {
  text-decoration: underline;
}

.nav-item.active {
  font-weight: bold;
}

.theme-toggle {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.theme-toggle button {
  background: none;
  border: 1px solid var(--border);
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}

.theme-toggle button:hover {
  background: var(--border);
}


/* --------- Content --------- */
.view {
  display: none;
}

.view.active {
  display: block;
}

h2 {
  font-size: 1.8rem;
  margin-bottom: 24px;
}

.poem {
  margin-top: 32px;
}

.poem p {
  white-space: pre-line;
  font-size: 1.1rem;
}

/* --------- Footer --------- */
.footer {
  height: 60px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  font-size: 0.9rem;
  color: var(--muted);
}

/* --------- Theme Toggle (iOS-style) --------- */
.theme-toggle {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--border);
  border-radius: 999px;
  transition: background-color 0.2s ease;
}

.slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background-color: var(--bg);
  border-radius: 50%;
  transition: transform 0.2s ease;
}

/* Checked (dark mode) */
.switch input:checked + .slider {
  background-color: var(--accent);
}

.switch input:checked + .slider::before {
  transform: translateX(18px);
}

/* Focus outline (keyboard accessibility) */
.switch input:focus-visible + .slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --------- Mobile Header --------- */
.mobile-header {
  display: none;
  height: 56px;
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  align-items: center;
  gap: 16px;
}

.mobile-header button {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text);
}

.mobile-title {
  font-size: 1.1rem;
  font-weight: bold;
}

/* --------- Responsive Layout --------- */
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 320px;
    background: var(--bg);
    border-right: none;
    border-bottom: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 1000;
    overflow-y: auto;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .content {
    padding: 24px 16px;
    max-width: 100%;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  .mobile-header {
    display: flex;
    padding-top: env(safe-area-inset-top);
  }

  body {
    padding-top: 56px;
  }

  h2 {
    font-size: 1.5rem;
  }

  .poem p {
    font-size: 1.05rem;
    line-height: 1.8;
  }

  .footer {
  padding-bottom: env(safe-area-inset-bottom);
  }
}


