/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5ebe0;
  --bg-subtle: #ede0d0;
  --text: #3e2c1e;
  --text-secondary: #7a6455;
  --accent: #b5651d;
  --accent-hover: #944f12;
  --card-bg: #faf3ea;
  --border: rgba(62, 44, 30, 0.12);
  --shadow: rgba(62, 44, 30, 0.15);
  --photo-border: #f0e6d8;
  --input-border: #c9b99a;
  --input-bg: #faf3ea;
  --overlay-bg: rgba(30, 20, 10, 0.95);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1410;
    --bg-subtle: #241c15;
    --text: #e8ddd0;
    --text-secondary: #a89580;
    --accent: #d4944a;
    --accent-hover: #e0a85e;
    --card-bg: #241c15;
    --border: rgba(232, 221, 208, 0.1);
    --shadow: rgba(0, 0, 0, 0.4);
    --photo-border: #3a2e22;
    --input-border: #5a4a38;
    --input-bg: #2a2018;
    --overlay-bg: rgba(10, 8, 5, 0.97);
  }
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Logo */
.logo {
  font-family: 'Pacifico', cursive;
  font-size: 1.8rem;
  color: var(--accent);
  text-decoration: none;
}

/* Password Gate */
#password-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

#password-gate[hidden] {
  display: none;
}

.gate-inner {
  text-align: center;
  max-width: 360px;
}

.gate-inner .logo {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.gate-inner p {
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
}

#password-form {
  display: flex;
  gap: 0.5rem;
}

#password-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid var(--input-border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text);
}

#password-input:focus {
  outline: none;
  border-color: var(--accent);
}

#password-form button {
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}

#password-form button:hover {
  background: var(--accent-hover);
}

.error {
  color: #c0503a;
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* Header */
.site-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
}

/* Footer */
.site-footer {
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 4rem;
}

/* Hero */
.hero {
  text-align: center;
  padding: 4rem 2rem 2rem;
}

.hero h1 {
  font-family: 'Pacifico', cursive;
  font-size: 3rem;
  color: var(--accent);
  font-weight: normal;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* Site Intro */
.site-intro {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem 2rem 2rem;
  text-align: left;
  line-height: 1.8;
  color: var(--text-secondary);
  font-size: 1.05rem;
}

.site-intro p {
  margin-bottom: 1rem;
}

.site-intro p:last-child {
  margin-bottom: 0;
}

.site-intro a {
  color: var(--accent);
}

/* Album Grid (Home) */
.album-list {
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2.5rem;
}

.album-card {
  text-decoration: none;
  color: inherit;
  display: block;
  text-align: center;
  transition: transform 0.2s;
}

.album-card:hover {
  transform: translateY(-4px);
}

.album-title {
  font-size: 1.2rem;
  margin-top: 1rem;
  font-weight: 600;
}

.album-meta {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Photo Pile */
.photo-pile {
  position: relative;
  width: 220px;
  height: 180px;
  margin: 0 auto;
}

.pile-photo {
  position: absolute;
  width: 200px;
  height: 160px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 2px 8px var(--shadow);
  border: 4px solid var(--photo-border);
  background: var(--photo-border);
}

.pile-photo.pile-0 {
  transform: rotate(-2deg);
  z-index: 3;
  left: 10px;
  top: 10px;
}

.pile-photo.pile-1 {
  transform: rotate(3deg);
  z-index: 2;
  left: 15px;
  top: 5px;
}

.pile-photo.pile-2 {
  transform: rotate(-5deg);
  z-index: 1;
  left: 5px;
  top: 15px;
}

.pile-placeholder {
  width: 200px;
  height: 160px;
  background: var(--bg-subtle);
  border-radius: 4px;
  border: 4px solid var(--photo-border);
  position: absolute;
  left: 10px;
  top: 10px;
}

/* Album Page */
.album-header {
  padding: 2rem 2rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.back-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  display: inline-block;
  margin-bottom: 1rem;
}

.back-link:hover {
  text-decoration: underline;
}

.album-header h1 {
  font-size: 2rem;
  font-weight: 600;
}

.album-description {
  color: var(--text);
  margin-top: 1.5rem;
  max-width: 720px;
  line-height: 1.8;
}

.album-description h1 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.album-description h1:first-child {
  margin-top: 0;
}

.album-description h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.album-description h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.album-description p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.album-description strong {
  color: var(--text);
  font-weight: 600;
}

.album-description ul,
.album-description ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.album-description li {
  margin-bottom: 0.35rem;
  color: var(--text-secondary);
}

.album-description li strong {
  color: var(--text);
}

.album-description hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.album-description a {
  color: var(--accent);
  text-decoration: underline;
}

.album-description blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

.album-description blockquote.collapsible {
  max-height: 12rem;
  overflow: hidden;
  position: relative;
  transition: max-height 0.4s ease;
}

.album-description blockquote.collapsible::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 5rem;
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none;
  transition: opacity 0.3s;
}

.album-description blockquote.collapsible.expanded {
  max-height: none;
}

.album-description blockquote.collapsible.expanded::after {
  opacity: 0;
}

.blockquote-toggle {
  display: inline-block;
  margin-top: 0.5rem;
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  padding: 0;
}

.blockquote-toggle:hover {
  text-decoration: underline;
}

/* Media Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding: 1rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.media-thumb {
  display: block;
  width: 100%;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1;
}

.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.media-thumb:hover img {
  transform: scale(1.05);
}

.media-video,
.media-text {
  background: var(--card-bg);
  box-shadow: 0 1px 4px var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.video-placeholder {
  color: var(--accent);
}

.text-card-preview {
  padding: 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-align: left;
  max-height: 100%;
}

.item-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 0.5rem;
}

/* Slideshow */
.slideshow {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slideshow[hidden] {
  display: none;
}

.slideshow-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #e8ddd0;
  font-size: 2.5rem;
  cursor: pointer;
  z-index: 10;
  line-height: 1;
}

.slideshow-prev,
.slideshow-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #e8ddd0;
  font-size: 3rem;
  cursor: pointer;
  z-index: 10;
  padding: 1rem;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.slideshow-prev:hover,
.slideshow-next:hover {
  opacity: 1;
}

.slideshow-prev { left: 0.5rem; }
.slideshow-next { right: 0.5rem; }

.slideshow-content {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.slideshow-media img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
}

.slideshow-media video {
  max-width: 90vw;
  max-height: 80vh;
}

.slideshow-media .text-slide {
  background: var(--card-bg);
  padding: 2rem 3rem;
  border-radius: 12px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1.8;
}

.slideshow-caption {
  color: rgba(232, 221, 208, 0.8);
  margin-top: 1rem;
  font-size: 0.95rem;
  text-align: center;
}

.slideshow-counter {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(232, 221, 208, 0.5);
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 900px) {
  .media-grid { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 2.2rem; }
}

@media (max-width: 500px) {
  .media-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.8rem; }
  .photo-pile { width: 180px; height: 150px; }
  .pile-photo { width: 160px; height: 130px; }
  .album-grid { gap: 2rem; }
}
