/* ================================
   Design Tokens
================================ */
:root{
  /* Palette */
  --bg-1:#0f172a;          /* slate-900 (header/footer) */
  --bg-2:#111827;          /* gray-900  (header/footer) */
  --bg-body-1:#1f2937;     /* slate-800 (page body) */
  --bg-body-2:#334155;     /* slate-700 (page body) */
  --card:#0b1222ee;
  --text:#e5e7eb;          /* gray-200 */
  --muted:#9ca3af;         /* gray-400 */
  --accent:#8b5cf6;        /* violet-500 */
  --accent-2:#22d3ee;      /* cyan-400 */
  --ring:#a78bfa;          /* violet-300 */

  /* Light-scheme text and glass */
  --text-on-light:#0f172a;
  --muted-on-light:#334155;
  --glass-light: rgba(255,255,255,.9);
  --border-light: rgba(0,0,0,.12);

  /* Reused backgrounds */
  --bg-gradient: linear-gradient(160deg, var(--bg-body-1), var(--bg-body-2));
  --header-gradient: linear-gradient(160deg, var(--bg-1), var(--bg-2));
}

html { color-scheme: dark; }

/* ================================
   Base / Reset
================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; background: none; }
body{
  margin: 0;
  min-height: 100%;
  position: relative;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

/* Background canvas */
body::before{
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(70vmax 55vmax at 20% 10%, #3b475a 0%, transparent 60%),
    var(--bg-gradient);
  background-repeat: no-repeat;
}

/* Accessibility */
:focus-visible{
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 8px;
}
.sr-only{
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0; white-space: nowrap;
}

/* ================================
   Layout
================================ */
main{ max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }
.intro{ color: var(--muted); margin-bottom: 10px; }

.grid{
  display: grid;
  gap: 22px;
  grid-template-columns: 1fr;
}
@media (min-width: 640px){
  .grid{ grid-template-columns: 1fr 1fr; }
}

/* ================================
   Header / Nav
================================ */
header{
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(8px);
  background: var(--header-gradient);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.nav{
  display: flex; align-items: center; gap: 16px;
  max-width: 1100px; margin: 0 auto; padding: 14px 20px;
}
.logo{ height: 40px; width: auto; display: block; }
.brand{ font-weight: 800; letter-spacing: .2px; }
.grow{ flex: 1; }

.search{
  display: flex; align-items: center; gap: 10px; flex: 1; max-width: 520px;
}
.search input{
  width: 100%;
  background: #0b1222;
  color: var(--text);
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  outline: none;
}
.search input:focus{
  border-color: var(--ring);
  box-shadow: 0 0 0 6px rgba(167,139,250,.14);
}

/* ================================
   Card + Content
================================ */
.card{
  display: flex; flex-direction: column; overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  box-shadow: 0 12px 36px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.06);
}

.content{ display: grid; gap: 8px; padding: 14px 14px 16px; }
.title{ color: #fff; font-weight: 700; font-size: 18px; line-height: 1.2; }
.desc{ color: var(--muted); font-size: 14px; }

.tags{ display: flex; flex-wrap: wrap; gap: 8px; color: #cbd5e1; }
.tag{
  font-size: 12px; padding: 3px 8px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.04);
  border-radius: 999px;
}

.files{ display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.file{
  font-size: 13px; color: var(--text); text-decoration: none;
  padding: 6px 10px; border-radius: 10px;
  border: 1px dashed rgba(255,255,255,.18);
  background: rgba(255,255,255,.03);
}

.empty{
  color: var(--muted); text-align: center; margin-top: 10px;
  padding: 40px; border-radius: 16px;
  border: 1px dashed rgba(255,255,255,.18);
}

/* ================================
   Carousel
================================ */
.carousel{
  position: relative; width: 100%;
  display: flex; align-items: center; justify-content: center;
  height: clamp(260px, 25vw, 1000px);
  overflow: hidden; background: #0b1222;
}
.carousel img{
  display: block; width: 100%; height: 100%; object-fit: contain;
}

/* Caption chip */
.caption{
  position: absolute; left: 12px; right: 12px; bottom: 42px;
  display: inline-flex; align-items: center; gap: 8px;
  width: max-content; max-width: calc(100% - 24px);
  padding: 6px 10px; font-size: 13px; font-weight: 600;
  color: #eee; border-radius: 999px;
  background: rgba(15,23,42,.75);
  border: 1px solid rgba(255,255,255,.14);
}
.caption-text{ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swatch{
  width: 12px; height: 12px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.5);
}

/* Controls */
.controls{
  position: absolute; inset: 0; padding: 0 6px;
  display: flex; align-items: center; justify-content: space-between;
  pointer-events: none;
}
.btn-icon{
  pointer-events: auto;
  display: grid; place-items: center;
  height: 36px; width: 36px; cursor: pointer;
  color: var(--text);
  background: rgba(15,23,42,.7);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  transition: transform .12s ease;
}
.btn-icon:hover{ transform: translateY(-1px); }

/* Dots */
.dots{
  position: absolute; bottom: 10px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 6px;
}
.dot{ width: 7px; height: 7px; border-radius: 999px; background: rgba(255,255,255,.3); }
.dot.active{ background: var(--accent); }

/* ================================
   CTAs / Footer
================================ */
.cta{ display: flex; justify-content: center; margin: 24px 20px 40px; }

.btn-order{
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 18px; font-weight: 700; letter-spacing: .3px; color: #fff;
  text-decoration: none; border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(180deg, var(--accent), #6d28d9);
  box-shadow: 0 10px 24px rgba(0,0,0,.25);
  transition: transform .15s ease, filter .15s ease;
}
.btn-order:hover{ transform: translateY(-1px); filter: brightness(1.05); }
.btn-order:active{ transform: translateY(0) scale(.99); }

footer{
  padding: 32px 20px; text-align: center; font-size: 14px;
  color: var(--muted);
  background: var(--header-gradient);
  border-top: 1px solid rgba(255,255,255,.08);
}

/* ================================
   Light-on-dark override helper
================================ */
.on-light,
.on-light .caption,
.on-light .btn-icon{
  color: var(--text-on-light);
}
.on-light .caption{
  background: var(--glass-light);
  border: 1px solid var(--border-light);
}
.on-light .dots .dot{ background: rgba(0,0,0,.25); }
.on-light .dots .dot.active{ background: var(--accent); }

/* ================================
   Media Queries
================================ */

/* Small screens */
@media (max-width: 640px){
  body::before{
    background:
      radial-gradient(70vmax 55vmax at 20% 10%, #1f2937 0%, transparent 60%),
      var(--bg-gradient);
  }
  .title{ color: #fff; font-weight: 800; }
  .desc{ color: #e2e8f0; font-size: 15px; line-height: 1.5; }
  .tag, .file{ border-color: rgba(255,255,255,.24); color: #e5e7eb; }

  /* Slightly brighter text on small screens */
  :root{ --text:#f8fafc; --muted:#cbd5e1; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  body::before{ background: var(--bg-gradient); }
}

/* System light scheme */
@media (prefers-color-scheme: light){
  .caption,
  .btn-icon{
    background: var(--glass-light);
    border: 1px solid var(--border-light);
    color: var(--text-on-light);
  }
  .swatch{ border-color: rgba(0,0,0,.45); }
  .dots .dot{ background: rgba(0,0,0,.25); }
  .dots .dot.active{ background: var(--accent); }
}

/* High-contrast / forced colors */
@media (forced-colors: active){
  .carousel{ background: Canvas; }
  .caption, .btn-icon{
    background: Canvas;
    color: CanvasText;
    border: 1px solid CanvasText;
  }
  .dots .dot{ background: GrayText; }
  .dots .dot.active{ background: Highlight; }
}
