/* AI Thumbnail Creator shared styles. Tailwind handles utilities; this file owns theme, animation, and canvas UI. */
:root {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-strong: #f1f5f9;
  --text: #101828;
  --muted: #5f6b7a;
  --line: #d9e2ec;
  --accent: #ff3d2e;
  --accent-2: #7c3aed;
  --accent-3: #0891b2;
  --good: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --shadow: 0 18px 45px rgba(15, 23, 42, .12);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1020;
  --surface: #12192b;
  --surface-strong: #1b2437;
  --text: #f8fafc;
  --muted: #b4c0d0;
  --line: #2d3850;
  --shadow: 0 18px 45px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a { color: inherit; text-decoration: none; }

button, input, textarea, select {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(124, 58, 237, .45);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 12px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.skip-link:focus { left: 12px; }

.site-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content { flex: 1; }

.glass-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  background:
    radial-gradient(circle at 25% 20%, #fff7 0 18%, transparent 20%),
    linear-gradient(135deg, #ff3d2e, #ff8a00 46%, #7c3aed);
  box-shadow: 0 10px 24px rgba(255, 61, 46, .32);
}

.nav-link {
  border-radius: 8px;
  color: var(--muted);
  transition: color .2s ease, background .2s ease;
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  color: var(--text);
  background: var(--surface-strong);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 44px;
  padding: .75rem 1rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
  line-height: 1;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease, color .2s ease;
  cursor: pointer;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #ff3d2e, #ff8a00 45%, #7c3aed);
  box-shadow: 0 14px 28px rgba(124, 58, 237, .22);
}

.btn-primary:hover { box-shadow: 0 18px 36px rgba(124, 58, 237, .3); }

.btn-secondary {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
}

.btn-secondary:hover { border-color: color-mix(in srgb, var(--accent-2) 45%, var(--line)); }

.btn-icon {
  width: 42px;
  height: 42px;
  padding: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .35rem .65rem;
  background: var(--surface);
  color: var(--muted);
  font-size: .84rem;
  font-weight: 700;
}

.panel,
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}

.card {
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--accent-2) 38%, var(--line));
}

.hero-wrap {
  position: relative;
  overflow: clip;
  isolation: isolate;
  background:
    linear-gradient(135deg, rgba(255, 61, 46, .11), rgba(124, 58, 237, .09) 55%, rgba(8, 145, 178, .12)),
    var(--bg);
}

.hero-media {
  position: relative;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 24%, rgba(255, 138, 0, .42), transparent 26%),
    radial-gradient(circle at 75% 30%, rgba(124, 58, 237, .35), transparent 24%),
    linear-gradient(135deg, #101828, #273247 55%, #09111f);
  box-shadow: var(--shadow);
}

.hero-thumb {
  position: absolute;
  inset: 48px 34px 70px;
  border: 8px solid rgba(255, 255, 255, .96);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(0,0,0,.18), transparent 38%),
    linear-gradient(135deg, #ff3d2e 0 34%, #111827 34% 70%, #ffcf33 70%);
  transform: rotate(-2deg);
}

.hero-thumb::before {
  content: "MAKE IT POP";
  position: absolute;
  left: 36px;
  bottom: 58px;
  max-width: 62%;
  color: #fff;
  font-size: clamp(2.1rem, 5vw, 4.7rem);
  line-height: .88;
  font-weight: 900;
  text-shadow: 4px 5px 0 #111827;
}

.hero-thumb::after {
  content: "";
  position: absolute;
  right: 54px;
  top: 58px;
  width: 150px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 8px solid #fff;
  background: linear-gradient(135deg, #fde68a, #fb7185);
  box-shadow: 0 0 0 12px rgba(17, 24, 39, .62);
}

.floating-icon {
  position: absolute;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: rgba(255,255,255,.92);
  color: #111827;
  box-shadow: 0 15px 30px rgba(0,0,0,.18);
  animation: drift 5.5s ease-in-out infinite;
}

.float-a { left: 7%; top: 12%; }
.float-b { right: 8%; top: 15%; animation-delay: -1.4s; }
.float-c { right: 18%; bottom: 9%; animation-delay: -2.7s; }

@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(-3deg); }
  50% { transform: translate3d(0, -14px, 0) rotate(4deg); }
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s ease, transform .6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-strong);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.42), transparent);
  animation: shimmer 1.15s infinite;
}

