:root {
  --bg: #0a0a0a;
  --surface: #131313;
  --surface-2: #1a1a1a;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.25);
  --text: #e8e8e8;
  --text-dim: #8a8a8a;
  --accent: #ffffff;
  --danger: #e05555;
  --success: #4caf82;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f4f4f4;
  --surface-2: #ececec;
  --border: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.3);
  --text: #1a1a1a;
  --text-dim: #666666;
  --accent: #000000;
  --danger: #c0392b;
  --success: #2f8f5b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }

.topnav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
}

.topnav-right { display: flex; align-items: center; gap: 1.5rem; }
.topnav-controls { display: flex; align-items: center; gap: 0.75rem; }

.hamburger-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.hamburger-toggle span { display: block; width: 100%; height: 2px; background: var(--text); }

.wordmark { display: inline-flex; align-items: center; }
.wordmark img { height: 28px; width: auto; }

.logo-for-dark-bg, .logo-for-light-bg { display: none; }
html[data-theme="dark"] .logo-for-dark-bg { display: block; }
html[data-theme="light"] .logo-for-light-bg { display: block; }

.auth-logo { height: 70px; width: auto; margin: 0 auto 1rem; }

.topnav-links { display: flex; align-items: center; gap: 1.5rem; }
.topnav-links a:not(.btn), .bottomnav-links a:not(.btn) { font-size: 0.85rem; letter-spacing: 0.03em; color: var(--text-dim); }
.topnav-links a:not(.btn):hover, .bottomnav-links a:not(.btn):hover { color: var(--text); }

.bottomnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.75rem 1rem;
  z-index: 100;
}
.bottomnav-links { display: flex; align-items: center; justify-content: center; gap: 1.25rem; flex-wrap: wrap; }

.content { padding: 2rem; max-width: 1400px; margin: 0 auto; }
.content-with-bottomnav { padding-bottom: 4.5rem; }

.page-title {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 1.5rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.album-description { color: var(--text-dim); margin-bottom: 1.5rem; }

.subscribe-hint {
  display: inline-block;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--bg);
  background: var(--accent);
  padding: 0.4rem 1rem;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}
.subscribe-hint:hover { opacity: 0.85; color: var(--bg); }

.subscribe-status {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--success);
  margin: 0 0 0.75rem;
}

.flashes { margin-bottom: 1.5rem; }
.flash { padding: 0.6rem 1rem; border-radius: 4px; margin-bottom: 0.5rem; font-size: 0.85rem; }
.flash-error { background: rgba(224, 85, 85, 0.15); color: var(--danger); }
.flash-success { background: rgba(76, 175, 130, 0.15); color: var(--success); }

.album-grid, .photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px;
}
.album-grid { row-gap: 44px; column-gap: 20px; }
.photo-grid { gap: 9px; }

.album-card { display: flex; flex-direction: column; gap: 0.5rem; }
.album-cover {
  width: 100%;
  height: auto;
  display: block;
  background: var(--surface);
  border-radius: 2px;
}
.album-cover-empty { background: var(--surface); aspect-ratio: 2 / 3; object-fit: contain; }
.album-title { font-size: 0.85rem; color: var(--text-dim); }
.album-card:hover .album-title { color: var(--text); }

.badge-adult {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--danger);
  border: 1px solid rgba(224, 85, 85, 0.4);
  border-radius: 3px;
  padding: 0.05rem 0.3rem;
  vertical-align: middle;
}

.album-card-locked { padding-bottom: 0.5rem; }
.cover-button {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  text-align: inherit;
}
.album-description-preview { font-size: 0.85rem; color: var(--text-dim); margin: 0; text-align: center; }
.album-photo-count { font-size: 0.85rem; color: var(--text-dim); text-align: center; }
.album-cta-row { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; margin-top: 0.25rem; }

.photo-thumb {
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 2px;
}
.photo-thumb img {
  width: 100%;
  height: auto;
  display: block;
  transition: opacity 0.15s ease;
}
.photo-thumb:hover img { opacity: 0.85; }

