/* ============================================
   GachaGhost Arts — unified stylesheet
   Replaces ghost.css + other-ghost.css
   ============================================ */

:root {
  --bg: #0a0908;
  --bg-card: #151212;
  --ink: #f2efe9;
  --ink-dim: #a39c94;
  --red: #e11d2e;
  --red-dim: #7a1019;
  --border: rgba(225, 29, 46, 0.35);
  --font-display: 'Oswald', sans-serif;
  --font-body: 'Roboto', sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  min-height: 100vh;
}

/* Subtle scanline / texture on the whole page so flat black doesn't feel bare */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.015) 0px,
    rgba(255, 255, 255, 0.015) 1px,
    transparent 1px,
    transparent 3px
  );
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* ---------- Header / Nav ---------- */

header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  background: rgba(10, 9, 8, 0.88);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  transition: padding 0.25s ease, background 0.25s ease;
}

header.scrolled {
  padding: 0.55rem 1.5rem;
  background: rgba(10, 9, 8, 0.97);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.brand .ghost-mark {
  color: var(--red);
  font-size: 1.5rem;
}

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
  font-size: 1.3rem;
  line-height: 1;
  padding: 0.4rem 0.65rem;
  cursor: pointer;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 0.25rem;
}

nav a {
  display: inline-block;
  text-decoration: none;
  color: var(--ink-dim);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  padding: 0.55rem 0.9rem;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
}

nav a:hover {
  color: var(--ink);
  background: rgba(225, 29, 46, 0.12);
}

nav a.active {
  color: var(--ink);
  background: var(--red);
}

@media (max-width: 760px) {
  .menu-toggle {
    display: block;
  }

  nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(10, 9, 8, 0.97);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }

  nav.open {
    max-height: 320px;
  }

  nav ul {
    flex-direction: column;
    padding: 0.5rem 1rem 1rem;
  }

  nav a {
    padding: 0.8rem 0.5rem;
    font-size: 0.95rem;
  }
}

/* ---------- Page intro ---------- */

.page-intro {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 2.5rem auto 0.5rem;
  padding: 0 1.5rem;
  text-align: center;
}

.page-intro h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  letter-spacing: 0.02em;
}

.page-intro h1 .accent {
  color: var(--red);
}

.page-intro p {
  margin-top: 0.6rem;
  color: var(--ink-dim);
  font-size: 0.95rem;
  line-height: 1.5;
}

.page-intro .count {
  display: inline-block;
  margin-top: 0.9rem;
  font-family: var(--font-body);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--red);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
}

/* ---------- Gallery grid ---------- */

main {
  position: relative;
  z-index: 1;
}

.container {
  max-width: 1280px;
  margin: 1.5rem auto 4rem;
  padding: 0 1.25rem;
  columns: 2 220px;
  column-gap: 0.9rem;
}

@media (min-width: 600px) {
  .container {
    columns: 3 240px;
    column-gap: 1.1rem;
  }
}

@media (min-width: 960px) {
  .container {
    columns: 4 260px;
    column-gap: 1.25rem;
  }
}

.container figure {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  break-inside: avoid;
  margin-bottom: 0.9rem;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

@media (min-width: 600px) {
  .container figure {
    margin-bottom: 1.1rem;
  }
}

@media (min-width: 960px) {
  .container figure {
    margin-bottom: 1.25rem;
  }
}

.container figure.in-view {
  opacity: 1;
  transform: translateY(0);
}

.container img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.4s ease, filter 0.4s ease;
  filter: saturate(0.92);
}

.container figure:hover img {
  transform: scale(1.045);
  filter: saturate(1.05);
}

.container figure::after {
  content: '\2197'; /* small arrow, signals "expand" */
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(10, 9, 8, 0.75);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.container figure:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.container img.is-loading {
  filter: blur(8px) saturate(0.8);
}

.container figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.6rem 0.75rem 0.6rem;
  background: linear-gradient(to top, rgba(6, 5, 5, 0.92), transparent);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.container figure:hover figcaption,
.container figure:focus-visible figcaption {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Lightbox / modal ---------- */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(6, 5, 5, 0.94);
  padding: 2rem 1rem;
  overflow: auto;
}

.modal.open {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.modal-content {
  max-width: min(90vw, 900px);
  max-height: 68vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 0 60px rgba(225, 29, 46, 0.15);
  animation: modal-pop 0.2s ease;
}

@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.close {
  position: fixed;
  top: 1.1rem;
  right: 1.5rem;
  font-size: 2rem;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  background: none;
  border: none;
}

.close:hover {
  color: var(--red);
}

.modal-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(21, 18, 18, 0.7);
  border: 1px solid var(--border);
  color: var(--ink);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.modal-nav:hover {
  background: var(--red);
  border-color: var(--red);
}

.modal-prev { left: 1rem; }
.modal-next { right: 1rem; }

@media (max-width: 640px) {
  .modal-nav { width: 38px; height: 38px; font-size: 1.1rem; }
  .modal-prev { left: 0.4rem; }
  .modal-next { right: 0.4rem; }
}

.modal-counter {
  position: fixed;
  top: 1.2rem;
  left: 1.5rem;
  color: var(--ink-dim);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  font-family: var(--font-body);
}

.modal-footer {
  margin-top: 1.1rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.modal-caption {
  color: var(--ink-dim);
  font-size: 0.85rem;
}

#downloadBtn {
  cursor: pointer;
  background: var(--red);
  color: var(--ink);
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1.4rem;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  transition: background 0.2s ease;
}

#downloadBtn:hover {
  background: #ff2e42;
}

/* ---------- Home page ---------- */

.hero {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 4.5rem auto 3.5rem;
  padding: 0 1.5rem;
  text-align: center;
}

.hero .ghost-mark {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2rem, 6vw, 3rem);
  letter-spacing: 0.02em;
}

.hero h1 .accent {
  color: var(--red);
}

.hero p {
  margin-top: 0.9rem;
  color: var(--ink-dim);
  font-size: 1rem;
}

.hero-links {
  margin-top: 1.8rem;
  display: flex;
  gap: 0.9rem;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-links a {
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 0.7rem 1.3rem;
  border-radius: 8px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.hero-links a:hover {
  background: var(--red);
  border-color: var(--red);
}

/* ---------- Focus visibility (accessibility) ---------- */

a:focus-visible,
button:focus-visible,
.container figure:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}

/* ---------- Scroll to top ---------- */

#toTop {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 900;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(21, 18, 18, 0.85);
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease;
}

#toTop.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

#toTop:hover {
  background: var(--red);
}

/* ---------- Home teaser mosaic ---------- */

.teaser {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto 4rem;
  padding: 0 1.25rem;
}

.teaser-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.7rem;
}

@media (min-width: 700px) {
  .teaser-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.9rem;
  }
}

.teaser-card {
  position: relative;
  display: block;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 4 / 5;
  text-decoration: none;
}

.teaser-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.85);
  transition: transform 0.4s ease, filter 0.4s ease;
}

.teaser-card:hover img {
  transform: scale(1.06);
  filter: saturate(1.05);
}

.teaser-card span.label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.6rem 0.75rem 0.6rem;
  background: linear-gradient(to top, rgba(6, 5, 5, 0.92), transparent);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

/* ---------- Footer ---------- */

footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem 1rem 3rem;
  color: var(--ink-dim);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}