/* ================================================================
   DOCKERFILE GENERATOR — PREMIUM UI
   Design language: "build layers" — every surface reads like an
   image being assembled, layer by layer, the same way Docker
   builds a container. Docker-blue + violet AI accent on near-black.
   ================================================================
   TABLE OF CONTENTS
   1.  Tokens
   2.  Reset & base
   3.  Ambient background
   4.  Header
   5.  Hero + signature stack visual
   6.  Upload card / dropzone
   7.  Folder summary
   8.  Generate button
   9.  Build console (loading state)
   10. Error state
   11. Empty state
   12. Results grid — code card
   13. Results grid — quick start card
   14. Fullscreen overlay
   15. Toasts
   16. Responsive
   17. Reduced motion
   ================================================================ */

/* ============================================================
   1. TOKENS
   ============================================================ */
:root {
  /* ---- Ink scale (near-black base) ---- */
  --ink-0: #f7f8f9;
  --ink-1: #d7dade;
  --ink-2: #9aa1ab;
  --ink-3: #6b7280;
  --ink-4: #454b54;
  --ink-5: #2a2e35;
  --ink-6: #1a1d22;
  --ink-7: #101317;
  --ink-8: #08090b;

  /* ---- Surfaces (glass) ---- */
  --surface-0: rgba(255,255,255,0.025);
  --surface-1: rgba(255,255,255,0.05);
  --surface-2: rgba(255,255,255,0.08);
  --surface-3: rgba(255,255,255,0.12);
  --glass-blur: blur(20px) saturate(160%);
  --glass-blur-heavy: blur(32px) saturate(180%);

  /* ---- Borders ---- */
  --border-0: rgba(255,255,255,0.06);
  --border-1: rgba(255,255,255,0.10);
  --border-2: rgba(255,255,255,0.18);

  /* ---- Semantic bg/text ---- */
  --bg: var(--ink-8);
  --bg-panel: var(--ink-7);
  --text: var(--ink-0);
  --text-soft: var(--ink-1);
  --text-muted: var(--ink-2);
  --text-faint: var(--ink-3);

  /* ---- Brand accents ----
     Docker blue is the primary action color; violet is the
     "AI detection" color used for anything the model inferred. */
  --docker-blue: #2496ed;
  --docker-blue-light: #4fb2ff;
  --docker-blue-dim: rgba(36,150,237,0.14);
  --docker-blue-glow: rgba(36,150,237,0.35);

  --ai-violet: #8b5cf6;
  --ai-violet-light: #a78bfa;
  --ai-violet-dim: rgba(139,92,246,0.14);

  --cyan: #22d3ee;

  --success: #2dd4a7;
  --warning: #f5a623;
  --error: #f2555a;
  --error-dim: rgba(242,85,90,0.12);

  /* ---- Type ---- */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Fira Code", monospace;

  --text-xs: 11.5px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-md: 17px;
  --text-lg: 21px;
  --text-xl: 27px;
  --text-2xl: 36px;
  --text-3xl: clamp(38px, 5.6vw, 60px);

  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semi: 600;
  --weight-bold: 700;
  --weight-black: 800;

  /* ---- Spacing ---- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px; --sp-20: 80px;

  /* ---- Radius ---- */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px;
  --r-2xl: 28px; --r-pill: 999px;

  /* ---- Shadow ---- */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.45);
  --shadow-lg: 0 24px 64px rgba(0,0,0,0.55);
  --shadow-xl: 0 40px 100px rgba(0,0,0,0.65);
  --shadow-blue-glow: 0 0 0 1px rgba(36,150,237,0.25), 0 12px 40px rgba(36,150,237,0.18);

  /* ---- Motion ---- */
  --ease: cubic-bezier(0.22,1,0.36,1);
  --ease-spring: cubic-bezier(0.34,1.56,0.64,1);
  --ease-in-out: cubic-bezier(0.65,0,0.35,1);
  --dur-fast: 140ms;
  --dur-base: 240ms;
  --dur-slow: 420ms;
  --dur-slower: 650ms;

  --header-h: 72px;
}

