/* ============================================================
   REAL OBJECT TYPOGRAPHY GENERATOR — style.css
   Design: Dark editorial with amber/gold accents, geometric grid
   Fonts: Bebas Neue (display) + DM Sans (body)
   ============================================================ */

/* ── 1. CSS CUSTOM PROPERTIES ─────────────────────────────── */
:root {
  --bg:           #0a0a0d;
  --surface:      #111116;
  --glass:        rgba(255,255,255,0.04);
  --glass-border: rgba(255,255,255,0.09);
  --accent:       #e8a830;        /* amber gold */
  --accent-dim:   rgba(232,168,48,0.15);
  --accent-glow:  rgba(232,168,48,0.35);
  --text-primary: #f0ede8;
  --text-muted:   rgba(240,237,232,0.45);
  --text-faint:   rgba(240,237,232,0.2);
  --error:        #e85530;
  --radius-sm:    8px;
  --radius-md:    14px;
  --radius-lg:    22px;
  --transition:   0.22s cubic-bezier(0.4,0,0.2,1);
  --tile-size:    130px;
  --tile-gap:     12px;
}

/* ── 2. RESET & BASE ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* ── 3. ATMOSPHERIC BACKGROUND ───────────────────────────── */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  /* Subtle dot grid */
  background-image: radial-gradient(circle, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 32px 32px;
}

.bg-glow {
  position: fixed; z-index: 0; pointer-events: none;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.18;
}
.glow-1 {
  width: 600px; height: 600px;
  background: #e8a830;
  top: -200px; left: -200px;
}
.glow-2 {
  width: 500px; height: 500px;
  background: #3055c8;
  bottom: -150px; right: -150px;
}
.glow-3 {
  width: 400px; height: 400px;
  background: #e85530;
  top: 40%; left: 55%;
  opacity: 0.08;
}

/* ── 4. LAYOUT ────────────────────────────────────────────── */
.container {
  position: relative; z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px 16px;
}

/* ── 5. HEADER ────────────────────────────────────────────── */
.site-header {
  text-align: center;
  margin-bottom: 48px;
}

.header-badge {
  display: inline-block;
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(232,168,48,0.3);
  padding: 5px 14px;
  border-radius: 100px;
  margin-bottom: 20px;
}

.site-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(52px, 10vw, 96px);
  line-height: 0.92;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  margin-bottom: 16px;
}
.site-title .accent { color: var(--accent); }

.site-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 300;
  letter-spacing: 0.01em;
}

/* ── 6. GLASSMORPHISM CONTROL CARD ───────────────────────── */
.control-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 20px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.03),
    0 24px 64px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.08);
}

/* ── 7. THEME ROW ─────────────────────────────────────────── */
.theme-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.label-text {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.25em;
  color: var(--text-muted);
  flex-shrink: 0;
}

.theme-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.theme-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.theme-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.18);
}
.theme-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}
.theme-icon { font-size: 15px; }

/* ── 8. DIVIDER ───────────────────────────────────────────── */
.divider {
  width: 100%; height: 1px;
  background: var(--glass-border);
  margin: 22px 0;
}

/* ── 9. INPUT ROW ─────────────────────────────────────────── */
.input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
}

.input-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
}

#wordInput {
  width: 100%;
  height: 52px;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 26px;
  letter-spacing: 0.12em;
  padding: 0 56px 0 18px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  text-transform: uppercase;
}
#wordInput::placeholder {
  color: var(--text-faint);
  font-size: 20px;
  letter-spacing: 0.08em;
}
#wordInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim), 0 0 20px var(--accent-glow);
}
#wordInput.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(232,85,48,0.15);
  animation: shake 0.35s ease;
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

.char-count {
  position: absolute;
  right: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint);
  pointer-events: none;
  transition: color var(--transition);
}
.char-count.warn { color: var(--accent); }

