:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f7f9fb;
  --panel-bg: #ffffff;
  --panel-border: rgba(0, 0, 0, 0.08);
  --text-primary: #0b0b0b;
  --text-muted: #4b5563;
  --accent: #92c729;
  --accent-hover: #7ead21;
  --accent-soft: rgba(146, 199, 41, 0.12);
  --max-width: 1080px;
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

/* Hide until auth is resolved */
body[data-auth-state="loading"],
body[data-auth-state="redirecting"] {
  visibility: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Open Sans", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  color: var(--text-primary);
  background: var(--bg-primary);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #ffffffcc;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.site-header__inner {
  margin: 0 auto;
  max-width: var(--max-width);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand__logo {
  height: 28px;
  width: auto;
  display: inline-block;
}

.brand__name {
  font-size: 0.95rem;
  color: var(--text-primary);
}

.nav-links {
  display: flex;
  gap: 1.25rem;
  font-size: 0.95rem;
  color: #111827;
}

.nav-links span {
  opacity: 0.65;
}

main {
  flex: 1;
}

.hero {
  position: relative;
  background: linear-gradient(125deg, #ffffff, #f7f9fb);
  padding: clamp(4rem, 10vw, 7rem) 1.5rem;
  box-shadow: inset 0 -80px 80px rgba(0, 0, 0, 0.04);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(680px 340px at 15% 20%, rgba(146, 199, 41, 0.20), transparent 60%),
    radial-gradient(560px 280px at 80% 10%, rgba(146, 199, 41, 0.16), transparent 65%),
    radial-gradient(480px 240px at 70% 80%, rgba(146, 199, 41, 0.12), transparent 65%);
}

.hero__content {
  margin: 0 auto;
  max-width: 760px;
  text-align: center;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 1.5rem 0 1rem;
  font-family: "Poppins", sans-serif;
  font-size: clamp(2.1rem, 5vw, 3.1rem);
  letter-spacing: -0.01em;
}

.hero p {
  margin: 0 auto 2.2rem;
  line-height: 1.7;
  color: var(--text-muted);
  max-width: 620px;
}

.hero__cta {
  display: inline-flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.95rem 2.3rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #0b0b0b;
  font-weight: 600;
  border-radius: 999px;
  letter-spacing: 0.02em;
  border: none;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(146, 199, 41, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hero__cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(146, 199, 41, 0.3);
}

.content-shell {
  margin: -80px auto 0;
  max-width: var(--max-width);
  padding: 0 1.5rem 4rem;
}

.panel-grid {
  display: grid;
  gap: 1.75rem;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.panel {
  position: relative;
  padding: 2.25rem;
  border-radius: 22px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-lg);
  backdrop-filter: none;
  overflow: hidden;
}

/* remove inner accent frame for light theme */
.panel::after { content: none; }

.panel h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-family: "Poppins", sans-serif;
  font-size: 1.6rem;
}

.panel p {
  color: var(--text-muted);
  margin-top: 0;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.panel strong {
  color: var(--accent);
}

/* When downloads are disabled, keep upload panel from stretching too wide */
body[data-can-download="false"] #uploadSection {
  max-width: 640px;
  margin-inline: auto;
}

body[data-can-download="false"] #uploadSection .input-field {
  max-width: 520px;
}

form {
  display: grid;
  gap: 1.25rem;
}

label {
  font-weight: 600;
  color: #111827;
}

input[type="text"],
input[type="file"],
button,
.button-like {
  font: inherit;
}

.input-field {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #ffffff;
  color: var(--text-primary);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.input-field::placeholder {
  color: #9ca3af;
}

.input-field:focus {
  outline: none;
  border-color: var(--accent);
  background: #ffffff;
}

.file-input-wrapper {
  display: grid;
  gap: 0.6rem;
}

#fileInput {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.file-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.95rem 1.6rem;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  background: var(--accent);
  color: #0b0b0b;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 18px rgba(146, 199, 41, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.file-trigger:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(146, 199, 41, 0.28);
}

.subtle-hint {
  font-size: 0.82rem;
  color: #6b7280;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.85rem 1.6rem;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #0b0b0b;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 12px 20px rgba(146, 199, 41, 0.22);
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(146, 199, 41, 0.28);
}

.cli-sections {
  margin-top: 2.5rem;
  display: grid;
  gap: 1.5rem;
}

.cli-card {
  position: relative;
  padding: 1.6rem;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid var(--panel-border);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
}

.cli-card h3 {
  margin-top: 0;
  font-family: "Poppins", sans-serif;
  font-size: 1.2rem;
}

pre {
  margin: 0.75rem 0 0;
  padding: 1rem 1.2rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid rgba(0, 0, 0, 0.06);
  color: #111827;
  font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Monaco, "Courier New",
    monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

code {
  color: var(--accent);
}

.presigned-url-box {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  word-break: break-all;
}

.button--sm {
  padding: 0.45rem 0.8rem;
  border-radius: 10px;
  font-size: 0.8rem;
  box-shadow: 0 6px 12px rgba(146, 199, 41, 0.18);
}

.status-message {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  min-height: 1.3em;
}

.config-warning {
  margin: 1rem auto 0;
  max-width: var(--max-width);
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #f9fafb;
  color: #111827;
}

.status-message--error { color: #b91c1c; }

.status-message--success { color: #166534; }

.share-bubble {
  margin-top: 1rem;
  padding: 1rem 1.2rem;
  border-radius: 14px;
  background: var(--accent-soft);
  border: 1px solid rgba(146, 199, 41, 0.35);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.share-bubble[hidden] {
  display: none;
}

.share-bubble__header {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.share-bubble__text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.share-bubble__close {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
}

.icon-share {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 999px;
  border: 2px solid currentColor;
  position: relative;
}

.icon-share::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -0.25rem;
  width: 2px;
  height: 0.7rem;
  background: currentColor;
  transform: translateX(-50%);
  border-radius: 999px;
}

.icon-share::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -0.35rem;
  width: 0;
  height: 0;
  border-left: 0.25rem solid transparent;
  border-right: 0.25rem solid transparent;
  border-bottom: 0.35rem solid currentColor;
  transform: translateX(-50%);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}

.loading-overlay[hidden] {
  display: none;
}

.loading-overlay__box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 2rem;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.95);
  color: #f9fafb;
  box-shadow: var(--shadow-lg);
  font-size: 0.95rem;
}

.loading-spinner {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 3px solid rgba(249, 250, 251, 0.25);
  border-top-color: #f9fafb;
  animation: loading-spin 0.75s linear infinite;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

footer {
  padding: 2rem 1.5rem 3rem;
  margin-top: 2rem;
  color: #6b7280;
  font-size: 0.85rem;
  background: linear-gradient(
    180deg,
    #ffffff,
    #f7f9fb
  );
}

footer .footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: center;
}

@media (max-width: 768px) {
  .site-header__inner {
    flex-direction: column;
    gap: 0.75rem;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
    gap: 0.85rem;
    font-size: 0.85rem;
  }

  .panel {
    padding: 1.75rem;
  }

  .hero__cta,
  .button {
    width: 100%;
    justify-content: center;
  }
}

@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;
  }
}
