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

:root {
  --header-h: 54px;
  --bg:        #0d0b09;
  --surface:   #131008;
  --border:    rgba(210, 198, 176, 0.13);
  --border-hi: rgba(210, 198, 176, 0.32);
  --text:      #d4cab6;
  --text-dim:  rgba(212, 202, 182, 0.38);
  --accent:    #c09a3c;
  --accent-dim:rgba(192, 154, 60, 0.1);
  --danger:    #a04428;
  --font: 'Cormorant Garamond', Georgia, serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overscroll-behavior: none;
}

/* ── Header ───────────────────────────────────────────────── */
.site-header, .admin-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-header { justify-content: space-between; }
.admin-header { background: var(--surface); gap: 12px; }

.site-logo {
  font-size: 1.35rem;
  font-weight: 300;
  font-style: italic;
  letter-spacing: .05em;
  color: var(--text);
  text-decoration: none;
}

.header-actions { display: flex; align-items: center; gap: 16px; }

.header-link {
  font-size: .75rem;
  font-weight: 300;
  letter-spacing: .12em;
  color: var(--text-dim);
  text-decoration: none;
  text-transform: uppercase;
  transition: color .2s;
}
.header-link:hover { color: var(--text); }

.understand-link {
  text-align: center;
  padding: 1rem 16px;
}

.understand-link a {
  display: inline-block;
  font-size: .85rem;
  font-style: italic;
  letter-spacing: .08em;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid rgba(192, 154, 60, 0.45);
  padding: 9px 20px;
  transition: border-color .2s, background .2s;
}

.understand-link a:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.admin-badge {
  font-size: .7rem;
  font-weight: 400;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 18px;
  font-size: .8rem;
  font-family: var(--font);
  letter-spacing: .08em;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  transition: border-color .2s, color .2s, background .2s;
}
.btn:disabled { opacity: .3; cursor: not-allowed; }
.btn-ghost:hover:not(:disabled) { border-color: var(--border-hi); }
.btn-primary { border-color: var(--accent); color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-dim); }
.btn-danger { border-color: rgba(160,68,40,.35); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: rgba(160,68,40,.1); border-color: var(--danger); }
.btn-sm { padding: 5px 11px; font-size: .75rem; }

.icon-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  transition: color .2s;
  text-decoration: none;
}
.icon-btn:hover { color: var(--text); }

/* ── Index strip ──────────────────────────────────────────── */
.strip-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding-top: var(--header-h);
}

.video-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  width: 100%;
}

.video-strip .card-thumb {
  aspect-ratio: 1 / 1;
  margin-bottom: 0;
}

@media (min-width: 768px) {
  .video-strip { grid-template-columns: repeat(4, 1fr); }
}

.video-card {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  display: block;
}
.video-card:hover .card-thumb img {
  filter: sepia(.15) brightness(1.05);
}

.card-thumb {
  position: relative;
  aspect-ratio: 9/16;
  background: #0a0805;
  overflow: hidden;
  margin-bottom: 7px;
}
.card-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  filter: sepia(.25) brightness(.88) saturate(.8);
  transition: filter .35s;
}
.card-thumb-placeholder {
  width: 100%; height: 100%;
  background: #0f0d0a;
}
.card-pin-flag {
  position: absolute;
  bottom: 6px; left: 6px;
  font-size: .62rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  font-style: normal;
  background: rgba(8, 6, 4, 0.72);
  padding: 2px 5px;
}
.card-duration {
  position: absolute;
  bottom: 6px; right: 6px;
  font-size: .65rem;
  color: rgba(212, 202, 182, 0.45);
  font-style: italic;
}
.card-title {
  font-size: .78rem;
  font-weight: 300;
  font-style: italic;
  color: var(--text-dim);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  letter-spacing: .01em;
}

/* ── Page footer (admin link) ─────────────────────────────── */
.page-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  padding: 12px 0 max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 60%, transparent 100%);
  pointer-events: none;
}
.page-footer a { pointer-events: auto; }

/* ── Reels overlay ────────────────────────────────────────── */
.reels-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: #000;
}
.reels-overlay[hidden] { display: none; }

.reels-close {
  position: fixed;
  top: 14px; right: 16px;
  z-index: 310;
  background: none;
  border: none;
  color: rgba(212,202,182,.45);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: color .2s;
}
.reels-close:hover { color: var(--text); }
.reels-close svg { width: 16px; height: 16px; }

.reels-counter {
  position: fixed;
  top: 20px; left: 18px;
  z-index: 310;
  font-size: .72rem;
  font-style: italic;
  letter-spacing: .06em;
  color: rgba(212,202,182,.35);
  pointer-events: none;
}

.swipe-hint {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 310;
  display: none;
  align-items: center;
  pointer-events: none;
}
.swipe-hint.visible {
  display: flex;
  animation: hint-fade 3s ease forwards;
}
.swipe-hint svg {
  width: 16px; height: 16px;
  stroke: rgba(212,202,182,.5);
  animation: hint-bob 1.1s ease-in-out infinite;
}

@keyframes hint-bob {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-5px); }
}
@keyframes hint-fade {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Reels feed ───────────────────────────────────────────── */
.reels-feed {
  height: 100dvh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
}
.reels-feed::-webkit-scrollbar { display: none; }
.reels-feed { scrollbar-width: none; }

.reels-slide {
  position: relative;
  width: 100%;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: #000;
}

/* warm vignette instead of scanlines */
.reels-slide::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(8,6,4,.55) 100%);
}

.reels-video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
}

.tap-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: pointer;
}

.slide-info {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 3;
  padding: 0 18px 36px;
  background: linear-gradient(to top, rgba(8,6,4,.85) 0%, transparent 55%);
  pointer-events: none;
}

