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

:root {
  --lime: #84CC16;
  --lime-dark: #5A8F0A;
  --lime-pale: #F0FADF;
  --lime-mid: #DCFCA7;
  --white: #FFFFFF;
  --text: #111111;
  --muted: #5A6472;
  --border: #E4EDCF;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  color: var(--text);
  background: var(--white);
}

/* ── Hero ── */
.hero {
  padding: 48px 24px 100px;
  text-align: center;
  background: var(--lime-pale);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--white);
  /* JS sets --hero-R and --hero-cy to produce a true circle arc:
     R = vw²/(8×60) + 30  →  cy = R−60 pixels below element bottom */
  clip-path: circle(var(--hero-R, 3030px) at 50% calc(100% + var(--hero-cy, 2970px)));
}

.hero-logo {
  height: 150px;
  max-width: 80vw;
  object-fit: contain;
  display: block;
  margin: 0 auto 28px;
  cursor: pointer;
}

.hero-logo:hover {
  animation: jiggle 0.5s ease;
}

@keyframes jiggle {
  0%   { transform: rotate(0deg); }
  15%  { transform: rotate(-6deg) scale(1.05); }
  30%  { transform: rotate(6deg) scale(1.05); }
  45%  { transform: rotate(-4deg); }
  60%  { transform: rotate(4deg); }
  75%  { transform: rotate(-2deg); }
  90%  { transform: rotate(2deg); }
  100% { transform: rotate(0deg); }
}

.hero h1 {
  font-size: clamp(2.8rem, 7vw, 5.2rem);
  font-weight: 900;
  color: var(--lime-dark);
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 18px;
}

.hero p {
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  color: var(--muted);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.65;
}

/* ── Project Sections ── */
.project-section {
  padding: 80px 0;
}

.project-section:nth-child(odd)  { background: var(--white); }
.project-section:nth-child(even) { background: var(--lime-pale); }

.project-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 40px;
}

/* Meta block */
.project-meta {
  margin-bottom: 40px;
}

.project-date {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--lime-dark);
  margin-bottom: 10px;
}

.project-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 14px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 18px;
}

.tag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--lime-mid);
  color: var(--lime-dark);
  border-radius: 100px;
  padding: 4px 12px;
}

.project-desc {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.75;
  max-width: 680px;
}

/* ── Project Dock ── */
.project-dock {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  position: relative;
  width: 100%;
  overflow: visible;
  background: var(--white);
  z-index: 10;
  padding-bottom: 16px;
}

.dock-bubble {
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--lime-dark);
  color: #fff;
  font-weight: 800;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  box-shadow: 0 2px 10px rgba(90, 143, 10, 0.35);
  /* no transition during hover — instant updates prevent queued-transition jitter */
}

/* smooth return to resting size on mouse-leave only */
.dock-bubble.dock-resetting {
  transition: width 0.3s ease, height 0.3s ease,
              font-size 0.3s ease, margin-bottom 0.3s ease;
}

/* ── Back to top ── */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--lime);
  color: #fff;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
  box-shadow: 0 4px 16px rgba(84, 204, 22, 0.35);
  z-index: 900;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  transform: translateY(-3px);
}

/* Image / video gallery */
.gallery-img {
  width: auto;
  max-width: 100%;
  max-height: 560px;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  display: block;
  cursor: zoom-in;
  margin: 0 auto;
  transition: opacity 0.18s, transform 0.18s;
}

.gallery-img:hover {
  opacity: 0.9;
  transform: scale(1.01);
}

.gallery-video {
  width: auto;
  max-width: 100%;
  max-height: 560px;
  height: auto;
  border-radius: 10px;
  display: block;
  margin: 0 auto;
  background: transparent;
}

/* Multi-item gallery: primary item + horizontal strip */
.gallery-primary {
  margin-bottom: 10px;
}

.gallery-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}

.gallery-strip .gallery-img,
.gallery-strip .gallery-video {
  height: 160px;
  width: auto;
  max-width: none;
  max-height: 160px;
  flex-shrink: 0;
  margin: 0;
}

/* Embedded iframe (e.g. Favoriot dashboard) */
.project-embed-wrap {
  margin-top: 40px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  height: 600px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

.project-embed-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Portrait single media: text 60% left, media 40% right */
.project-inner--side {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 48px;
  align-items: start;
}

/* Section divider accent */
.project-section::before {
  content: '';
  display: block;
  width: 48px;
  height: 4px;
  background: var(--lime);
  border-radius: 2px;
  margin: 0 auto 0;
  opacity: 0;
}

/* ── Loading ── */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 100px 0;
}

.loading-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--lime);
  animation: pulse 1.2s ease-in-out infinite;
}

.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
  0%, 80%, 100% { transform: scale(0.65); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 100px 24px;
  font-size: 1.05rem;
}

/* ── Lightbox ── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.93);
  align-items: center;
  justify-content: center;
}

.lightbox.open { display: flex; }

.lightbox-img {
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 4px;
  user-select: none;
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  background: rgba(255,255,255,0.12);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  color: white;
  font-size: 1.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.lightbox-close:hover { background: var(--lime); }

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.12);
  border: none;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  line-height: 1;
}

.lightbox-nav:hover { background: var(--lime); }
.lightbox-nav.prev { left: 16px; }
.lightbox-nav.next { right: 16px; }

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
  background: var(--white);
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .hero-logo { height: 60px; }
  .hero { padding: 32px 20px 80px; }
  .project-inner { padding: 0 20px; }

  .project-inner--side {
    grid-template-columns: 1fr;
  }

  .lightbox-nav { display: none; }
}
