/* daily-habit.de – Stylesheet
   Fonts: Prototyp nutzt Georgia/System. Für die Live-Seite lokal hosten (DSGVO):
   @font-face { font-family:'Inter'; src:url('/fonts/inter.woff2') format('woff2'); font-display:swap; }
   @font-face { font-family:'Cormorant'; src:url('/fonts/cormorant.woff2') format('woff2'); font-display:swap; }
   Dann unten 'Georgia' durch 'Cormorant' ersetzen. */

:root {
  --bg:        #F7F3EC;
  --surface:   #FFFDF9;
  --ink:       #2B2A26;
  --ink-soft:  #6E685C;
  --ink-faint: #A29A89;
  --line:      #E4DDCF;
  --accent:    #A8442F;
  --accent-d:  #8C3826;
  --done:      #2E7D53;
  --broken:    #C9C1B1;
}
html[data-theme="dark"] {
  --bg:        #171512;
  --surface:   #201D19;
  --ink:       #EFEAE0;
  --ink-soft:  #A79F90;
  --ink-faint: #776F60;
  --line:      #322E27;
  --accent:    #D97A5F;
  --accent-d:  #E69078;
  --done:      #57A97F;
  --broken:    #4A4438;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 17px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  transition: background 0.25s, color 0.25s;
}

.wrap { max-width: 620px; margin: 0 auto; padding: 0 1.25rem; }

header { text-align: center; padding: 3.2rem 0 2.2rem; position: relative; }
.brand {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.brand a { color: inherit; text-decoration: none; }
.brand .dot { color: var(--accent); }
.claim,
h1.claim {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 400;
  letter-spacing: 0;
  margin: 0.35rem 0 0;
}

.theme-toggle {
  position: absolute;
  top: 1.1rem; right: 1.25rem;
  width: 36px; height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s, border-color 0.15s;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-faint); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.icon-sun { display: none; }
html[data-theme="dark"] .icon-sun { display: block; }
html[data-theme="dark"] .icon-moon { display: none; }

section { padding: 2rem 0; }
.divider { border: none; border-top: 1px solid var(--line); }
.hidden { display: none !important; }

h1.page-title, h2 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 1.1rem;
}
.sub { color: var(--ink-soft); font-size: 0.9rem; margin-bottom: 1.2rem; }