@keyframes shimmer { to { transform: translateX(100%); } }

.sticky-cta {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 45;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 70;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  padding: .8rem 1rem;
  border-radius: 8px;
  color: #fff;
  background: #111827;
  box-shadow: var(--shadow);
  transition: opacity .2s ease, transform .2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(245px, 300px) minmax(0, 1fr) minmax(265px, 330px);
  gap: 1rem;
  align-items: start;
}

.editor-panel {
  max-height: calc(100vh - 110px);
  overflow: auto;
  scrollbar-width: thin;
}

.canvas-shell {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: #111827;
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: var(--shadow);
}

#thumbCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

#thumbCanvas.dragging { cursor: grabbing; }

.template-mini {
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #111827;
}

.template-mini .text {
  position: absolute;
  left: 8%;
  bottom: 12%;
  width: 66%;
  color: #fff;
  font-weight: 900;
  line-height: .92;
  font-size: clamp(.95rem, 2vw, 1.35rem);
  text-shadow: 2px 2px 0 rgba(0,0,0,.85);
}

.tool-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
}

.input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .65rem .75rem;
  color: var(--text);
  background: var(--surface);
}

.input[type="color"] {
  padding: .25rem;
}

.range {
  width: 100%;
  accent-color: var(--accent-2);
}

.drop-zone {
  border: 1.5px dashed color-mix(in srgb, var(--accent-2) 45%, var(--line));
  border-radius: 8px;
  padding: 1rem;
  background: color-mix(in srgb, var(--surface-strong) 75%, transparent);
  text-align: center;
  transition: border-color .2s ease, background .2s ease;
}

.drop-zone.is-over {
  border-color: var(--accent);
  background: rgba(255, 61, 46, .08);
}

.layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .55rem .65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.layer-item.active {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, .15);
}

.gauge {
  position: relative;
  width: 170px;
  height: 170px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--good) var(--score-angle), var(--surface-strong) 0);
}

.gauge::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: var(--surface);
}

.gauge span {
  position: relative;
  font-size: 2.4rem;
  font-weight: 900;
}

.youtube-row {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: .75rem;
  align-items: center;
}

.mini-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  object-fit: cover;
  background: #111827;
}

.sidebar-preview {
  width: 156px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 1rem;
  background: var(--surface-strong);
}

.title-card.good { border-color: rgba(22, 163, 74, .55); }
.title-card.warn { border-color: rgba(217, 119, 6, .55); }
.title-card.bad { border-color: rgba(220, 38, 38, .55); }

.legal-copy p { margin-bottom: 1rem; color: var(--muted); line-height: 1.8; }
.legal-copy h2 { margin-top: 2rem; margin-bottom: .75rem; font-size: 1.5rem; font-weight: 900; }
.legal-copy ul { margin: 0 0 1rem 1.25rem; color: var(--muted); line-height: 1.8; list-style: disc; }

@media (max-width: 1100px) {
  .editor-grid { grid-template-columns: 1fr; }
  .editor-panel { max-height: none; }
}

@media (max-width: 767px) {
  .hero-media { min-height: 300px; }
  .hero-thumb { inset: 42px 20px 64px; }
  .hero-thumb::after { right: 28px; top: 46px; width: 112px; }
  .floating-icon { width: 44px; height: 44px; }
  .sticky-cta { right: 12px; bottom: 12px; }
  .youtube-row { grid-template-columns: 128px minmax(0, 1fr); }
  .sidebar-preview { width: 132px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }
}
