/* Grief Workbook - Hello World, Softly
 * A gentle, accessible design for those in pain
 */

:root {
  --bg: #0f0f1a;
  --bg-section: #161625;
  --bg-input: #1e1e30;
  --text: #e8e8f0;
  --text-muted: #9090a8;
  --accent: #7c9eb2;
  --accent-soft: #4a6a7a;
  --border: #2a2a40;
  --crisis: #c47070;
  --practice: #6b8a7a;
  --reassurance: #8a8a6b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 17px;
}

/* Navigation */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(15, 15, 26, 0.95);
  backdrop-filter: blur(10px);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-weight: 500;
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-links .crisis-link {
  color: var(--crisis);
}

/* Hero */
.hero {
  padding: 8rem 2rem 4rem;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 300;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.hero .subtitle {
  color: var(--accent);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.hero .intro {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.8;
}

/* Main Workbook */
.workbook {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
}

/* Parts */
.part {
  margin-bottom: 4rem;
}

.part > h2 {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--accent);
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

/* Sections */
.section {
  background: var(--bg-section);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.section h3 {
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 1rem;
  color: var(--text);
}

.section h4 {
  font-size: 1rem;
  font-weight: 500;
  margin: 1.5rem 0 0.75rem;
  color: var(--accent);
}

.section-intro {
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-style: italic;
}

.section p {
  margin-bottom: 1rem;
}

/* Checklists */
.checklist {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
}

.checklist.two-column {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.5rem;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.check-item:hover {
  background: #252540;
}

.check-item input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid var(--border);
  border-radius: 4px;
  margin-top: 2px;
  transition: all 0.2s;
}

.check-item input:checked + .checkmark {
  background: var(--accent);
  border-color: var(--accent);
}

.check-item input:checked + .checkmark::after {
  content: '✓';
  display: block;
  text-align: center;
  color: var(--bg);
  font-size: 14px;
  line-height: 16px;
}

.check-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.check-content strong {
  color: var(--text);
}

.check-content span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Write Spaces */
.write-space {
  margin: 1.5rem 0;
}

.write-space label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text);
  font-weight: 500;
}

.write-space textarea,
.write-space input[type="text"] {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  padding: 1rem;
  resize: vertical;
  transition: border-color 0.2s;
}

.write-space textarea {
  min-height: 100px;
}

.write-space.large textarea {
  min-height: 200px;
}

.write-space.small input {
  padding: 0.75rem 1rem;
}

.write-space textarea:focus,
.write-space input:focus {
  outline: none;
  border-color: var(--accent);
}

.write-space textarea::placeholder,
.write-space input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

/* Wave Tracker */
.wave-tracker {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1rem 0;
}

.wave-entry {
  display: grid;
  grid-template-columns: 1fr 1.5fr 100px 30px;
  gap: 0.75rem;
  align-items: center;
}

.wave-entry input[type="text"] {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.75rem;
}

.wave-entry input[type="range"] {
  -webkit-appearance: none;
  background: var(--border);
  height: 6px;
  border-radius: 3px;
}

.wave-entry input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}

