/* ── TOKENS ─────────────────────────────────────── */
:root {
  --purple:       #3f2b7e;
  --purple-dark:  #2a1c57;
  --purple-light: #5a3faa;
  --gold:         #cfa151;
  --gold-light:   #e8bf82;
  --cream:        #faf7f2;
  --ink:          #1a1520;
  --muted:        #8b7fa8;
  --border:       rgba(63, 43, 126, 0.14);
  --radius:       4px;
  --shadow:       0 12px 48px rgba(63, 43, 126, 0.14);
}

/* ── RESET ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'DM Mono', monospace;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SCREENS ─────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: block; }

/* ── GATE ─────────────────────────────────────────── */
#gate {
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  position: relative;
}
#gate.active { display: flex; }

.gate-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  animation: fadeUp 0.5s ease both;
}

.gate-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(63,43,126,0.16) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 80% 100%, rgba(207,161,81,0.08) 0%, transparent 60%),
    var(--cream);
  z-index: 0;
}

.gate-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 36px 48px 40px;
  width: 420px;
  max-width: 92vw;
  box-shadow: var(--shadow);
  text-align: center;
}

.gate-logo {
  width: 240px;
  height: auto;
  display: block;
}

.subtitle {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-bottom: 20px;
}

.input-wrap {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}
.input-wrap:focus-within {
  border-color: var(--purple);
}

.input-wrap input {
  flex: 1;
  padding: 12px 16px;
  border: none;
  outline: none;
  font-family: 'DM Mono', monospace;
  font-size: 0.88rem;
  background: transparent;
  color: var(--ink);
}
.input-wrap input::placeholder { color: var(--muted); }

.input-wrap button {
  padding: 12px 20px;
  background: var(--purple);
  color: #fff;
  border: none;
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  transition: background 0.2s;
}
.input-wrap button:hover { background: var(--purple-light); }

.error-msg {
  margin-top: 14px;
  font-size: 0.78rem;
  color: #c0392b;
  letter-spacing: 0.02em;
}
.hidden { display: none !important; }

/* ── STICKY SITE HEADER (header + ticker) ────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
}

header {
  background: rgba(250, 247, 242, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  position: relative;
  padding: 10px 32px 10px 24px;
  display: flex;
  align-items: center;
}

.header-logo {
  height: 44px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.header-nav {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
}

.header-name {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.05em;
}

/* ── NAV BUTTONS (inline in header-inner) ─────────── */
.nav-btn {
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  padding: 5px 13px;
  border-radius: 20px;
  border: 1.5px solid var(--purple);
  color: var(--purple);
  background: transparent;
  transition: background 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}
.nav-btn:hover {
  background: var(--purple);
  color: #fff;
}
.nav-btn.nav-btn-active {
  background: var(--purple);
  color: #fff;
}

/* ── TICKER ──────────────────────────────────────── */
.ticker-wrap {
  background: var(--purple);
  overflow: hidden;
  padding: 7px 0;
  border-bottom: 1px solid rgba(207, 161, 81, 0.25);
  margin-top: -1px; /* overlap the header's bottom border so there's no gap */
}

.ticker-track {
  display: flex;
  justify-content: center;
}

.ticker-track span {
  font-family: 'DM Mono', monospace;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  color: var(--gold);
}

/* ── STORE MAIN ───────────────────────────────────── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 52px 32px 88px;
}

.hero {
  margin-bottom: 52px;
}

.hero h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.8rem;
  font-weight: 600;
  color: var(--purple-dark);
  letter-spacing: 0.02em;
  margin-bottom: 10px;
}

.hero p {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  max-width: 480px;
  line-height: 1.7;
}

/* ── ITEMS GRID ───────────────────────────────────── */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.item-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  transition: box-shadow 0.3s, transform 0.3s, border-color 0.3s;
  animation: fadeUp 0.4s ease both;
}
.item-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-3px);
  border-color: rgba(63, 43, 126, 0.28);
}

/* ── CARD IMAGE AREA ──────────────────────────────── */
.item-img-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.item-img-wrap {
  position: relative;
  overflow: hidden;
}

.item-img-single {
  position: relative;
  overflow: hidden;
}

.item-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: #f0ecf7;
  transition: transform 0.4s ease;
}
.item-card:hover .item-img {
  transform: scale(1.03);
}

.img-label {
  position: absolute;
  bottom: 8px;
  left: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(63, 43, 126, 0.68);
  padding: 2px 7px;
  border-radius: 2px;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.item-img-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #f0ecf7 0%, #e8e2f5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 3rem;
  color: var(--purple-light);
  opacity: 0.35;
}

/* ── CARD BODY ────────────────────────────────────── */
.item-body {
  padding: 20px 22px 22px;
}

.item-tag {
  display: inline-block;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid rgba(207, 161, 81, 0.45);
  border-radius: 2px;
  padding: 2px 7px;
  margin-bottom: 9px;
}

.item-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--purple-dark);
  margin-bottom: 4px;
  letter-spacing: 0.01em;
}

