/* Flippy Gallery — styles */
/* Uses the Flippy Win98 palette and typography. */

:root {
  --win98-bg:       #c0c0c0;
  --win98-dark:     #808080;
  --win98-darker:   #404040;
  --win98-title:    #000080;
  --win98-title-fg: #ffffff;
  --accent:         #000080;
  --body-bg:        #c0c0c0;
  --tile-bg:        #d4d0c8;
  --tile-hover:     #e2e2e2;
  --text:           #000000;
  --text-dim:       #404040;
  --font:           'MS Sans Serif', 'Microsoft Sans Serif', Tahoma, Arial, sans-serif;
  /* Win98 bevel — matches Flippy main page */
  --bevel-ll: #ffffff;
  --bevel-l:  #dfdfdf;
  --bevel-d:  #808080;
  --bevel-dd: #404040;
  --btn-bg:   #c0c0c0;
}

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

body {
  background: var(--win98-bg);
  color: #000;
  font-family: 'MS Sans Serif', 'Microsoft Sans Serif', Tahoma, Arial, sans-serif;
  font-size: 11px;
  min-height: 100vh;
}

/* ── Header ── */
.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  height: 56px;
  background: var(--win98-bg);
  border-bottom: 2px solid;
  border-color: #fff #808080 #808080 #fff;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-logo { display: flex; align-items: center; gap: 10px; color: #000; text-decoration: none; position: relative; }
.header-logo a { color: #000; text-decoration: none; }
.header-title { font-size: 18px; font-weight: bold; letter-spacing: 0.5px; color: #000; }
.header-controls { display: flex; align-items: center; gap: 4px; }

.gallery-search-bar {
  display: flex;
  justify-content: flex-end;
  padding: 6px 16px 12px;
}

#search-input {
  padding: 4px 8px;
  border: 2px inset var(--win98-bg);
  background: #fff;
  font-size: 13px;
  width: min(260px, 100%);
}

.btn-auth {
  height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  background: var(--btn-bg);
  border: 2px solid;
  border-color: var(--bevel-ll) var(--bevel-d) var(--bevel-d) var(--bevel-ll);
  box-shadow: inset 1px 1px 0 var(--bevel-l), inset -1px -1px 0 var(--bevel-dd);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-auth:active {
  border-color: var(--bevel-d) var(--bevel-ll) var(--bevel-ll) var(--bevel-d);
  box-shadow: inset 1px 1px 0 var(--bevel-dd), inset -1px -1px 0 var(--bevel-l);
}
.btn-auth-sm { font-size: 11px; padding: 2px 6px; }

#user-info { position: relative; display: flex; align-items: center; }
#user-avatar { width: 28px; height: 28px; border-radius: 0; border: 1px solid var(--bevel-d); object-fit: cover; background: var(--btn-bg); }
.user-avatar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  height: 38px;
  width: 38px;
  background: var(--btn-bg);
  border: 2px solid;
  border-color: var(--bevel-ll) var(--bevel-d) var(--bevel-d) var(--bevel-ll);
  box-shadow: inset 1px 1px 0 var(--bevel-l), inset -1px -1px 0 var(--bevel-dd);
  cursor: pointer;
}
.user-avatar-btn:active,
.user-avatar-btn.is-open {
  border-color: var(--bevel-d) var(--bevel-ll) var(--bevel-ll) var(--bevel-d);
  box-shadow: inset 1px 1px 0 var(--bevel-dd), inset -1px -1px 0 var(--bevel-l);
}

/* Logo button — just the image, no visible button styling */
.header-logo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
}
.header-logo-btn img { height: 44px; width: auto; display: block; }

/* Logo dropdown — opens to the left (right:auto, left:0) */
.logo-menu-dropdown {
  left: 0;
  right: auto;
}