[data-theme="light"] {
  --ink-0: #14161a; --ink-1: #2c313a; --ink-2: #5a6270; --ink-3: #838b98;
  --ink-4: #c3c9d1; --ink-5: #dde1e6; --ink-6: #eceef1; --ink-7: #f5f6f8; --ink-8: #ffffff;
  --surface-0: rgba(10,15,25,0.025); --surface-1: rgba(10,15,25,0.045);
  --surface-2: rgba(10,15,25,0.07); --surface-3: rgba(10,15,25,0.1);
  --border-0: rgba(10,15,25,0.06); --border-1: rgba(10,15,25,0.1); --border-2: rgba(10,15,25,0.16);
  --bg: var(--ink-8); --bg-panel: var(--ink-7);
  --text: var(--ink-0); --text-soft: var(--ink-1); --text-muted: var(--ink-2); --text-faint: var(--ink-3);
  --docker-blue-dim: rgba(36,150,237,0.08);
  --ai-violet-dim: rgba(139,92,246,0.08);
  --error-dim: rgba(242,85,90,0.08);
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; scroll-behavior: smooth; }
[data-theme="light"] html { color-scheme: light; }

body {
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--dur-slow) var(--ease), color var(--dur-slow) var(--ease);
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
img, svg { display: block; max-width: 100%; }
::selection { background: var(--docker-blue-dim); color: var(--docker-blue-light); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

.hidden { display: none !important; }

:focus-visible {
  outline: 2px solid var(--docker-blue);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ============================================================
   3. AMBIENT BACKGROUND
   ============================================================ */
.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 55% at 50% 10%, black 25%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 10%, black 25%, transparent 100%);
}
[data-theme="light"] .bg-grid { opacity: 0.5; }

.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  will-change: transform;
}
.blob-a {
  width: 640px; height: 640px;
  top: -260px; left: -120px;
  background: radial-gradient(circle, rgba(36,150,237,0.16) 0%, transparent 72%);
  animation: driftA 24s ease-in-out infinite;
}
.blob-b {
  width: 560px; height: 560px;
  top: -160px; right: -180px;
  background: radial-gradient(circle, rgba(139,92,246,0.12) 0%, transparent 72%);
  animation: driftB 30s ease-in-out infinite;
}
.blob-c {
  width: 420px; height: 420px;
  bottom: -220px; left: 30%;
  background: radial-gradient(circle, rgba(34,211,238,0.07) 0%, transparent 72%);
  animation: driftA 20s ease-in-out infinite reverse;
}
@keyframes driftA {
  0%,100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(50px,30px) scale(1.06); }
}
@keyframes driftB {
  0%,100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(-40px,40px) scale(0.96); }
}

#containerField { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.55; }

/* ============================================================
   4. HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 var(--sp-8);
  background: rgba(8,9,11,0.6);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-0);
}
[data-theme="light"] .site-header { background: rgba(255,255,255,0.7); }

.brand { display: flex; align-items: center; gap: var(--sp-3); }

.brand-mark {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, var(--docker-blue) 0%, #1463a3 100%);
  box-shadow: 0 6px 20px rgba(36,150,237,0.4);
  flex-shrink: 0;
}
.brand-icon { width: 22px; height: 22px; fill: #fff; }

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-name { font-size: var(--text-sm); font-weight: var(--weight-bold); letter-spacing: -0.01em; }
.brand-sub { font-size: 10.5px; color: var(--text-faint); }

.header-actions { display: flex; align-items: center; gap: var(--sp-2); }

.header-link {
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 var(--sp-4);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  background: var(--surface-0);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease-spring);
}
.header-link:hover { background: var(--surface-1); border-color: var(--border-2); color: var(--text); transform: translateY(-1px); }
.header-link.icon-only { width: 38px; padding: 0; justify-content: center; }
.header-link i { font-size: 13px; }

/* ============================================================
   5. HERO + SIGNATURE STACK VISUAL
   ============================================================ */
.layout-shell {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--sp-8);
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-5);
  padding: var(--sp-16) 0 var(--sp-12);
}

