/* Faithlete - Daybreak design system
   Warm morning light palette. System fonts only. No build step. */

:root {
  /* spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  /* radius */
  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 20px;

  /* type */
  --font-serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;

  /* light theme (default)
     All text/background pairs below hold 4.5:1 or better (WCAG AA). */
  --bg: #faf3e7;
  --bg-raised: #fffaf1;
  --bg-sunken: #f1e6d3;
  --ink: #2b2620;
  --ink-soft: #6b5f4f;
  --ink-faint: #746645;
  --border: #e6d6ba;
  --accent: #a05a20;
  --accent-ink: #fff8ef;
  --accent-soft: #f1d9bb;
  --accent-deep: #7d450f;
  --success: #4f6b4f;
  --success-soft: #dee8dc;
  --danger: #a3402e;
  --shadow: 0 2px 10px rgba(90, 65, 30, 0.10);

  --dawn-1: #f6d9a8;
  --dawn-2: #eb9e5c;
  --dawn-3: #c9642f;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #211c17;
  --bg-raised: #2a241d;
  --bg-sunken: #1a1611;
  --ink: #f3ead9;
  --ink-soft: #cdbea3;
  --ink-faint: #a69274;
  --border: #453b2d;
  --accent: #e0a15c;
  --accent-ink: #2a1c0c;
  --accent-soft: #4a3a24;
  --accent-deep: #eab273;
  --success: #9ab88f;
  --success-soft: #33402f;
  --danger: #e0836f;
  --shadow: 0 2px 14px rgba(0, 0, 0, 0.35);

  --dawn-1: #3a2c1c;
  --dawn-2: #5c3d22;
  --dawn-3: #7a3f22;

  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #211c17;
    --bg-raised: #2a241d;
    --bg-sunken: #1a1611;
    --ink: #f3ead9;
    --ink-soft: #cdbea3;
    --ink-faint: #a69274;
    --border: #453b2d;
    --accent: #e0a15c;
    --accent-ink: #2a1c0c;
    --accent-soft: #4a3a24;
    --accent-deep: #eab273;
    --success: #9ab88f;
    --success-soft: #33402f;
    --danger: #e0836f;
    --shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
    --dawn-1: #3a2c1c;
    --dawn-2: #5c3d22;
    --dawn-3: #7a3f22;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}

a { color: inherit; }

button {
  font-family: inherit;
  cursor: pointer;
}
button:disabled { cursor: default; }

/* Keyboard focus: visible ring on anything interactive, without flashing
   a ring on every mouse tap. Inputs keep their always-on focus outline. */
button:focus-visible,
select:focus-visible,
.list-row:focus-visible,
.switch input:focus-visible ~ .track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  gap: var(--sp-3);
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.app-header .brand svg { width: 22px; height: 22px; }

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink-soft);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-s);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 150ms ease-out, color 150ms ease-out;
}
.icon-btn:hover { background: var(--bg-sunken); color: var(--ink); }
.icon-btn:active { background: var(--accent-soft); }
.icon-btn svg { width: 19px; height: 19px; }

/* views */
.view {
  flex: 1;
  padding: 0 var(--sp-4) var(--sp-6);
  animation: fadeSlideIn 220ms ease-out;
}

.view[hidden] { display: none; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* dawn hero on Today view */
.dawn-hero {
  position: relative;
  border-radius: var(--radius-l);
  padding: var(--sp-5) var(--sp-5) var(--sp-6);
  margin-bottom: var(--sp-5);
  overflow: hidden;
  background: linear-gradient(180deg, var(--dawn-1) 0%, var(--dawn-2) 55%, var(--dawn-3) 100%);
  color: #2b1a0c;
}
:root[data-theme="dark"] .dawn-hero { color: #f6e6cf; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .dawn-hero { color: #f6e6cf; }
}
.dawn-hero .sun {
  position: absolute;
  right: var(--sp-5);
  top: var(--sp-4);
  width: 46px; height: 46px;
  border-radius: 50%;
  background: rgba(255, 249, 235, 0.85);
}
.dawn-hero .day-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.85;
}
.dawn-hero .theme-label {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  margin-top: var(--sp-2);
  max-width: 80%;
}

/* cards */
.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
  box-shadow: var(--shadow);
}

.card h2, .card h3 {
  margin-top: 0;
  font-family: var(--font-serif);
}

.verse-ref {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--sp-2);
}

.verse-text {
  font-family: var(--font-serif);
  font-size: 21px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 var(--sp-4);
}

.translation-note {
  font-size: 12px;
  color: var(--ink-faint);
  margin-bottom: var(--sp-4);
}

.reflection-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--sp-1);
}

.reflection-text {
  font-size: 16px;
  color: var(--ink);
  margin: 0 0 var(--sp-4);
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  border: none;
  border-radius: var(--radius-s);
  padding: 13px var(--sp-5);
  font-size: 15px;
  font-weight: 700;
  transition: transform 120ms ease-out, background 150ms ease-out, opacity 150ms ease-out;
  width: 100%;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { opacity: 0.92; }
.btn-primary:disabled {
  background: var(--success);
  color: var(--accent-ink);
  opacity: 1;
}

.btn-secondary {
  background: var(--bg-sunken);
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--accent-soft); }

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px dashed var(--border);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger:hover { background: var(--danger); color: var(--accent-ink); }

