:root {
  --bg: #0f1115;
  --card: #151922;
  --text: #e8eef9;
  --muted: #a0acc0;
  --brand: #6aa3ff;
  --shadow: rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  background: linear-gradient(180deg, var(--bg) 0%, #0b0d12 100%);
  color: var(--text);
}

.site-header {
  padding: 24px 20px 8px;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  background: linear-gradient(180deg, rgba(15,17,21,0.85), rgba(15,17,21,0.35) 65%, rgba(15,17,21,0));
}
.site-header h1 { margin: 0 0 4px 0; font-size: 28px; }
.subtitle { margin: 0 0 14px 0; color: var(--muted); }
.controls { display: flex; gap: 12px; }

/* Tip button */
.tip-button {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  color: #0b0f15;
  background: linear-gradient(90deg, #ffdd7e, #ffc447);
  border: 1px solid rgba(0,0,0,.25);
  box-shadow: 0 6px 16px rgba(0,0,0,.35);
}

/* Ko-fi widget container */
.kofi-widget-container {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 20;
}

input[type="search"] {
  width: 100%; max-width: 520px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid #242b38; background: #0b0f15; color: var(--text);
  outline: none; transition: border-color .2s ease, box-shadow .2s ease;
}
input[type="search"]::placeholder { color: #6b768a; }
input[type="search"]:focus { border-color: #31405a; box-shadow: 0 0 0 3px rgba(74,118,255,.2); }

.layout { padding: 16px 18px 40px; display: grid; gap: 18px; }
.section { display: grid; gap: 12px; }
.section-title { margin: 8px 2px; font-size: 18px; color: #dbe4f8; }

.hero {
  border: 1px solid #1c2330; border-radius: 16px; overflow: hidden;
  background: linear-gradient(180deg, #0f1420, #0c1018);
  box-shadow: 0 10px 26px var(--shadow);
}
.hero figure { margin: 0; }
.hero img { width: 100%; height: auto; display: block; max-height: 70vh; object-fit: contain; background: #0b0f15; }
.hero figcaption { padding: 10px 14px; border-top: 1px solid #1a2030; color: #d6def0; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px; list-style: none; padding: 0; margin: 0;
}
.card { background: linear-gradient(180deg, #0f1420, #0c1018); border: 1px solid #1c2330; border-radius: 14px; overflow: hidden; box-shadow: 0 8px 22px var(--shadow); transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease; }
.card:hover { transform: translateY(-2px); border-color: #283142; box-shadow: 0 14px 30px rgba(0,0,0,.45); }
.card figure { margin: 0; display: grid; grid-template-rows: 1fr auto; height: 100%; }
.card img { width: 100%; height: 220px; object-fit: cover; display: block; background: #0b0f15; }
.card figcaption { padding: 10px 12px; font-size: 14px; color: #d6def0; border-top: 1px solid #1a2030; }

/* Original badge */
.card { position: relative; }
.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 999px;
  color: #0b0f15;
  background: linear-gradient(90deg, #ffe37a, #ffd24d);
  border: 1px solid rgba(0,0,0,.25);
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}

.site-footer { padding: 18px; color: var(--muted); text-align: center; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(5,7,10,0.9); display: none; align-items: center; justify-content: center; padding: 24px; }
.lightbox.open { display: flex; }
.lightbox img { max-width: min(95vw, 1400px); max-height: 82vh; border-radius: 12px; box-shadow: 0 24px 60px rgba(0,0,0,.65); }
.lightbox-caption { position: absolute; left: 24px; right: 24px; bottom: 20px; text-align: center; color: #e7ecf8; font-size: 16px; }
.lightbox-close { position: absolute; top: 16px; right: 18px; border: 0; background: #121826; color: #e7ecf8; font-size: 28px; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; }

@media (min-width: 640px) { .card img { height: 240px; } }
@media (min-width: 960px) { .card img { height: 260px; } }

/* Subpage navigation cards */
.nav-cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  align-items: stretch;
}
.nav-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid #1c2330;
  background: linear-gradient(180deg, #0f1420, #0c1018);
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 8px 22px var(--shadow);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
  height: 100%;
}
.nav-card:hover {
  transform: translateY(-2px);
  border-color: #283142;
  box-shadow: 0 14px 30px rgba(0,0,0,.45);
}
.nav-card-thumb { width: 100%; height: 140px; object-fit: cover; border-radius: 10px; background: #0b0f15; display: block; }
.nav-card-icon { font-size: 28px; }
.nav-card-title { font-weight: 700; font-size: 16px; }
.nav-card-desc { color: var(--muted); font-size: 14px; flex-grow: 1; }

/* Floating CTA on gallery page */
.floating-cta {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 14px;
  align-items: center;
  max-width: min(420px, 90vw);
  padding: 14px 16px;
  border: 1px solid #1c2330;
  border-radius: 14px;
  background: linear-gradient(180deg, #0f1420, #0c1018);
  box-shadow: 0 12px 30px rgba(0,0,0,.55);
}
.floating-cta p { margin: 0; color: #e7ecf8; }
.floating-cta .cta-btn {
  justify-self: end;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: #0b0f15;
  font-weight: 700;
  background: linear-gradient(90deg, #8de3ff, #6aa3ff);
  border: 1px solid rgba(0,0,0,.25);
  box-shadow: 0 6px 16px rgba(0,0,0,.35);
}
.floating-cta .close-cta {
  position: absolute;
  top: 8px;
  right: 10px;
  border: 0;
  background: #121826;
  color: #e7ecf8;
  font-size: 18px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
}

/* AI Lab form */
.lab-form { display: grid; gap: 10px; }
.lab-form input, .lab-form select, .lab-form textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #242b38;
  background: #0b0f15;
  color: var(--text);
}
.lab-form textarea {
  resize: vertical;
}
.lab-actions { display: flex; align-items: center; gap: 12px; }
.lab-actions button {
  padding: 10px 14px;
  border: 1px solid #1c2330;
  border-radius: 10px;
  background: linear-gradient(90deg, #86a6ff, #6aa3ff);
  color: #0b0f15;
  font-weight: 700;
  cursor: pointer;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* AI Lab preview */
.lab-preview { margin: 0; display: grid; gap: 8px; }
.lab-preview img { width: 100%; max-width: 680px; max-height: 60vh; object-fit: contain; border-radius: 12px; background: #0b0f15; box-shadow: 0 10px 26px var(--shadow); display: block; }
.lab-preview figcaption { color: var(--muted); }
.lab-preview [hidden] { display: none !important; }
.lab-right .lab-preview { margin-bottom: var(--lab-actions-h, 0px); }
.lab-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.lab-left, .lab-right { display: grid; gap: 12px; }
.lab-preview-placeholder {
  display: grid;
  place-items: center;
  height: 280px;
  border-radius: 12px;
  border: 1px dashed #2a3446;
  color: #8ba0bf;
  background: #0b0f15;
}
@media (min-width: 900px) {
  .lab-grid { grid-template-columns: 1fr 1fr; align-items: start; }
  .lab-preview img { max-width: 100%; }
}