.item-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.item-price {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
}

.item-qty {
  font-size: 0.72rem;
  color: var(--muted);
}

.item-btn {
  width: 100%;
  padding: 11px;
  background: var(--purple);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.07em;
  transition: background 0.2s, transform 0.1s;
}
.item-btn:hover  { background: var(--purple-light); }
.item-btn:active { transform: scale(0.98); }

.item-btn.sold-out {
  background: #ede9f5;
  color: var(--muted);
  cursor: not-allowed;
}

/* ── SKELETON ─────────────────────────────────────── */
.skeleton {
  height: 380px;
  background: linear-gradient(90deg, #f0ecf7 25%, #e8e2f5 50%, #f0ecf7 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── LIGHTBOX ─────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(26, 21, 32, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
  animation: fadeIn 0.18s ease both;
}

.lightbox img {
  max-width: min(90vw, 800px);
  max-height: 88vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5);
  cursor: default;
  animation: zoomIn 0.2s ease both;
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 0.9rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.2); }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.93); }
  to   { opacity: 1; transform: scale(1); }
}

/* Cursor hint on card images */
.item-img-wrap .item-img,
.item-img-single .item-img {
  cursor: zoom-in;
}

/* ── MODAL ────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 21, 32, 0.52);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: #fff;
  border-radius: 8px;
  /* gold accent line at top */
  border-top: 3px solid var(--gold);
  padding: 40px 36px 36px;
  width: 440px;
  max-width: 96vw;
  position: relative;
  animation: fadeUp 0.22s ease both;
  box-shadow: 0 24px 64px rgba(63, 43, 126, 0.18);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  border-radius: 2px;
  transition: color 0.15s, background 0.15s;
}
.modal-close:hover {
  color: var(--ink);
  background: #f0ecf7;
}

.modal h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.65rem;
  font-weight: 600;
  color: var(--purple-dark);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

#modal-desc {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 22px;
  line-height: 1.7;
}

.modal-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.modal-meta span {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--gold);
  background: transparent;
  border: 1px solid rgba(207, 161, 81, 0.45);
  padding: 3px 10px;
  border-radius: 2px;
}

.modal-size-row {
  margin-bottom: 28px;
}

