:root {
  color-scheme: dark;
  --page-bg: #5674C8;
  --tile-border: #56ADC8;
  --ink: #f7f9ff;
  --muted: rgba(247, 249, 255, 0.76);
  --panel: rgba(22, 39, 87, 0.24);
  --panel-strong: rgba(13, 27, 66, 0.88);
  --tile-radius: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-width: 320px; background: var(--page-bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
button:focus-visible, label:focus-within, input:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.94);
  outline-offset: 3px;
}

.site-header, main, .site-footer {
  width: min(1680px, calc(100% - 56px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 38px 0 30px;
}

.eyebrow, .player-kicker {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.header-actions, .toolbar-actions, .player-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 17px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 750;
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  user-select: none;
}

.action-button svg, .search-box svg, .player-control svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.action-button:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(17, 32, 78, 0.18); }
.action-button-secondary { color: var(--ink); background: rgba(255, 255, 255, 0.09); }
.action-button-secondary:hover { background: rgba(255, 255, 255, 0.15); }
.action-button-primary { color: #17305e; background: #f8fbff; border-color: #f8fbff; }
.action-button-primary:hover { background: #e7f6fc; border-color: #e7f6fc; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 61px;
  margin: 0 0 22px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 15px;
  background: rgba(22, 39, 87, 0.16);
}

.library-status { display: inline-flex; align-items: center; gap: 10px; padding-left: 4px; font-size: 0.9rem; font-weight: 750; }
.status-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--tile-border); box-shadow: 0 0 0 4px rgba(86, 173, 200, 0.15); }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(260px, 35vw);
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(16, 33, 79, 0.14);
}

.search-box svg { width: 17px; height: 17px; }
.search-box input { width: 100%; min-width: 0; padding: 8px 0; border: 0; outline: 0; color: white; background: transparent; font-size: 0.85rem; }
.search-box input::placeholder { color: rgba(255, 255, 255, 0.68); }
.search-box input:disabled { cursor: not-allowed; }
.text-button { padding: 8px 4px; border: 0; color: rgba(255, 255, 255, 0.85); background: transparent; font-size: 0.83rem; font-weight: 700; cursor: pointer; }
.text-button:hover:not(:disabled) { color: white; text-decoration: underline; text-underline-offset: 3px; }
.text-button:disabled { opacity: 0.42; cursor: not-allowed; }

.video-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
  gap: 24px 18px;
  padding: 0 0 28px;
}

.video-card {
  position: relative;
  min-width: 0;
  border-radius: var(--tile-radius);
  background: rgba(20, 39, 90, 0.17);
  transform: translateZ(0);
  transition: transform 220ms cubic-bezier(0.2, 0.75, 0.25, 1), box-shadow 220ms ease;
  z-index: 0;
}

.video-card:hover, .video-card:focus-within {
  z-index: 2;
  transform: scale(1.045);
  box-shadow: 0 15px 32px rgba(15, 30, 73, 0.28);
}

.card-open {
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--tile-border);
  border-radius: var(--tile-radius);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  background: rgba(13, 28, 68, 0.32);
  box-shadow: 0 5px 12px rgba(16, 33, 79, 0.13);
}

.thumb-frame {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, rgba(24, 54, 113, 0.95), rgba(44, 93, 153, 0.95));
}

.thumb-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(224, 247, 255, 0.85);
  background: radial-gradient(circle at 50% 45%, rgba(86, 173, 200, 0.3), transparent 43%);
}

