/* ============================================================
   main.css — Grundlayout, Farbpalette, Typografie
   ============================================================ */

@font-face {
  font-family: 'Caveat';
  src: url('../fonts/caveat-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Caveat';
  src: url('../fonts/caveat-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Merriweather';
  src: url('../fonts/merriweather-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Merriweather';
  src: url('../fonts/merriweather-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #e5dec9;          /* wärmeres, dunkleres Papier (war #f4f1ea) */
  --ink: #1a1a1a;            /* kräftiges Schwarz für gute Lesbarkeit */
  --timeline: #4e3f2d;       /* dunkles Braun für die Timeline */
  --accent: #a32a1e;         /* tiefes Rot für Herzen und wichtige Akzente */
  --shadow: rgba(0, 0, 0, 0.22);
  --font-hand: 'Caveat', 'Segoe Script', cursive;
  --font-serif: 'Merriweather', Georgia, serif;
  --font-round: 'Trebuchet MS', 'Comic Sans MS', sans-serif;
}

* { box-sizing: border-box; }

/* Kein natives Bild-Dragging: ein abgebrochener HTML5-Drag kann unter Linux
   den Pointer-Grab des Browsers hängen lassen (Maus wirkt dann in anderen
   Fenstern „eingefroren“, bis man den Fokus wechselt). */
img { -webkit-user-drag: none; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  position: relative; /* Anker für #emoji-layer (absolute, volle Dokumenthöhe) */
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* --- Header --- */
.site-header {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 3.5rem 1rem 0.5rem;
}

.site-title {
  margin: 0;
  color: var(--ink);
}

/* „time flies“ — weiche Handschrift mit sanftem Pinselstrich dahinter */
.title-line {
  position: relative;
  z-index: 0;
  display: inline-block;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: clamp(3.6rem, 10vw, 6.2rem);
  line-height: 1.05;
  padding: 0 0.18em;
}
.title-flies {
  display: inline-block;
  color: var(--accent);
  transform: rotate(-2deg) translateY(0.04em);
  text-decoration: underline wavy var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.14em;
}
.title-sub {
  display: block;
  margin-top: 1.8rem;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(0.95rem, 2.2vw, 1.15rem);
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(44, 44, 44, 0.55);
}
.title-sub::before,
.title-sub::after {
  content: '♥';
  color: var(--accent);
  opacity: 0.6;
  font-size: 0.85em;
  letter-spacing: 0;
  margin: 0 0.9rem;
  vertical-align: 0.08em;
}

/* --- Zusammen-seit-Timer --- */
.together-timer {
  margin-top: 1.1rem;
  font-family: var(--font-hand);
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  color: var(--timeline);
  text-align: center;
  user-select: none;
  transition: transform 0.2s ease, color 0.2s ease;
}
.together-timer .timer-label {
  display: block;
  font-family: var(--font-serif);
  font-size: 0.6em;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  opacity: 0.55;
  margin-bottom: 0.2rem;
}
.together-timer .timer-value {
  display: inline-block;
  font-weight: 700;
}
.together-timer.editable {
  cursor: pointer;
}
.together-timer.editable:hover {
  transform: scale(1.03);
  color: var(--accent);
}

.btn-edit,
.btn-logout {
  font-family: var(--font-round);
  font-size: 1.1rem;
  width: 2.6rem;
  height: 2.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 253, 247, 0.85);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 4px var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  z-index: 20;
}

.btn-edit {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
}
.btn-edit:hover {
  transform: translateX(-50%) translateY(-1px) scale(1.05);
  box-shadow: 0 3px 8px var(--shadow);
}
.btn-edit[aria-pressed="true"] {
  background: var(--timeline);
  color: #fff;
}
/* Im Edit-Mode ausblenden, damit der Stift die Toolbar nicht überlagert */
body.edit-mode .btn-edit {
  display: none;
}

.btn-logout {
  position: fixed;
  top: 1rem;
  right: 1rem;
}
.btn-logout:hover {
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 3px 8px var(--shadow);
}

/* Versteckte Doppelklick-Zone oben links */
#secret-edit-zone {
  position: fixed;
  top: 0;
  left: 0;
  width: 48px;
  height: 48px;
  z-index: 200;
  cursor: default;
}

/* --- Login-Seite --- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  background: #fffdf7;
  padding: 2.5rem 2.75rem;
  width: min(92vw, 24rem);
  border-radius: 4px;
  box-shadow: 0 6px 24px var(--shadow);
  transform: rotate(-0.6deg);
}

.login-title {
  font-family: var(--font-hand);
  font-size: 2.2rem;
  margin: 0 0 0.25rem;
  text-align: center;
}

.login-subtitle {
  text-align: center;
  font-family: var(--font-round);
  color: var(--timeline);
  margin: 0 0 1.5rem;
}

.login-card label {
  display: block;
  font-family: var(--font-round);
  font-size: 0.9rem;
  margin: 0.9rem 0 0.25rem;
}

.login-card input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid #c9c2b4;
  border-radius: 4px;
  background: #fff;
  font-size: 1rem;
  font-family: var(--font-serif);
}

.login-card input:focus-visible {
  outline: 2px solid var(--timeline);
  outline-offset: 1px;
}

.login-error {
  color: var(--accent);
  font-family: var(--font-round);
  font-size: 0.9rem;
  background: #fdf0ee;
  border-left: 3px solid var(--accent);
  padding: 0.5rem 0.75rem;
}

.btn-primary {
  display: block;
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.7rem;
  border: 0;
  border-radius: 4px;
  background: var(--timeline);
  color: #fff;
  font-size: 1.05rem;
  font-family: var(--font-round);
  cursor: pointer;
  transition: filter 0.15s ease;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- Lightbox --- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: zoom-out;
  animation: fadeIn 0.25s ease;
}
.lightbox-overlay img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 6px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

/* --- Utility --- */
[hidden] { display: none !important; }

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

@media (max-width: 640px) {
  .site-header { padding-bottom: 1rem; }
  .btn-edit { bottom: 1rem; }
  .btn-logout { top: 0.75rem; right: 0.75rem; }
}

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