.animate-in {
  animation: heroIn var(--dur-slower) var(--ease-spring) both;
  animation-delay: var(--d, 0ms);
}
@keyframes heroIn {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-badge {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--border-1);
  border-radius: var(--r-pill);
  background: var(--surface-1);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.01em;
}
.pulse-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--docker-blue-light);
  box-shadow: 0 0 0 0 rgba(36,150,237,0.6);
  animation: dotPulse 2s ease-out infinite;
}
@keyframes dotPulse {
  0% { box-shadow: 0 0 0 0 rgba(36,150,237,0.55); }
  70% { box-shadow: 0 0 0 8px rgba(36,150,237,0); }
  100% { box-shadow: 0 0 0 0 rgba(36,150,237,0); }
}

.hero-title {
  font-size: var(--text-3xl);
  font-weight: var(--weight-black);
  letter-spacing: -0.03em;
  line-height: 1.06;
  max-width: 760px;
}
.hero-title-accent {
  position: relative;
  display: inline-block;
  background: linear-gradient(100deg, var(--docker-blue-light), var(--ai-violet-light) 70%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-underline {
  position: absolute;
  left: 0; right: 0; bottom: -10px;
  width: 100%; height: 14px;
  overflow: visible;
}
.hero-underline path {
  fill: none;
  stroke: var(--docker-blue);
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0.55;
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  animation: drawUnderline 1.1s var(--ease) 0.5s forwards;
}
@keyframes drawUnderline { to { stroke-dashoffset: 0; } }

.hero-subtitle {
  font-size: var(--text-md);
  color: var(--text-muted);
  max-width: 540px;
  line-height: 1.65;
}

/* ---- Signature element: assembling Dockerfile layer stack ---- */
.hero-visual { margin-top: var(--sp-6); perspective: 1200px; }

.stack-scene {
  position: relative;
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  width: min(92vw, 480px);
  padding: var(--sp-5) var(--sp-5) var(--sp-6);
  border-radius: var(--r-xl);
  border: 1px solid var(--border-1);
  background: linear-gradient(180deg, var(--surface-1), var(--surface-0));
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-lg);
}

.stack-layer {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-soft);
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  animation: layerRise var(--dur-slow) var(--ease-spring) forwards;
  animation-delay: calc(var(--i) * 260ms + 400ms);
}
.stack-layer--final {
  border-color: rgba(36,150,237,0.5);
  background: var(--docker-blue-dim);
  color: var(--docker-blue-light);
  box-shadow: 0 0 24px rgba(36,150,237,0.18);
}
@keyframes layerRise {
  0% { opacity: 0; transform: translateY(14px) scale(0.97); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.stack-glow {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 60px rgba(36,150,237,0.06);
}

/* ============================================================
   6. UPLOAD CARD / DROPZONE
   ============================================================ */
.tool-zone {
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
  padding-bottom: var(--sp-20);
}

.upload-card {
  border-radius: var(--r-2xl);
  border: 1px solid var(--border-1);
  background: linear-gradient(165deg, var(--surface-1) 0%, var(--surface-0) 100%);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-8);
  animation: heroIn var(--dur-slower) var(--ease-spring) 260ms both;
}

.upload-card-inner { display: flex; flex-direction: column; gap: var(--sp-5); }

.upload-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-2);
  padding: var(--sp-12) var(--sp-6);
  border-radius: var(--r-xl);
  border: 1.5px dashed var(--border-2);
  background: var(--surface-0);
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--dur-base) var(--ease), background var(--dur-base) var(--ease),
              transform var(--dur-base) var(--ease-spring);
}
.upload-dropzone:hover {
  border-color: rgba(36,150,237,0.45);
  background: var(--docker-blue-dim);
}
.upload-dropzone.drag-active {
  border-color: var(--docker-blue);
  background: var(--docker-blue-dim);
  transform: scale(1.012);
  box-shadow: var(--shadow-blue-glow);
}
.upload-dropzone.has-folder {
  border-style: solid;
  border-color: rgba(45,212,167,0.4);
}