.intensity-label {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

.add-wave-btn {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  padding: 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.2s;
  margin-top: 0.5rem;
}

.add-wave-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Practice Section */
.practice-section {
  border-color: var(--practice);
}

.practice-box {
  background: rgba(107, 138, 122, 0.1);
  border: 1px solid var(--practice);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.practice-box h4 {
  color: var(--practice);
  margin-top: 0;
}

.practice-box ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.practice-box li {
  margin-bottom: 0.5rem;
}

.practice-note {
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 0;
}

/* Gentle Question */
.gentle-question {
  background: rgba(138, 138, 107, 0.1);
  border-left: 3px solid var(--reassurance);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
}

.gentle-note {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0;
}

/* Reassurance */
.reassurance {
  color: var(--reassurance);
  font-style: italic;
  margin-top: 1rem;
}

/* Lists */
.cant-list, .avoid-list {
  background: var(--bg-input);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1rem 0;
}

.cant-list ul, .avoid-list ul, .worry-list {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.cant-list li, .avoid-list li, .worry-list li {
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

/* For Both Box */
.for-both-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}

.for-both-box p {
  background: var(--bg-input);
  padding: 1rem;
  border-radius: 8px;
  margin: 0;
}

/* Journal Entries */
.journal-entries {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1rem 0;
}

.journal-entry {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 0.75rem;
}

.journal-entry input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.75rem;
}

.journal-entry input[type="date"] {
  color-scheme: dark;
}

/* Name Placeholder */
.name-placeholder {
  color: var(--accent);
  border-bottom: 1px dashed var(--accent);
}

.practice-prompt {
  font-style: italic;
  color: var(--text-muted);
}

/* Closing */
.closing {
  text-align: center;
  padding: 3rem 2rem;
  margin: 2rem 0;
}

.closing blockquote {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 2;
  font-style: italic;
}

.closing blockquote p {
  margin-bottom: 0.5rem;
}

/* Crisis Section */
.crisis-section {
  background: rgba(196, 112, 112, 0.1);
  border: 1px solid var(--crisis);
  border-radius: 12px;
  padding: 2rem;
  margin: 2rem 0;
}

.crisis-section h2 {
  color: var(--crisis);
  font-size: 1.3rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.crisis-resources {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.crisis-card {
  background: var(--bg-section);
  border: 1px solid var(--crisis);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.crisis-card:hover {
  background: rgba(196, 112, 112, 0.15);
  transform: translateY(-2px);
}

.crisis-number {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--crisis);
}

.crisis-name {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.crisis-action {
  font-size: 0.85rem;
  color: var(--accent);
}

.crisis-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

/* Footer */
.footer {
  text-align: center;
  padding: 3rem 2rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.footer p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.footer-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin: 1.5rem 0;
}

.footer button {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.footer button:hover {
  background: var(--text);
}

.footer button.secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.footer button.secondary:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.footer-links {
  margin: 1rem 0;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
}

.footer-links a:hover {
  color: var(--accent);
}

.attribution {
  color: var(--accent);
  font-size: 0.85rem;
  margin-top: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
  .nav {
    padding: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .nav-links {
    display: flex;
    width: 100%;
    justify-content: center;
    gap: 1rem;
    font-size: 0.85rem;
  }

  .nav-links a:not(.crisis-link) {
    display: none;
  }

  .nav-links .crisis-link {
    display: block;
  }

  .hero {
    padding: 6rem 1.5rem 3rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .workbook {
    padding: 1rem;
  }

  .section {
    padding: 1.5rem;
  }

  .wave-entry {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .wave-entry input[type="range"] {
    width: 100%;
  }

  .for-both-box {
    grid-template-columns: 1fr;
  }

  .journal-entry {
    grid-template-columns: 1fr;
  }

  .checklist.two-column {
    grid-template-columns: 1fr;
  }

  .footer-actions {
    flex-direction: column;
  }
}

/* Print Styles */
@media print {
  .nav, .footer-actions, .add-wave-btn {
    display: none;
  }

  body {
    background: white;
    color: black;
  }

  .section {
    break-inside: avoid;
    border: 1px solid #ccc;
  }

  .crisis-section {
    border-color: #999;
  }
}

/* Saved indicator */
.saved-indicator {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--practice);
  color: var(--bg);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.saved-indicator.show {
  opacity: 1;
}

/* Overwhelm Mode */
.overwhelm-trigger {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s;
  margin-left: auto;
}

.overwhelm-trigger:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.overwhelm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.overwhelm-content {
  text-align: center;
  max-width: 400px;
  padding: 2rem;
}

.overwhelm-breathing {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  margin: 0 auto 3rem;
  animation: breathe 6s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% {
    transform: scale(0.8);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.8;
  }
}

.overwhelm-instruction {
  font-size: 1.5rem;
  color: var(--text);
  margin-bottom: 0.5rem;
  font-weight: 300;
}

.overwhelm-sub {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 3rem;
}

.overwhelm-timer {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 2rem;
  min-height: 1.2em;
}

.overwhelm-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.overwhelm-stay,
.overwhelm-return {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.overwhelm-stay:hover,
.overwhelm-return:hover {
  border-color: var(--accent);
  color: var(--text);
}

.overwhelm-return {
  opacity: 0;
  animation: fadeInDelayed 0.5s ease 10s forwards;
}

@keyframes fadeInDelayed {
  to { opacity: 1; }
}

.overwhelm-less {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: none;
  margin-top: 2rem;
}

.overwhelm-less:hover {
  color: var(--accent);
}

.overwhelm-talk {
  display: block;
  color: var(--accent);
  font-size: 0.85rem;
  text-decoration: none;
  margin-top: 1rem;
}

.overwhelm-talk:hover {
  text-decoration: underline;
}

.overwhelm-crisis {
  display: block;
  color: var(--crisis);
  font-size: 0.85rem;
  text-decoration: none;
  margin-top: 1rem;
}

.overwhelm-crisis:hover {
  text-decoration: underline;
}

/* Hide return button initially, show after 10s */
.overwhelm-overlay.just-entered .overwhelm-return {
  display: none;
}

/* Minimal mode - even more reduced */
.overwhelm-overlay.minimal .overwhelm-actions,
.overwhelm-overlay.minimal .overwhelm-timer {
  display: none;
}

.overwhelm-overlay.minimal .overwhelm-sub {
  margin-bottom: 4rem;
}

@media (max-width: 768px) {
  .overwhelm-trigger {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 50;
    background: var(--bg-section);
    border-radius: 20px;
    padding: 0.5rem 1rem;
  }

  .overwhelm-instruction {
    font-size: 1.3rem;
  }

  .overwhelm-actions {
    flex-direction: column;
  }
}
