:root {
  --bg: #0f1115;
  --panel: #181b22;
  --panel-2: #20242d;
  --text: #e8eaed;
  --muted: #9aa3b0;
  --accent: #4f8cff;
  --accent-2: #3a73e0;
  --danger: #ff6b6b;
  --ok: #46c98b;
  --radius: 14px;
  --space: 16px;
}

* { box-sizing: border-box; }

/* The `hidden` attribute must always win, even over explicit display rules
   like `.lightbox { display: flex }` (otherwise the overlay shows on top of
   the page and blocks interaction). */
[hidden] { display: none !important; }

/* Lucide inline icons: scale with font-size by default. */
.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.125em;
  flex: none;
}

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 18px 80px;
}

/* Hero / home */
.hero { text-align: center; margin: 24px 0 28px; }
.logo {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.logo .icon { color: var(--accent); }
.logo.small { font-size: 1rem; color: var(--muted); }
.logo.small .icon { color: var(--muted); }
.hero h1 {
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  margin: 14px 0 10px;
  letter-spacing: -0.02em;
}
.lede { color: var(--muted); max-width: 560px; margin: 0 auto; line-height: 1.5; }

/* Cards */
.card {
  background: var(--panel);
  border: 1px solid #262b35;
  border-radius: var(--radius);
  padding: 22px;
  max-width: 480px;
  margin: 0 auto 18px;
}
.card h2 { margin: 0 0 16px; font-size: 1.25rem; }
.card.success { border-color: #2c5; }

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 12px 0 6px;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #2c323d;
  background: var(--panel-2);
  color: var(--text);
  font-size: 1rem;
}
input:focus { outline: 2px solid var(--accent); border-color: transparent; }

button,
.btn-link {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 18px;
}
button:hover { background: var(--accent-2); }
button:disabled { opacity: 0.6; cursor: default; }

#create-form button,
#join-form button { width: 100%; margin-top: 18px; }

.btn-link {
  display: inline-block;
  margin-top: 16px;
  text-align: center;
}
.btn-link:hover { text-decoration: none; }

.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; }
.copy-row button { background: var(--panel-2); border: 1px solid #2c323d; }
.copy-row button:hover { background: #2a3038; }

.share-sep { margin-top: 16px; }
.share-sep summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.88rem;
  user-select: none;
}
.share-sep summary:hover { color: var(--text); }

.error { color: var(--danger); margin-top: 12px; }
.warn { color: #ffcf6b; font-size: 0.9rem; margin-top: 16px; }
.muted { color: var(--muted); font-size: 0.9rem; }

/* Trip header */
.trip-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.trip-header h1 { margin: 6px 0 2px; font-size: 1.7rem; letter-spacing: -0.02em; }

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}
.upload-btn:hover { background: var(--accent-2); }

.upload-status {
  background: var(--panel);
  border: 1px solid #262b35;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  color: var(--muted);
}
.up-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.up-pct { font-variant-numeric: tabular-nums; color: var(--text); }
.up-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
}
.up-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.2s ease;
}

/* Gallery grid */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.tile {
  position: relative;
  padding: 0;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid #262b35;
}
.tile:hover { background: var(--panel-2); }
.tile-open {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
  cursor: pointer;
}
.tile-open:hover { background: none; }
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tile .noThumb {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}
.tile .noThumb .icon { width: 2.4rem; height: 2.4rem; color: var(--muted); }
.tile .badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.tile .badge .icon { width: 14px; height: 14px; }

