/* ============================================
   1. CSS CUSTOM PROPERTIES
   ============================================ */
:root {
  /* Primary comic colors */
  --comic-red: #D72638;
  --comic-blue: #1B3A8C;
  --comic-yellow: #F5C542;
  --comic-black: #1A1A1A;
  --comic-white: #FAF9F6;

  /* Secondary/accent */
  --comic-orange: #E8752A;
  --comic-green: #2D8C3C;

  /* Background tones */
  --paper-cream: #F2E8D5;
  --panel-bg: #FAFAFA;

  /* UI values */
  --border-thick: 4px;
  --border-panel: 3px;
  --shadow-offset: 4px;
  --max-width: 1200px;
}

/* ============================================
   2. RESET / BASE STYLES
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Comic Neue', cursive, sans-serif;
  font-weight: 400;
  line-height: 1.6;
  color: var(--comic-black);
  background-color: var(--paper-cream);
  background-image: radial-gradient(circle, #D4C5A9 1px, transparent 1px);
  background-size: 12px 12px;
  min-height: 100vh;
}

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

a {
  color: var(--comic-blue);
  text-decoration: none;
}

a:hover {
  color: var(--comic-red);
}

ul {
  list-style: none;
}

/* ============================================
   3. TYPOGRAPHY
   ============================================ */
h1, h2, h3, .nav-link, .site-title {
  font-family: 'Bangers', cursive;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }

p {
  margin-bottom: 1rem;
}

p:last-child {
  margin-bottom: 0;
}

/* ============================================
   4. COMIC BOOK COMPONENTS
   ============================================ */

/* --- Comic Panel --- */
.comic-panel {
  border: var(--border-thick) solid var(--comic-black);
  background: var(--panel-bg);
  box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--comic-black);
  position: relative;
}

/* --- Comic Heading (outlined text) --- */
.comic-heading {
  font-family: 'Bangers', cursive;
  color: var(--comic-white);
  text-shadow:
    3px 3px 0 var(--comic-black),
    -1px -1px 0 var(--comic-black),
    1px -1px 0 var(--comic-black),
    -1px 1px 0 var(--comic-black);
  font-size: clamp(2rem, 5vw, 4rem);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Speech Bubble --- */
.speech-bubble {
  position: relative;
  background: var(--comic-white);
  border: 3px solid var(--comic-black);
  border-radius: 20px;
  padding: 1rem 1.5rem;
  font-family: 'Comic Neue', cursive;
  font-weight: 700;
}

.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: 30px;
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 20px solid var(--comic-black);
}

.speech-bubble::before {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 33px;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 17px solid var(--comic-white);
  z-index: 1;
}

/* --- Caption Box (narrator) --- */
.caption-box {
  background: var(--comic-yellow);
  border: 3px solid var(--comic-black);
  padding: 0.75rem 1rem;
  font-family: 'Comic Neue', cursive;
  font-style: italic;
  font-weight: 700;
  box-shadow: 2px 2px 0 var(--comic-black);
  display: inline-block;
}

/* --- Halftone Accent Band --- */
.halftone-accent {
  background-color: var(--comic-red);
  background-image: radial-gradient(circle, rgba(0,0,0,0.15) 2px, transparent 2px);
  background-size: 8px 8px;
}

/* --- Action Lines (radiating) --- */
.action-lines {
  position: relative;
  overflow: hidden;
}

.action-lines::before {
  content: '';
  position: absolute;
  inset: -50%;
  background: repeating-conic-gradient(
    var(--comic-yellow) 0deg 3deg,
    #F0BA30 3deg 6deg,
    var(--comic-yellow) 6deg 15deg
  );
  z-index: 0;
  opacity: 0.6;
}

.action-lines > * {
  position: relative;
  z-index: 1;
}

