/* Shrek's Onion Engineering Gallery Stylesheet */
:root {
  --swamp-deep: #0f170c;
  --swamp-panel: #1b2615;
  --swamp-card: #25351d;
  --swamp-border: #3d582c;
  --swamp-accent: #7fa63a;
  --swamp-glow: #b1d65c;
  --mud-tan: #cfb17d;
  --text-light: #e8ede0;
  --text-muted: #a3b293;
}

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

body {
  background-color: var(--swamp-deep);
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(127, 166, 58, 0.15), transparent 45%),
    radial-gradient(ellipse at 80% 90%, rgba(77, 124, 42, 0.18), transparent 50%),
    repeating-linear-gradient(45deg, rgba(20, 30, 16, 0.4) 0px, rgba(20, 30, 16, 0.4) 12px, transparent 12px, transparent 24px);
  background-size: 100% 100%, 100% 100%, 80px 80px;
  background-attachment: fixed;
  animation: swampBackgroundScroll 16s ease-in-out infinite alternate;
  color: var(--text-light);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  padding: 2.5rem 1rem;
  line-height: 1.6;
  position: relative;
}

/* Fixed background canvas for ambient floating procedural javascript onions */
.bg-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  opacity: 0.3;
}

@keyframes swampBackgroundScroll {
  0% {
    background-position: 0% 0%, 0% 0%, 0px 0px;
  }

  100% {
    background-position: -10% 10%, 10% -10%, 100px 1000px;
  }
}

.page-wrapper {
  max-width: 960px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.badge {
  display: inline-block;
  background: rgba(127, 166, 58, 0.2);
  color: var(--swamp-glow);
  border: 1px solid var(--swamp-accent);
  padding: 0.25rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

h1 {
  font-size: 2.4rem;
  font-weight: 800;
  color: #f0f7e4;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--mud-tan);
  font-size: 1.1rem;
  font-style: italic;
}

.bio-section {
  background: var(--swamp-panel);
  border: 1px solid var(--swamp-border);
  border-radius: 14px;
  padding: 1.75rem 2rem;
  margin-bottom: 2.5rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.bio-section h2 {
  color: var(--swamp-glow);
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
  text-align: center;
  justify-content: center;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bio-section p {
  color: var(--text-light);
  margin-bottom: 0.85rem;
  font-size: 1rem;
}

.bio-section p:last-child {
  margin-bottom: 0;
}

.bio-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--swamp-border);
}

.stat-item {
  background: rgba(15, 23, 12, 0.65);
  padding: 0.85rem 1.15rem;
  border-radius: 10px;
  border: 1px solid rgba(127, 166, 58, 0.25);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.55);
}

.stat-item .label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-item .value {
  display: block;
  font-size: 1.05rem;
  font-weight: bold;
  color: var(--mud-tan);
}

.gallery-section {
  text-align: center;
}

.gallery-section h2 {
  font-size: 1.5rem;
  color: #fff;
  margin-bottom: 0.35rem;
  text-align: center;
}

.gallery-desc {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  text-align: center;
}

#galleryContainer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
}

.onion-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  background: var(--swamp-card);
  border: 1px solid var(--swamp-border);
  border-radius: 12px;
  padding: 1.25rem 1rem;
  width: 190px;
  flex: 0 1 190px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.onion-card:hover,
.onion-card:focus {
  transform: translateY(-5px);
  border-color: var(--swamp-glow);
  box-shadow: 0 8px 25px rgba(177, 214, 92, 0.2);
  outline: none;
}

.thumbnail-wrapper {
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 12, 0.6);
  border-radius: 50%;
  margin-bottom: 1rem;
  border: 2px dashed rgba(127, 166, 58, 0.3);
  transition: border-color 0.2s ease;
}

.onion-card:hover .thumbnail-wrapper {
  border-color: var(--swamp-glow);
}

.onion-thumb {
  width: 120px;
  height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.5));
  animation: onionFloat 2.4s ease-in-out infinite alternate;
  will-change: transform;
}

.onion-card:nth-child(2n) .onion-thumb {
  animation-duration: 2.8s;
  animation-delay: -0.7s;
}

.onion-card:nth-child(3n) .onion-thumb {
  animation-duration: 2.1s;
  animation-delay: -1.3s;
}

@keyframes onionFloat {
  0% {
    transform: translateY(6px) rotate(-3.5deg);
  }

  50% {
    transform: translateY(-8px) rotate(2deg);
  }

  100% {
    transform: translateY(-18px) rotate(-3deg);
  }
}

.onion-caption {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-light);
  text-align: center;
  line-height: 1.3;
}

