/* ============================================================
   FotoViewer — "Fotoalbum"
   Licht, warm papier; afdrukken met een dun wit randje en een
   zachte schaduw; zwarte fotohoekjes als accent. De lightbox is
   donker, daar telt alleen de foto.
   ============================================================ */

:root {
  --paper: #f4efe6;
  --paper-deep: #e9e2d5;
  --card: #fbf8f2;
  --ink: #2b2620;
  --ink-soft: #6b6157;
  --ink-faint: #a39a8e;
  --line: #d9d0c1;
  --accent: #8a4b2f;          /* oud sepia-rood, voor links en knoppen */
  --accent-soft: #b8785a;
  --print-border: #ffffff;
  --shadow: 0 1px 2px rgba(60, 40, 20, 0.12), 0 6px 16px rgba(60, 40, 20, 0.10);
  --shadow-lift: 0 2px 4px rgba(60, 40, 20, 0.16), 0 12px 28px rgba(60, 40, 20, 0.16);
  --thumb-gap: 10px;          /* moet gelijk zijn aan GAP in SubjectRow.tsx */
  --radius: 3px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Source Sans 3', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-body);
  background: var(--paper);
  background-image: radial-gradient(ellipse at top, rgba(255,255,255,0.5), transparent 60%);
  color: var(--ink);
  min-height: 100vh;
}

body.lightbox-open { overflow: hidden; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-soft); }

h1, h2 { font-family: var(--font-display); font-weight: 400; line-height: 1.15; }

.loading { padding: 60px 16px; text-align: center; color: var(--ink-soft); font-style: italic; }

