/* ===== TOPLIC MAKERY — design language inspired by AI Makery ===== */

:root {
  --amber: #FBBF25;
  --amber-strong: #F59E0B;
  --amber-text: #B45309; /* amber for text on light surfaces — 4.5:1+ on white */
  --amber-soft: #FEF3C7;
  --ink: #18181b;          /* zinc-900 */
  --ink-2: #3f3f46;        /* zinc-700 */
  --muted: #71717a;        /* zinc-500 */
  --bg: #ffffff;
  --bg-2: #fafafa;         /* zinc-50 */
  --card: #ffffff;
  --card-translucent: rgba(255, 255, 255, 0.9);
  --line: #e4e4e7;         /* zinc-200 */
  --shadow: 0 10px 30px rgba(24, 24, 27, 0.08);
  --shadow-lg: 0 24px 60px rgba(24, 24, 27, 0.16);
  --r-btn: 8px;
  --r-card: 24px;
}

html[data-theme="dark"] {
  --ink: #fafafa;
  --ink-2: #d4d4d8;
  --muted: #a1a1aa;
  --amber-text: #FBBF25;   /* bright amber is readable on dark surfaces */
  --bg: #09090b;           /* zinc-950 */
  --bg-2: #212124;         /* must stay distinct from --card and --line */
  --card: #18181b;
  --card-translucent: rgba(24, 24, 27, 0.88);
  --line: #27272a;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Rubik", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }

button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ===== logo ===== */
.logo { display: inline-flex; align-items: center; gap: 10px; user-select: none; }
.logo-spark { width: 1.5em; height: 1.5em; color: var(--amber); flex: none; }
.logo-text { font-weight: 800; letter-spacing: 0.04em; white-space: nowrap; }
.logo-toplic { color: var(--ink); }
.logo-makery { color: var(--amber-text); }
.logo-big { font-size: clamp(26px, 5vw, 44px); }
.logo-small { font-size: 18px; }

/* ===== buttons ===== */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--amber); color: #18181b;
  border: none; border-radius: var(--r-btn);
  font-weight: 600; font-size: 16px;
  padding: 10px 22px;
  box-shadow: 0 6px 18px rgba(251, 191, 37, 0.35);
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.btn-primary:hover { background: var(--amber-strong); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(245, 158, 11, 0.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-lg { font-size: 20px; padding: 14px 34px; }
.btn-block { width: 100%; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: transparent; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--r-btn);
  font-weight: 500; font-size: 15px; padding: 10px 18px;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.btn-ghost:hover { border-color: var(--amber); background: rgba(251, 191, 37, 0.08); }

.chip-btn {
  background: var(--card-translucent); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-btn);
  font-size: 12px; font-weight: 500; padding: 7px 12px;
  backdrop-filter: blur(6px);
  transition: border-color 0.2s ease, transform 0.15s ease;
}
.chip-btn:hover { border-color: var(--amber); transform: translateY(-1px); }

/* ===== landing ===== */
.landing {
  position: relative; min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 24px;
}

.landing-bg { position: absolute; inset: 0; }
.collage {
  position: absolute; inset: -8vmax; /* viewport-relative bleed so the -4deg rotation never exposes corners */
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  transform: rotate(-4deg) scale(1.06);
  animation: drift 60s linear infinite alternate;
}
@keyframes drift { from { transform: rotate(-4deg) scale(1.06) translateY(-14px); } to { transform: rotate(-4deg) scale(1.06) translateY(14px); } }
.collage .tile {
  border-radius: 18px;
  min-height: 120px;
  opacity: 0.85;
}
.landing-veil {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.65) 100%);
}
html[data-theme="dark"] .landing-veil {
  background: radial-gradient(ellipse at center, rgba(9,9,11,0.35) 0%, rgba(9,9,11,0.8) 100%);
}

.landing-topbar {
  position: absolute; top: 16px; inset-inline-start: 16px;
  display: flex; gap: 8px; z-index: 3;
}