/* --- Comic Button --- */
.comic-button {
  font-family: 'Bangers', cursive;
  font-size: 1.25rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--comic-red);
  color: var(--comic-white);
  border: 3px solid var(--comic-black);
  padding: 0.75rem 2rem;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--comic-black);
  transition: all 0.1s ease;
}

.comic-button:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--comic-black);
}

.comic-button:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}

/* ============================================
   5. NAVIGATION
   ============================================ */
.site-nav {
  background: var(--comic-black);
  border-bottom: 5px solid var(--comic-red);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
}

.site-title {
  font-size: 2rem;
  color: var(--comic-yellow);
  text-decoration: none;
  text-shadow: 2px 2px 0 var(--comic-red);
  white-space: nowrap;
}

.site-title:hover {
  color: var(--comic-yellow);
}

.nav-links {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.nav-link {
  font-size: 1.25rem;
  color: var(--comic-white);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border: 2px solid transparent;
  transition: all 0.15s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--comic-yellow);
  border-color: var(--comic-yellow);
}

/* Hamburger (mobile) */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
}

.hamburger-line {
  display: block;
  width: 28px;
  height: 3px;
  background: var(--comic-white);
  border-radius: 2px;
  transition: all 0.2s ease;
}

/* ============================================
   6. HERO BANNER
   ============================================ */
.hero-banner {
  text-align: center;
  padding: 3rem 1.5rem;
  position: relative;
  overflow: hidden;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-content .comic-heading {
  margin-bottom: 1rem;
}

.hero-content .caption-box {
  font-size: 1.1rem;
}

/* ============================================
   7. GALLERY PAGE
   ============================================ */
.gallery-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.section-intro {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.section-heading {
  font-size: clamp(1.75rem, 4vw, 3rem);
  color: var(--comic-black);
  text-shadow:
    3px 3px 0 var(--comic-yellow),
    -1px -1px 0 var(--comic-yellow),
    1px -1px 0 var(--comic-yellow),
    -1px 1px 0 var(--comic-yellow);
}

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

/* In-progress badge */
.in-progress-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--comic-red);
  color: var(--comic-white);
  font-family: 'Bangers', cursive;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border: 2px solid var(--comic-black);
  box-shadow: 2px 2px 0 var(--comic-black);
  z-index: 2;
}

.gallery-item {
  aspect-ratio: 3 / 4;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease;
}

.gallery-item:hover {
  transform: rotate(-0.5deg) scale(1.02);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(26, 26, 26, 0.85);
  color: var(--comic-yellow);
  font-family: 'Bangers', cursive;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.6rem 0.75rem;
  transform: translateY(100%);
  transition: transform 0.2s ease;
}

.gallery-item:hover .gallery-item-title,
.gallery-item:focus .gallery-item-title {
  transform: translateY(0);
}

/* Aspect ratio fallback */
@supports not (aspect-ratio: 3/4) {
  .gallery-item {
    padding-bottom: 133.33%;
    height: 0;
  }
  .gallery-item img {
    position: absolute;
    top: 0;
    left: 0;
  }
}

/* ============================================
   8. MODAL / LIGHTBOX
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.9);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
}

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

.modal-content {
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  position: relative;
}

.modal-close {
  position: absolute;
  top: -15px;
  right: -15px;
  width: 40px;
  height: 40px;
  background: var(--comic-red);
  color: var(--comic-white);
  border: 3px solid var(--comic-black);
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  box-shadow: 2px 2px 0 var(--comic-black);
  line-height: 1;
}

.modal-close:hover {
  background: var(--comic-black);
}

.modal-image-wrap {
  background: var(--comic-black);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.modal-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-height: 70vh;
}

.modal-details {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--panel-bg);
}

.modal-details .comic-heading {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  color: var(--comic-black);
  text-shadow:
    2px 2px 0 var(--comic-yellow),
    -1px -1px 0 var(--comic-yellow);
}

.modal-details .caption-box {
  font-size: 0.95rem;
}

.modal-details .speech-bubble {
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.6;
}

/* ============================================
   9. ABOUT PAGE
   ============================================ */