/* === Knoppen === */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: 600 0.95rem var(--font-body);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--accent-soft); border-color: var(--accent-soft); color: #fff; }
.btn-secondary { background: transparent; color: var(--accent); }
.btn-secondary:hover { background: rgba(138, 75, 47, 0.08); color: var(--accent); }
.btn-back { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn-back:hover { background: var(--card); color: var(--ink); border-color: var(--ink-faint); }

.actions { display: inline-flex; gap: 6px; flex-shrink: 0; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--card); color: var(--accent);
  font-size: 1rem; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.btn-icon:hover { background: var(--accent); border-color: var(--accent); color: #fff; transform: translateY(-1px); }

/* === Pagina-opbouw === */

.page { max-width: 1400px; margin: 0 auto; padding: 24px 16px 64px; }

.page-header {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding-bottom: 16px; margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.page-header h1 { font-size: 2rem; flex: 1 1 auto; min-width: 0; }
.page-header h1 .subtitle {
  display: block; font-family: var(--font-body); font-size: 1rem; color: var(--ink-soft); margin-top: 2px;
}
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* === Login === */

.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-box {
  position: relative;
  width: 100%; max-width: 380px;
  padding: 48px 32px 40px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: center;
}
.login-box h1 { font-size: 2rem; }
.login-box .subtitle { color: var(--ink-soft); font-style: italic; margin-bottom: 28px; }
.login-box form { display: flex; flex-direction: column; gap: 12px; }
.login-box input {
  padding: 10px 12px; font: 1rem var(--font-body);
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink);
}
.login-box input:focus { outline: none; border-color: var(--accent); }
/* Wachtwoordveld met "Toon/Verberg"-knop rechts in het veld */
.password-field { position: relative; display: flex; }
.password-field input { flex: 1; min-width: 0; padding-right: 80px; }
.login-box .show-toggle {
  position: absolute; top: 4px; right: 4px; bottom: 4px;
  padding: 0 12px; background: transparent; color: var(--accent); font-size: 0.9rem;
}
.login-box button { padding: 10px; border: none; border-radius: var(--radius); background: var(--accent); color: #fff; font: 600 1rem var(--font-body); cursor: pointer; }
.login-box button:disabled { opacity: 0.5; cursor: default; }
.login-box .error { color: #a8362a; font-size: 0.9rem; }

/* Fotohoekjes: zwarte driehoekjes in de hoeken, zoals in een oud album */
.corner { position: absolute; width: 22px; height: 22px; background: var(--ink); }
.corner.tl { top: -1px; left: -1px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.corner.tr { top: -1px; right: -1px; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.corner.bl { bottom: -1px; left: -1px; clip-path: polygon(0 0, 0 100%, 100% 100%); }
.corner.br { bottom: -1px; right: -1px; clip-path: polygon(100% 0, 100% 100%, 0 100%); }

/* === Jaarlijst === */

.year-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.year-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink);
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, transform 0.15s;
}
.year-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.year-card-main { display: flex; align-items: center; gap: 18px; flex: 1 1 auto; min-width: 0; color: inherit; }
.year-number { font-family: var(--font-display); font-size: 2rem; color: var(--ink); min-width: 4.5ch; }
.year-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.year-subtitle { font-family: var(--font-display); font-style: italic; font-size: 1.05rem; }
.year-summary { color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.year-count { color: var(--ink-faint); font-size: 0.85rem; }

/* === Jaarpagina: onderwerpregels === */

.subject-row { margin-bottom: 32px; }
.subject-header { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.subject-header h2 { font-size: 1.35rem; flex: 1 1 auto; min-width: 0; }
.subject-header h2 a { color: var(--ink); }
.subject-header h2 a:hover { color: var(--accent); }
.subject-header .count { color: var(--ink-faint); font-size: 0.85rem; }
.subject-header .actions { align-self: center; }

.thumb-row { display: grid; gap: var(--thumb-gap); }

/* === Onderwerppagina: raster === */

.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--thumb-gap); }

/* === Thumbnails: een afdruk met wit randje === */

.thumb {
  display: block; position: relative;
  aspect-ratio: 3 / 2;
  background: var(--paper-deep);
  padding: 4px;
  border: 1px solid var(--print-border);
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
  overflow: hidden;
}
.thumb:hover { transform: translateY(-2px) rotate(-0.4deg); box-shadow: var(--shadow-lift); z-index: 1; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; background: var(--paper-deep); }
.thumb-more { display: flex; align-items: center; justify-content: center; background: var(--card); color: var(--accent); font: 600 1rem var(--font-body); }
.thumb-more:hover { background: var(--accent); color: #fff; }

/* === Lightbox === */

.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: #111;
  display: flex; align-items: center; justify-content: center;
  user-select: none;
}
.lightbox-image { max-width: 100vw; max-height: 100vh; object-fit: contain; animation: lb-fade 0.3s ease; }
@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }

.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 56px; height: 96px;
  border: none; background: rgba(0,0,0,0.35); color: #fff;
  font-size: 2rem; cursor: pointer;
  transition: opacity 0.25s, background 0.15s;
}
.lb-nav:hover { background: rgba(0,0,0,0.6); }
.lb-nav:disabled { opacity: 0.15; cursor: default; }
.lb-prev { left: 0; border-radius: 0 6px 6px 0; }
.lb-next { right: 0; border-radius: 6px 0 0 6px; }

.lb-bar {
  position: absolute; left: 0; right: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  color: #ddd;
  transition: opacity 0.25s;
}
.lb-top { top: 0; background: linear-gradient(rgba(0,0,0,0.7), transparent); }
.lb-bottom { bottom: 0; background: linear-gradient(transparent, rgba(0,0,0,0.7)); justify-content: center; }
.lb-title { flex: 1; text-align: center; min-width: 0; }
.lb-subject { display: block; font-family: var(--font-display); font-size: 1.1rem; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-counter { display: block; font-size: 0.85rem; color: #bbb; }

.lb-btn {
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,0.3); border-radius: var(--radius);
  background: rgba(0,0,0,0.4); color: #fff;
  font: 600 0.9rem var(--font-body); cursor: pointer; white-space: nowrap;
}
.lb-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
.lb-speed { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.lb-speed input { width: 120px; accent-color: #fff; }

.controls-hidden .lb-bar, .controls-hidden .lb-nav { opacity: 0; pointer-events: none; }
.controls-hidden { cursor: none; }

/* === Telefoon === */

@media (max-width: 600px) {
  .page { padding: 16px 12px 48px; }
  .page-header h1 { font-size: 1.5rem; }
  .year-card { padding: 12px; }
  .year-number { font-size: 1.5rem; }
  .year-summary { -webkit-line-clamp: 1; }
  .thumb-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .lb-nav { width: 40px; height: 72px; font-size: 1.5rem; }
  .lb-bar { padding: 8px 10px; gap: 8px; }
  .lb-speed input { width: 80px; }
}