.modal-size-row label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.size-options {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.size-btn {
  padding: 7px 14px;
  border: 1.5px solid var(--border);
  background: transparent;
  border-radius: var(--radius);
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--ink);
  transition: all 0.15s;
}
.size-btn:hover { border-color: var(--purple); color: var(--purple); }
.size-btn.selected {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

#confirm-btn {
  width: 100%;
  padding: 13px;
  background: var(--gold);
  color: var(--purple-dark);
  border: none;
  border-radius: var(--radius);
  font-family: 'DM Mono', monospace;
  font-size: 0.83rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
#confirm-btn:hover  { background: var(--gold-light); }
#confirm-btn:active { transform: scale(0.99); }

.modal-status {
  margin-top: 14px;
  font-size: 0.76rem;
  text-align: center;
  color: var(--muted);
}
.modal-status.success { color: #2d7d46; }
.modal-status.error   { color: #c0392b; }

/* ── FOOTER ───────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 24px;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.07em;
}

/* ── ANIMATION ────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RESPONSIVE ───────────────────────────────────── */
@media (max-width: 600px) {
  main { padding: 32px 20px 64px; }
  .header-inner { padding: 13px 20px; }
  .hero h2 { font-size: 2rem; }
  .gate-card { padding: 40px 28px 36px; }
  .items-grid { grid-template-columns: 1fr; }
  .modal { padding: 36px 24px 28px; }
}

/* ── ARCHIVE PAGE ─────────────────────────────────── */
.archive-body {
  background: #1a1520;
  color: var(--cream);
}

.archive-body header {
  background: #1a1520;
  border-bottom: 1px solid rgba(207,161,81,0.2);
}

.archive-body .nav-btn {
  border-color: var(--gold);
  color: var(--gold);
  background: transparent;
}
.archive-body .nav-btn:hover {
  background: var(--gold);
  color: #1a1520;
}
.archive-body .nav-btn.nav-btn-active {
  background: var(--gold);
  color: #1a1520;
  border-color: var(--gold);
}

.archive-body .header-name { color: rgba(207,161,81,0.6); }

.archive-body .ticker-wrap-gold {
  background: var(--gold);
  border-bottom: 1px solid rgba(207,161,81,0.3);
}
.archive-body .ticker-wrap-gold .ticker-track span {
  color: #1a1520;
}

.archive-body footer {
  border-top-color: rgba(255,255,255,0.08);
  color: rgba(250,247,242,0.3);
}

.archive-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 52px 40px 100px;
}

.archive-body .hero h2 { color: var(--cream); }
.archive-body .hero p  { color: rgba(250,247,242,0.45); }

/* ── SEMESTER SECTIONS ────────────────────────────── */
.semester-section {
  margin-bottom: 72px;
}

.semester-tape {
  display: inline-block;
  background: var(--cream);
  color: var(--purple);
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  padding: 4px 14px;
  margin-bottom: 28px;
  transform: rotate(-2deg);
  box-shadow: 1px 2px 6px rgba(0,0,0,0.3);
  transform-origin: left center;
}

/* ── POLAROID LAYOUT ──────────────────────────────── */
.polaroid-row {
  display: flex;
  flex-wrap: wrap;
  gap: 36px 40px;
  padding: 16px 8px 24px;
}

.polaroid-pair {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

/* ── POLAROID CARD ────────────────────────────────── */
.polaroid {
  background: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  width: 160px;
  transform: rotate(var(--rot, 0deg));
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  flex-shrink: 0;
}
.polaroid:hover {
  transform: rotate(0deg) scale(1.05);
  box-shadow: 0 12px 40px rgba(0,0,0,0.55);
  z-index: 10;
  position: relative;
}

.polaroid-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #f0ecf7 0%, #e8e2f5 100%);
}

.polaroid-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.polaroid-photo .item-img-placeholder {
  width: 100%;
  height: 100%;
  aspect-ratio: unset;
  font-size: 2rem;
}

/* ── POLAROID CAPTION ─────────────────────────────── */
.polaroid-caption {
  padding: 8px 8px 10px;
  text-align: center;
  background: #fff;
}

.polaroid-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.polaroid-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  color: #aaa;
}

.polaroid-designer {
  font-family: 'DM Mono', monospace;
  font-size: 0.58rem;
  color: var(--gold);
  margin-top: 2px;
}

/* ── ARCHIVE SKELETON ─────────────────────────────── */
.archive-skeleton-wrap {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 40px 0;
}

.archive-skeleton {
  width: 160px;
  height: 200px;
  background: linear-gradient(90deg, #2a1c57 25%, #3f2b7e 50%, #2a1c57 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

/* ── ARCHIVE RESPONSIVE ───────────────────────────── */
@media (max-width: 900px) {
  .archive-main { padding: 40px 24px 80px; }
  .polaroid { width: 140px; }
}

/* ── SWIPE HINT (hidden on desktop) ──────────────── */
.swipe-hint { display: none; }

/* ══════════════════════════════════════════════════
   MOBILE  —  max-width: 640px
   Desktop layout is completely untouched above.
   ══════════════════════════════════════════════════ */
@media (max-width: 640px) {

  /* ── Gate ── */
  .gate-card {
    width: 92vw;
    padding: 32px 24px;
  }
  .crest { font-size: 2.2rem; }
  .gate-card h1 { font-size: 1.25rem; }

  /* ── Header ── */
  .header-inner {
    padding: 10px 16px;
    gap: 8px;
  }
  .header-logo { height: 34px; }
  .nav-btn {
    font-size: 0.6rem;
    padding: 4px 8px;
    border-radius: 14px;
  }
  .header-name { display: none; }
  .ticker-wrap { padding: 5px 0; }
  .ticker-track span { font-size: 0.6rem; }

  /* ── Footer ── */
  footer {
    font-size: 0.65rem;
    padding: 20px 16px;
  }

  /* ── Store — hero ── */
  .hero { margin-bottom: 32px; }
  .hero h2 { font-size: 1.8rem; }
  .hero p  { font-size: 0.78rem; }

  /* ── Store — grid ── */
  .items-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .item-body { padding: 16px 18px 18px; }
  .item-name { font-size: 1.1rem; }
  .item-btn  { padding: 13px; }

  /* ── Store — modal ── */
  .modal {
    padding: 28px 20px 24px;
    width: 96vw;
  }
  .size-options { gap: 6px; }
  .size-btn { padding: 8px 12px; }

  /* ── Archive — main padding ── */
  .archive-main { padding: 28px 0 64px; }

  /* ── Archive — semester label ── */
  .semester-tape {
    margin: 24px 16px 8px;
    font-size: 0.75rem;
    display: block;
    transform: none;
  }

  /* ── Archive — horizontal scroll strips ── */
  .polaroid-row {
    flex-wrap: nowrap;
    flex-direction: row;
    overflow-x: auto;
    gap: 12px;
    padding: 12px 16px 20px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .polaroid-row::-webkit-scrollbar { display: none; }

  .polaroid-pair {
    flex: 0 0 auto;
    scroll-snap-align: start;
    width: 220px;
  }

  .polaroid {
    transform: none !important;
    width: 100px;
  }
  .polaroid:hover {
    transform: none !important;
  }

  .polaroid-photo img {
    aspect-ratio: 3 / 4;
  }

  .polaroid-photo .item-img-placeholder {
    aspect-ratio: 3 / 4;
  }

  .polaroid-name { font-size: 0.72rem; }

  /* ── Swipe hint ── */
  .swipe-hint {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    align-self: center;
    font-family: 'DM Mono', monospace;
    font-size: 0.65rem;
    color: var(--gold);
    opacity: 0.35;
    padding: 0 16px;
  }
}