.landing-card {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 28px;
  background: var(--card-translucent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--r-card);
  padding: clamp(28px, 5vw, 56px);
  max-width: 720px; width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.headline {
  margin: 0;
  font-size: clamp(24px, 4.5vw, 40px);
  font-weight: 700; line-height: 1.35;
  letter-spacing: -0.01em;
}
.type-wrap { white-space: nowrap; }
.typeword { color: var(--amber-text); }
.cursor {
  color: var(--amber-text);
  animation: blink 0.9s steps(1) infinite;
  font-weight: 400;
}
@keyframes blink { 50% { opacity: 0; } }

.sub { margin: 0; font-size: clamp(15px, 2.2vw, 19px); color: var(--muted); }

/* ===== studio ===== */
.studio { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: var(--card-translucent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.tabs { display: flex; gap: 4px; background: var(--bg-2); border-radius: 10px; padding: 4px; }
.tab {
  border: none; background: transparent; color: var(--muted);
  font-size: 14px; font-weight: 500; padding: 8px 18px; border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--ink); }
.tab.active { background: var(--amber); color: #18181b; font-weight: 600; }

.count-badge {
  background: var(--ink); color: var(--bg);
  font-size: 11px; font-weight: 700;
  border-radius: 999px; padding: 1px 7px;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* auth */
.auth-area { display: inline-flex; align-items: center; gap: 8px; }
.google-btn { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; padding: 7px 14px; }
.google-btn svg { width: 16px; height: 16px; flex: none; }
.avatar { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--line); display: block; }
.auth-name {
  font-size: 13px; font-weight: 500; color: var(--ink-2);
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 720px) { .auth-name { display: none; } }

.credits {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--amber-soft); color: #92400e;
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 999px; font-size: 14px; font-weight: 700;
  padding: 6px 14px;
  transition: transform 0.15s ease;
}
html[data-theme="dark"] .credits { background: rgba(251, 191, 37, 0.12); color: var(--amber); }
.credits:hover { transform: translateY(-1px); }
.credits-plus { font-weight: 800; opacity: 0.7; }
.credits.bump { animation: bump 0.4s ease; }
@keyframes bump { 30% { transform: scale(1.15); } }

.view { flex: 1; padding: clamp(20px, 4vw, 48px); max-width: 1200px; margin: 0 auto; width: 100%; }

.hero-strip h2 { margin: 0 0 6px; font-size: clamp(22px, 3.4vw, 32px); font-weight: 700; }
.hero-strip p { margin: 0 0 26px; color: var(--muted); font-size: 16px; }

/* filters */
.filters { display: flex; flex-direction: column; gap: 14px; margin-bottom: 26px; }
.search {
  width: 100%; max-width: 380px;
  background: var(--card); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 15px; padding: 10px 16px;
  transition: border-color 0.2s ease;
}
.search:focus { outline: none; border-color: var(--amber-text); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.35); }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink-2);
  border-radius: 999px; font-size: 13px; font-weight: 500; padding: 7px 16px;
  transition: all 0.2s ease;
}
.pill:hover { border-color: var(--amber); }
.pill.active { background: var(--amber); border-color: var(--amber); color: #18181b; font-weight: 600; }

/* grid + cards */
.grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.maker-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex; flex-direction: column;
  text-align: start;
  padding: 0;
}
.maker-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--amber); }

.maker-art {
  height: 140px;
  display: flex; align-items: center; justify-content: center;
  font-size: 52px;
  position: relative;
}
.maker-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.maker-title { font-size: 17px; font-weight: 700; margin: 0; }
.maker-desc { font-size: 13.5px; color: var(--muted); margin: 0; line-height: 1.5; flex: 1; }
.maker-cat {
  align-self: flex-start;
  font-size: 11px; font-weight: 600;
  background: var(--amber-soft); color: #92400e;
  border-radius: 999px; padding: 3px 10px; margin-top: 6px;
}
html[data-theme="dark"] .maker-cat { background: rgba(251, 191, 37, 0.14); color: var(--amber); }

/* my creations */
.grid-mine { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.mine-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-card); overflow: hidden;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.mine-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.mine-meta { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mine-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-actions { display: flex; gap: 4px; }
.icon-btn {
  background: transparent; border: none; font-size: 15px;
  padding: 4px 6px; border-radius: 6px; color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--bg-2); color: var(--ink); }

.empty { text-align: center; padding: 60px 20px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.empty-emoji { font-size: 64px; }
.empty p { color: var(--muted); font-size: 17px; margin: 0; }

/* ===== modal ===== */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(9, 9, 11, 0.55); backdrop-filter: blur(4px); }
.modal-card {
  position: relative; z-index: 1;
  background: var(--card);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 460px;
  max-height: 92vh; overflow-y: auto;
  padding: 28px;
  animation: pop 0.25s ease;
}
@keyframes pop { from { transform: scale(0.94); opacity: 0; } }