.dropzone-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(36,150,237,0.10), transparent 65%);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease);
  pointer-events: none;
}
.upload-dropzone.drag-active .dropzone-glow,
.upload-dropzone:hover .dropzone-glow { opacity: 1; }

.dz-icon {
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  color: var(--docker-blue-light);
  font-size: 26px;
  margin-bottom: var(--sp-2);
  transition: transform var(--dur-base) var(--ease-spring);
}
.upload-dropzone:hover .dz-icon,
.upload-dropzone.drag-active .dz-icon { transform: translateY(-4px) scale(1.06); }

.dz-title { font-size: var(--text-md); font-weight: var(--weight-semi); color: var(--text); }
.dz-sub { font-size: var(--text-sm); color: var(--text-muted); max-width: 380px; }

.btn-choose {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  margin-top: var(--sp-3);
  height: 42px; padding: 0 var(--sp-6);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease-spring),
              box-shadow var(--dur-fast) var(--ease);
}
.btn-choose:hover { background: var(--surface-3); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-choose:active { transform: translateY(0) scale(0.97); }

.dz-hint { font-size: 11.5px; color: var(--text-faint); margin-top: var(--sp-1); }

/* ============================================================
   7. FOLDER SUMMARY
   ============================================================ */
.folder-summary {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-1);
  background: var(--surface-1);
  animation: heroIn var(--dur-base) var(--ease-spring) both;
}
.fs-icon {
  width: 44px; height: 44px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md);
  background: rgba(45,212,167,0.12);
  color: var(--success);
  font-size: 18px;
}
.fs-meta { flex: 1; min-width: 0; }
.fs-name {
  font-size: var(--text-sm); font-weight: var(--weight-semi); color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fs-stats {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px;
}
.fs-stats i { margin-right: 4px; opacity: 0.7; }
.fs-dot { opacity: 0.4; }
.fs-clear {
  width: 32px; height: 32px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  color: var(--text-faint);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.fs-clear:hover { background: var(--error-dim); color: var(--error); }

.upload-status {
  min-height: 18px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
}
.upload-status.status-error { color: var(--error); }
.upload-status.status-ok { color: var(--success); }

/* ============================================================
   8. GENERATE BUTTON
   ============================================================ */
.btn-generate {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  height: 56px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--docker-blue) 0%, #6f4de8 130%);
  color: #fff;
  font-size: var(--text-md);
  font-weight: var(--weight-semi);
  overflow: hidden;
  box-shadow: 0 10px 32px rgba(36,150,237,0.35);
  transition: transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-base) var(--ease);
}
.btn-generate:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 44px rgba(36,150,237,0.48);
}
.btn-generate:not(:disabled):active { transform: translateY(0) scale(0.98); }
.btn-generate:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

.btn-generate-glow {
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.22), transparent);
  transform: translateX(-120%);
  transition: transform 0.7s var(--ease);
}
.btn-generate:not(:disabled):hover .btn-generate-glow { transform: translateX(120%); }

.btn-generate-content { display: inline-flex; align-items: center; gap: 10px; position: relative; z-index: 1; }

.btn-spinner {
  display: none;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  position: relative; z-index: 1;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-generate.is-loading .btn-generate-content { display: none; }
.btn-generate.is-loading .btn-spinner { display: inline-block; }

/* ============================================================
   9. BUILD CONSOLE — loading state (distinct signature animation)
   ============================================================ */
.build-console {
  border-radius: var(--r-2xl);
  border: 1px solid var(--border-1);
  background: linear-gradient(165deg, var(--surface-1), var(--surface-0));
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-10) var(--sp-8);
  animation: heroIn var(--dur-base) var(--ease-spring) both;
}
.build-console-inner {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-6);
}

/* Stacked "image layers" that fill left-to-right, one at a time,
   like docker build steps completing — deliberately different
   from a spinner or orbiting rings. */
.build-visual { position: relative; width: 100%; max-width: 360px; }
.build-layers { display: flex; flex-direction: column; gap: 8px; }

