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

:root {
  --bg: #f8f8f7;
  --surface: #ffffff;
  --border: #e8e6e1;
  --text: #1a1a18;
  --muted: #6b6b68;
  --accent: #2d2d2b;
  --accent-hover: #111;
  --radius: 4px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html { font-size: 16px; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font); min-height: 100vh;
  /* iOS safe area: padding for home indicator */
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: inherit; text-decoration: none; }

/* ─── Header ─────────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem; height: 56px;
  /* iOS standalone: push header below status bar */
  padding-top: env(safe-area-inset-top);
  height: calc(56px + env(safe-area-inset-top));
}
.logo { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.03em; }
/* ─── Hamburger ──────────────────────────────────────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column; justify-content: center; gap: 5px;
  width: 36px; height: 36px; padding: 4px;
  background: none; border: none; cursor: pointer; border-radius: 6px;
  transition: background 0.15s;
}
.hamburger:hover { background: var(--bg); }
.hamburger span {
  display: block; height: 2px; background: var(--text); border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ─── Nav overlay ────────────────────────────────────────────────────────────── */
.nav-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: flex-end;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.nav-overlay.open { opacity: 1; pointer-events: auto; }

.nav-overlay__close {
  position: absolute; top: 18px; right: 18px;
  background: none; border: none; color: #fff; font-size: 1.4rem;
  cursor: pointer; padding: 8px; line-height: 1;
}

.nav-overlay__links {
  background: var(--surface); width: min(280px, 80vw);
  height: 100%; padding: 4.5rem 0 2rem;
  display: flex; flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,.15);
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(.4,0,.2,1);
}
.nav-overlay.open .nav-overlay__links { transform: translateX(0); }

