/* ================= 主题变量 ================= */
:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --bg-2: #ffffff;
  --card: #ffffff;
  --card-hover: #fbfcff;
  --border: rgba(15, 23, 42, 0.08);
  --text: #1a2233;
  --muted: #64748b;
  --accent: #4f6bff;
  --accent-2: #8b5cf6;
  --danger: #e5484d;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.10);
  --img-bg: #e9edf5;
  --overlay: rgba(244, 246, 251, 0.97);
  --overlay-2: rgba(15, 23, 42, 0.35);
  --header-bg: rgba(255, 255, 255, 0.72);
  --control-bg: rgba(15, 23, 42, 0.06);
  --control-bg-hover: rgba(15, 23, 42, 0.12);
  --control-text: #1a2233;
  --input-bg: #f4f6fb;
  --glow1: rgba(79, 107, 255, 0.16);
  --glow2: rgba(139, 92, 246, 0.14);
  --radius: 16px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0e17;
  --bg-2: #121627;
  --card: #1a2036;
  --card-hover: #232b47;
  --border: rgba(255, 255, 255, 0.08);
  --text: #eef1f8;
  --muted: #9aa3c0;
  --accent: #6d8dff;
  --accent-2: #a06dff;
  --danger: #ff6d8d;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --img-bg: #0e1322;
  --overlay: rgba(5, 7, 14, 0.94);
  --overlay-2: rgba(5, 7, 14, 0.7);
  --header-bg: rgba(11, 14, 23, 0.72);
  --control-bg: rgba(255, 255, 255, 0.07);
  --control-bg-hover: rgba(255, 255, 255, 0.16);
  --control-text: #eef1f8;
  --input-bg: #0e1322;
  --glow1: rgba(109, 141, 255, 0.18);
  --glow2: rgba(160, 109, 255, 0.16);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* 保证 hidden 属性始终生效 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(900px 420px at 12% -8%, var(--glow1), transparent 60%),
    radial-gradient(760px 440px at 92% 0%, var(--glow2), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
}

body.no-scroll { overflow: hidden; }

/* ---------- 顶部 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1280px; margin: 0 auto; padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center; font-size: 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px rgba(79, 107, 255, 0.30);
  overflow: hidden;
  flex: none;
}
.logo.has-image { background: var(--card); }
.logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-text h1 { font-size: 20px; font-weight: 700; letter-spacing: 0.5px; }
.brand-text p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.theme-btn {
  width: 36px; height: 36px; border-radius: 999px;
  font-size: 16px; cursor: pointer; line-height: 1;
  display: grid; place-items: center;
  background: var(--control-bg); color: var(--control-text);
  border: 1px solid var(--border);
  transition: background-color .18s ease, transform .18s ease;
}
.theme-btn:hover { background: var(--control-bg-hover); transform: translateY(-1px); }
.admin-entry { text-decoration: none; }
.header-tip {
  font-size: 12px; color: var(--muted);
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
}

/* ---------- 分类页签 ---------- */
.tabs {
  max-width: 1280px; margin: 22px auto 0; padding: 0 24px;
  display: flex; gap: 10px; flex-wrap: wrap;
}
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; cursor: pointer;
  font-size: 15px; color: var(--muted); background: var(--card);
  border: 1px solid var(--border); transition: all 0.18s ease;
}
.tab:hover { color: var(--text); border-color: var(--accent); transform: translateY(-1px); }
.tab.active {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 20px rgba(79, 107, 255, 0.32);
}
.tab-icon { font-size: 16px; }
.lock-badge { font-size: 12px; opacity: 0.9; }

/* ---------- 主区域 ---------- */
.main {
  --row-cols: 48px minmax(0, 1fr) 72px 96px 150px; /* 表格视图列宽：缩略图 / 文件名 / 类型 / 大小 / 时间 */
  max-width: 1280px; margin: 0 auto; padding: 18px 24px 40px; flex: 1; width: 100%;
}
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 16px; min-height: 28px;
}
.toolbar-left { display: flex; align-items: baseline; gap: 12px; }
.album-title { font-size: 18px; font-weight: 600; }
.count { font-size: 12px; color: var(--muted); background: var(--control-bg); padding: 3px 10px; border-radius: 999px; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }

/* ---------- 排版视图切换 ---------- */
.view-switch {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--control-bg); border: 1px solid var(--border); border-radius: 999px;
}
.view-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: 0; border-radius: 999px; cursor: pointer;
  font-size: 13px; line-height: 1.2; white-space: nowrap;
  color: var(--muted); background: transparent;
  transition: background-color .16s ease, color .16s ease, box-shadow .16s ease;
}
.view-btn:hover { color: var(--text); background: var(--control-bg-hover); }
.view-btn.active {
  color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 14px rgba(79, 107, 255, 0.28);
}
.view-icon { font-size: 14px; line-height: 1; }

.logout-btn {
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  font-size: 13px; color: var(--danger); background: transparent;
  border: 1px solid var(--danger);
  transition: all 0.18s ease;
}
.logout-btn:hover { background: var(--danger); color: #fff; }

/* ---------- 图片网格（默认：1/1 缩略图卡片） ---------- */
.gallery {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
}
.card {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  cursor: zoom-in;
  animation: fadeUp 0.3s ease both;
}
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}
.card img {
  display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
  background: var(--img-bg); transition: transform 0.4s ease;
}
.card:hover img { transform: scale(1.06); }
.card::after {
  content: '🔍';
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 30px; color: #fff;
  background: rgba(15, 23, 42, 0.22);
  opacity: 0; transition: opacity .25s ease;
  pointer-events: none;
}
.card:hover::after { opacity: 1; }
.card figcaption {
  padding: 10px 12px; font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card .name {
  display: block; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card .meta { display: none; }
.card img.broken { filter: grayscale(1); opacity: 0.35; }
.card video {
  display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
  background: var(--img-bg); transition: transform 0.4s ease;
}
.card:hover video { transform: scale(1.06); }
.media-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; line-height: 1.5; color: #fff;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
}

/* ---------- 表格视图表头 ---------- */
.gallery-head {
  display: grid; grid-template-columns: var(--row-cols); align-items: center;
  gap: 14px; padding: 0 8px 8px;
  font-size: 12px; color: var(--muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.gh-cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 瀑布流：按原图比例竖向错落（JS 分栏，各列都有内容） ---------- */
.gallery[data-view="masonry"] { display: flex; align-items: flex-start; gap: 16px; }
.masonry-col { display: flex; flex: 1 1 0; min-width: 0; flex-direction: column; gap: 16px; }
.gallery[data-view="masonry"] .card { width: 100%; }
.gallery[data-view="masonry"] .card img,
.gallery[data-view="masonry"] .card video { aspect-ratio: auto; height: auto; }
.gallery[data-view="masonry"] .card img { min-height: 60px; }

/* ---------- 大图：大尺寸预览 + 底部渐变信息条 ---------- */
.gallery[data-view="large"] {
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 20px;
}
.gallery[data-view="large"] .card img,
.gallery[data-view="large"] .card video { aspect-ratio: 4 / 3; }
.gallery[data-view="large"] .card figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  padding: 40px 14px 12px; color: #fff;
  background: linear-gradient(to top, rgba(8, 12, 22, 0.82), rgba(8, 12, 22, 0));
}
.gallery[data-view="large"] .card .name { font-size: 14px; font-weight: 600; color: #fff; }
.gallery[data-view="large"] .card .meta {
  display: flex; gap: 10px; margin-top: 4px;
  font-size: 12px; color: rgba(255, 255, 255, 0.78);
}

/* ---------- 紧凑：只显示小缩略图 ---------- */
.gallery[data-view="compact"] {
  grid-template-columns: repeat(auto-fill, minmax(min(128px, 100%), 1fr));
  gap: 10px;
}
.gallery[data-view="compact"] .card figcaption { display: none; }
.gallery[data-view="compact"] .card::after { font-size: 22px; }

/* ---------- 列表：缩略图 + 文件名 + 信息（同 Alist 列表视图） ---------- */
.gallery[data-view="list"] { display: flex; flex-direction: column; gap: 8px; }
.gallery[data-view="list"] .card {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 14px 8px 8px; border-radius: 14px;
  cursor: pointer; animation: none;
}
.gallery[data-view="list"] .card:hover {
  transform: none; border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}
.gallery[data-view="list"] .card::after { display: none; }
.gallery[data-view="list"] .card img,
.gallery[data-view="list"] .card video {
  flex: 0 0 auto; width: 76px; height: 54px; aspect-ratio: auto;
  border-radius: 9px; object-fit: cover;
}
.gallery[data-view="list"] .card:hover img,
.gallery[data-view="list"] .card:hover video { transform: none; }
.gallery[data-view="list"] .card figcaption {
  display: flex; flex: 1; min-width: 0; align-items: center;
  justify-content: space-between; gap: 14px;
  padding: 0; font-size: 13px;
}
.gallery[data-view="list"] .card .name { flex: 1; margin: 0; color: var(--text); font-size: 14px; }
.gallery[data-view="list"] .card .meta {
  display: flex; flex: 0 0 auto; align-items: center; gap: 16px;
  font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.gallery[data-view="list"] .card .m-kind { min-width: 32px; }
.gallery[data-view="list"] .media-badge { display: none; }

/* ---------- 表格：列对齐展示文件信息 ---------- */
.gallery[data-view="table"] { display: flex; flex-direction: column; gap: 0; }
.gallery[data-view="table"] .card {
  display: grid; grid-template-columns: var(--row-cols); align-items: center; gap: 14px;
  padding: 8px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0;
  background: transparent; box-shadow: none; cursor: pointer; animation: none;
}
.gallery[data-view="table"] .card:hover {
  transform: none; border-color: transparent;
  background: var(--control-bg); box-shadow: none;
}
.gallery[data-view="table"] .card::after { display: none; }
.gallery[data-view="table"] .card img,
.gallery[data-view="table"] .card video {
  width: 44px; height: 44px; aspect-ratio: auto;
  border-radius: 8px; object-fit: cover;
}
.gallery[data-view="table"] .card:hover img,
.gallery[data-view="table"] .card:hover video { transform: none; }
.gallery[data-view="table"] .card figcaption,
.gallery[data-view="table"] .card .meta { display: contents; }
.gallery[data-view="table"] .card .name,
.gallery[data-view="table"] .card .meta > span {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gallery[data-view="table"] .card .name { color: var(--text); font-size: 14px; }
.gallery[data-view="table"] .card .meta > span {
  color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums;
}
.gallery[data-view="table"] .media-badge { display: none; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 加载 / 空状态 ---------- */
.state { text-align: center; padding: 60px 20px; color: var(--muted); font-size: 15px; }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-text { font-size: 15px; }
.pwd-box { max-width: 380px; margin: 0 auto; }
.pwd-form { display: flex; gap: 8px; margin-top: 18px; }
.pwd-form input {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--input-bg);
  color: var(--text); font: inherit; outline: none;
}
.pwd-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow1); }
.pwd-form button {
  flex: none; padding: 10px 18px; border: 0; border-radius: 10px;
  background: var(--accent); color: #fff; font: inherit; font-weight: 600;
  cursor: pointer; transition: opacity 0.2s ease;
}
.pwd-form button:disabled { opacity: 0.6; cursor: default; }
.pwd-error { min-height: 18px; margin-top: 10px; color: var(--danger); font-size: 13px; }
.spinner {
  width: 34px; height: 34px; margin: 0 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); } }

/* ---------- 灯箱 ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: var(--overlay);
  display: flex; flex-direction: column;
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.lb-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; gap: 12px;
}
.lb-name { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-actions { display: flex; gap: 8px; }
.lb-actions button, .lb-zoom button, .lb-bottom > button {
  width: 40px; height: 40px; border-radius: 12px; cursor: pointer;
  font-size: 17px; color: var(--control-text); background: var(--control-bg);
  border: 1px solid var(--border); transition: background-color .15s ease, transform .15s ease;
}
.lb-actions button:hover, .lb-zoom button:hover, .lb-bottom > button:hover {
  background: var(--control-bg-hover);
}

.lb-stage {
  flex: 1; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  cursor: default; touch-action: none;
}
.lb-swipe-preview {
  position: absolute; inset: 0; z-index: 0;
  background-position: center; background-repeat: no-repeat; background-size: contain;
  pointer-events: none; opacity: 0;
  will-change: transform, opacity;
}
.lb-stage img, .lb-stage video { position: relative; z-index: 1; will-change: transform, opacity; }
.lb-stage.zoomed { cursor: grab; }
.lb-stage.dragging { cursor: grabbing; }
.lb-stage img {
  display: block; max-width: 100%; max-height: 100%;
  user-select: none; -webkit-user-drag: none;
  transition: transform 0.18s ease-out;
}
.lb-stage.dragging img,
.lb-stage.interacting img,
.lb-stage.wheel-zoom img { transition: none; }
.lb-stage.sliding img,
.lb-stage.sliding video,
.lb-stage.swiping img,
.lb-stage.swiping video { transition: none; }
.lb-stage video {
  display: block; max-width: 100%; max-height: 100%;
  background: #000;
}

.lb-bottom {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; gap: 12px;
}
.lb-zoom { display: flex; align-items: center; gap: 8px; }
#lbZoomLabel { min-width: 54px; text-align: center; font-size: 13px; color: var(--muted); }
.lb-hint {
  display: none; text-align: center;
  font-size: 12px; color: var(--muted); user-select: none;
}

/* 手机 / 平板：隐藏缩放按钮，改用双击放大、双指缩放 */
@media (hover: none) and (pointer: coarse), (max-width: 640px) {
  .lb-zoom { display: none; }
  .lb-hint { display: block; }
  .lb-bottom { padding: 10px 14px; }
}

/* ---------- 密码弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: var(--overlay-2); backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  width: 100%; max-width: 360px; text-align: center;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 22px; padding: 32px 28px; box-shadow: var(--shadow);
  animation: pop 0.22s ease;
}
@keyframes pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-lock { font-size: 40px; margin-bottom: 8px; }
.modal-card h2 { font-size: 20px; margin-bottom: 6px; color: var(--text); }
.modal-card p { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
#passwordForm { display: flex; flex-direction: column; gap: 12px; }
#passwordInput {
  padding: 13px 16px; border-radius: 12px; font-size: 15px;
  color: var(--text); background: var(--input-bg); border: 1px solid var(--border); outline: none;
}
#passwordInput:focus { border-color: var(--accent); }
#passwordForm button {
  padding: 13px; border-radius: 12px; cursor: pointer; font-size: 15px; font-weight: 600;
  color: #fff; border: none; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transition: opacity 0.15s ease;
}
#passwordForm button:hover { opacity: 0.9; }
.modal-err { min-height: 18px; margin-top: 12px; font-size: 13px; color: var(--danger); }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--border); padding: 18px 24px;
  text-align: center; font-size: 12px; color: var(--muted);
}
.site-footer span { white-space: pre-line; }

/* ---------- 响应式 ---------- */
/* 窄屏：视图按钮只留图标（title 仍有说明），表格隐藏次要列 */
@media (max-width: 860px) {
  .view-btn { padding: 6px 9px; }
  .view-btn .view-label { display: none; }
  .view-btn .view-icon { font-size: 15px; }
}
@media (max-width: 720px) {
  .main { --row-cols: 44px minmax(0, 1fr) 92px; }
  .gallery-head .gh-kind, .gallery-head .gh-date,
  .gallery[data-view="table"] .card .meta > .m-kind,
  .gallery[data-view="table"] .card .meta > .m-date { display: none; }
  .gallery[data-view="list"] .card .m-kind,
  .gallery[data-view="list"] .card .m-date { display: none; }
  .gallery[data-view="list"] .card img,
  .gallery[data-view="list"] .card video { width: 64px; height: 46px; }
  .gallery[data-view="large"] .card .meta { flex-wrap: wrap; gap: 4px 10px; }
  .gallery[data-view="masonry"] { gap: 10px; }
  .masonry-col { gap: 10px; }
}
@media (max-width: 640px) {
  .gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .header-tip { display: none; }
  .lb-name { font-size: 12px; }
}

/* ============================================================
   视觉增强：环境光、渐变与入场动效
   ============================================================ */
body {
  isolation: isolate;
}
body::before {
  content: "";
  position: fixed;
  inset: -18%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(42% 38% at 18% 22%, var(--glow1), transparent 68%),
    radial-gradient(36% 34% at 82% 16%, var(--glow2), transparent 68%),
    radial-gradient(34% 32% at 55% 88%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%);
  filter: blur(12px);
  opacity: .65;
  animation: ambient-drift 26s ease-in-out infinite alternate;
}
@keyframes ambient-drift {
  0% { transform: translate3d(-1.5%, -1%, 0) scale(1); }
  50% { transform: translate3d(1.2%, 1.6%, 0) scale(1.05); }
  100% { transform: translate3d(2%, -1.2%, 0) scale(1.02); }
}

.site-header {
  box-shadow: 0 1px 0 color-mix(in srgb, var(--text) 4%, transparent);
}
.site-header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 48%, transparent), color-mix(in srgb, var(--accent-2) 42%, transparent), transparent);
  background-size: 200% 100%;
  animation: gradient-pan 10s linear infinite;
}
@keyframes gradient-pan {
  from { background-position: 0% 0; }
  to { background-position: 200% 0; }
}