/* Per-tile controls: download + delete, top-right, separated */
.tile-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 10px;
}
.tile-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0.85;
}
.tile-btn .icon { width: 16px; height: 16px; }
.tile-btn:hover { opacity: 1; }
.tile-btn.del:hover { background: var(--danger); }
.tile-btn.dl:hover { background: var(--accent); }
.tile .who {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 8px 6px;
  font-size: 0.75rem;
  text-align: left;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.empty { text-align: center; color: var(--muted); margin-top: 40px; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.lb-content {
  max-width: 100%;
  max-height: 82vh;
  display: flex;
}
.lb-content img,
.lb-content video {
  max-width: 100%;
  max-height: 82vh;
  border-radius: 8px;
}
.lb-caption { color: #ccc; margin-top: 14px; font-size: 0.9rem; text-align: center; }
.lb-close {
  position: absolute;
  top: 16px;
  right: 18px;
  background: rgba(255, 255, 255, 0.12);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.lb-close .icon { width: 20px; height: 20px; }

@media (max-width: 560px) {
  .gallery { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .trip-header { align-items: stretch; }
  .upload-btn { justify-content: center; }
}

/* ============================================================
   Landing page
   ============================================================ */

.landing { background: radial-gradient(1200px 600px at 70% -10%, #1b2336 0%, var(--bg) 55%); }

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(15, 17, 21, 0.7);
  border-bottom: 1px solid #1e2430;
}
.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-cta {
  background: var(--accent);
  color: #fff;
  padding: 9px 16px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.9rem;
}
.nav-cta:hover { background: var(--accent-2); text-decoration: none; }

/* Hero */
.lp-hero {
  max-width: 1080px;
  margin: 0 auto;
  padding: 56px 20px 40px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 14px;
}
.lp-hero h1 {
  font-size: clamp(2rem, 5vw, 3.3rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
}
.lp-hero .lede { margin: 0 0 28px; font-size: 1.08rem; max-width: 520px; }

.cta-big {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 15px 28px;
  border-radius: 12px;
  box-shadow: 0 10px 30px -10px rgba(79, 140, 255, 0.7);
}
.cta-big:hover { background: var(--accent-2); text-decoration: none; transform: translateY(-1px); }
.reassure { color: var(--muted); font-size: 0.85rem; margin-top: 12px; }

/* Hero art: a playful tilted photo grid */
.lp-hero__art { display: flex; justify-content: center; }
.mock-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: min(100%, 380px);
  transform: rotate(3deg);
}
.mock-grid .m {
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #232a38, #1a1f2b);
  border: 1px solid #2a3140;
  box-shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.7);
}
.mock-grid .m .icon { width: 42%; height: 42%; color: #aeb6c4; }
.mock-grid .m2 { margin-top: 18px; }
.mock-grid .m6 { margin-top: -14px; }
.mock-grid .m7 { margin-top: 10px; }

/* Sections */
.section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 20px;
}
.section-title {
  text-align: center;
  font-size: 1.7rem;
  letter-spacing: -0.02em;
  margin: 0 0 36px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.step {
  background: var(--panel);
  border: 1px solid #232a36;
  border-radius: var(--radius);
  padding: 26px 22px;
}
.step-num {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
}
.step h3 { margin: 0 0 8px; font-size: 1.15rem; }
.step p { margin: 0; color: var(--muted); line-height: 1.5; }

.features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.feature {
  background: var(--panel);
  border: 1px solid #232a36;
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
}
.feature-ico { font-size: 2rem; margin-bottom: 10px; color: var(--accent); }
.feature h3 { margin: 0 0 8px; font-size: 1.05rem; }
.feature p { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }

/* Create section centers the card */
.create-section { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.create-section .card { width: 100%; }
.create-section #create-form button { width: 100%; margin-top: 18px; }

/* Footer */
.footer {
  border-top: 1px solid #1e2430;
  text-align: center;
  padding: 36px 20px 48px;
  color: var(--muted);
}
.footer p { margin: 10px 0 0; font-size: 0.9rem; }

@media (max-width: 820px) {
  .lp-hero { grid-template-columns: 1fr; padding-top: 36px; gap: 28px; }
  .lp-hero__art { order: -1; }
  .mock-grid { width: min(80%, 300px); }
  .steps { grid-template-columns: 1fr; }
  .features { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 460px) {
  .features { grid-template-columns: 1fr; }
}
