/* ── Design tokens (match portfolio) ───────────────────────────────── */
:root {
  --bg:         #faf7f4;
  --bg-dark:    #0d0a09;
  --gold:       #c9a96e;
  --gold-light: #e8d5a3;
  --wine:       #4a0e1c;
  --cream:      #f5efe6;
  --text:       #2c1f1a;
  --text-muted: #8a7060;
  --card-bg:    #ffffff;
  --border:     rgba(201, 169, 110, 0.22);
  --timeline:   rgba(201, 169, 110, 0.32);
  --radius:     10px;
  --font:       'Cormorant Garamond', Georgia, serif;
}

/* ── Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 1.05rem;
  line-height: 1.7;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--gold); }
img { max-width: 100%; display: block; }
textarea, input { font-family: var(--font); }

/* ── Flash bar ───────────────────────────────────────────────────────── */
.flash-bar {
  background: var(--wine);
  color: #fff;
  text-align: center;
  padding: 10px 20px;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

/* ════════════════════════════════════════════════════════════════════════
   LOGIN SCREEN
   ════════════════════════════════════════════════════════════════════════ */
.pin-screen {
  background: var(--bg-dark);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: 100%;
  max-width: 320px;
  padding: 40px 24px;
}

.pin-label {
  font-size: 1.3rem;
  font-style: italic;
  color: var(--gold-light);
  letter-spacing: 0.06em;
}

/* Dots */
.pin-dots {
  display: flex;
  gap: 14px;
}
.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  background: transparent;
  transition: background 0.15s;
}
.dot.filled {
  background: var(--gold);
}

.pin-error {
  color: #e07070;
  font-size: 0.9rem;
  font-style: italic;
}

/* Text input + submit (shown on all screens, styled minimally) */
.pin-text-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--gold);
  color: var(--gold-light);
  font-size: 1rem;
  padding: 8px 4px;
  text-align: center;
  letter-spacing: 0.15em;
  outline: none;
}
.pin-text-input::placeholder { color: rgba(201,169,110,0.4); letter-spacing: 0.05em; }

.pin-submit {
  width: 100%;
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-family: var(--font);
  font-size: 1rem;
  letter-spacing: 0.1em;
  padding: 10px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  border-radius: 4px;
}
.pin-submit:hover { background: var(--gold); color: var(--bg-dark); }

/* Numeric keypad */
.pin-keypad {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.pin-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.pin-key {
  background: rgba(201,169,110,0.06);
  border: 1px solid rgba(201,169,110,0.18);
  border-radius: 8px;
  color: var(--gold-light);
  font-family: var(--font);
  font-size: 1.2rem;
  padding: 14px 0;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}
.pin-key:active, .pin-key:hover { background: rgba(201,169,110,0.16); }
.pin-key--empty { visibility: hidden; }
.pin-key--del { font-size: 1rem; }
form#pinForm { width: 100%; display: flex; flex-direction: column; gap: 10px; }

/* ════════════════════════════════════════════════════════════════════════
   HEADER
   ════════════════════════════════════════════════════════════════════════ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 247, 244, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-title {
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.btn-new {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 5px 14px;
  border-radius: 20px;
  transition: background 0.2s, color 0.2s;
}
.btn-new:hover { background: var(--gold); color: #fff; }
.btn-logout {
  color: var(--text-muted);
  font-size: 1.1rem;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.btn-logout:hover { opacity: 1; color: var(--wine); }
.btn-back {
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.btn-back:hover { color: var(--gold); }
.btn-edit-inline {
  font-size: 0.85rem;
  color: var(--gold);
  letter-spacing: 0.05em;
}

/* ════════════════════════════════════════════════════════════════════════
   MAIN LAYOUT
   ════════════════════════════════════════════════════════════════════════ */
.main-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.main-wrap--narrow {
  max-width: 620px;
}

/* ── Empty state ─────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 2rem;
  color: var(--gold);
  margin-bottom: 16px;
}
.empty-state a { color: var(--gold); border-bottom: 1px solid var(--border); }

/* ════════════════════════════════════════════════════════════════════════
   YEAR GROUP + TIMELINE
   ════════════════════════════════════════════════════════════════════════ */
.year-group {
  margin-bottom: 56px;
}
.year-label {
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.timeline {
  position: relative;
  padding-left: 32px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 1.5px;
  background: linear-gradient(to bottom,
    transparent,
    var(--timeline) 8%,
    var(--timeline) 92%,
    transparent
  );
}

.timeline-item {
  position: relative;
  margin-bottom: 28px;
}
.timeline-dot {
  position: absolute;
  left: -32px;
  top: 18px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--gold);
}

/* ════════════════════════════════════════════════════════════════════════
   ENTRY CARD
   ════════════════════════════════════════════════════════════════════════ */
.entry-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 18px rgba(44, 31, 26, 0.06);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.entry-card:hover {
  box-shadow: 0 4px 28px rgba(44, 31, 26, 0.1);
}
.entry-card--full {
  box-shadow: 0 2px 24px rgba(44, 31, 26, 0.08);
}

/* Card header */
.entry-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.entry-card__meta-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Mood badge */
.mood-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--gold);
}
.mood-emoji {
  font-size: 1rem;
  line-height: 1;
}