.onion-card:hover .onion-caption {
  color: var(--swamp-glow);
}

footer {
  margin-top: 3.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid rgba(61, 88, 44, 0.4);
  padding-top: 1.5rem;
}

.slicer-section {
  background: var(--swamp-panel);
  border: 1px solid var(--swamp-border);
  border-radius: 14px;
  padding: 1.75rem 2rem;
  margin-bottom: 2.5rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.slicer-section h2 {
  color: var(--swamp-glow);
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  text-align: center;
  display: block;
}

.slicer-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  align-items: center;
  margin-top: 1.25rem;
}

@media (max-width: 680px) {
  .slicer-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

.slicer-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(15, 23, 12, 0.7);
  border: 2px dashed var(--swamp-accent);
  border-radius: 12px;
  padding: 1rem;
}

#previewCanvas {
  width: 170px;
  height: 170px;
  background: transparent;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}

.preview-tag {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.slicer-controls {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.control-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.control-row label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--mud-tan);
  display: flex;
  justify-content: space-between;
}

.control-row input[type="text"],
.control-row select {
  background: rgba(15, 23, 12, 0.8);
  border: 1px solid var(--swamp-border);
  color: var(--text-light);
  padding: 0.55rem 0.8rem;
  border-radius: 6px;
  font-size: 0.95rem;
  outline: none;
}

.control-row input[type="text"]:focus,
.control-row select:focus {
  border-color: var(--swamp-glow);
}

.control-row input[type="range"] {
  accent-color: var(--swamp-glow);
  cursor: pointer;
}

.slicer-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn-slice,
.btn-random {
  padding: 0.65rem 1.2rem;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}

.btn-slice {
  background: var(--swamp-accent);
  color: #111e0a;
  flex: 1;
}

.btn-slice:hover {
  background: var(--swamp-glow);
  transform: translateY(-2px);
}

.btn-random {
  background: rgba(61, 88, 44, 0.5);
  color: var(--text-light);
  border: 1px solid var(--swamp-border);
}

.btn-random:hover {
  background: rgba(61, 88, 44, 0.8);
  color: #fff;
}

.tidbit-section {
  background: var(--swamp-panel);
  border: 1px solid var(--swamp-border);
  border-radius: 14px;
  padding: 1.75rem 2rem;
  margin-top: 2.5rem;
  margin-bottom: 2.5rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.tidbit-section h3 {
  color: var(--swamp-glow);
  font-size: 1.25rem;
  margin-bottom: 0.85rem;
  text-align: center;
  display: block;
}

.tidbit-section p {
  color: var(--text-light);
  font-size: 0.98rem;
  margin-bottom: 0.85rem;
  line-height: 1.65;
}

.tidbit-section code {
  background: rgba(0, 0, 0, 0.4);
  color: var(--mud-tan);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.88rem;
  font-family: Consolas, Monaco, monospace;
}

.breathing-red-link {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  display: inline-block;
  animation: breathingRed 2.2s ease-in-out infinite alternate;
  cursor: pointer;
}

@keyframes breathingRed {
  0% {
    color: #ff3344;
    text-shadow: 0 0 4px rgba(255, 51, 68, 0.4);
    transform: scale(1);
  }

  50% {
    color: #ff6677;
    text-shadow: 0 0 12px rgba(255, 102, 119, 0.8), 0 0 20px rgba(255, 30, 50, 0.5);
    transform: scale(1.04);
  }

  100% {
    color: #cc001b;
    text-shadow: 0 0 2px rgba(204, 0, 27, 0.3);
    transform: scale(1);
  }
}

.breathing-red-link:hover {
  animation-play-state: paused;
  color: #ff1a35;
  text-shadow: 0 0 16px #ff1a35;
}

/* =========================================================================
   MODULAR POP-UP MODAL (IFRAME VIEWER)
   ========================================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 8, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--swamp-panel);
  border: 1px solid var(--swamp-border);
  border-radius: 16px;
  width: 90vw;
  max-width: 820px;
  height: 85vh;
  position: relative;
  display: flex;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(127, 166, 58, 0.2);
  transform: scale(0.94) translateY(12px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-backdrop.open .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 10;
  background: rgba(15, 23, 12, 0.85);
  border: 1px solid var(--swamp-border);
  color: var(--swamp-glow);
  font-size: 1.6rem;
  line-height: 1;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.modal-close-btn:hover {
  background: var(--swamp-accent);
  color: #111e0a;
  border-color: var(--swamp-glow);
  transform: scale(1.08);
}

.modal-body {
  width: 100%;
  height: 100%;
  position: relative;
  background: var(--swamp-deep);
  display: flex;
}

.modal-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  flex: 1;
}