.build-layer {
  position: relative;
  height: 14px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  overflow: hidden;
  width: calc(100% - (var(--layer-index, 0) * 22px));
}
.build-layer[data-layer="0"] { --layer-index: 0; }
.build-layer[data-layer="1"] { --layer-index: 1; }
.build-layer[data-layer="2"] { --layer-index: 2; }
.build-layer[data-layer="3"] { --layer-index: 3; }
.build-layer[data-layer="4"] { --layer-index: 4; }

.build-layer::after {
  content: '';
  position: absolute; inset: 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--docker-blue), var(--ai-violet-light));
  box-shadow: 0 0 14px rgba(36,150,237,0.5);
  animation: layerFill 2.6s var(--ease-in-out) infinite;
}
.build-layer[data-layer="0"]::after { animation-delay: 0s; }
.build-layer[data-layer="1"]::after { animation-delay: 0.3s; }
.build-layer[data-layer="2"]::after { animation-delay: 0.6s; }
.build-layer[data-layer="3"]::after { animation-delay: 0.9s; }
.build-layer[data-layer="4"]::after { animation-delay: 1.2s; }
@keyframes layerFill {
  0% { width: 0%; opacity: 0.7; }
  45% { width: 100%; opacity: 1; }
  70% { width: 100%; opacity: 1; }
  100% { width: 100%; opacity: 0.35; }
}

.build-scan {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 40px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  animation: scanMove 2.6s linear infinite;
  pointer-events: none;
}
@keyframes scanMove {
  0% { transform: translateX(-40px); }
  100% { transform: translateX(360px); }
}

.build-message {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text-soft);
  min-height: 22px;
  transition: opacity var(--dur-base) var(--ease);
}
.build-message.fade { opacity: 0; }

.build-progress {
  width: 100%; max-width: 360px;
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  overflow: hidden;
}
.build-progress-fill {
  height: 100%;
  width: 6%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--docker-blue), var(--ai-violet-light));
  transition: width 0.6s var(--ease-in-out);
}

.build-terminal {
  width: 100%; max-width: 420px;
  min-height: 78px;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--border-1);
  background: rgba(0,0,0,0.35);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--success);
  text-align: left;
  overflow: hidden;
  white-space: pre-wrap;
  line-height: 1.7;
}
.term-caret { animation: caretBlink 0.9s step-end infinite; color: var(--text-muted); }
@keyframes caretBlink { 50% { opacity: 0; } }

/* ============================================================
   10. ERROR STATE
   ============================================================ */
.error-panel {
  display: flex; align-items: flex-start; gap: var(--sp-4);
  padding: var(--sp-6);
  border-radius: var(--r-xl);
  border: 1px solid rgba(242,85,90,0.3);
  background: linear-gradient(165deg, rgba(242,85,90,0.10), rgba(242,85,90,0.03));
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  animation: shakeIn var(--dur-slow) var(--ease-spring) both;
}
@keyframes shakeIn {
  0% { opacity: 0; transform: translateX(-6px); }
  50% { transform: translateX(4px); }
  100% { opacity: 1; transform: translateX(0); }
}
.error-icon {
  width: 44px; height: 44px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md);
  background: rgba(242,85,90,0.15);
  color: var(--error);
  font-size: 18px;
}
.error-body { flex: 1; min-width: 0; }
.error-title { font-size: var(--text-base); font-weight: var(--weight-semi); color: var(--text); margin-bottom: 4px; }
.error-message { font-size: var(--text-sm); color: var(--text-muted); line-height: 1.6; word-break: break-word; }
.btn-retry {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 var(--sp-4);
  border: 1px solid rgba(242,85,90,0.4);
  border-radius: var(--r-md);
  background: rgba(242,85,90,0.12);
  color: var(--error);
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  flex-shrink: 0;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease-spring);
}
.btn-retry:hover { background: rgba(242,85,90,0.2); transform: translateY(-1px); }
.btn-retry:active { transform: translateY(0) scale(0.96); }
/* ============================================================
   DOCKERFILE GENERATOR - WHY SECTION
   Prefix: dfg-why
   ============================================================ */