.goals { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.goal {
  font-family: inherit;
  font-size: 0.88rem; font-weight: 500;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.goal:hover { border-color: var(--ink-faint); }
.goal.active { border-color: var(--accent); background: var(--accent); color: var(--surface); }
.goal:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.own-habit { margin: 1.2rem 0 1.4rem; display: flex; gap: 0.6rem; flex-wrap: wrap; }
.own-habit input {
  flex: 1 1 220px;
  font-family: inherit; font-size: 0.92rem;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
}
.own-habit input::placeholder { color: var(--ink-faint); }
.own-habit input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Habit-Karte: das Habit ist der Star – Serife, kursiv, Terrakotta */
.habit-card {
  margin-top: 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.9rem 1.5rem;
  text-align: center;
}
.habit-text {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.3rem, 4.4vw, 1.7rem);
  font-style: italic;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.005em;
  text-wrap: balance;
}
.habit-tip {
  margin-top: 0.75rem;
  font-size: 0.86rem;
  color: var(--ink-soft);
  max-width: 46ch;
  margin-left: auto; margin-right: auto;
}
.habit-src {
  margin-top: 0.55rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
.habit-actions { margin-top: 1.3rem; display: flex; gap: 0.7rem; justify-content: center; flex-wrap: wrap; }

.btn {
  font-family: inherit;
  font-size: 0.9rem; font-weight: 600;
  padding: 0.72rem 1.35rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: var(--surface); border: 1px solid var(--accent); }
.btn-primary:hover { background: var(--accent-d); border-color: var(--accent-d); }
.btn-secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-secondary:hover { border-color: var(--ink-faint); }
.btn-text {
  background: none; border: none;
  color: var(--ink-soft);
  font-size: 0.8rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer; font-family: inherit;
}
.btn-text:hover { color: var(--ink); }

/* Ketten-Sektion: ein Klick zu Druck oder Digital */
.days-select {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.88rem; color: var(--ink-soft);
  margin-bottom: 1.1rem; flex-wrap: wrap;
}
.days-select select {
  font-family: inherit; font-size: 0.88rem;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
}
.chain-choice { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: center; margin-top: 1.4rem; }
.chain-note { margin-top: 0.7rem; font-size: 0.78rem; color: var(--ink-faint); }

/* Die Kette: Ringe + Verbinder */
.chain-board {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.5rem 1.3rem;
  overflow-x: auto;
}
.chain-week { margin-bottom: 1.15rem; }
.chain-week:last-child { margin-bottom: 0; }
.chain-meta {
  font-size: 0.68rem; color: var(--ink-faint);
  letter-spacing: 0.12em; text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.chain-row { display: flex; align-items: center; }
.ring {
  width: 34px; height: 34px;
  flex: 0 0 auto;
  border: 2px solid var(--ink-soft);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 600;
  color: var(--ink-soft);
  background: var(--surface);
}
.ring.done { background: var(--done); border-color: var(--done); color: #fff; }
.ring.today-open {
  border-color: var(--accent);
  color: var(--accent);
  cursor: pointer;
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
  50%      { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 26%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .ring.today-open { animation: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
}
.ring.missed { border-style: dashed; border-color: var(--broken); color: var(--broken); }
.ring.future { border-color: var(--line); color: var(--ink-faint); }
.connector { width: 14px; height: 2px; flex: 0 0 auto; background: var(--ink-soft); }
.connector.future { background: var(--line); }
.connector.done { background: var(--done); }
.connector.torn { background: none; border-top: 2px dashed var(--broken); }

.chain-status { margin-top: 1.15rem; font-size: 0.88rem; color: var(--ink-soft); }
.chain-status strong { color: var(--ink); }
.chain-actions { margin-top: 1.4rem; display: flex; gap: 0.9rem; align-items: center; flex-wrap: wrap; }

.active-habit-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.3rem, 4.5vw, 1.7rem);
  font-style: italic;
  font-weight: 700;
  color: var(--accent);
  text-wrap: balance;
  margin-bottom: 0.3rem;
}

.explain p { margin-bottom: 1rem; font-size: 0.95rem; }
.explain p.muted { color: var(--ink-faint); font-size: 0.82rem; }
.explain h3 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.1rem; font-weight: 700;
  margin: 1.6rem 0 0.5rem;
}

footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0 3rem;
  text-align: center;
  font-size: 0.76rem;
  color: var(--ink-soft);
}
footer p { max-width: 52ch; margin: 0 auto 0.8rem; }
footer a { color: inherit; }
.heart { color: var(--accent); }

/* ============ Druckvorlage (Poster) ============ */
#print-sheet { display: none; }
@media print {
  @page { size: A4 portrait; margin: 0; }
  html, body { margin: 0; padding: 0; height: auto; background: #FBF7EF; }
  body > :not(#print-sheet) { display: none !important; }
  #print-sheet {
    display: flex; flex-direction: column; align-items: center;
    width: 210mm; height: 296mm; overflow: hidden;
    position: relative;
    padding: 18mm 16mm 13mm;
    background: #FBF7EF; color: #2B2A26;
    font-family: Georgia, 'Times New Roman', serif;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .ps-badge {
    position: absolute; top: 11mm; right: 13mm;
    width: 30mm; height: 30mm; border-radius: 50%;
    background: #6E7F5E; color: #FBF7EF;
    display: flex; align-items: center; justify-content: center;
    text-align: center;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 6.8pt; letter-spacing: 0.12em; text-transform: uppercase;
    line-height: 1.6;
    transform: rotate(7deg);
  }
  .ps-sparkle { position: absolute; width: 6mm; height: 6mm; }
  .ps-sparkle.s1 { top: 34mm; left: 22mm; transform: rotate(-12deg); }
  .ps-sparkle.s2 { top: 58mm; right: 26mm; width: 4.5mm; height: 4.5mm; transform: rotate(18deg); }
  .ps-eyebrow {
    text-align: center;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 8pt; letter-spacing: 0.42em; text-indent: 0.42em;
    text-transform: uppercase; color: #A89F8C;
    margin-bottom: 6mm;
  }
  .ps-habit {
    text-align: center;
    font-size: 24pt; font-style: italic; font-weight: 400;
    line-height: 1.3; color: #2B2A26;
    max-width: 138mm;
    text-wrap: balance;
  }
  .ps-swoosh { display: block; width: 56mm; height: 4.5mm; margin: 2.5mm auto 3.5mm; }
  .ps-sub {
    text-align: center;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 8.5pt; letter-spacing: 0.08em; color: #8A8474;
    margin-bottom: 7mm;
  }
  .ps-card {
    background: #F2EBDD;
    border-radius: 6mm;
    padding: 7mm 8mm;
    width: 100%;
  }
  .ps-week { margin-bottom: 4mm; }
  .ps-week:last-child { margin-bottom: 0; }
  .ps-week-label {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 6.5pt; letter-spacing: 0.25em; text-transform: uppercase;
    color: #A79E8B; margin-bottom: 1.6mm;
    text-align: center;
  }
  .ps-row { display: flex; align-items: center; justify-content: center; }
  .ps-ring {
    width: 9.5mm; height: 9.5mm;
    border: 0.45mm solid #776F60;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 6.5pt; color: #776F60;
    background: #FBF7EF;
    flex: 0 0 auto;
  }
  .ps-ring.ps-done { background: #A8442F; border-color: #A8442F; color: #FBF7EF; }
  .ps-conn { width: 3.8mm; height: 0.45mm; background: #776F60; flex: 0 0 auto; }
  .ps-rule {
    text-align: center;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 8.5pt; font-weight: 600; color: #2B2A26;
    margin: 6mm 0 2mm;
  }
  .ps-tagline {
    text-align: center;
    font-size: 12pt; font-style: italic; color: #A8442F;
    margin-bottom: 4mm;
  }
  .ps-list {
    columns: 2;
    column-gap: 8mm;
    width: 100%;
    margin-top: 4mm;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 6.4pt;
    line-height: 1.55;
    color: #6B6455;
  }
  .ps-list.hidden { display: none; }
  .ps-list div { break-inside: avoid; padding-left: 4mm; text-indent: -4mm; margin-bottom: 0.8mm; }
  .ps-tagline.hidden { display: none; }
  .ps-footer {
    margin-top: auto;
    text-align: center;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 6pt; letter-spacing: 0.12em; color: #B5AC99;
    line-height: 1.7;
  }
}

@media (max-width: 480px) {
  header { padding: 2.6rem 0 2rem; }
  .goal { font-size: 0.84rem; padding: 0.55rem 0.85rem; }
}

/* Einmaliger Homescreen-Hinweis unter der aktiven Kette */
.pwa-hint {
  margin-top: 1.2rem;
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.pwa-hint-close {
  margin-left: auto;
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--ink-faint);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.1rem;
}
.pwa-hint-close:hover { color: var(--ink); }
.pwa-hint-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Listen-Seiten (Pillar + Ziel-Seiten) */
.toc { display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; font-size: 0.88rem; }
.toc a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--line); }
.toc a:hover { border-color: var(--accent); }
.habit-item { border-top: 1px solid var(--line); padding: 1.15rem 0 1rem; }
.habit-item:first-child { border-top: none; }
/* Clickable habit cards on the list pages */
a.habit-pick {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 1.15rem 1rem;
  margin: 0 -1rem;
  border-top: 1px solid var(--line);
  border-radius: 10px;
  transition: background 0.15s;
  position: relative;
}
a.habit-pick:first-child { border-top: none; }
a.habit-pick:hover { background: var(--surface); }
a.habit-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
a.habit-pick .hi-text { display: block; }
a.habit-pick .hi-tip { display: block; }
a.habit-pick .hi-src { display: block; }
a.habit-pick::after {
  content: 'Kette starten →';
  display: inline-block;
  margin-top: 0.5rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-style: normal;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.15s;
}
a.habit-pick:hover::after,
a.habit-pick:focus-visible::after { opacity: 1; }
@media (hover: none) {
  a.habit-pick::after { opacity: 1; }
}
.hi-text {
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-weight: 700;
  font-size: 1.12rem;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.hi-tip { font-size: 0.88rem; color: var(--ink-soft); }
.hi-src { font-size: 0.72rem; color: var(--ink-faint); margin-top: 0.3rem; letter-spacing: 0.04em; }
.cta-box {
  margin-top: 2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.6rem 1.4rem;
  text-align: center;
}
.cta-box p { margin-bottom: 1rem; }

/* Today's rotating exercise */
.today-exercise {
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--accent);
  margin: -0.4rem 0 1rem;
}
.today-exercise .te-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-right: 0.5rem;
}

/* Unterseiten: Rechtstexte */
.legal h1, .legal h2, .legal h3 {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700;
  margin: 1.6rem 0 0.5rem;
}
.legal h2 { font-size: 1.15rem; }
.legal h3 { font-size: 1.02rem; }
.legal p, .legal ul { margin-bottom: 0.9rem; font-size: 0.92rem; color: var(--ink); }
.legal ul { padding-left: 1.2rem; }
.legal a { color: var(--accent); }

/* FAQ als natives Akkordeon */
.faq-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  margin-bottom: 0.7rem;
  padding: 0;
  overflow: hidden;
}
.faq-item summary {
  cursor: pointer;
  padding: 0.95rem 1.1rem;
  font-weight: 600;
  font-size: 0.95rem;
  list-style: none;
  position: relative;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  position: absolute;
  right: 1.1rem;
  color: var(--accent);
  font-weight: 400;
}
.faq-item[open] summary::after { content: '\2212'; }
.faq-item summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.faq-antwort { padding: 0 1.1rem 1rem; font-size: 0.9rem; color: var(--ink-soft); }
.faq-antwort p { margin-bottom: 0.7rem; }

/* Kontaktformular */
.kontakt-form { max-width: 480px; }
.kontakt-form label { display: block; font-size: 0.85rem; font-weight: 600; margin: 1rem 0 0.35rem; }
.kontakt-form input[type=text],
.kontakt-form input[type=email],
.kontakt-form textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.92rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
}
.kontakt-form input:focus-visible,
.kontakt-form textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.kontakt-form .check { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 400; font-size: 0.8rem; color: var(--ink-soft); margin: 1.1rem 0 1.3rem; }
.kontakt-form .check input { margin-top: 0.2rem; }
.kontakt-form .check a { color: var(--accent); }
.hp { position: absolute; left: -9999px; top: -9999px; }
.msg { padding: 0.85rem 1rem; border-radius: 10px; font-size: 0.9rem; margin-bottom: 1.2rem; }
.msg-ok { background: color-mix(in srgb, var(--done) 12%, var(--surface)); color: var(--done); border: 1px solid var(--done); }
.msg-err { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--accent); border: 1px solid var(--accent); }