.btn-small {
  width: auto;
  padding: 12px 16px;
  font-size: 13px;
  margin-top: var(--sp-2);
}

.btn-block-row {
  display: flex;
  gap: var(--sp-3);
}
.btn-block-row .btn { width: auto; flex: 1; }

/* selects and the time picker share one look; 16px stops iOS focus zoom */
.select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: var(--bg-sunken);
  color: var(--ink);
  font-size: 16px;
  font-family: var(--font-sans);
  min-height: 44px;
}
.select-compact { width: auto; flex-shrink: 0; }

/* streak card */
.streak-row {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}
.streak-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
}
.streak-figure .num {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 700;
  transition: transform 220ms ease-out;
}
.streak-figure .num.pulse { transform: scale(1.18); }
.streak-figure .lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}
.streak-note {
  font-size: 13px;
  color: var(--ink-soft);
  flex: 1;
}

/* nav */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--bg-raised);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 10;
}
.tab-bar-inner {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  width: 100%;
}
.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--ink-faint);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--sp-2) 0 6px;
  font-size: 11px;
  font-weight: 600;
  transition: color 150ms ease-out;
}
.tab-btn svg { width: 22px; height: 22px; }
.tab-btn.active { color: var(--accent); }

/* list rows: plan days, journal entries */
.list-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  width: 100%;
  text-align: left;
  transition: background 150ms ease-out;
}
.list-row:hover { background: var(--accent-soft); }

.list-row .check {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.list-row .check.done {
  background: var(--success);
  border-color: var(--success);
  color: var(--accent-ink);
}
/* today, not yet done: an open ring with a small accent dot, so a filled
   green check always means "completed", never just "current" */
.list-row .check.today { border-color: var(--accent); }
.list-row .check .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.list-row .check svg { width: 14px; height: 14px; }

.list-row .meta { flex: 1; min-width: 0; }
.list-row .meta .day-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.list-row .meta .title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-row .meta .sub {
  font-size: 13px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* section headers */
.section-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  margin: var(--sp-2) 0 var(--sp-4);
}
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-1);
}
.section-sub {
  font-size: 14px;
  color: var(--ink-soft);
  margin: -8px 0 var(--sp-4);
}
.section-title-row + .section-sub { margin-top: var(--sp-2); }

/* empty states */
.empty-state {
  text-align: center;
  padding: var(--sp-7) var(--sp-4);
  color: var(--ink-soft);
}
.empty-state .glyph {
  display: flex;
  justify-content: center;
  color: var(--ink-faint);
  margin-bottom: var(--sp-3);
}
.empty-state .glyph svg { width: 44px; height: 44px; }
.empty-state h3 {
  font-family: var(--font-serif);
  color: var(--ink);
  margin: 0 0 var(--sp-2);
}
.empty-state p { margin: 0 0 var(--sp-4); font-size: 14px; }
.empty-state .btn { width: auto; display: inline-flex; padding-left: var(--sp-6); padding-right: var(--sp-6); }

/* forms */
.field { margin-bottom: var(--sp-4); }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--sp-2);
}
.field input[type="text"],
.field input[type="date"],
.field input[type="time"],
.field textarea {
  width: 100%;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 12px 14px;
  font-size: 16px;
  color: var(--ink);
  font-family: var(--font-sans);
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.field-hint {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: var(--sp-1);
}

/* journal entry detail */
.entry-body {
  white-space: pre-wrap;
  font-size: 16px;
  line-height: 1.6;
}
.entry-date {
  font-size: 13px;
  color: var(--ink-faint);
  margin-bottom: var(--sp-3);
}
.entry-linked-ref {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-deep);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: var(--sp-3);
}

/* modal / overlay for entry editor and day detail */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 15, 8, 0.45);
  display: flex;
  align-items: flex-end;
  z-index: 20;
  animation: fadeIn 180ms ease-out;
}
.overlay[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  background: var(--bg);
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  padding: var(--sp-5) var(--sp-4) var(--sp-6);
  animation: slideUp 220ms ease-out;
}
@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}
.sheet-header h2 {
  font-family: var(--font-serif);
  margin: 0;
  font-size: 20px;
}

/* toast */
.toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out, transform 200ms ease-out;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* badge / pill */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
}
.pill.warn {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

/* circle card header: name + role pill left, invite code right */
.circle-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-3);
}
.circle-head h3 { margin: 0 0 var(--sp-1); }
.invite-code { text-align: right; flex-shrink: 0; }
.invite-code .code {
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 17px;
}

.note-banner {
  background: var(--accent-soft);
  color: var(--ink);
  border-radius: var(--radius-m);
  padding: var(--sp-4);
  font-size: 13px;
  margin-bottom: var(--sp-4);
  line-height: 1.5;
}

.request-row {
  border-bottom: 1px solid var(--border);
  padding: var(--sp-3) 0;
}
.request-row:last-child { border-bottom: none; }
.request-row .who {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.request-row .txt { font-size: 15px; margin-top: 2px; }

.settings-group { margin-bottom: var(--sp-5); }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row .label { font-size: 15px; }
.settings-row .desc { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }

.switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: background 150ms ease-out;
}
.switch .thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--bg-raised);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform 150ms ease-out;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track + .thumb { transform: translateX(20px); }

@media (min-width: 720px) {
  #app { padding-bottom: 0; }
  .tab-bar { position: sticky; }
}