.dfg-why{
    --why-card-bg: rgba(255,255,255,.03);
    --why-card-bg-hover: rgba(255,255,255,.05);

    --why-border: rgba(255,255,255,.06);
    --why-border-hover: rgba(255,255,255,.12);

    --why-heading:#fff;
    --why-sub:rgba(255,255,255,.52);

    --why-label:#f4f4f5;
    --why-desc:rgba(255,255,255,.48);

    --why-icon-bg:rgba(255,255,255,.045);
    --why-icon-border:rgba(255,255,255,.08);
    --why-icon-color:rgba(255,255,255,.72);

    --why-radius-card:16px;
    --why-radius-icon:12px;
}

/* ========================================================= */

.dfg-why{
    width:100%;
    max-width:980px;
    margin:5rem auto 3rem;
    padding:0 1.5rem;
}

.dfg-why-heading{
    margin:0;
    text-align:center;
    font-size:clamp(2rem,3vw,2.6rem);
    font-weight:700;
    color:var(--why-heading);
    letter-spacing:-.03em;
}

.dfg-why-sub{
    max-width:640px;
    margin:.85rem auto 2.8rem;
    text-align:center;
    font-size:1rem;
    line-height:1.8;
    color:var(--why-sub);
}

/* ========================================================= */

.dfg-why-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:1.25rem;
}

/* ========================================================= */

.dfg-why-card{
    background:var(--why-card-bg);
    border:1px solid var(--why-border);
    border-radius:var(--why-radius-card);
    padding:1.35rem;
    display:flex;
    flex-direction:column;
    transition:
        background .25s ease,
        border-color .25s ease,
        transform .25s ease,
        box-shadow .25s ease;
}

.dfg-why-card:hover{
    background:var(--why-card-bg-hover);
    border-color:var(--why-border-hover);
    transform:translateY(-4px);
    box-shadow:0 18px 40px rgba(0,0,0,.22);
}

/* ========================================================= */

.dfg-why-icon{
    width:42px;
    height:42px;
    border-radius:var(--why-radius-icon);
    background:var(--why-icon-bg);
    border:1px solid var(--why-icon-border);
    display:flex;
    align-items:center;
    justify-content:center;
    margin-bottom:1rem;
    flex-shrink:0;
}

.dfg-why-icon svg{
    width:18px;
    height:18px;
    color:var(--why-icon-color);
}

/* ========================================================= */

.dfg-why-label{
    margin:0 0 .8rem;
    font-size:.82rem;
    font-weight:700;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--why-label);
}

.dfg-why-desc{
    margin:0;
    font-size:.96rem;
    line-height:1.8;
    color:var(--why-desc);
}

.dfg-why-desc code{
    padding:2px 6px;
    border-radius:6px;
    background:rgba(255,255,255,.06);
    font-size:.88em;
    font-family:monospace;
}

.dfg-why-desc kbd{
    padding:2px 6px;
    border-radius:6px;
    background:rgba(255,255,255,.08);
    border:1px solid rgba(255,255,255,.08);
    font-size:.82em;
    font-family:inherit;
}

/* ========================================================= */

@media (max-width:900px){

    .dfg-why-grid{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }

}

@media (max-width:640px){

    .dfg-why{
        margin:4rem auto 2rem;
        padding:0 1rem;
    }

    .dfg-why-heading{
        font-size:1.85rem;
    }

    .dfg-why-sub{
        font-size:.95rem;
    }

    .dfg-why-grid{
        grid-template-columns:1fr;
    }

}
/* ============================================================
   11. EMPTY STATE
   ============================================================ */
.empty-panel {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--sp-3);
  padding: var(--sp-16) var(--sp-6);
  border-radius: var(--r-2xl);
  border: 1px dashed var(--border-1);
  color: var(--text-muted);
  animation: heroIn var(--dur-slow) var(--ease-spring) 340ms both;
}
.empty-illustration { color: var(--text-faint); animation: floatY 4s ease-in-out infinite; margin-bottom: var(--sp-2); }
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.empty-svg { width: 120px; height: 90px; }
.empty-svg rect { fill: var(--surface-2); stroke: var(--border-2); stroke-width: 1; }
.empty-svg path { stroke: var(--border-2); stroke-width: 1.5; fill: none; }
.empty-panel h3 { font-size: var(--text-md); font-weight: var(--weight-semi); color: var(--text-soft); }
.empty-panel p { font-size: var(--text-sm); max-width: 360px; }