/* Fullscreen + help icon buttons in gallery header */
.btn-gallery-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  width: 38px;
  padding: 2px;
  background: var(--btn-bg);
  border: 2px solid;
  border-color: var(--bevel-ll) var(--bevel-d) var(--bevel-d) var(--bevel-ll);
  box-shadow: inset 1px 1px 0 var(--bevel-l), inset -1px -1px 0 var(--bevel-dd);
  cursor: pointer;
  color: #000;
}
.btn-gallery-icon:active {
  border-color: var(--bevel-d) var(--bevel-ll) var(--bevel-ll) var(--bevel-d);
  box-shadow: inset 1px 1px 0 var(--bevel-dd), inset -1px -1px 0 var(--bevel-l);
}
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 150px;
  background: var(--win98-bg);
  border: 2px outset var(--win98-bg);
  box-shadow: 2px 2px 0 #000;
  padding: 2px;
  z-index: 260;
}
.user-menu-item {
  display: block;
  width: 100%;
  padding: 7px 10px;
  background: transparent;
  border: 0;
  color: #000;
  text-align: left;
  text-decoration: none;
  font-size: 12px;
  cursor: pointer;
}
.user-menu-item:hover,
.user-menu-item:focus {
  background: linear-gradient(to right, #000080, #1084d0);
  color: #fff;
  outline: none;
}

/* ── Gallery main ── */
.gallery-main { padding: 16px; max-width: 1600px; margin: 0 auto; }

/* ── Row sections ── */
.anim-row { margin-bottom: 24px; }
.row-title {
  font-size: 13px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #000;
  margin-bottom: 8px;
}
.row-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--win98-dark) var(--win98-bg);
}
.row-scroll .anim-tile { flex: 0 0 160px; aspect-ratio: 4 / 3; }
.row-scroll .anim-tile video,
.row-scroll .anim-tile img { height: 100%; object-fit: cover; }

/* ── Controls bar ── */
.gallery-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.sort-controls, .limit-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #000;
}
.sort-btn {
  padding: 3px 10px;
  background: var(--win98-bg);
  border: 2px outset var(--win98-bg);
  font-size: 12px;
  cursor: pointer;
  color: #000;
}
.sort-btn.active {
  border-style: inset;
  background: #dcdcdc;
}
.sort-btn:hover:not(.active) { background: #dcdcdc; }

#page-limit {
  padding: 2px 4px;
  background: #fff;
  border: 2px inset var(--win98-bg);
  font-size: 12px;
}

/* ── Animation grid ── */
.anim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

/* ── Animation tile ── */
.anim-tile {
  position: relative;
  background: var(--tile-bg);
  border: 2px solid;
  border-color: #fff #808080 #808080 #fff;
  box-shadow: 2px 2px 0 #000;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.1s;
  aspect-ratio: 4 / 3;
}
.anim-tile:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 #000; }
.anim-tile video, .anim-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.anim-tile .tile-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  padding: 24px 8px 6px;
  opacity: 0;
  transition: opacity 0.15s;
}
.anim-tile:hover .tile-overlay { opacity: 1; }
.tile-title { font-size: 12px; font-weight: bold; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-creator { font-size: 11px; color: #fff; display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.tile-creator img { width: 16px; height: 16px; border-radius: 0; }

/* ── Load more ── */
.btn-load-more {
  display: block;
  margin: 0 auto 32px;
  padding: 8px 32px;
  background: var(--win98-bg);
  border: 2px outset var(--win98-bg);
  font-size: 13px;
  cursor: pointer;
}
.btn-load-more:active { border-style: inset; }

/* ── Win98 window chrome ── */
.win98-window {
  background: var(--win98-bg);
  border: 2px outset var(--win98-bg);
  box-shadow: 2px 2px 0 #000;
}
.win98-titlebar {
  background: linear-gradient(to right, #000080, #1084d0);
  color: var(--win98-title-fg);
  padding: 3px 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: bold;
  user-select: none;
}
.win98-close {
  background: var(--win98-bg);
  border: 1px outset var(--win98-bg);
  width: 18px; height: 16px;
  font-size: 11px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  color: #000;
}
.win98-close:active { border-style: inset; }

/* ── Overlay / backdrop ── */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  pointer-events: auto;
  background: rgba(0,0,0,0.42);
  overflow: hidden;
}
.overlay > * { pointer-events: all; }

.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.42);
  z-index: 199;
}

/* ── Detail popup ── */
.detail-window {
  width: min(90vw, 900px);
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.detail-body {
  display: flex;
  gap: 0;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}
.detail-left {
  flex: 0 0 auto;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 480px;
}
.detail-left video { max-width: 480px; max-height: calc(90vh - 60px); display: block; }
.detail-right {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--win98-bg);
  color: #000;
  min-width: 0;
}