.page-header {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--comic-white);
}

.about-section {
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.about-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.about-panel {
  padding: 1.5rem;
}

.about-panel--wide {
  grid-column: 1 / -1;
}

.about-panel .panel-content {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-top: 1rem;
}

.about-photo {
  width: 250px;
  min-width: 200px;
  border: 4px solid var(--comic-black);
  box-shadow: 4px 4px 0 var(--comic-black);
}

.about-panel .panel-heading {
  font-family: 'Bangers', cursive;
  color: var(--comic-red);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.about-panel p {
  font-size: 1.05rem;
}

.about-panel ul {
  padding-left: 1.25rem;
  list-style: disc;
}

.about-panel li {
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

/* ============================================
   10. CONTACT PAGE
   ============================================ */
.contact-section {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  display: grid;
  gap: 1.5rem;
}

.contact-panel {
  padding: 1.5rem;
}

.contact-panel .panel-heading {
  font-family: 'Bangers', cursive;
  color: var(--comic-red);
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.contact-form {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-family: 'Bangers', cursive;
  font-size: 1.1rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--comic-black);
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 3px solid var(--comic-black);
  font-family: 'Comic Neue', cursive;
  font-size: 1rem;
  background: var(--comic-white);
  box-shadow: 2px 2px 0 var(--comic-black);
  transition: box-shadow 0.15s ease;
}

.form-input:focus {
  outline: 3px solid var(--comic-blue);
  outline-offset: 2px;
  box-shadow: 4px 4px 0 var(--comic-blue);
}

textarea.form-input {
  resize: vertical;
  min-height: 120px;
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 1.1rem;
}

.contact-list a {
  font-weight: 700;
  color: var(--comic-blue);
  border-bottom: 2px solid var(--comic-blue);
  transition: color 0.15s ease;
}

.contact-list a:hover {
  color: var(--comic-red);
  border-bottom-color: var(--comic-red);
}

/* ============================================
   11. FOOTER
   ============================================ */
.site-footer {
  text-align: center;
  padding: 2rem 1.5rem;
  margin-top: 3rem;
  border-top: 5px solid var(--comic-black);
  background: var(--comic-black);
}

.site-footer .caption-box {
  font-size: 0.9rem;
}

/* ============================================
   12. ACCESSIBILITY
   ============================================ */

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--comic-yellow);
  color: var(--comic-black);
  padding: 0.5rem 1rem;
  z-index: 300;
  font-family: 'Comic Neue', cursive;
  font-weight: 700;
  border: 3px solid var(--comic-black);
}

.skip-link:focus {
  top: 0;
}

/* Visible focus indicators */
:focus-visible {
  outline: 3px solid var(--comic-blue);
  outline-offset: 3px;
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ============================================
   13. RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 900px) {
  .modal-content {
    grid-template-columns: 1fr;
    max-height: 95vh;
  }

  .modal-image-wrap img {
    max-height: 50vh;
  }
}

@media (max-width: 768px) {
  /* Navigation */
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--comic-black);
    border-bottom: 4px solid var(--comic-red);
    padding: 1rem;
    gap: 0;
  }

  .nav-links--open {
    display: flex;
  }

  .nav-link {
    display: block;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    width: 100%;
  }

  /* Gallery */
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }

  /* About */
  .about-panels {
    grid-template-columns: 1fr;
  }

  .about-panel .panel-content {
    flex-direction: column;
  }

  .about-photo {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
  }

  /* Hero */
  .hero-banner {
    padding: 2rem 1rem;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .gallery-item-title {
    font-size: 0.85rem;
    padding: 0.4rem 0.5rem;
  }

  .site-title {
    font-size: 1.5rem;
  }

  .modal-content {
    margin: 0;
  }

  .modal-details {
    padding: 1rem;
  }
}