.logo {
  position: relative;
  transition: transform .3s ease, box-shadow .3s ease;
}
.logo::before {
  content: "";
  position: absolute;
  inset: -40% -70%;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.42) 50%, transparent 65%);
  transform: translateX(-55%) rotate(8deg);
  animation: logo-shine 7s ease-in-out infinite;
}
.logo:hover { transform: rotate(-5deg) scale(1.04); box-shadow: 0 10px 28px rgba(79, 107, 255, 0.4); }
@keyframes logo-shine {
  0%, 62%, 100% { transform: translateX(-55%) rotate(8deg); opacity: 0; }
  72% { opacity: .9; }
  86% { transform: translateX(55%) rotate(8deg); opacity: 0; }
}
.brand-text h1 {
  background: linear-gradient(100deg, var(--text), color-mix(in srgb, var(--accent) 62%, var(--text)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-text p, .header-tip { transition: color .2s ease; }
.header-inner:hover .header-tip { color: var(--text); }

.tab, .view-btn.active {
  will-change: transform;
}
.tab.active {
  background-size: 200% 200%;
  animation: accent-flow 9s ease infinite;
}
.view-btn.active {
  background-size: 200% 200%;
  animation: accent-flow 9s ease infinite;
}
@keyframes accent-flow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.tab.active:hover { transform: translateY(-2px) scale(1.015); }
.tab:hover .tab-icon { transform: scale(1.12) rotate(-3deg); }
.tab-icon { display: inline-block; transition: transform .2s ease; }

.card {
  animation-delay: calc(var(--i, 0) * 24ms);
  animation-fill-mode: backwards;
  will-change: transform;
}
.card:hover {
  box-shadow:
    0 22px 48px -24px color-mix(in srgb, var(--accent) 68%, transparent),
    var(--shadow);
}
.card img, .card video {
  animation: media-in .5s ease both;
}
@keyframes media-in {
  from { opacity: 0; filter: saturate(.65) blur(4px); }
  to { opacity: 1; filter: none; }
}
.card:hover img, .card:hover video { transform: scale(1.065); }
.card::after {
  backdrop-filter: blur(2px) saturate(.9);
  -webkit-backdrop-filter: blur(2px) saturate(.9);
  background: linear-gradient(180deg, rgba(8, 12, 22, .12), rgba(8, 12, 22, .34));
}
.media-badge {
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
  border: 1px solid rgba(255, 255, 255, .16);
}
.gallery[data-view="large"] .card figcaption {
  transition: padding-bottom .25s ease;
}
.gallery[data-view="large"] .card:hover figcaption {
  padding-bottom: 16px;
}

.lightbox {
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: color-mix(in srgb, var(--overlay) 90%, transparent);
}
.modal-card {
  box-shadow:
    0 30px 80px -30px color-mix(in srgb, var(--accent) 55%, transparent),
    var(--shadow);
}
.site-footer {
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--accent) 3%, transparent));
}

::selection { color: #fff; background: var(--accent); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 26%, transparent);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--accent) 48%, transparent); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 640px) {
  body::before { inset: -30%; opacity: .5; }
  .brand-text h1 { letter-spacing: .2px; }
}
@media (prefers-reduced-motion: reduce) {
  body::before, .site-header::after, .logo::before, .tab.active,
  .view-btn.active, .card, .card img, .card video {
    animation: none !important;
  }
  * { scroll-behavior: auto !important; }
}