.slide-meta { max-width: 80%; }

.pin-badge {
  display: inline-block;
  font-size: .62rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 7px;
  font-style: normal;
}

.slide-title {
  font-size: 1.05rem;
  font-weight: 400;
  font-style: italic;
  line-height: 1.35;
  margin-bottom: 5px;
  color: var(--text);
}

.slide-desc {
  font-size: .82rem;
  font-weight: 300;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.slide-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 5px; }
.tag {
  font-size: .72rem;
  font-style: italic;
  color: var(--text-dim);
  letter-spacing: .02em;
}

.slide-duration {
  font-size: .68rem;
  color: var(--text-dim);
  letter-spacing: .05em;
}

/* ── Play indicator ───────────────────────────────────────── */
.play-indicator {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  pointer-events: none;
}
.play-indicator svg {
  width: 44px; height: 44px;
  color: rgba(212,202,182,.7);
  filter: drop-shadow(0 0 16px rgba(212,202,182,.2));
}
.play-indicator.flash { animation: flash-fade .6s ease forwards; }
@keyframes flash-fade {
  0%   { opacity: 1; }
  60%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: var(--text-dim);
  font-size: .95rem;
  font-style: italic;
  letter-spacing: .04em;
}

/* ── Admin ────────────────────────────────────────────────── */
.admin-main {
  padding-top: calc(var(--header-h) + 20px);
  padding-bottom: 40px;
  max-width: 1100px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

.video-grid-admin {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.video-card-admin {
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.video-card-admin .card-thumb { aspect-ratio: 9/16; }
.video-card-admin .card-thumb img,
.video-card-admin .card-thumb video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  filter: sepia(.3) brightness(.8) saturate(.7);
}
.card-body { padding: 10px 10px 4px; flex: 1; }
.card-title-admin {
  font-size: .82rem;
  font-style: italic;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 4px;
}
.card-desc-admin {
  font-size: .74rem;
  font-weight: 300;
  color: var(--text-dim);
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-tags-admin { display: flex; flex-wrap: wrap; gap: 5px; }
.card-actions {
  display: flex;
  gap: 8px;
  padding: 8px 10px 10px;
}
.card-seq {
  position: absolute;
  top: 5px; left: 6px;
  font-size: .62rem;
  font-style: italic;
  color: rgba(212,202,182,.35);
}
.card-pin-flag {
  position: absolute;
  bottom: 6px; left: 6px;
  font-size: .62rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  font-style: italic;
}
.card-duration {
  position: absolute;
  bottom: 6px; right: 6px;
  font-size: .65rem;
  color: rgba(212, 202, 182, 0.75);
  font-style: italic;
  background: rgba(8, 6, 4, 0.72);
  padding: 2px 5px;
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(4,3,2,.85);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-backdrop[hidden] { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  width: 100%;
  max-width: 520px;
  padding: 22px 22px max(22px, env(safe-area-inset-bottom));
  max-height: 92dvh;
  overflow-y: auto;
  animation: slide-up .2s ease;
}
@keyframes slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  font-size: .85rem;
  font-weight: 400;
  font-style: italic;
  letter-spacing: .06em;
  color: var(--text-dim);
}

.drop-zone {
  border: 1px solid var(--border);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  margin-bottom: 12px;
  color: var(--text-dim);
}
.drop-icon { font-size: 1.3rem; margin-bottom: 8px; }
.drop-zone p { font-size: .82rem; font-style: italic; line-height: 1.6; }
.drop-zone.dragover { border-color: var(--border-hi); background: var(--accent-dim); }
.browse-link { color: var(--text); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.drop-hint { font-size: .7rem; color: var(--text-dim); margin-top: 4px; }

.form-input {
  width: 100%;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: .88rem;
  font-family: var(--font);
  font-style: italic;
  letter-spacing: .02em;
  padding: 10px 12px;
  margin-bottom: 10px;
  outline: none;
  transition: border-color .2s;
  resize: none;
}
.form-input::placeholder { color: var(--text-dim); font-style: italic; }
.form-input:focus { border-color: var(--border-hi); }
.form-textarea { min-height: 80px; }

.upload-progress {
  height: 1px;
  background: rgba(255,255,255,.07);
  margin-bottom: 12px;
}
.upload-progress[hidden] { display: none; }
.progress-bar { height: 100%; background: var(--accent); width: 0%; transition: width .3s; }

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ── Login ────────────────────────────────────────────────── */
.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-logo {
  font-size: 1.6rem;
  font-weight: 300;
  font-style: italic;
  color: var(--text);
  text-decoration: none;
  display: block;
  letter-spacing: .04em;
}

.login-sep {
  border: none;
  border-top: 1px solid var(--border);
}

.login-sub {
  font-size: .72rem;
  font-weight: 300;
  font-style: italic;
  color: var(--text-dim);
  letter-spacing: .08em;
}

.login-input {
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: .95rem;
  font-family: var(--font);
  font-style: italic;
  letter-spacing: .03em;
  padding: 8px 0;
  outline: none;
  transition: border-color .2s;
}
.login-input::placeholder { color: var(--text-dim); font-style: italic; }
.login-input:focus { border-color: var(--border-hi); }

.login-btn {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: .8rem;
  font-style: italic;
  letter-spacing: .1em;
  padding: 0;
  cursor: pointer;
  transition: color .2s;
  text-transform: lowercase;
}
.login-btn:hover { color: var(--text); }

.flash-error {
  font-size: .75rem;
  font-style: italic;
  color: var(--danger);
  letter-spacing: .04em;
  border-left: 2px solid var(--danger);
  padding-left: 8px;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (min-width: 600px) {
  .modal { border: 1px solid var(--border); margin-bottom: 40px; }
  .modal-backdrop { align-items: center; }
}