.empty-state { color: var(--text-dim); }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.lightbox[hidden] { display: none; }
.lightbox-image {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
}
.lightbox-close, .lightbox-nav, .lightbox-download {
  position: absolute;
  background: none;
  border: none;
  color: var(--text);
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.15s ease;
  font-size: 1.5rem;
}
.lightbox-close:hover, .lightbox-nav:hover, .lightbox-download:hover { opacity: 1; }
.lightbox-close { top: 1.5rem; right: 2rem; font-size: 2rem; }
.lightbox-prev { left: 2rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 2rem; top: 50%; transform: translateY(-50%); }
.lightbox-download {
  bottom: 1.5rem;
  right: 2rem;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  border: 1px solid var(--border);
  padding: 0.4rem 1rem;
  border-radius: 3px;
  text-decoration: none;
}

.auth-shell { display: flex; justify-content: center; padding-top: 4rem; }
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 320px;
}
.auth-title { text-align: center; font-weight: 500; letter-spacing: 0.05em; margin-bottom: 1rem; }
.auth-switch { text-align: center; font-size: 0.8rem; color: var(--text-dim); margin: 0.5rem 0 0; }

.hero { padding: 3rem 0 4rem; text-align: center; }
.hero-title { font-size: 2.2rem; font-weight: 600; letter-spacing: -0.01em; margin: 0 auto 1rem; max-width: 640px; }
.hero-subtitle { color: var(--text-dim); font-size: 1rem; line-height: 1.6; margin: 0 auto 2rem; max-width: 640px; }
.hero-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.end-actions { margin: 0 0 3rem; }
.hero-logo { height: 77px; width: auto; margin: 0 auto 1.5rem; }

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  max-width: 900px;
  margin: 3rem auto;
  text-align: center;
}
.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 1.5rem;
}
.pricing-card h2 { font-size: 0.9rem; color: var(--text-dim); font-weight: 500; margin: 0 0 0.75rem; }
.pricing-price { font-size: 1.8rem; font-weight: 600; margin: 0 0 0.75rem; }
.pricing-unit { font-size: 0.85rem; color: var(--text-dim); font-weight: 400; }
.pricing-desc { color: var(--text-dim); font-size: 0.85rem; line-height: 1.5; margin: 0; }

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  max-width: 900px;
  margin: 0 auto;
}
.featured-item { display: block; border-radius: 4px; overflow: hidden; }
.featured-item img { width: 100%; height: auto; display: block; }
.featured-item:hover img { opacity: 0.85; }

label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; color: var(--text-dim); }
input[type=text], input[type=password], input[type=number], textarea, select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.7rem;
  border-radius: 3px;
  font-size: 0.9rem;
  font-family: inherit;
}
input[type=file] { color: var(--text-dim); font-size: 0.85rem; }

