/* === BASE === */

@font-face {
  font-family: 'DM Serif Display';
  src: url("/static/fonts/dm-serif-display-latin-400-normal.c27d5a47c09e.woff2") format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DM Mono';
  src: url("/static/fonts/dm-mono-latin-400-normal.e1ed461ac183.woff2") format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DM Mono';
  src: url("/static/fonts/dm-mono-latin-500-normal.c4598219c4b8.woff2") format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
    --bg: #0d0d0d;
    --bg-card: #141414;
    --fg: #e8e4dc;
    --fg-muted: #6b6660;
    --accent: #c8b89a;
    --border: #222;
    --input-bg: #111;
    --font-serif: 'DM Serif Display', Georgia, serif;
    --font-mono: 'DM Mono', monospace;
}

[data-theme="light"] {
    --bg: #f5f3ee;
    --bg-card: #eceae4;
    --fg: #1a1a1a;
    --fg-muted: #888;
    --accent: #8b6f47;
    --border: #ccc;
    --input-bg: #ede9e2;
}

[data-theme="color"] {
    --bg: #0f0f1a;
    --bg-card: #16162a;
    --fg: #e8e4dc;
    --fg-muted: #6b6660;
    --accent: #e94560;
    --border: #2a2a3e;
    --input-bg: #13131f;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-touch-callout: none;
}

html {
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'DM Mono', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* === NAV === */

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}


.nav-link {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  transition: color 0.15s;
}

.nav-link:hover {
  color: var(--fg);
}

.nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--fg-muted);
  transition: color 0.15s;
}

.nav-logo:hover {
  color: var(--fg);
}

.nav-logo-img {
  height: 1.7rem;
  width: auto;
  display: block;
  filter: invert(0) opacity(0.6);
  transition: filter 0.15s;
}

.nav-logo:hover .nav-logo-img {
  filter: invert(0) opacity(1);
}

[data-theme="tageslicht"] .nav-logo-img {
  filter: invert(1) opacity(0.6);
}

[data-theme="tageslicht"] .nav-logo:hover .nav-logo-img {
  filter: invert(1) opacity(1);
}

.nav-spacer {
  flex: 1;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
}

.theme-toggle:hover {
  color: var(--fg);
}

/* === NAV SEARCH === */

.single-view .search-bar {
  display: none;
}

.nav-search-toggle {
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.nav-search-toggle:hover {
  color: var(--fg);
}

/* === SEARCH BAR === */

.search-bar {
  padding: 0.6rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.search-bar-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-bar-input {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.25rem 0;
  outline: none;
  min-width: 0;
  -webkit-appearance: none;
  border-radius: 0;
}

.search-bar-input::placeholder {
  color: var(--fg-muted);
}

.search-bar-input:focus {
  border-bottom-color: var(--accent);
}

.search-bar-clear {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 1.1rem;
  line-height: 1;
  transition: color 0.15s;
}

.search-bar-clear:hover {
  color: var(--fg);
}

/* Search results banner */
.search-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.5rem;
  border-bottom: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg));
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.search-banner-label {
  color: var(--fg-muted);
}


/* === SINGLE VIEW (immersive) === */

.single-view .nav {
  position: fixed;
  width: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}


.single-view.nav-visible .nav {
  opacity: 1;
  pointer-events: auto;
}