.modal-close {
  position: absolute; top: 14px; inset-inline-end: 14px;
  background: var(--bg-2); border: none; border-radius: 8px;
  width: 32px; height: 32px; font-size: 14px; color: var(--muted);
  transition: color 0.15s ease, background 0.15s ease;
}
.modal-close:hover { color: var(--ink); background: var(--line); }

.modal-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.modal-emoji {
  font-size: 34px; width: 64px; height: 64px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 18px;
}
.modal-head h3 { margin: 0 0 2px; font-size: 20px; font-weight: 700; }
.modal-head p { margin: 0; font-size: 13.5px; line-height: 1.45; }

.field { margin-bottom: 16px; }
.field label, .field .label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
.field input {
  width: 100%; background: var(--bg-2); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 15px; padding: 11px 14px;
  transition: border-color 0.2s ease;
}
.field input:focus { outline: none; border-color: var(--amber-text); background: var(--card); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.35); }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  width: 44px; height: 44px; border-radius: 12px;
  border: 2.5px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease;
  padding: 0;
}
.swatch:hover { transform: scale(1.08); }
.swatch.active { border-color: var(--ink); transform: scale(1.08); }

.cost { font-weight: 400; font-size: 14px; opacity: 0.75; }

/* generating step */
#stepGen { text-align: center; padding: 30px 0 10px; }
.gen-anim { position: relative; width: 120px; height: 120px; margin: 0 auto 24px; }
.gen-orb {
  position: absolute; inset: 10px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--amber), #f97316, var(--amber-strong), var(--amber));
  animation: spin 1.6s linear infinite;
  filter: blur(2px);
}
.gen-orb::after {
  content: ""; position: absolute; inset: 10px;
  border-radius: 50%; background: var(--card);
}
@keyframes spin { to { transform: rotate(360deg); } }
.gen-spark { position: absolute; color: var(--amber); font-size: 18px; animation: float 2s ease-in-out infinite; }
.s1 { top: -4px; inset-inline-start: 8px; }
.s2 { bottom: 0; inset-inline-end: 0; animation-delay: 0.5s; }
.s3 { top: 30px; inset-inline-end: -10px; animation-delay: 1s; }
@keyframes float { 50% { transform: translateY(-8px); opacity: 0.5; } }

.gen-status { font-size: 16px; font-weight: 500; min-height: 24px; }
.gen-bar { height: 8px; background: var(--bg-2); border-radius: 999px; overflow: hidden; margin-top: 16px; }
.gen-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--amber), var(--amber-strong)); border-radius: 999px; transition: width 0.3s ease; }

/* result step */
#stepResult { text-align: center; }
#stepResult h3 { margin: 0 0 16px; font-size: 20px; }
.result-frame {
  border-radius: 18px; overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.result-frame img { width: 100%; display: block; }
.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.saved-note { font-size: 12.5px; color: var(--muted); margin: 14px 0 0; }

/* toast */
.toast {
  position: fixed; bottom: 24px; inset-inline-start: 50%;
  transform: translateX(50%);
  background: var(--ink); color: var(--bg);
  font-size: 14px; font-weight: 500;
  border-radius: 12px; padding: 12px 22px;
  z-index: 100; box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s ease;
}
html[dir="ltr"] .toast { transform: translateX(-50%); }
@keyframes toast-in { from { opacity: 0; translate: 0 10px; } }

.hidden-canvas { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* focus visibility for keyboard users */
button:focus-visible, .maker-card:focus-visible, .tab:focus-visible, .pill:focus-visible, .swatch:focus-visible {
  outline: 2px solid var(--amber-text);
  outline-offset: 2px;
}

/* responsive */
@media (max-width: 720px) {
  .topbar { justify-content: center; }
  .tabs { order: 3; width: 100%; justify-content: center; }
  .landing-card { gap: 20px; }
  .collage { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 460px) {
  /* keep the topbar to two rows: spark icon only, wordmark hidden */
  .logo-small .logo-text { display: none; }
  .logo-small .logo-spark { width: 26px; height: 26px; }
}

@media (max-height: 600px) {
  /* short/landscape viewports: keep the corner chips clear of the card */
  .landing { align-items: flex-start; padding-top: 72px; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  .collage, .cursor, .gen-orb, .gen-spark, .credits.bump { animation: none; }
  .modal-card, .toast { animation: none; }
  .btn-primary, .chip-btn, .maker-card, .credits { transition: none; }
  .btn-primary:hover, .maker-card:hover, .chip-btn:hover, .credits:hover { transform: none; }
}
