/* ==========================================================================
   PocketAmp Theme & Skin Hub — Hand-Drawn Sketchbook Aesthetic
   Built on DoodleCSS (vendor/doodle/doodle.css)
   ========================================================================== */

:root {
  --paper: #FDF7F1;
  --paper-card: #FFFCF8;
  --paper-tint: #F6ECE1;
  --grid-line: rgba(110, 96, 82, 0.11);
  --ink: #24211E;
  --ink-muted: #655C54;
  --mark-yellow: #FFE66D;
  --mark-coral: #FF8C6B;
  --mark-sky: #A8E0FF;
  --mark-mint: #B8F2C6;
  --font-display: 'Patrick Hand', cursive;
  --font-body: 'Short Stack', cursive;
  --font-mono: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Base sketchbook notebook paper */
body.doodle {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  background-color: var(--paper);
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 26px 26px;
  background-position: -1px -1px;
}

body.modal-open {
  overflow: hidden;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 999;
  padding: 8px 14px;
  background: var(--mark-yellow);
  color: var(--ink);
  border: 2px solid var(--ink);
  text-decoration: none;
}

.skip-link:focus {
  left: 12px;
}

.page-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.brand-block {
  max-width: 620px;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.doodle-psp {
  width: 64px;
  height: 34px;
  flex-shrink: 0;
  transform: rotate(-3deg);
}

.doodle-note {
  width: 24px;
  height: 26px;
  flex-shrink: 0;
  transform: rotate(7deg);
}

.brand-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.3rem, 4.5vw, 3.1rem);
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.hub-scribble {
  display: inline-block;
  padding: 2px 10px 1px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  background: var(--mark-yellow);
  border: 2px solid var(--ink);
  transform: rotate(-1.5deg);
}

.brand-tagline {
  margin: 10px 0 0;
  color: var(--ink-muted);
  font-size: 0.96rem;
}

.brand-tagline code,
.site-footer code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 1px 6px;
  background: var(--paper-tint);
  border: 1.5px solid rgba(36, 33, 30, 0.28);
}

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

/* Doodle buttons (links & buttons unified) */
.doodle .doodle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  min-height: 44px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  border-style: solid;
  border-width: 10px;
  border-image: url(vendor/doodle/button.svg) 10 10 10 10 stretch stretch;
  background-color: var(--paper-card);
  transition: transform 0.12s ease, background-color 0.12s ease;
}

.doodle .doodle-btn:hover {
  transform: translate(-1px, -2px);
}

.doodle .doodle-btn:active {
  transform: translate(1px, 1px);
}

.doodle .btn-yellow {
  background-color: var(--mark-yellow);
}

.doodle .btn-yellow:hover {
  background-color: #ffde42;
}

.doodle .btn-coral {
  background-color: var(--mark-coral);
}

.doodle .btn-coral:hover {
  background-color: #ff7750;
}

.sketch-hr {
  margin: 22px 0 20px;
}

/* ==========================================================================
   Filter & Search Controls
   ========================================================================== */

.controls-bar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.search-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1 1 320px;
  max-width: 520px;
  padding: 0;
  display: block;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.doodle #search-input {
  width: 100%;
  min-height: 46px;
  padding: 6px 14px 6px 38px;
  background-color: var(--paper-card);
  color: var(--ink);
  font-size: 0.94rem;
}

.doodle #search-input::placeholder {
  color: #887d73;
}

.results-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.doodle .text-reset-btn {
  border: 0;
  border-image: none;
  padding: 4px 6px;
  min-height: 34px;
  font-size: 0.86rem;
  text-decoration: underline wavy var(--mark-coral);
  text-underline-offset: 4px;
  color: var(--ink);
  cursor: pointer;
}

.filter-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-label {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--ink-muted);
  min-width: 58px;
}

.pill-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.doodle .pill-btn {
  min-height: 40px;
  padding: 3px 12px;
  font-size: 0.88rem;
  background-color: var(--paper-card);
  color: var(--ink);
  cursor: pointer;
  border-width: 8px;
  transition: transform 0.1s ease, background-color 0.12s ease;
}

.doodle .pill-btn:hover {
  transform: translateY(-1px);
  background-color: var(--paper-tint);
}

.doodle .pill-btn.is-active {
  background-color: var(--mark-yellow);
  font-weight: 700;
}

.pill-count {
  font-family: var(--font-mono);
  font-size: 0.78em;
  color: var(--ink-muted);
  margin-left: 3px;
}

.doodle .tag-btn {
  min-height: 36px;
  padding: 2px 11px;
  font-size: 0.84rem;
  background-color: var(--paper-card);
  color: var(--ink);
  cursor: pointer;
  border-style: solid;
  border-width: 6px;
  border-image: url(vendor/doodle/button.svg) 10 10 10 10 stretch stretch;
  transition: transform 0.1s ease, background-color 0.12s ease;
}

.doodle .tag-btn:hover {
  background-color: var(--paper-tint);
  transform: translateY(-1px);
}

.doodle .tag-btn.is-active {
  background-color: var(--mark-coral);
  font-weight: 700;
}

/* ==========================================================================
   Theme Cards Grid (480 x 272 PSP Screen Ratio)
   ========================================================================== */

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.theme-card {
  display: flex;
  flex-direction: column;
  background-color: var(--paper-card);
  padding: 8px;
  transition: transform 0.14s ease, filter 0.14s ease;
}

.theme-card:hover {
  transform: translate(-2px, -3px);
  filter: drop-shadow(3px 3px 0 var(--ink));
}