/* Entry title */
.entry-title {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.02em;
}
.entry-title--large {
  font-size: 1.3rem;
  font-weight: 500;
}

/* Age chip */
.age-chip {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

/* Photo */
.entry-photo {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  display: block;
}

/* Body */
.entry-body {
  padding: 16px 18px;
  font-size: clamp(1rem, 2vw, 1.1rem);
  color: var(--text);
  line-height: 1.75;
}
.entry-body--full {
  padding: 22px 22px;
}
.entry-body--full p + p {
  margin-top: 12px;
}
.read-more {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--gold);
  letter-spacing: 0.04em;
}

/* Card footer */
.entry-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px 14px;
  border-top: 1px solid var(--border);
}
.entry-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  font-style: italic;
}
.btn-edit {
  font-size: 0.95rem;
  color: var(--text-muted);
  opacity: 0.5;
  transition: opacity 0.2s, color 0.2s;
}
.btn-edit:hover { opacity: 1; color: var(--gold); }
.btn-delete {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  letter-spacing: 0.06em;
  opacity: 0.5;
  transition: opacity 0.2s, color 0.2s;
}
.btn-delete:hover { opacity: 1; color: #c06060; }

/* ════════════════════════════════════════════════════════════════════════
   COMPOSE FORM
   ════════════════════════════════════════════════════════════════════════ */
.compose-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-top: 16px;
}

.form-field { display: flex; flex-direction: column; }

.input-title {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--text);
  padding: 8px 0;
  outline: none;
  transition: border-color 0.2s;
}
.input-title:focus { border-bottom-color: var(--gold); }
.input-title::placeholder { color: var(--text-muted); font-weight: 300; font-style: italic; }

.input-date {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 6px 0;
  outline: none;
  transition: border-color 0.2s;
  cursor: pointer;
}
.input-date:focus { border-bottom-color: var(--gold); color: var(--text); }

.date-row { display: flex; flex-direction: row; align-items: center; gap: 12px; }

.btn-detect-date {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s;
}
.btn-detect-date:hover { border-color: var(--gold); color: var(--text); }

/* Mood pills */
.mood-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.mood-pill {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text-muted);
  transition: border-color 0.18s, background 0.18s, color 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  user-select: none;
}
.mood-pill:hover {
  border-color: var(--gold-light);
  color: var(--text);
}
.mood-pill.selected {
  border-color: var(--gold);
  background: var(--cream);
  color: var(--text);
}
.mood-pill .mood-emoji { font-size: 1rem; line-height: 1; }

/* Body textarea */
.input-body {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text);
  padding: 8px 0;
  resize: none;
  outline: none;
  min-height: 140px;
  transition: border-color 0.2s;
  overflow: hidden;
}
.input-body:focus { border-bottom-color: var(--gold); }
.input-body::placeholder { color: var(--text-muted); font-style: italic; }

/* Photo section */
.photo-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.photo-preview {
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
.photo-preview img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: var(--radius);
}
.photo-preview.hidden { display: none; }

.remove-photo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  margin-top: 6px;
}
.clear-photo {
  background: rgba(44,31,26,0.55);
  border: none;
  color: #fff;
  font-family: var(--font);
  font-size: 0.85rem;
  padding: 5px 12px;
  border-radius: 14px;
  cursor: pointer;
  margin-top: 6px;
  align-self: flex-start;
}

.btn-photo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  align-self: flex-start;
}
.btn-photo:hover { border-color: var(--gold); color: var(--gold); }
.file-input-hidden { display: none; }

/* Submit */
.form-actions { display: flex; justify-content: flex-end; }
.btn-post {
  background: var(--wine);
  border: none;
  color: #fff;
  font-family: var(--font);
  font-size: 1rem;
  letter-spacing: 0.06em;
  padding: 12px 32px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-post:hover { background: #5a1a2c; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .header-inner { padding: 12px 16px; }
  .main-wrap { padding: 28px 16px 60px; }
  .timeline { padding-left: 24px; }
  .timeline-dot { left: -24px; }
  .mood-row { gap: 6px; }
  .mood-pill { padding: 5px 10px; font-size: 0.88rem; }
}

/* Video */
video.entry-photo { width: 100%; max-height: 420px; display: block; background: #000; }

/* Trim UI */
.trim-section { margin: 12px 0; padding: 12px; background: var(--surface); border-radius: 8px; }
.trim-label { font-size: 0.85rem; color: var(--text-muted); margin: 0 0 8px; }
.trim-slider { width: 100%; accent-color: var(--gold); cursor: pointer; }
.trim-range { font-size: 0.85rem; color: var(--text); margin: 6px 0 0; text-align: center; }

.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 10px 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
  background: var(--bg);
}