/* ============================================================
   12. RESULTS GRID — CODE CARD
   ============================================================ */
.results-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: var(--sp-6);
  align-items: start;
  animation: heroIn var(--dur-slow) var(--ease-spring) both;
}

.result-card {
  border-radius: var(--r-xl);
  border: 1px solid var(--border-1);
  background: linear-gradient(165deg, var(--surface-1), var(--surface-0));
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: box-shadow var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}
.result-card:hover { border-color: var(--border-2); box-shadow: var(--shadow-lg); }

.result-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-0);
  background: rgba(0,0,0,0.15);
  flex-wrap: wrap; gap: var(--sp-2);
}
.rc-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rc-dot { width: 10px; height: 10px; border-radius: 50%; }
.rc-dot--red { background: #f2555a; }
.rc-dot--yellow { background: #f5a623; }
.rc-dot--green { background: #2dd4a7; }
.rc-name { font-size: var(--text-sm); font-weight: var(--weight-semi); color: var(--text-soft); margin-left: 4px; }
.rc-title > i { color: var(--docker-blue-light); font-size: 14px; }

.rc-actions { display: flex; align-items: center; gap: 4px; }
.rc-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px;
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  background: var(--surface-0);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: var(--weight-medium);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease-spring);
}
.rc-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-2); transform: translateY(-1px); }
.rc-btn:active { transform: translateY(0) scale(0.94); }
.rc-btn.icon-only { width: 30px; padding: 0; justify-content: center; }
.rc-btn.copied { background: rgba(45,212,167,0.15); border-color: rgba(45,212,167,0.4); color: var(--success); }
.rc-btn.active { background: var(--docker-blue-dim); border-color: rgba(36,150,237,0.4); color: var(--docker-blue-light); }

.rc-btn.bookmarked {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.45);
  color: var(--ai-violet-light);
}
.rc-btn.bookmarked i::before {
  font-weight: 900; /* switches fa-regular → fa-solid glyph */
}

.code-scroll { max-height: 440px; overflow: auto; background: rgba(0,0,0,0.35); }
.code-block {
  margin: 0;
  padding: var(--sp-5);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.85;
  color: var(--ink-1);
  white-space: pre;
  counter-reset: line;
}
.code-block.wrap-on { white-space: pre-wrap; word-break: break-word; }

.code-block .code-line {
  display: block;
  counter-increment: line;
  padding-left: 3.2em;
  position: relative;
  border-radius: 4px;
}
.code-block .code-line:hover { background: rgba(255,255,255,0.035); }
.code-block .code-line::before {
  content: counter(line);
  position: absolute;
  left: 0; width: 2.4em;
  text-align: right;
  color: var(--text-faint);
  font-size: 11.5px;
  user-select: none;
}

/* Syntax tokens */
.tok-instr { color: var(--docker-blue-light); font-weight: 600; }
.tok-str   { color: #c3e88d; }
.tok-flag  { color: var(--ai-violet-light); }
.tok-cmt   { color: var(--text-faint); font-style: italic; }
.tok-num   { color: #f5a623; }

.result-card-footer {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-4);
  border-top: 1px solid var(--border-0);
  font-size: 11.5px;
  color: var(--text-faint);
}
.result-card-footer i { margin-right: 4px; }

/* ============================================================
   13. RESULTS GRID — QUICK START CARD
   ============================================================ */
.qs-progress {
  font-size: 11px;
  font-weight: var(--weight-semi);
  color: var(--text-faint);
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--surface-1);
  border: 1px solid var(--border-1);
}

.qs-list {
  list-style: none;
  padding: var(--sp-2) var(--sp-4) var(--sp-4);
  display: flex;
  flex-direction: column;
}