.nav-overlay__link {
  padding: 1rem 1.75rem; font-size: 1.1rem; font-weight: 500;
  color: var(--text); text-decoration: none; border-left: 3px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.nav-overlay__link:hover { background: var(--bg); }
.nav-overlay__link.active { border-left-color: var(--accent); color: var(--accent); font-weight: 700; }

.site-nav { display: flex; gap: 4px; }

@media (max-width: 768px) {
  .site-nav  { display: none; }
  .hamburger { display: flex; }
}

.nav-link {
  font-size: 0.875rem; font-weight: 500; padding: 6px 14px;
  border-radius: 999px; color: var(--muted); transition: background 0.15s, color 0.15s;
}
.nav-link:hover { color: var(--text); background: var(--bg); }
.nav-link.active { background: var(--accent); color: #fff; }

.admin-header-right { display: flex; align-items: center; gap: 10px; }

.btn-logout {
  font-size: 0.8rem; background: none; border: 1px solid var(--border);
  color: var(--muted); padding: 5px 14px; border-radius: 999px; cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-logout:hover { border-color: var(--accent); color: var(--text); }

@media (max-width: 768px) {
  #adminNav    { display: none; }
  #adminHamburger { display: flex; }
  .btn-logout  { display: none; }
}

.btn-admin, .btn-back {
  font-size: 0.8125rem; font-weight: 500;
  background: var(--accent); color: #fff;
  padding: 6px 14px; border-radius: 999px;
  transition: background 0.15s;
}
.btn-admin:hover, .btn-back:hover { background: var(--accent-hover); }

/* ─── Profile hero ───────────────────────────────────────────────────────────── */
.profile-hero {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.profile-inner {
  max-width: 700px; margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex; align-items: center; gap: 1.75rem;
  justify-content: center;
}
.profile-avatar {
  width: 90px; height: 90px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  border: 3px solid var(--border);
}
.profile-avatar--placeholder {
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 700;
}
.profile-body { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.profile-top { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.profile-name { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
.btn-follow {
  background: var(--accent); color: #fff; border: none;
  padding: 7px 20px; border-radius: 6px; font-size: 0.875rem; font-weight: 600;
  cursor: not-allowed; opacity: .6;
}
.btn-follow--active {
  cursor: pointer; opacity: 1; text-decoration: none;
  transition: background 0.15s;
}
.btn-follow--active:hover { background: var(--accent-hover); }
.profile-meta { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 2px; }
.profile-meta-item { display: flex; align-items: center; gap: 4px; font-size: 0.8125rem; color: var(--muted); }
.profile-meta-item a { color: var(--muted); text-decoration: underline; }
.profile-meta-item svg { flex-shrink: 0; }
.profile-bio { font-size: 0.9rem; line-height: 1.6; color: var(--text); max-width: 560px; }
.profile-stats { font-size: 0.8125rem; color: var(--muted); }

/* ─── Page tabs (below hero) ─────────────────────────────────────────────────── */
.page-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  max-width: 100%;
  padding: 0 1.5rem;
}
.page-tab {
  padding: 12px 20px; font-size: 0.875rem; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.page-tab:hover { color: var(--text); }
.page-tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 700; }

/* ─── Grid ───────────────────────────────────────────────────────────────────── */
main { max-width: 1600px; margin: 0 auto; padding: 1.5rem; }

/* ═══ PHOTO FEED — mobile first ══════════════════════════════════════════════ */

/* Mobile (default): single column, natural proportions, no cropping */
.photo-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}

.feed-card {
  display: block;
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  border-radius: 14px;
  overflow: hidden;
}

.feed-card__img img {
  display: block;
  width: 100%;
  height: auto;       /* ← the only rule needed on mobile */
}

.feed-card__meta {
  padding: 7px 14px 11px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* Desktop (≥ 601px): justified rows — same height, widths from aspect ratio */
@media (min-width: 601px) {
  .photo-feed {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    padding: 1.5rem;
    align-items: flex-start;
  }

  .feed-card {
    flex-grow: 1;          /* overridden inline with aspect-ratio value */
    flex-basis: 200px;
    min-width: 140px;
    max-width: 680px;
    border-radius: var(--radius);
    overflow: hidden;
    transition: opacity 0.18s;
  }

  /* Invisible spacers absorb remaining row space so orphan cards stay small */
  .feed-fill {
    flex-grow: 9999;
    flex-basis: 200px;
    height: 0;
    overflow: hidden;
    pointer-events: none;
  }
  .feed-card:hover { opacity: .88; }

  .feed-card__img {
    height: 260px;
    overflow: hidden;
  }

  .feed-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Galeria: karty w naturalnych proporcjach (stała wysokość, szerokość z aspect ratio).
     Nie rozciągają się na całą szerokość przy małej liczbie zdjęć. */
  .gallery-feed { justify-content: flex-start; gap: 10px; }
  .gallery-feed .feed-card {
    flex: 0 0 auto;
    width: calc(300px * var(--ratio, 1.5));
    max-width: 100%;
  }
  .gallery-feed .feed-card__img { height: 300px; }
}

.card-meta-top { display: flex; align-items: center; gap: 8px; }
.day-num   { font-size: 0.65rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.card-date { font-size: 0.65rem; color: var(--muted); }
.card-title {
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (min-width: 601px) {
  .feed-card__meta {
    min-height: 68px;
  }
}

.load-more-wrap { display: flex; justify-content: center; padding: 2rem 0; }
.btn-load {
  background: none; border: 1.5px solid var(--border); color: var(--text);
  padding: 10px 28px; border-radius: 999px; font-size: 0.875rem; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.btn-load:hover { border-color: var(--accent); background: var(--accent); color: #fff; }

.empty { text-align: center; color: var(--muted); padding: 4rem 0; }
.empty a { text-decoration: underline; }

/* ─── Photo page ─────────────────────────────────────────────────────────────── */
.photo-page { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.photo-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem;
}
.back-link { font-size: 0.875rem; color: var(--muted); transition: color 0.15s; }
.back-link:hover { color: var(--text); }
.day-badge {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em;
  background: var(--accent); color: #fff;
  padding: 4px 10px; border-radius: 999px;
}
.photo-layout {
  display: grid; grid-template-columns: 1fr 320px; gap: 3rem; align-items: start;
}
@media (max-width: 800px) {
  .photo-layout { grid-template-columns: 1fr; }
}
.photo-img-wrap { border-radius: 6px; overflow: hidden; background: #111; }
.photo-full { width: 100%; height: auto; display: block; max-height: 85vh; object-fit: contain; }
.photo-sidebar { position: sticky; top: 80px; }
.photo-title { font-size: 1.5rem; font-weight: 700; line-height: 1.2; margin-bottom: 0.5rem; }
.photo-date { font-size: 0.8rem; color: var(--muted); margin-bottom: 1rem; }
.photo-desc { font-size: 0.9375rem; line-height: 1.65; color: #333; margin-bottom: 1.25rem; }
.mood-tag {
  display: inline-block; font-size: 0.8rem;
  background: var(--bg); border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 1.5rem;
}
.exif-block { border-top: 1px solid var(--border); padding-top: 1.25rem; }
.exif-heading { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.75rem; }
.exif-list { display: flex; flex-direction: column; gap: 5px; }
.exif-row { display: flex; gap: 8px; font-size: 0.8375rem; }
.exif-row dt { color: var(--muted); min-width: 80px; flex-shrink: 0; }
.exif-row dd { color: var(--text); }

/* ─── Spinner ────────────────────────────────────────────────────────────────── */
.spinner {
  width: 32px; height: 32px; margin: 4rem auto;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}
.feed-card__img {
  background: var(--border);
  background-image: linear-gradient(90deg, var(--border) 25%, var(--surface) 50%, var(--border) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
}
.feed-card__img img {
  display: block;
  transition: opacity 0.25s;
}
.feed-card__img img:not([src]), .feed-card__img img[src=""] {
  opacity: 0;
}
.feed-card__img img.loaded {
  opacity: 1;
}
.error { text-align: center; color: var(--muted); padding: 4rem 0; }

/* ─── Admin ──────────────────────────────────────────────────────────────────── */
.admin-page { max-width: 820px; margin: 0 auto; padding: 2rem 1.5rem; }
.admin-heading { font-size: 1.25rem; font-weight: 700; margin-bottom: 1.5rem; }

.upload-form { display: flex; flex-direction: column; gap: 1.1rem; }

.drop-zone {
  border: 2px dashed var(--border); border-radius: 8px;
  background: var(--surface); text-align: center;
  cursor: pointer; overflow: hidden; transition: border-color 0.15s;
  min-height: 200px; display: flex; align-items: center; justify-content: center;
}
.drop-zone.drag-over { border-color: var(--accent); background: #f5f5f3; }
.drop-inner { padding: 2.5rem 1rem; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); }
.drop-inner svg { opacity: .4; }
.drop-inner p { font-size: 0.9rem; }
.drop-inner button { background: none; border: none; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; font-size: inherit; }
.drop-hint { font-size: 0.75rem !important; }
.drop-preview { width: 100%; max-height: 400px; object-fit: contain; display: block; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-label, label { display: flex; flex-direction: column; gap: 5px; font-size: 0.875rem; font-weight: 500; }

input[type=text], input[type=number], input[type=date], input[type=email], input[type=url], input[type=password], textarea, select {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 0.9375rem; font-family: var(--font);
  background: var(--surface); color: var(--text);
  transition: border-color 0.15s;
  appearance: auto;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 90px; }
.req { color: #c0392b; }

.btn-submit {
  align-self: flex-start; background: var(--accent); color: #fff;
  border: none; padding: 10px 24px; border-radius: 999px;
  font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: background 0.15s;
}
.btn-submit:hover:not(:disabled) { background: var(--accent-hover); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-danger {
  background: #c0392b; color: #fff; border: none;
  padding: 10px 24px; border-radius: 999px;
  font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: background 0.15s;
}
.btn-danger:hover { background: #922b21; }

.form-msg { padding: 10px 14px; border-radius: var(--radius); font-size: 0.875rem; }
.form-msg--success { background: #eafaf1; color: #1e8449; border: 1px solid #a9dfbf; }
.form-msg--error   { background: #fdedec; color: #c0392b; border: 1px solid #f5b7b1; }

.divider { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.admin-card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
}
.admin-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.admin-card-info { padding: 8px 10px 4px; display: flex; flex-direction: column; gap: 2px; font-size: 0.78rem; }
.btn-edit {
  margin: 6px 10px 10px; background: none; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 5px; font-size: 0.78rem; cursor: pointer;
  transition: background 0.15s;
}
.btn-edit:hover { background: var(--bg); }

/* ─── Memories strip ─────────────────────────────────────────────────────────── */
.memories-strip {
  background: #111; padding: 2.5rem 0 3rem;
  margin-top: 3rem;
}
.memories-inner {
  max-width: 900px; margin: 0 auto; padding: 0 1.5rem;
  display: flex; gap: 16px; flex-wrap: wrap; justify-content: center;
}
.memory-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-decoration: none; color: #fff;
  transition: opacity 0.18s;
}
.memory-card:hover { opacity: .75; }
.memory-img {
  width: 160px; height: 120px; overflow: hidden; border-radius: 4px;
  background: #222;
}
.memory-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.memory-label {
  font-size: 0.78rem; color: rgba(255,255,255,.55);
  text-align: center; letter-spacing: 0.02em;
}

@media (max-width: 600px) {
  .memory-img { width: 100px; height: 75px; }
  .memories-inner { gap: 10px; }
}

/* ─── Moods page ─────────────────────────────────────────────────────────────── */
.moods-page { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }

.moods-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem; margin-bottom: 2.5rem;
}
.mood-legend { display: flex; gap: 2rem; flex-wrap: wrap; }
.legend-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.legend-pct { font-size: 0.75rem; color: var(--muted); font-weight: 600; }

.year-select {
  padding: 7px 32px 7px 14px; border: 1.5px solid var(--border);
  border-radius: 999px; font-size: 0.875rem; font-weight: 600;
  background: var(--surface); cursor: pointer; appearance: auto;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem 3rem;
}
@media (max-width: 900px) { .cal-grid { grid-template-columns: repeat(2, 1fr); gap: 2rem; } }
@media (max-width: 500px)  { .cal-grid { grid-template-columns: 1fr; gap: 1.5rem; } }

.cal-month { display: flex; flex-direction: column; gap: 10px; }
.cal-month-name {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em;
  color: var(--muted); text-transform: uppercase;
}

/* dot size adapts to available width */
.cal-dots {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-dot {
  aspect-ratio: 1;
  border-radius: 50%;
  width: 100%;
}
.cal-dot--empty { background: transparent; pointer-events: none; }
.cal-dot--none  { background: #e0deda; }
.cal-dot--filled { cursor: pointer; transition: transform 0.12s, opacity 0.12s; }
.cal-dot--filled:hover { transform: scale(1.25); opacity: .85; }

/* ─── Habit dots in calendar ─────────────────────────────────────────────────── */
.cal-dot--habit-done { background: #52b788; }
.cal-dot--habit-fail { background: #e05c5c; }

/* ─── Habit legend (stats view) ──────────────────────────────────────────────── */
.moods-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.habit-stat { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 8px; }
.habit-stat--done { background: #eafaf1; color: #1e8449; }
.habit-stat--fail { background: #fdedec; color: #c0392b; }
.habit-stat-icon { font-size: 1.1rem; font-weight: 700; }
.habit-stat-num  { font-size: 1.5rem; font-weight: 700; }
.habit-stat-label { font-size: 0.8rem; }

/* ─── Habits on photo page ────────────────────────────────────────────────────── */
.habits-block { border-top: 1px solid var(--border); padding-top: 1.25rem; margin-bottom: 1.25rem; }
.habits-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.habit-item { display: flex; align-items: center; gap: 10px; font-size: 0.875rem; }
.habit-icon { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; flex-shrink: 0; }
.habit-done .habit-icon { background: #52b788; color: #fff; }
.habit-fail .habit-icon { background: #e05c5c; color: #fff; }
.habit-unset .habit-icon { background: var(--border); color: var(--muted); }

/* ─── Habits in admin ─────────────────────────────────────────────────────────── */
.habits-checkboxes { display: flex; flex-direction: column; gap: 8px; }
.habit-check-label { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; cursor: pointer; padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); }
.habit-check-label input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.habit-list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.habit-list-info { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: .875rem; }

/* mood pill on photo page */
.mood-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.825rem; font-weight: 500;
  background: var(--bg); border: 1px solid var(--border);
  padding: 5px 12px 5px 6px; border-radius: 999px; margin-bottom: 1.25rem;
}

/* ─── Admin avatar ───────────────────────────────────────────────────────────── */
.profile-avatar-section { display: flex; align-items: center; gap: 1.25rem; margin-bottom: .5rem; }
.profile-avatar-admin { width: 80px; height: 80px; border-radius: 50%; overflow: hidden; background: var(--border); flex-shrink: 0; }
.profile-avatar-admin img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; font-weight: 700; background: var(--accent); color: #fff; }

/* ─── Login ──────────────────────────────────────────────────────────────────── */
.login-wrap {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100vh; padding: 2rem;
}
.login-logo { font-size: 2rem; font-weight: 700; margin-bottom: 1rem; }
.login-heading { font-size: 1.1rem; font-weight: 600; margin-bottom: 1.5rem; color: var(--muted); }
.login-form { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 1rem; }

/* ─── Galleries grid (public) ────────────────────────────────────────────────── */
.galleries-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px;
  max-width: 1400px; margin: 0 auto; padding: 2rem 1.5rem;
}
.gallery-card {
  display: block; border-radius: 6px; overflow: hidden;
  background: var(--surface);
  transition: transform 0.18s, box-shadow 0.18s;
}
.gallery-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.gallery-cover { aspect-ratio: 4/3; overflow: hidden; background: #eee; }
.gallery-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-no-cover { width: 100%; height: 100%; background: var(--border); }
.gallery-info { padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.gallery-title { font-size: 1rem; font-weight: 600; }
.gallery-count { font-size: 0.78rem; color: var(--muted); }

/* ─── Gallery page ───────────────────────────────────────────────────────────── */
.gallery-header { max-width: 1400px; margin: 0 auto; padding: 1.5rem 1.5rem 0; }
.gallery-page-title { font-size: 2rem; font-weight: 700; margin: .5rem 0; }
.gallery-desc { color: var(--muted); font-size: .9rem; margin-bottom: .25rem; }
.gallery-meta { font-size: .8rem; color: var(--muted); margin-bottom: 1rem; }

/* ─── Admin galleries list ───────────────────────────────────────────────────── */
.gallery-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.gallery-list-thumb {
  width: 60px; height: 60px; object-fit: cover; border-radius: 4px; flex-shrink: 0;
}
.gallery-list-info { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: .85rem; }
.gallery-list-desc { color: var(--muted); font-size: .78rem; }

/* ─── Gallery modal photo picker ─────────────────────────────────────────────── */
.modal-box--wide { max-width: 720px; max-height: 90vh; overflow-y: auto; }
.gallery-photo-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px;
  margin-bottom: .5rem;
}
.gphoto-card {
  position: relative; border-radius: 4px; overflow: hidden; background: #eee;
  /* Padding-top trick: reliable cross-browser square regardless of aspect-ratio support */
  padding-top: 100%; height: 0;
}
.gphoto-card img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
}
.gphoto-label, .gphoto-add, .gphoto-remove, .gphoto-check { position: absolute; }
.gphoto-card.gphoto-in { opacity: .45; }
.gphoto-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.55); color: #fff; font-size: .65rem; padding: 2px 4px; text-align: center;
}
.gphoto-add, .gphoto-remove {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%; border: none; cursor: pointer;
  font-size: .75rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.gphoto-add { background: var(--accent); color: #fff; }
.gphoto-remove { background: #c0392b; color: #fff; }
.gphoto-check {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%; background: #27ae60;
  color: #fff; font-size: .75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ─── Modal ──────────────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal-box {
  background: var(--surface); border-radius: 8px;
  padding: 2rem; width: 100%; max-width: 480px;
  display: flex; flex-direction: column; gap: 1rem; position: relative;
}
.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--muted);
}
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ─── PWA / iOS Standalone ───────────────────────────────────────────────────── */
@media (display-mode: standalone) {
  /* Side paddings respect notch on landscape */
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  /* Header already gets padding-top via safe-area-inset-top above;
     ensure left/right also respect notch in landscape */
  .site-header {
    padding-left: max(2rem, env(safe-area-inset-left));
    padding-right: max(2rem, env(safe-area-inset-right));
  }

  /* Nav overlay full-height should account for bottom bar */
  .nav-overlay__links {
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
  }

  /* Tap targets slightly larger for touch-first use */
  .nav-overlay__link { padding: 1.1rem 1.75rem; }
  .hamburger { width: 44px; height: 44px; }
}

/* ─── Landing page ───────────────────────────────────────────────────────────── */
.landing { max-width: 640px; margin: 0 auto; padding: 3.5rem 1.5rem 4rem; }
.lp-hero { margin-bottom: 3.5rem; }
.lp-title { font-size: 2.5rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 1rem; }
.lp-lead { font-size: 1.2rem; font-weight: 500; line-height: 1.55; margin-bottom: 1rem; }
.lp-text { font-size: 0.95rem; line-height: 1.7; color: var(--muted); margin-bottom: 0.9rem; }
.lp-heading { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 0.75rem; }

.lp-newsletter {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 1.75rem; margin-bottom: 3rem;
}
.lp-form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.25rem; }
.lp-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 540px) { .lp-form-row { grid-template-columns: 1fr; } }
.lp-label { font-size: 0.875rem; font-weight: 500; }
.lp-honeypot { position: absolute; left: -9999px; opacity: 0; height: 0; pointer-events: none; }
.lp-consent {
  flex-direction: row; align-items: flex-start; gap: 10px;
  font-size: 0.8rem; font-weight: 400; color: var(--muted); line-height: 1.5;
  cursor: pointer;
}
.lp-consent input { width: 16px; height: 16px; margin-top: 2px; flex-shrink: 0; accent-color: var(--accent); cursor: pointer; }
.lp-consent a { text-decoration: underline; }

.lp-social { margin-bottom: 3rem; }
.lp-social-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 1rem; }
.lp-social-link {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--border); border-radius: 999px;
  padding: 9px 18px; font-size: 0.875rem; font-weight: 600;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.lp-social-link:hover { border-color: var(--accent); background: var(--accent); color: #fff; }

.lp-365 { border-top: 1px solid var(--border); padding-top: 2.5rem; }
.lp-365-btn { display: inline-block; margin-top: 0.5rem; }

/* ─── Privacy page ───────────────────────────────────────────────────────────── */
.privacy-page { max-width: 640px; margin: 0 auto; padding: 3rem 1.5rem 4rem; }
.privacy-page .lp-title { font-size: 1.8rem; margin-bottom: 2rem; }
.privacy-page .lp-heading { font-size: 1.05rem; margin-top: 1.75rem; }

/* ─── Page hero (Projekt 365) ────────────────────────────────────────────────── */
.page-hero {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 2.25rem 1.5rem;
}
.page-hero-title { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; max-width: 700px; margin: 0 auto 0.5rem; }
.page-hero-desc { font-size: 0.9rem; line-height: 1.65; color: var(--muted); max-width: 700px; margin: 0 auto; }

.lp-subheading { font-size: 1.05rem; font-weight: 700; margin: 1.25rem 0 0.5rem; }

/* ═══ Footer ═══════════════════════════════════════════════════════════════════ */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding: 1.75rem 1.5rem calc(1.75rem + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: center;
  gap: 1.25rem; flex-wrap: wrap;
  font-size: 0.8rem; color: var(--muted);
}
.site-footer__link { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; transition: color 0.15s; }
.site-footer__link:hover { color: var(--text); }

/* ═══ Wspólna paleta marki (niebieski) ═════════════════════════════════════════ */
:root {
  --brand-navy: #172554;
  --brand-blue: #1d4ed8;
  --brand-blue-2: #2563eb;
  --brand-blue-3: #3b82f6;
  --brand-grad: linear-gradient(105deg, #172554 0%, #1e40af 48%, #2563eb 100%);
  --brand-tint: #eff4ff;
  --brand-border: #dbe4fb;
}

/* Wspólny nagłówek gradientowy — homepage + podstrony */
.brand-gradient-text {
  background: var(--brand-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ═══ Paleta — prosto, mocny akcent ════════════════════════════════════════════ */
:root {
  --pl-ink: #0f1115;
  --pl-accent: #2b3aff;
  --pl-accent-ink: #1e2ad6;
  --pl-muted: #565b66;
  --pl-line: #ececef;
}

/* ═══ Logo w navbarze — bold wordmark ══════════════════════════════════════════ */
.logo {
  font-family: 'Space Grotesk', var(--font);
  font-weight: 700; font-size: 1.2rem; letter-spacing: -0.02em; color: var(--pl-ink);
}
.logo .logo-accent { color: var(--pl-accent); }

/* Aktywna zakładka i podkreślenia w kolorze marki */
.page-tab.active { border-bottom-color: var(--brand-blue-2); }

/* ═══ Landing — styl „kokpit" (ciemny, Archivo + IBM Plex Mono, zielony akcent) ═ */
body:has(.landing) {
  --bg: #0b0d10; --panel: #14181d; --panel-2: #1a1f26;
  --line: rgba(225,232,240,.14); --line-soft: rgba(225,232,240,.07);
  --cream: #f0f4f8; --muted: #9aa7b5; --muted-2: #67737f;
  --steel: #96a3b2; --steel-dim: rgba(150,163,178,.5);
  --green: #22c55e; --green-hi: #16a34a; --green-ink: #04160b;
  --input-bg: rgba(225,232,240,.05); --input-bg-f: rgba(225,232,240,.09);
  --font-d: 'Archivo', var(--font); --font-m: 'IBM Plex Mono', monospace;
  background: var(--bg); color: var(--cream);
  font-family: var(--font-d);
}
/* subtelny grain */
body:has(.landing)::after {
  content: ""; position: fixed; inset: -100%; z-index: 9000; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

/* ── Nagłówek / nawigacja na landingu (ciemny) ── */
body:has(.landing) .site-header {
  background: rgba(11,13,16,.72); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
body:has(.landing) .logo {
  font-family: var(--font-m); font-weight: 500; font-size: 12px;
  letter-spacing: .2em; text-transform: uppercase; color: var(--cream);
}
body:has(.landing) .logo .logo-accent { color: var(--muted); background: none; -webkit-text-fill-color: currentColor; }
body:has(.landing) .nav-link {
  font-family: var(--font-m); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
body:has(.landing) .nav-link:hover { color: var(--steel); background: var(--input-bg-f); }
body:has(.landing) .nav-link.active { background: var(--green); color: var(--green-ink); }
body:has(.landing) .hamburger span { background: var(--steel); }
body:has(.landing) .nav-overlay__links { background: var(--panel); }
body:has(.landing) .nav-overlay__link { color: var(--cream); }
body:has(.landing) .nav-overlay__link:hover { background: var(--input-bg-f); }
body:has(.landing) .nav-overlay__link.active { border-left-color: var(--green); color: var(--green); }

/* ── Stopka na landingu ── */
body:has(.landing) .site-footer {
  border-top: 1px solid var(--line-soft);
  font-family: var(--font-m); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2);
}
body:has(.landing) .site-footer__link { color: var(--muted-2); }
body:has(.landing) .site-footer__link:hover { color: var(--steel); }

/* ── Kontener ── */
.landing {
  max-width: 1180px; margin: 0 auto;
  padding: clamp(72px,10vh,110px) clamp(20px,4vw,48px) clamp(48px,7vh,88px);
  color: var(--cream);
}

/* eyebrow + mono kickery */
.landing .lp-eyebrow, .landing .lp-kicker {
  font-family: var(--font-m); font-weight: 500; text-transform: uppercase;
}
.landing .lp-eyebrow {
  font-size: clamp(10px,.85vw,11.5px); letter-spacing: .19em; line-height: 2; color: var(--muted); margin: 0 0 .25rem;
}
.landing .lp-eyebrow span { display: block; }
.landing .lp-kicker {
  font-size: 10px; letter-spacing: .24em; color: var(--steel-dim); margin: 0 0 .9rem;
}

/* hero */
.landing .lp-hero { margin-bottom: clamp(3rem,7vh,5rem); }
.landing .lp-title {
  font-family: var(--font-d); font-weight: 800;
  font-size: clamp(2.35rem,5vw,3.7rem); line-height: 1.04; letter-spacing: -.03em;
  color: var(--cream); margin: 1rem 0 0; max-width: 20ch;
}
.landing .lp-title em { font-style: normal; color: var(--green); }
.landing .lp-lead {
  font-family: var(--font-d); font-size: clamp(1.05rem,1.5vw,1.2rem); font-weight: 400;
  color: var(--muted); line-height: 1.6; margin: 1.4rem 0 0; max-width: 44rem;
}
.landing .lp-text { font-family: var(--font-d); font-size: 1.05rem; line-height: 1.65; color: var(--muted); margin-bottom: 1.1rem; max-width: 44rem; }

/* definicja wolności — panel z zielonym akcentem */
.landing .lp-callout {
  margin: 2rem 0; padding: 1.35rem 1.5rem;
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--green);
  border-radius: 8px; color: var(--cream); font-weight: 400;
  font-size: 1.12rem; line-height: 1.55; max-width: 44rem;
}
.landing .lp-callout__label {
  display: block; margin-bottom: .6rem;
  font-family: var(--font-m); font-weight: 500; font-size: 10px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--green);
}

/* obszary życia — pigułki mono */
.landing .lp-areas-intro {
  margin: 2.25rem 0 1rem;
  font-family: var(--font-m); font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--steel-dim);
}
.landing .lp-tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 9px; }
.landing .lp-tags li {
  font-family: var(--font-m); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); background: var(--input-bg); border: 1px solid var(--line);
  padding: 9px 15px; border-radius: 999px;
  transition: border-color .2s, color .2s;
}
.landing .lp-tags li:hover { border-color: var(--steel-dim); color: var(--cream); }

/* nagłówki sekcji */
.landing .lp-heading {
  font-family: var(--font-d); font-weight: 800; letter-spacing: -.02em;
  font-size: clamp(1.6rem,3vw,2.1rem); color: var(--cream); margin-bottom: .75rem;
}

/* sekcje oddzielone linią */
.landing .lp-newsletter,
.landing .lp-social,
.landing .lp-365 {
  margin: 0; padding: clamp(2.5rem,5vh,3.5rem) 0;
  border-top: 1px solid var(--line-soft); background: none; border-radius: 0; box-shadow: none;
}
.landing .lp-newsletter::before { display: none; }

/* formularz — styl MA */
.landing .lp-form { margin-top: 1.5rem; max-width: 620px; }
.landing .lp-form input[type=text],
.landing .lp-form input[type=email] {
  background: var(--input-bg); border: 1px solid var(--line); border-radius: 5px;
  padding: 15px 16px; color: var(--cream); font: 500 15px var(--font-m); letter-spacing: .02em;
}
.landing .lp-form input::placeholder { color: var(--muted-2); }
.landing .lp-form input:focus { border-color: var(--steel); background: var(--input-bg-f); box-shadow: none; }
.landing .lp-label { font-family: var(--font-m); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2); font-weight: 500; }
.landing .lp-consent { font-family: var(--font-m); font-size: 11.5px; color: var(--muted-2); line-height: 1.55; }
.landing .lp-consent input { accent-color: var(--green); }
.landing .lp-consent a { color: var(--muted); }
.landing .lp-consent a:hover { color: var(--steel); }

/* przyciski — zielone mono uppercase */
.landing .btn-submit,
.landing .lp-365-btn {
  background: var(--green); color: var(--green-ink); border: none; border-radius: 5px;
  font: 600 13px var(--font-m); letter-spacing: .14em; text-transform: uppercase;
  padding: 15px 26px; box-shadow: none;
  transition: transform .2s, background .2s;
}
.landing .btn-submit:hover:not(:disabled),
.landing .lp-365-btn:hover { background: var(--green-hi); color: var(--green-ink); transform: translateY(-2px); }
.landing .form-msg--success { background: none; border: none; color: var(--green); padding: 0; font-family: var(--font-m); font-size: 12px; }
.landing .form-msg--error { background: none; border: none; color: #ff6b57; padding: 0; font-family: var(--font-m); font-size: 12px; }

/* social — pigułki mono */
.landing .lp-social-links { gap: 10px; margin-top: 1.5rem; }
.landing .lp-social-link {
  font-family: var(--font-m); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 500;
  background: var(--input-bg); border: 1px solid var(--line); color: var(--muted);
  border-radius: 8px; padding: 11px 18px;
  transition: border-color .2s, color .2s, background .2s;
}
.landing .lp-social-link:hover { border-color: var(--steel-dim); color: var(--cream); background: var(--input-bg-f); }

/* Projekt 365 */
.landing .lp-365 .lp-heading { color: var(--cream); }
.landing .lp-subheading {
  font-family: var(--font-m); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--green);
  font-weight: 500; margin: .5rem 0 .75rem;
}
.landing .lp-list {
  list-style: none; padding: 0; margin: 1.25rem 0 1.75rem;
  display: flex; flex-direction: column; gap: .8rem;
}
.landing .lp-list li {
  position: relative; padding-left: 1.9rem;
  font-family: var(--font-d); font-size: 1.05rem; line-height: 1.5; color: var(--muted);
}
.landing .lp-list li::before {
  content: ""; position: absolute; left: 0; top: .32rem; width: 1.05rem; height: 1.05rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolyline points='4 12.5 10 18.5 20 6' fill='none' stroke='%2322c55e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
}
.landing .lp-365-note { font-family: var(--font-d); font-size: 1rem; line-height: 1.55; color: var(--muted-2); margin: 0 0 1.75rem; }
.landing .lp-365-btn { display: inline-block; }

@media (max-width: 540px) {
  .landing { padding: 3.5rem 1.25rem 3.5rem; }
}

/* ═══ Page hero (Projekt 365) — spójna tonacja z homepage ══════════════════════ */
.page-hero {
  background: linear-gradient(180deg, var(--brand-tint), #ffffff);
  border-bottom: 1px solid var(--brand-border);
}
.page-hero-title {
  font-family: 'Space Grotesk', var(--font);
  font-weight: 700; letter-spacing: -0.03em;
  background: var(--brand-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