.single-view .card {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 2.5rem;
  opacity: 0;
  transform: scale(1.015);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.single-view .card.in-view {
  opacity: 1;
  transform: scale(1);
}

.single-view .card .card-display {
  margin: 0 auto;
  width: 100%;
  max-width: 500px;
}

.single-view .card .card-headline {
  font-size: 2rem;
  line-height: 1.35;
  margin-bottom: 1.25rem;
}

.single-view .card .card-body {
  font-size: 1rem;
  line-height: 1.75;
}

.single-view .card .card-time {
  width: 100%;
  max-width: 500px;
  margin: 0.75rem auto 0;
  text-align: right;
}

/* === MAIN === */

.main {
  flex: 1;
  padding: 2rem 1.5rem;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
}

.main--cards {
  padding: 0;
  max-width: none;
  margin: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* === COMPOSE === */

.compose-wrap {
  position: relative;
}


.compose-headline {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  font-family: 'DM Serif Display', serif;
  font-size: 1.5rem;
  line-height: 1.4;
  padding: 0.5rem 0 0.75rem;
  outline: none;
  caret-color: var(--accent);
}

.compose-headline::placeholder {
  color: var(--border);
}

.compose-body {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--fg-muted);
  font-family: 'DM Mono', monospace;
  font-size: 1rem;
  line-height: 1.65;
  padding: 0.75rem 0 1rem;
  resize: none;
  min-height: 8rem;
  outline: none;
  caret-color: var(--accent);
}

.compose-body::placeholder {
  color: var(--border);
}

.compose-actions {
  margin-top: 1.25rem;
  display: flex;
  justify-content: flex-end;
}

/* === BUTTONS === */

.btn-save {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  padding: 0.4rem 1rem;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: color 0.15s, border-color 0.15s;
}

.btn-save:hover {
  color: var(--fg);
  border-color: var(--fg-muted);
}

/* === THEME LABEL === */

.theme-label {
  position: fixed;
  bottom: 2rem;
  right: 1.5rem;
  font-size: 0.75rem;
  color: var(--fg-muted);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.theme-label.visible {
  opacity: 1;
}

/* === SAVE CONFIRM === */

.save-confirm {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  color: var(--fg-muted);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.save-confirm.visible {
  opacity: 1;
}

/* === CARD LIST — EINZELN (horizontal) === */

.card-list {
  display: flex;
  flex-direction: row;
  flex: 1;
  overflow-x: scroll;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.card-list::-webkit-scrollbar {
  display: none;
}

.card {
  width: 100vw;
  min-width: 100vw;
  height: 100%;
  flex-shrink: 0;
  scroll-snap-align: start;
  padding: 2rem 1.5rem;
  overflow-y: auto;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* === CARD LIST — ALLE (vertikal) === */

.card-list--alle {
  flex-direction: column;
  overflow-x: visible;
  overflow-y: auto;
  scroll-snap-type: none;
  flex: 1;
  height: auto;
  max-width: 680px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem;
  width: 100%;
}

.card-swipe-wrapper {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.card-list--alle .card {
  width: 100%;
  min-width: 0;
  background: var(--bg);
  z-index: 1;
  height: auto;
  scroll-snap-align: none;
  padding: 1.5rem 0 1.5rem 1rem;
  overflow-y: visible;
  border-right: none;
  border-bottom: none;
  position: relative;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: pan-y;
}

.card-list--alle .card .card-body,
.card-list--alle .card .card-time {
  display: none;
}

.card-list--alle .card .card-headline {
  font-size: 1.1rem;
  margin-bottom: 0;
}

/* delete button (revealed on swipe) */
.card-delete-btn {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
  pointer-events: none;
}

.card-swipe-wrapper.swipe-open .card-delete-btn {
  pointer-events: auto;
}

@media (hover: hover) {
  .card-swipe-wrapper:hover .card-delete-btn {
    pointer-events: auto;
    opacity: 1;
  }

  .card-delete-btn {
    opacity: 0;
    transition: opacity 0.15s;
  }
}


/* dragging state */
.card-list--alle .card.dragging {
  opacity: 0.2;
  cursor: grabbing;
}

.card-list--alle .card.drag-over {
  border-top: 2px solid var(--accent);
}


.card.editing .card-headline,
.card.editing .card-body {
  outline: none;
  caret-color: var(--accent);
}

.card.editing .card-headline {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
}

.card.editing .card-body {
  min-height: 1.5em;
}

.card.editing .card-body:empty::before {
  content: '...';
  color: var(--border);
  pointer-events: none;
}


.card-headline {
  font-family: 'DM Serif Display', serif;
  font-size: 1.6rem;
  line-height: 1.3;
  color: var(--fg);
  margin-bottom: 0.75rem;
}

.card-body {
  font-family: 'DM Mono', monospace;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--fg-muted);
}

.card-time {
  display: none;
}


/* === EMPTY STATE === */

.empty-state {
  padding: 4rem 0;
  text-align: left;
}

.cursor {
  font-family: 'DM Mono', monospace;
  font-size: 1.5rem;
  color: var(--fg-muted);
  text-decoration: none;
}

/* === LOGIN / LOGOUT === */

.login-wrap {
  padding-top: 4rem;
}

.logged-out-msg {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--fg-muted);
  margin-bottom: 1.5rem;
}

.nav-logout {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-mono);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 280px;
}

.input {
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--fg);
  font-family: 'DM Mono', monospace;
  font-size: 0.9rem;
  padding: 0.6rem 0.75rem;
  outline: none;
  width: 100%;
}

.input:focus {
  border-color: var(--fg-muted);
}

.login-error {
  font-size: 0.8rem;
  color: var(--fg-muted);
}
