/* Choose Your Own Mindfulness — app shell styles.
   Palette follows the source PDF: cream paper, deep blue-teal accents. */

:root {
  /* The design is deliberately light (cream paper, per the source PDF);
     opt out of browser-generated dark modes. */
  color-scheme: only light;
  --paper: #F8F4EA;
  --paper-raised: #FDFAF3;
  --ink: #26333A;
  --ink-muted: #5C6B70;
  --accent: #1B4B57;
  --accent-soft: #4E7E8A;
  --rule: #DDD5C2;
  --danger: #8A3B2E;
  --serif: "Iowan Old Style", "Palatino", "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --nav-height: 58px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
}

/* Header */

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  padding-top: calc(0.55rem + env(safe-area-inset-top));
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.app-title {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.01em;
}

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: -8px -8px -8px 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent-soft);
  cursor: pointer;
}

.icon-button:active { color: var(--accent); }

/* Main content */

#main {
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 1.1rem;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 1.5rem);
}

.view[hidden] { display: none; }

.view article { margin: 1.4rem 0 2rem; }

.view h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.45rem;
  line-height: 1.3;
  color: var(--accent);
  margin: 0 0 0.6rem;
}

.view h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--accent);
  margin: 1.4rem 0 0.4rem;
}

.view p { margin: 0.6rem 0; }

.view a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }

.view ul, .view ol { padding-left: 1.3rem; }

.view blockquote {
  margin: 1rem 0;
  padding: 0.1rem 0 0.1rem 1rem;
  border-left: 2px solid var(--accent-soft);
  color: var(--ink-muted);
}

.view hr { border: none; border-top: 1px solid var(--rule); margin: 1.5rem 0; }

.content-note { color: var(--ink-muted); }

.load-error { color: var(--danger); }

/* Placeholder cards for the Practice tools and Listen episodes */

.tool-card {
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  border-radius: 3px;
  padding: 0.9rem 1rem;
  margin: 0.9rem 0;
}

.tool-card h3 { margin-top: 0; }

.tool-status {
  font-size: 0.85rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0.2rem 0 0.5rem;
}

/* Settings */

.settings-actions { margin: 1.5rem 0; }

.button {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 0.6rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--accent);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 1rem;
  cursor: pointer;
  margin-top: 1.4rem;
}

.button:active { background: var(--accent-soft); border-color: var(--accent-soft); }

.button-danger {
  background: none;
  color: var(--danger);
  border-color: var(--danger);
}

.button-danger:active { background: rgba(138, 59, 46, 0.08); }

.settings-hint {
  font-size: 0.875rem;
  color: var(--ink-muted);
  margin: 0.4rem 0 0;
}

.settings-status { min-height: 1.5em; color: var(--accent); }

/* Bottom navigation */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  background: var(--paper);
  border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--nav-height);
  padding: 6px 2px;
  border: none;
  background: none;
  color: var(--ink-muted);
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.nav-button svg { width: 23px; height: 23px; }

.nav-button[aria-current="true"] { color: var(--accent); }

/* Practice tool navigation */

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  margin: 0.4rem 0 0;
  border: none;
  background: none;
  color: var(--accent-soft);
  font-family: var(--sans);
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
}

.tool-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
  min-height: 64px;
  padding: 0.8rem 1rem;
  margin: 0.9rem 0;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--paper-raised);
  font-family: var(--sans);
  text-align: left;
  cursor: pointer;
}

.tool-link:active { background: var(--paper); }

.tool-link-text { display: flex; flex-direction: column; gap: 2px; }

.tool-link-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--accent);
}

.tool-link-desc { font-size: 0.875rem; color: var(--ink-muted); }

.tool-link-chevron { font-size: 1.5rem; color: var(--accent-soft); }

/* Body tension check */

.rating-row { margin: 0.9rem 0; }

.rating-label { display: block; font-size: 0.95rem; margin-bottom: 0.3rem; }

.rating-scale { display: flex; gap: 5px; }

.rating-btn {
  flex: 1;
  min-height: 44px;
  min-width: 44px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--paper-raised);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.rating-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
}

.button:disabled {
  background: var(--rule);
  border-color: var(--rule);
  color: var(--ink-muted);
  cursor: default;
}

.link-danger {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 0.6rem;
  padding: 0.5rem;
  border: none;
  background: none;
  color: var(--danger);
  font-family: var(--sans);
  font-size: 0.9rem;
  cursor: pointer;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8rem 0;
  font-size: 0.95rem;
}

.compare-table th, .compare-table td {
  padding: 0.45rem 0.4rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}

.compare-table th { font-family: var(--serif); color: var(--accent); font-weight: 600; }

.compare-table td:not(:first-child), .compare-table th:not(:first-child) { text-align: center; }

.compare-table tfoot th { border-bottom: none; }

/* History and journal lists */

.item-list { border-top: 1px solid var(--rule); margin-top: 0.5rem; }

.list-item { border-bottom: 1px solid var(--rule); }

.list-item-button {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  min-height: 56px;
  padding: 0.7rem 0.2rem;
  border: none;
  background: none;
  font-family: var(--sans);
  text-align: left;
  cursor: pointer;
}

.list-item-title { color: var(--accent); font-size: 0.95rem; }

.list-item-meta { color: var(--ink-muted); font-size: 0.9rem; }

.entry-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.item-detail { padding: 0 0.2rem 0.8rem; }

/* Journal */

.prompts { margin: 1rem 0; border: 1px solid var(--rule); border-radius: 3px; background: var(--paper-raised); }

.prompts summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0.4rem 1rem;
  font-family: var(--serif);
  color: var(--accent);
  cursor: pointer;
}

.prompts > div { padding: 0 1rem 0.6rem; }

.journal-text {
  display: block;
  width: 100%;
  min-height: 45vh;
  padding: 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--paper-raised);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
}

.journal-text:focus { outline: 2px solid var(--accent-soft); outline-offset: -1px; }

/* Drawing */

.drawing-canvas {
  display: block;
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: #FDFAF3;
  touch-action: none;
  margin: 0.8rem 0;
}

.button-row { display: flex; gap: 0.8rem; }

.button-row .button { margin-top: 0.6rem; }

.button-secondary {
  background: none;
  color: var(--accent);
}

.button-secondary:active { background: var(--paper-raised); }

/* Desktop is secondary but should not look broken */

@media (min-width: 700px) {
  body { font-size: 1.0625rem; }
  .app-title { font-size: 1.15rem; }
}