/* ── 10. BUTTONS ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: white;
  opacity: 0;
  transition: opacity 0.15s;
}
.btn:active::after { opacity: 0.06; }

.btn-primary {
  background: var(--accent);
  color: #0a0a0d;
}
.btn-primary:hover {
  background: #f0b840;
  box-shadow: 0 0 24px var(--accent-glow);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.2);
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-download:hover {
  background: rgba(255,255,255,0.08);
  color: var(--accent);
  border-color: rgba(232,168,48,0.4);
}

/* ── 11. TOOLBAR ──────────────────────────────────────────── */
.toolbar {
  display: none; /* shown via JS after generation */
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
  animation: fadeSlideDown 0.3s ease;
}
.toolbar.visible { display: flex; }

@keyframes fadeSlideDown {
  from { opacity:0; transform:translateY(-8px); }
  to   { opacity:1; transform:translateY(0); }
}

.view-toggle {
  display: flex;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}

.view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.view-btn.active {
  background: rgba(255,255,255,0.09);
  color: var(--text-primary);
}
.view-btn:hover:not(.active) { color: var(--text-primary); }

/* ── 12. OUTPUT SECTION ───────────────────────────────────── */
.output-section {
  min-height: 200px;
  position: relative;
  /* No flex here — children stack normally, empty-state centers itself */
}