.qs-item {
  position: relative;
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  animation: heroIn var(--dur-base) var(--ease-spring) both;
}
.qs-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 15px; top: 40px; bottom: -12px;
  width: 1.5px;
  background: var(--border-1);
}

.qs-check {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border-2);
  background: var(--surface-1);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint);
  font-size: 12px;
  transition: background var(--dur-base) var(--ease-spring), border-color var(--dur-base) var(--ease),
              color var(--dur-base) var(--ease), transform var(--dur-base) var(--ease-spring);
  z-index: 1;
}
.qs-item.done .qs-check {
  background: var(--success);
  border-color: var(--success);
  color: #04241b;
  transform: scale(1.08);
}

.qs-body { flex: 1; min-width: 0; padding-top: 2px; }
.qs-step-title { font-size: var(--text-sm); font-weight: var(--weight-semi); color: var(--text); margin-bottom: 6px; }

.qs-cmd-row {
  display: flex; align-items: center; gap: var(--sp-2);
  border-radius: var(--r-md);
  border: 1px solid var(--border-1);
  background: rgba(0,0,0,0.32);
  padding: 8px 10px;
}
.qs-cmd {
  flex: 1; min-width: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--docker-blue-light);
  white-space: nowrap;
  overflow-x: auto;
}
.qs-cmd::before { content: '$ '; color: var(--text-faint); }
.qs-copy {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease-spring);
}
.qs-copy:hover { background: var(--surface-2); color: var(--text); }
.qs-copy.copied { color: var(--success); transform: scale(1.15); }

/* ============================================================
   14. FULLSCREEN OVERLAY
   ============================================================ */
.fullscreen-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(2,3,4,0.85);
  backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-8);
  animation: fadeIn var(--dur-base) var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.fullscreen-box {
  width: min(1000px, 100%);
  max-height: 88vh;
  display: flex; flex-direction: column;
  border-radius: var(--r-xl);
  border: 1px solid var(--border-2);
  background: var(--ink-7);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: scaleIn var(--dur-base) var(--ease-spring);
}
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.fs-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border-0);
}
.fs-toolbar-title { font-size: var(--text-sm); font-weight: var(--weight-semi); display: flex; align-items: center; gap: 8px; }
.fullscreen-code { flex: 1; overflow: auto; max-height: none; }

/* ============================================================
   15. TOASTS
   ============================================================ */
.toast-stack {
  position: fixed; bottom: var(--sp-6); right: var(--sp-6); z-index: 300;
  display: flex; flex-direction: column; gap: var(--sp-2);
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 260px; max-width: 360px;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--border-1);
  background: rgba(16,19,23,0.95);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  pointer-events: all;
  animation: toastIn 0.32s var(--ease-spring) both;
}
.toast.leaving { animation: toastOut 0.22s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(0.95); } }
.toast-icon { flex-shrink: 0; font-size: 15px; }
.toast.toast-success .toast-icon { color: var(--success); }
.toast.toast-error .toast-icon { color: var(--error); }
.toast.toast-info .toast-icon { color: var(--docker-blue-light); }

/* ============================================================
   16. RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
  .results-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .site-header { padding: 0 var(--sp-5); }
  .layout-shell { padding: 0 var(--sp-5); }
  .hero { padding: var(--sp-12) 0 var(--sp-8); }
  .hero-title { font-size: var(--text-2xl); }
  .upload-card { padding: var(--sp-5); }
  .upload-dropzone { padding: var(--sp-8) var(--sp-4); }
  .btn-generate { height: 52px; font-size: var(--text-base); }
  .build-console { padding: var(--sp-8) var(--sp-5); }
  .header-link span { display: none; }
  .header-link { padding: 0; width: 38px; justify-content: center; }
}

@media (max-width: 480px) {
  .brand-sub { display: none; }
  .hero-badge { font-size: 10.5px; text-align: left; }
  .rc-actions .rc-btn span { display: none; }
  .rc-actions .rc-btn { width: 30px; padding: 0; justify-content: center; }
  .qs-cmd { font-size: 11.5px; }
}

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