/* ============================================= */
/* MIDDLE FINGER BOY - Stylesheet               */
/* Standards-only CSS with modern features      */
/* ============================================= */

:root {
  /* Color palette */
  --bg: #0b1220;
  --panel: rgba(255, 255, 255, 0.95);
  --panelBorder: rgba(15, 23, 42, 0.12);
  --text: #0f172a;
  --muted: rgba(15, 23, 42, 0.65);
  --btn: #1e293b;
  --btnText: #fff;
  --btnGhost: rgba(30, 41, 59, 0.08);
  --primary: #2563eb;
  --primaryHover: #1d4ed8;
  --success: #16a34a;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadowSmall: 0 4px 12px rgba(0, 0, 0, 0.08);
  --radius: 16px;
  --radiusSmall: 12px;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: 'Segoe UI', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(ellipse 1400px 800px at 5% -10%, rgba(59, 157, 255, 0.25), transparent 60%),
    radial-gradient(ellipse 1000px 600px at 95% 15%, rgba(139, 92, 246, 0.15), transparent 55%),
    linear-gradient(175deg, #f0f8ff 0%, #e8f4ff 40%, #f5faff 100%);
  min-height: 100vh;
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 12px;
  padding: 12px 16px;
  background: #fff;
  border: 2px solid var(--text);
  border-radius: var(--radiusSmall);
  font-weight: 700;
  z-index: 100;
  text-decoration: none;
  color: var(--text);
}
.skip-link:focus {
  left: 12px;
}

/* ============================================= */
/* HEADER                                       */
/* ============================================= */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 32px);
  position: sticky;
  top: 0;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.75);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(139, 92, 246, 0.12));
  border: 1px solid rgba(37, 99, 235, 0.2);
  font-size: 22px;
}

.brand-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text);
}

.brand-subtitle {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 1px;
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ============================================= */
/* MAIN LAYOUT                                  */
/* ============================================= */
.layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(360px, 1fr);
  gap: 24px;
  padding: 24px clamp(16px, 4vw, 32px) 32px;
  max-width: 1280px;
  margin: 0 auto;
}

/* Panel (controls sidebar) */
.panel {
  background: var(--panel);
  border: 1px solid var(--panelBorder);
  border-radius: calc(var(--radius) + 4px);
  padding: 20px;
  box-shadow: var(--shadow);
  height: fit-content;
  position: sticky;
  top: 90px;
}

.panel-title {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text);
}

/* ============================================= */
/* FORM CONTROLS                                */
/* ============================================= */
.controls {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.1px;
  color: var(--text);
}

.help {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.help code {
  font-family: ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', 'Courier New', monospace;
  font-weight: 700;
  font-size: 11px;
  background: rgba(30, 41, 59, 0.07);
  padding: 2px 6px;
  border-radius: 6px;
}

.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radiusSmall);
  border: 1.5px solid rgba(30, 41, 59, 0.15);
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  outline: none;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.input::placeholder {
  color: rgba(30, 41, 59, 0.4);
}

.range {
  width: 100%;
  height: 8px;
  accent-color: var(--primary);
  cursor: pointer;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1.5px solid rgba(30, 41, 59, 0.15);
  background: rgba(30, 41, 59, 0.06);
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--radiusSmall);
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
}

.btn:hover {
  background: rgba(30, 41, 59, 0.1);
  border-color: rgba(30, 41, 59, 0.2);
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primaryHover);
  border-color: var(--primaryHover);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover {
  background: rgba(30, 41, 59, 0.06);
  border-color: rgba(30, 41, 59, 0.1);
}

/* Details/Summary */
.details {
  margin-top: 4px;
}

.details summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  padding: 4px 0;
}

.details summary:hover {
  color: var(--text);
}

.examples {
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.examples code {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.05);
  border: 1px solid rgba(30, 41, 59, 0.08);
  font-family: ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', 'Courier New', monospace;
  font-weight: 600;
  font-size: 12px;
  word-break: break-all;
}

/* Note box */
.note {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radiusSmall);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(139, 92, 246, 0.06));
  border: 1px solid rgba(37, 99, 235, 0.15);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.45;
}

/* ============================================= */
/* STAGE (artwork area)                         */
/* ============================================= */
.stage {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.canvas {
  margin: 0;
  width: 100%;
  max-width: 680px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.6));
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: calc(var(--radius) + 8px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.art {
  display: block;
  width: 100%;
  height: auto;
}

.caption {
  margin: 0;
  padding: 14px 18px 18px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.5);
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.caption code {
  font-family: ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', 'Courier New', monospace;
  background: rgba(30, 41, 59, 0.07);
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
}

/* ============================================= */
/* FOOTER                                       */
/* ============================================= */
.site-footer {
  padding: 20px clamp(16px, 4vw, 32px) 28px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.footer-note {
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
}

.footer-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.06);
  border: 1px solid rgba(30, 41, 59, 0.08);
  color: var(--muted);
}

/* ============================================= */
/* CLOUD ANIMATION                              */
/* Fixed: Uses inner group for animation,       */
/* wrapper group preserves static position      */
/* ============================================= */
.cloud-inner {
  animation: cloud-drift linear infinite;
  will-change: transform;
}

@keyframes cloud-drift {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(750px);
  }
}

/* Pause animation when motion-off class is on body */
body.motion-off .cloud-inner {
  animation-play-state: paused;
}

/* ============================================= */
/* RESPONSIVE DESIGN                            */
/* ============================================= */
@media (max-width: 920px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .panel {
    position: static;
  }

  .canvas {
    max-width: 600px;
  }
}

@media (max-width: 600px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .layout {
    padding: 16px;
  }

  .panel {
    padding: 16px;
  }

  .canvas {
    border-radius: var(--radius);
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* ============================================= */
/* UTILITY & ENHANCEMENTS                       */
/* ============================================= */

/* Smooth transitions for interactive elements */
.btn, .input {
  transition: all 0.15s ease;
}

/* Focus visible for better keyboard navigation */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Selection color */
::selection {
  background: rgba(37, 99, 235, 0.2);
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .cloud-inner {
    animation: none;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