.thumb-placeholder svg { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.video-thumbnail, .video-preview {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-thumbnail { opacity: 0; transition: opacity 180ms ease; }
.video-thumbnail.has-thumbnail { opacity: 1; }
.video-preview { z-index: 1; opacity: 0; transition: opacity 180ms ease; }
.video-card.is-previewing .video-preview { opacity: 1; }
.video-card.is-previewing .video-thumbnail { opacity: 0; }

.play-pill {
  position: absolute;
  z-index: 2;
  left: 12px;
  bottom: 12px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
  color: white;
  background: rgba(10, 25, 57, 0.62);
  backdrop-filter: blur(8px);
  transition: transform 180ms ease, background 180ms ease;
}

.play-pill svg { width: 13px; height: 13px; margin-left: 2px; fill: currentColor; }
.video-card:hover .play-pill, .video-card:focus-within .play-pill { transform: scale(1.1); background: rgba(31, 88, 126, 0.82); }

.video-label {
  display: block;
  padding: 11px 12px 12px;
  min-width: 0;
  background: rgba(15, 31, 74, 0.42);
}

.video-name {
  display: block;
  overflow: hidden;
  color: #fff;
  font-size: 0.87rem;
  font-weight: 750;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-meta { display: block; margin-top: 4px; color: rgba(240, 246, 255, 0.7); font-size: 0.72rem; }

.empty-state {
  display: flex;
  min-height: 330px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 42px 22px;
  border: 2px dashed rgba(86, 173, 200, 0.75);
  border-radius: 20px;
  text-align: center;
  background: rgba(18, 38, 89, 0.14);
}

.empty-icon { display: grid; width: 76px; height: 76px; place-items: center; margin-bottom: 19px; border: 1px solid rgba(86, 173, 200, 0.6); border-radius: 21px; color: #bcefff; background: rgba(86, 173, 200, 0.13); }
.empty-icon svg { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.empty-state h2 { margin: 0; font-size: 1.35rem; letter-spacing: -0.02em; }
.empty-state p { max-width: 540px; margin: 11px 0 0; color: var(--muted); line-height: 1.65; }
.drop-prompt { margin-top: 20px; color: #d1f4ff; font-size: 0.86rem; font-weight: 700; }
.no-results { padding: 48px 15px; color: var(--muted); text-align: center; }
.drop-hint { margin: 0 0 22px; color: rgba(255, 255, 255, 0.68); font-size: 0.8rem; text-align: center; }

.drop-overlay {
  position: fixed;
  z-index: 30;
  inset: 10px;
  display: grid;
  place-items: center;
  border: 3px dashed var(--tile-border);
  border-radius: 24px;
  background: rgba(18, 39, 91, 0.83);
  backdrop-filter: blur(8px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 140ms ease;
}
.drop-overlay.visible { opacity: 1; }
.drop-overlay-card { display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; }
.drop-overlay-card strong { font-size: 1.45rem; }
.drop-overlay-card span:last-child { color: var(--muted); font-size: 0.93rem; }
.drop-overlay-icon { display: grid; width: 58px; height: 58px; place-items: center; border-radius: 17px; color: #17305e; background: var(--tile-border); font-size: 2.7rem; line-height: 1; }

.player-modal {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 12, 31, 0.91);
  backdrop-filter: blur(12px);
}
.player-modal[hidden] { display: none; }
.player-stage {
  display: flex;
  width: min(1440px, 100%);
  height: min(920px, 92vh);
  min-height: 300px;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--tile-border);
  border-radius: 18px;
  background: #101b3d;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.4);
}

.player-stage:fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  min-height: 0;
  padding: 20px;
  border: 0;
  border-radius: 0;
  background: #060912;
  box-shadow: none;
}

.player-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.player-title-wrap { min-width: 0; }
.player-kicker { display: block; margin-bottom: 4px; color: var(--tile-border); font-size: 0.64rem; }
.player-header h2 { overflow: hidden; margin: 0; font-size: 1.03rem; text-overflow: ellipsis; white-space: nowrap; }
.player-actions { flex: 0 0 auto; }
.player-control { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 11px; border: 1px solid rgba(255, 255, 255, 0.23); border-radius: 10px; color: white; background: rgba(255, 255, 255, 0.08); cursor: pointer; font-size: 0.82rem; font-weight: 700; }
.player-control:hover { background: rgba(255, 255, 255, 0.16); }
.player-control svg { width: 17px; height: 17px; }
.close-control { color: #fce8ef; }
.main-player { display: block; width: 100%; height: 100%; min-height: 0; flex: 1 1 auto; border-radius: 11px; background: #000; object-fit: contain; }
.player-tip { margin: 0; color: rgba(235, 242, 255, 0.62); font-size: 0.75rem; }

.site-footer { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 22px 0 30px; color: rgba(255, 255, 255, 0.62); font-size: 0.76rem; }
.footer-separator { color: var(--tile-border); }
body.modal-open { overflow: hidden; }

@media (max-width: 1250px) {
  .video-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 950px) {
  .site-header, main, .site-footer { width: min(100% - 36px, 1680px); }
  .site-header { align-items: flex-start; flex-direction: column; padding-top: 30px; }
  .video-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 14px; }
  .header-actions { width: 100%; }
}

@media (max-width: 680px) {
  .site-header, main, .site-footer { width: calc(100% - 28px); }
  .site-header { gap: 22px; padding-top: 25px; }
  .header-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .action-button { padding-inline: 10px; font-size: 0.82rem; }
  .gallery-toolbar { align-items: stretch; flex-direction: column; gap: 12px; }
  .toolbar-actions { justify-content: space-between; }
  .search-box { width: min(250px, 64%); }
  .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 11px; }
  .video-name { font-size: 0.79rem; }
  .video-label { padding: 9px 9px 10px; }
  .play-pill { left: 8px; bottom: 8px; width: 30px; height: 30px; }
  .player-modal { padding: 10px; }
  .player-stage { height: min(92vh, 850px); padding: 11px; gap: 10px; border-radius: 13px; }
  .player-control { width: 38px; padding: 0; }
  .player-control span { display: none; }
  .player-tip { font-size: 0.68rem; }
}

@media (max-width: 420px) {
  .video-grid { grid-template-columns: 1fr; gap: 17px; }
  .video-label { padding: 10px 12px 12px; }
  .video-name { font-size: 0.88rem; }
  .search-box { width: 66%; }
  .text-button { font-size: 0.77rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}


.folder-browser {
  margin: 0 0 24px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  background: rgba(22, 39, 87, 0.18);
}
.folder-browser-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.folder-browser-heading h2 { margin: 0; font-size: 1.05rem; letter-spacing: -0.02em; }
.folder-browser-heading p { margin: 5px 0 0; color: var(--muted); font-size: 0.8rem; }
.current-folder-label { text-align: right; overflow-wrap: anywhere; }
.folder-list { display: flex; flex-direction: column; gap: 6px; }
.folder-button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px;
  padding: 8px 12px; padding-left: calc(12px + var(--folder-depth, 0) * 18px);
  border: 1px solid rgba(255,255,255,0.13); border-radius: 10px;
  color: var(--ink); background: rgba(12, 29, 74, 0.16); text-align: left; cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease;
}
.folder-button:hover { background: rgba(255,255,255,0.11); border-color: rgba(86,173,200,0.7); }
.folder-button.is-selected { background: rgba(86,173,200,0.2); border-color: var(--tile-border); }
.folder-button-icon { color: #bcefff; flex: 0 0 auto; }
.folder-button-name { min-width: 0; flex: 1; overflow-wrap: anywhere; font-size: 0.9rem; }
.folder-button-count { display: inline-grid; min-width: 26px; height: 24px; padding: 0 6px; place-items: center; border-radius: 999px; color: var(--muted); background: rgba(0,0,0,0.15); font-size: 0.75rem; }
@media (max-width: 600px) {
  .folder-browser-heading { align-items: flex-start; flex-direction: column; }
  .current-folder-label { text-align: left; }
  .folder-button { padding-left: calc(10px + var(--folder-depth, 0) * 12px); }
}

.folder-status {
  min-height: 1.2em;
  margin: -12px 4px 18px;
  color: rgba(247, 249, 255, 0.76);
  font-size: 0.78rem;
  line-height: 1.45;
}
.video-card.is-previewing .thumb-placeholder {
  opacity: 0;
  transition: opacity 160ms ease;
}


/* Access-code popup shown before the gallery loads. */
body.access-locked { overflow: hidden; }
.access-gate {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 18, 48, 0.82);
  backdrop-filter: blur(12px);
}
.access-card {
  width: min(100%, 410px);
  padding: 34px;
  border: 1px solid rgba(86, 173, 200, 0.85);
  border-radius: 22px;
  background: #182d65;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  text-align: center;
}
.access-lock-icon { font-size: 2rem; margin-bottom: 12px; }
.access-card h1 { margin: 0 0 10px; font-size: 1.65rem; }
.access-card > p { color: var(--muted); margin: 0 0 22px; }
.access-card label { display: block; text-align: left; font-size: 0.88rem; font-weight: 750; margin-bottom: 8px; }
.access-card input {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.35); border-radius: 11px;
  color: white; background: rgba(7, 18, 48, .45); letter-spacing: .3em;
  text-align: center; font-size: 1.2rem;
}
.access-submit {
  width: 100%; min-height: 48px; margin-top: 16px; border: 0; border-radius: 11px;
  color: #17305e; background: #f8fbff; font-weight: 800; cursor: pointer;
}
.access-submit:hover { background: #dff5fc; }
.access-error { margin: 10px 0 0 !important; color: #ffb8b8 !important; font-size: .9rem; }

/* Shared project navigation */
.page-link { text-decoration: none; }