.captcha-row { flex-direction: row; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.captcha-row input[type=number] { width: 4.5rem; }

.btn {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 1.1rem;
  border-radius: 3px;
  font-size: 0.85rem;
  cursor: pointer;
}
.btn:hover { border-color: var(--border-strong); }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-primary:hover { opacity: 0.85; color: var(--bg); }
.btn-small { padding: 0.35rem 0.7rem; font-size: 0.75rem; }
.btn-danger { color: var(--danger); border-color: rgba(224, 85, 85, 0.4); }
.btn-secondary { background: transparent; border-color: var(--border-strong); }

.link-button { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 0.85rem; padding: 0; }
.link-button:hover { color: var(--text); }

.topnav-username { font-size: 0.85rem; color: var(--text); font-weight: 600; }
.theme-toggle { font-size: 1rem; line-height: 1; }
.lang-switch {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.2rem 0.45rem;
}
.lang-switch:hover { border-color: var(--border-strong); color: var(--text); }
.inline-form { display: inline-flex; gap: 0.4rem; align-items: center; justify-content: center; margin: 0; }

.admin-shell { display: flex; gap: 2.5rem; }
.admin-subnav { display: flex; flex-direction: column; gap: 0.75rem; min-width: 120px; }
.admin-subnav a { font-size: 0.85rem; color: var(--text-dim); }
.admin-subnav a:hover { color: var(--text); }
.admin-main { flex: 1; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.admin-section { margin-bottom: 2.5rem; }
.admin-section h2 { font-size: 0.9rem; color: var(--text-dim); margin-bottom: 1rem; font-weight: 500; }
.admin-form { display: flex; flex-direction: column; gap: 1rem; max-width: 480px; }
.admin-filter-form { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; }
.field-error { color: var(--danger); font-size: 0.75rem; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th, .admin-table td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
}
.admin-table th { color: var(--text-dim); font-weight: 500; }
.admin-actions { display: flex; gap: 0.75rem; align-items: center; }

.photo-grid-admin { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.photo-thumb-admin { display: flex; flex-direction: column; gap: 0.4rem; }
.photo-thumb-admin img { width: 100%; height: auto; display: block; border-radius: 2px; }

.permission-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.5rem; }
.permission-item { flex-direction: row; align-items: center; gap: 0.5rem; color: var(--text); font-size: 0.85rem; }

.permission-list-dated { display: flex; flex-direction: column; gap: 0.4rem; max-width: 480px; }
.permission-list-dated .permission-item { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.permission-name { display: flex; align-items: center; gap: 0.5rem; }
.permission-date { font-variant-numeric: tabular-nums; white-space: nowrap; }
.permission-date-granted { color: #2ecc71; }
.permission-date-revoked { color: #e74c3c; }

.pagination { display: flex; gap: 1rem; align-items: center; margin-top: 1.5rem; font-size: 0.85rem; color: var(--text-dim); }

.model-album-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; align-items: start; }
.model-album-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
}
.model-album-panel { margin-top: 2rem; max-width: 640px; }
.model-album-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; }
.model-album-title { font-size: 1rem; font-weight: 500; margin: 0; overflow-wrap: anywhere; }
.model-album-title a { color: var(--text); }
.model-album-status {
  flex-shrink: 0;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  white-space: nowrap;
}
.model-album-status-offer, .model-album-status-offer_share, .model-album-status-share_only { color: var(--success); border-color: var(--success); }
.model-album-cover {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--surface-2);
  border-radius: 3px;
}
.model-album-cover.album-cover-empty { object-fit: contain; }
.model-status-form, .share-link-create { display: flex; flex-direction: column; gap: 0.6rem; }
.model-status-form .btn, .share-link-create .btn { align-self: flex-start; }
.model-panel-heading { font-size: 0.9rem; font-weight: 600; color: var(--text); margin: 0.5rem 0 0; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.model-panel-heading-first { margin-top: 0; padding-top: 0; border-top: none; }
.model-panel-note { font-size: 0.8rem; color: var(--text-dim); margin: 0; }
.share-link-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.share-link-item { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.6rem; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); }
.share-link-item input[type=text] { width: 100%; min-width: 0; font-size: 0.75rem; }
.share-link-expired { opacity: 0.55; }
.share-link-note { margin: 0; font-size: 0.85rem; color: var(--text); overflow-wrap: anywhere; }
.share-link-meta { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: 0.75rem; color: var(--text-dim); }
.share-link-actions { display: flex; gap: 0.4rem; align-items: center; }

@media (min-width: 700px) {
  .model-album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1100px) {
  .model-album-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .wordmark img { display: none; }
  .hero-actions { display: grid; grid-template-columns: repeat(2, 1fr); }
  .pricing-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .hamburger-toggle { display: flex; }
  .topnav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    z-index: 100;
  }
  .topnav-links.open { display: flex; }

  .bottomnav { position: static; }
  .content-with-bottomnav { padding-bottom: 0; }
  .bottomnav-links { flex-direction: column; align-items: stretch; text-align: center; gap: 0.75rem; }
}