.card-preview-btn {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 2px solid var(--ink) !important;
  border-image: none !important;
  background: #141418;
  aspect-ratio: 480 / 272;
  overflow: hidden;
  cursor: pointer;
}

.doodle .card-preview-btn img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  border-image: none;
  border-radius: 0;
  image-rendering: auto;
  transition: transform 0.2s ease;
}

.card-preview-btn:hover img {
  transform: scale(1.025);
}

.type-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--ink);
  border: 2px solid var(--ink);
  line-height: 1.2;
  pointer-events: none;
}

.badge-wsz {
  background-color: var(--mark-coral);
}

.badge-json {
  background-color: var(--mark-sky);
}

.badge-wallpaper {
  background-color: var(--mark-mint);
}

.photo-count-pill {
  position: absolute;
  bottom: 8px;
  left: 8px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink);
  background: var(--mark-yellow);
  border: 1.5px solid var(--ink);
  pointer-events: none;
}

.card-body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 4px 4px;
  flex: 1;
}

.card-meta {
  min-width: 0;
}

.card-title-btn {
  display: block;
  max-width: 100%;
  padding: 0;
  margin: 0;
  border: 0 !important;
  border-image: none !important;
  background: transparent;
  text-align: left;
  font-family: var(--font-display);
  font-size: 1.3rem;
  line-height: 1.15;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-title-btn:hover {
  text-decoration: underline wavy var(--mark-coral);
  text-underline-offset: 3px;
}

.card-author {
  margin: 3px 0 0;
  font-size: 0.74rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doodle .card-dl-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 2px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  background-color: var(--mark-yellow);
  border-style: solid;
  border-width: 7px;
  border-image: url(vendor/doodle/button.svg) 10 10 10 10 stretch stretch;
  transition: transform 0.1s ease, background-color 0.12s ease;
}

.doodle .card-dl-btn:hover {
  background-color: #ffde42;
  transform: translateY(-1px);
}

.doodle .card-dl-btn:active {
  transform: translateY(1px);
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.empty-state {
  max-width: 480px;
  margin: 36px auto;
  padding: 28px 24px;
  text-align: center;
  background: var(--paper-card);
}

.doodle-vinyl {
  width: 60px;
  height: 60px;
  margin-bottom: 8px;
}

.empty-state h2 {
  margin: 4px 0 6px;
  font-family: var(--font-display);
  font-size: 1.6rem;
}

.empty-state p {
  margin: 0 0 18px;
  color: var(--ink-muted);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--ink-muted);
}

.site-footer p {
  margin: 0;
}

.site-footer strong {
  color: var(--ink);
}

/* ==========================================================================
   Detail Modal
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(36, 33, 30, 0.58);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 920px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 22px;
  padding: 20px;
  background-color: var(--paper);
  filter: drop-shadow(5px 5px 0 var(--ink));
}

.doodle .modal-close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 5;
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  background-color: var(--paper-card);
  border-width: 6px;
  cursor: pointer;
}

.doodle .modal-close-btn:hover {
  background-color: var(--mark-yellow);
}

.modal-preview-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 480 / 272;
  background: #141418;
  border: 2.5px solid var(--ink);
  overflow: hidden;
}

.doodle .modal-stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: 0;
  border-image: none;
  border-radius: 0;
}

.doodle .stage-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 44px;
  padding: 0;
  font-size: 1.6rem;
  line-height: 1;
  background: var(--mark-yellow);
  border: 2px solid var(--ink);
  border-image: none;
  cursor: pointer;
}

.stage-prev {
  left: 8px;
}

.stage-next {
  right: 8px;
}

.modal-thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.doodle .thumb-btn {
  padding: 3px 10px;
  font-size: 0.8rem;
  border-style: solid;
  border-width: 6px;
  border-image: url(vendor/doodle/button.svg) 10 10 10 10 stretch stretch;
  background: var(--paper-card);
  cursor: pointer;
}

.doodle .thumb-btn.is-active {
  background: var(--mark-yellow);
  font-weight: 700;
}

.modal-info-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 12px;
}

.modal-header h2 {
  margin: 0;
  padding-right: 28px;
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1.1;
}

.modal-author {
  margin: 4px 0 8px;
  color: var(--ink-muted);
  font-size: 0.92rem;
}

.modal-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.modal-tag-chip {
  padding: 2px 8px;
  font-size: 0.78rem;
  background: var(--paper-tint);
  border: 1.5px solid var(--ink);
}

.modal-download-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mono-meta {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.install-box {
  background: var(--paper-card);
  padding: 12px 14px;
}

.install-box h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.3rem;
}

.install-steps {
  margin: 0 0 12px;
  padding-left: 20px;
  font-size: 0.86rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.install-path-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: var(--paper-tint);
  border: 2px solid var(--ink);
  flex-wrap: wrap;
}

.install-path-bar code {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  word-break: break-all;
}

.doodle .copy-btn {
  padding: 2px 8px;
  font-size: 0.76rem;
  background: var(--mark-yellow);
  border: 1.5px solid var(--ink);
  border-image: none;
  cursor: pointer;
}

/* ==========================================================================
   Responsive & Reduced Motion
   ========================================================================== */

@media (max-width: 980px) {
  .catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal-sheet {
    grid-template-columns: 1fr;
  }

  .modal-info-col {
    padding-right: 0;
  }
}

@media (max-width: 620px) {
  .page-shell {
    padding: 18px 14px 36px;
  }

  .catalog-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .header-actions {
    width: 100%;
  }

  .doodle .header-actions .doodle-btn {
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