/* Portrait / narrow-screen: stack video above info */
@media (max-width: 600px), (orientation: portrait) and (max-width: 900px) {
  .detail-window {
    width: 100%;
    max-width: 100%;
    max-height: 100dvh;
    max-height: 100vh;
  }
  .detail-body {
    flex-direction: column;
    overflow-y: auto;
  }
  .detail-left {
    max-width: 100%;
    width: 100%;
    flex-shrink: 0;
  }
  .detail-left video {
    max-width: 100%;
    max-height: 45vw;
    width: 100%;
    object-fit: contain;
  }
  .detail-right {
    flex: 1;
    overflow-y: visible;
  }
}
.detail-right h2 { font-size: 16px; }
.detail-creator { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.detail-creator img { width: 28px; height: 28px; border-radius: 50%; border: 1px solid #000; }
.detail-meta { font-size: 12px; color: var(--win98-darker); }
.detail-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag-chip {
  background: var(--win98-title);
  color: #fff;
  padding: 1px 6px;
  font-size: 11px;
  cursor: pointer;
  border: 1px solid #000;
}
.tag-chip:hover { background: #1084d0; color: #fff; }
.detail-actions { display: flex; gap: 8px; align-items: center; }
.btn-like {
  padding: 3px 10px;
  border: 2px outset var(--win98-bg);
  background: var(--win98-bg);
  cursor: pointer;
  font-size: 13px;
}
.btn-like.liked { background: #ffaaaa; }
.btn-like:active { border-style: inset; }

/* ── Comments ── */
.comments-section { border-top: 2px inset var(--win98-bg); padding-top: 8px; }
.comments-section h3 { font-size: 13px; margin-bottom: 6px; }
.comment-item { font-size: 12px; border-bottom: 1px solid var(--win98-dark); padding: 4px 0; }
.comment-item .comment-author { font-weight: bold; color: var(--win98-title); text-decoration: none; }
.comment-item .comment-author:hover { text-decoration: underline; }
.comment-item .comment-body { margin-top: 2px; }
#comment-form textarea {
  width: 100%;
  border: 2px inset var(--win98-bg);
  background: #fff;
  padding: 4px;
  font-size: 12px;
  resize: vertical;
  min-height: 48px;
  margin-top: 6px;
}
#comment-form button {
  margin-top: 4px;
  padding: 2px 12px;
  background: var(--win98-bg);
  border: 2px outset var(--win98-bg);
  font-size: 12px;
  cursor: pointer;
}

/* ── Profile mini-popup ── */
.profile-popup {
  position: fixed;
  z-index: 300;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 280px;
}
.profile-popup-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--win98-bg); }
.profile-popup-body img { width: 64px; height: 64px; border-radius: 0; border: 2px solid #000; object-fit: cover; }
.profile-popup-body .pp-name { font-size: 14px; font-weight: bold; }
.profile-popup-body .pp-bio { font-size: 12px; color: var(--win98-darker); }
.profile-popup-body .pp-stats { font-size: 11px; }
.btn-subscribe {
  padding: 3px 12px;
  background: var(--win98-bg);
  border: 2px outset var(--win98-bg);
  font-size: 12px;
  cursor: pointer;
}
.btn-subscribe.subscribed { background: #aaffaa; }
.btn-subscribe:active { border-style: inset; }

/* ── Profile page ── */
.profile-main { max-width: 900px; margin: 24px auto; padding: 0 16px; }
.profile-card { margin-bottom: 24px; }
.profile-card-body { display: flex; gap: 16px; padding: 12px; background: var(--win98-bg); }
.profile-avatar-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.profile-avatar-wrap img { width: 96px; height: 96px; border-radius: 0; border: 2px solid #000; object-fit: cover; }
.profile-info { flex: 1; display: flex; flex-direction: column; gap: 6px; color: #000; }
.profile-name-wrap { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: bold; }
.profile-stats { font-size: 12px; color: var(--win98-darker); }
.stat-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: inherit;
  color: inherit;
  cursor: default;
}
.stat-btn.clickable {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}
.stat-btn.clickable:hover { color: #000080; }

.suspension-notice {
  background: #fff3cd;
  border: 1px solid #856404;
  color: #856404;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 12px;
}
.danger-zone {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid #c0c0c0;
}
.btn-delete-account {
  background: #c0c0c0;
  border: 2px outset #c0c0c0;
  color: #800000;
  font-weight: bold;
  font-size: 13px;
  padding: 4px 14px;
  cursor: pointer;
}
.btn-delete-account:active { border-style: inset; }
.btn-delete-account:hover { background: #d0d0d0; }

.profile-field-input {
  font: inherit;
  font-size: inherit;
  font-family: inherit;
  padding: 1px 4px;
  border: 1px solid #000080;
  background: #fff;
  color: #000;
  outline: none;
  resize: vertical;
}
.section-heading { font-size: 13px; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; color: #000; margin-bottom: 10px; }