/* ── 13. EMPTY STATE ──────────────────────────────────────── */
.empty-state {
  text-align: center;
  color: var(--text-faint);
  padding: 48px 24px;
  transition: opacity 0.3s;
  /* Always centered regardless of parent */
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.empty-state.hidden { opacity: 0; pointer-events: none; display: none; }
.empty-icon {
  font-size: 36px;
  margin-bottom: 16px;
  display: block;
  animation: spin 8s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.empty-state p {
  font-size: 14px;
  line-height: 1.7;
}
.empty-state strong { color: var(--accent); }

/* ── 14. LOADER ───────────────────────────────────────────── */
.loader {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px;
}
.loader.visible { display: flex; }

.loader-ring {
  width: 40px; height: 40px;
  border: 2.5px solid rgba(232,168,48,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loader-text {
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── 15. OUTPUT CONTAINER & TILES ─────────────────────────── */
.output-container {
  width: 100%;
  padding: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--tile-gap);
  /* Glow backdrop for the whole word */
  filter: drop-shadow(0 0 32px rgba(232,168,48,0.12));
}

/* Inline view — horizontal scroll, ALL tiles always visible */
.output-container.inline-view {
  flex-wrap: nowrap;          /* single row */
  overflow-x: auto;           /* scroll when letters overflow */
  overflow-y: visible;
  padding-bottom: 16px;
  justify-content: flex-start; /* start from left, don't clip */
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--accent-dim) transparent;
}
.output-container.inline-view::-webkit-scrollbar { height: 4px; }
.output-container.inline-view::-webkit-scrollbar-track { background: transparent; }
.output-container.inline-view::-webkit-scrollbar-thumb {
  background: var(--accent-dim);
  border-radius: 2px;
}

/* Grid view */
.output-container.grid-view {
  flex-wrap: wrap;
  justify-content: center;
}

/* ── Letter Tile ── */
.letter-tile {
  position: relative;
  flex-shrink: 0;
  width: var(--tile-size);
  height: var(--tile-size);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  background: #111116; /* dark bg while image loads */

  /* Staggered entry animation */
  opacity: 0;
  transform: translateY(24px) scale(0.88);
  animation: tileReveal 0.5s cubic-bezier(0.34,1.56,0.64,1) forwards;

  box-shadow:
    0 0 0 1px rgba(255,255,255,0.07),
    0 8px 28px rgba(0,0,0,0.55);
  transition:
    transform 0.32s cubic-bezier(0.34,1.56,0.64,1),
    box-shadow 0.32s ease;
}

/* ── IMAGE: fills tile perfectly, same size always ── */
.tile-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;       /* crops to fill — no stretch, no empty space */
  object-position: center; /* always centered crop */
  transition: transform 0.4s ease;
}
.letter-tile:hover .tile-img {
  transform: scale(1.08);  /* subtle zoom on hover */
}

/* Scale the inner SVG to fill the CSS tile size (SVG mode fallback) */
.letter-tile svg {
  width: 100% !important;
  height: 100% !important;
  border-radius: inherit;
}

@keyframes tileReveal {
  to { opacity:1; transform:translateY(0) scale(1); }
}

.letter-tile:hover {
  transform: translateY(-8px) scale(1.08) rotate(-1.5deg);
  box-shadow:
    0 0 0 1.5px rgba(232,168,48,0.6),
    0 20px 48px rgba(0,0,0,0.65),
    0 0 40px rgba(232,168,48,0.28);
  z-index: 10;
}

/* ── 16. TOAST NOTIFICATION ───────────────────────────────── */
.toast {
  position: fixed;
  bottom: 32px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(20,20,24,0.92);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: 100px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 9999;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── 17. RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 680px) {
  .container { padding: 32px 16px 60px; }

  .site-title { font-size: clamp(44px, 14vw, 72px); }

  .control-card { padding: 20px 18px; }

  .input-row { flex-direction: column; }
  .input-wrapper { min-width: 0; }
  .btn { width: 100%; justify-content: center; }

  :root {
    --tile-size: 80px;
    --tile-gap: 8px;
  }

  .tile-label { font-size: 17px; }

  .toolbar { flex-direction: column; align-items: flex-start; }
  .btn-download { width: 100%; justify-content: center; }
}

@media (max-width: 400px) {
  :root {
    --tile-size: 68px;
    --tile-gap: 6px;
  }
}

/* ── MISSING IMAGE FALLBACK TILE ────────────────────────── */
.tile-missing {
  background: #1a1a22;
  border: 1px dashed rgba(232,168,48,0.3);
}
.tile-fallback {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
}
.tile-fallback-letter {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 48px;
  color: rgba(232,168,48,0.4);
  line-height: 1;
}
.tile-fallback-hint {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.2);
  text-transform: uppercase;
}

/* ── Letter label at bottom of tile ── */
/* .tile-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 28px 6px 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, transparent 100%);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 26px;
  letter-spacing: 0.05em;
  color: #fff;
  text-align: center;
  line-height: 1;
  text-shadow: 0 1px 8px rgba(0,0,0,0.9);
  pointer-events: none;
} */

@media (max-width: 680px) {
  .container { padding: 32px 16px 60px; }
  .site-title { font-size: clamp(44px, 14vw, 72px); }
  .control-card { padding: 20px 18px; }
  .input-row { flex-direction: column; }
  .input-wrapper { min-width: 0; }
  .btn { width: 100%; justify-content: center; }
  :root {
    --tile-size: 80px;
    --tile-gap: 8px;
  }
  .tile-label { font-size: 17px; }
  .toolbar { flex-direction: column; align-items: flex-start; }
  .btn-download { width: 100%; justify-content: center; }
  .theme-buttons { gap: 6px; }
  .theme-btn { padding: 6px 10px; font-size: 12px; }
}

@media (max-width: 400px) {
  :root {
    --tile-size: 68px;
    --tile-gap: 6px;
  }
}
/* ── FOOTER ─────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 16px 24px 20px;   /* kam padding — upar aa jayega */
  font-size: 13px;
  font-weight: 500;
  color: rgba(240,237,232,0.5);   /* thoda zyada visible */
  letter-spacing: 0.05em;
}
.footer-heart {
  font-size: 14px;
  animation: heartbeat 1.8s ease infinite;
  display: inline-block;
  vertical-align: 0.2px;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  14%       { transform: scale(1.3); }
  28%       { transform: scale(1); }
  42%       { transform: scale(1.2); }
  56%       { transform: scale(1); }
}
.footer-name {
  font-style: italic;
  letter-spacing: 0.06em;
}