/* Wider layout and larger type on desktop; mobile stays untouched */
@media (min-width: 900px) {
  html { font-size: 18.5px; }
  .wrap { max-width: 760px; }
  .habit-text { font-size: clamp(1.5rem, 2.4vw, 1.95rem); }
  .habit-card { padding: 2.4rem 2.2rem; }
  h1.page-title, h2 { font-size: 1.6rem; }
  .explain p { font-size: 1rem; }
  .habit-list { columns: 1; }
}

/* On very wide screens the reading column may grow a little more */
@media (min-width: 1200px) {
  .wrap { max-width: 820px; }
}

/* ---------- Rewards ---------- */
@keyframes ringPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.32); }
  70%  { transform: scale(0.94); }
  100% { transform: scale(1); }
}
.ring.just-closed {
  animation: ringPop 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@media (prefers-reduced-motion: reduce) {
  .ring.just-closed { animation: none; }
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 60;
}

.chain-banner {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: color-mix(in srgb, var(--ink) 42%, transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.chain-banner.show { opacity: 1; }
.cb-inner {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 2.2rem 2rem 1.8rem;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 20px 60px color-mix(in srgb, var(--ink) 30%, transparent);
  transform: translateY(8px) scale(0.98);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.chain-banner.show .cb-inner { transform: translateY(0) scale(1); }
.cb-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.6rem;
}
.cb-text { font-size: 0.92rem; color: var(--ink-soft); margin-bottom: 1.4rem; }
.cb-close { width: 100%; }
