/* ==========================================================================
   TinyPDF — Shared Stylesheet
   ========================================================================== */

/* ---- Custom Properties ---- */
:root {
  /* Palette */
  --blue:        #2563eb;
  --blue-hover:  #1d4ed8;
  --blue-light:  #eff6ff;
  --blue-glow:   rgba(37, 99, 235, .12);

  /* Neutrals */
  --bg:          #f8f9fb;
  --surface:     #ffffff;
  --text:        #1e293b;
  --text-mid:    #475569;
  --text-muted:  #94a3b8;
  --border:      #e2e8f0;
  --border-hover:#94a3b8;

  /* Feedback */
  --success:     #16a34a;
  --error:       #dc2626;
  --error-bg:    #fef2f2;

  /* Typography */
  --font:        'Roboto', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius:      12px;
  --radius-sm:   8px;

  /* Layout */
  --max-w:       680px;
  --header-h:    56px;
}

/* ---- Dark Mode ---- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #0f172a;
    --surface:    #1e293b;
    --text:       #f1f5f9;
    --text-mid:   #94a3b8;
    --text-muted: #64748b;
    --border:     #334155;
    --border-hover:#475569;
    --blue-light: #1e293b;
    --blue-glow:  rgba(37, 99, 235, .25);
    --error-bg:   #450a0a;
  }
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--blue); text-decoration: none; transition: color .15s; }
a:hover { color: var(--blue-hover); }

img { max-width: 100%; height: auto; display: block; }

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  display: flex;
  align-items: center;
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
}

.header-inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
}

.logo span { color: var(--blue); }

.nav { display: flex; gap: 20px; align-items: center; }
.nav a {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-mid);
  transition: color .15s;
}
.nav a:hover { color: var(--text); }

/* Mobile hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text);
}
.nav-toggle svg { width: 24px; height: 24px; }

@media (max-width: 600px) {
  .nav-toggle { display: block; }
  .nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px 24px;
    gap: 12px;
  }
  .nav.open { display: flex; }
}

/* ---- Main ---- */
main {
  flex: 1;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px 24px 48px;
}

/* ---- Hero ---- */
.hero {
  text-align: center;
  margin-bottom: 32px;
}

.hero h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.15;
  margin-bottom: 12px;
}

.hero p {
  font-size: clamp(1rem, 2.5vw, 1.125rem);
  color: var(--text-mid);
  max-width: 480px;
  margin: 0 auto;
}

/* ---- Drop Zone ---- */
.drop-zone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .25s, background .25s, box-shadow .25s;
  user-select: none;
  -webkit-user-select: none;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--blue);
  background: var(--blue-light);
  box-shadow: 0 0 0 4px var(--blue-glow);
}

.drop-zone.dragover { cursor: pointer; }

.drop-zone-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: var(--text-muted);
  transition: color .25s;
}

.drop-zone:hover .drop-zone-icon,
.drop-zone.dragover .drop-zone-icon { color: var(--blue); }

.drop-zone-text {
  font-size: 1rem;
  color: var(--text-mid);
  margin-bottom: 6px;
}

.drop-zone-text a { text-decoration: underline; text-underline-offset: 2px; }

.drop-zone-hint {
  font-size: .8125rem;
  color: var(--text-muted);
}

#file-input { display: none; }

/* ---- Progress ---- */
.progress-section {
  margin-top: 24px;
  display: none;
}

.progress-section.visible { display: block; }

.progress-bar-track {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--blue);
  border-radius: 3px;
  transition: width .2s ease;
}

.progress-label {
  font-size: .875rem;
  color: var(--text-mid);
  text-align: center;
}

.progress-status {
  font-size: .8125rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
}

/* ---- Download CTA ---- */
.download-cta {
  margin-top: 24px;
  text-align: center;
  display: none;
}

.download-cta.visible { display: block; }

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--blue);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, transform .1s;
}

.download-btn:hover {
  background: var(--blue-hover);
  color: #fff;
}

.download-btn:active { transform: scale(.98); }

.download-btn svg { width: 18px; height: 18px; }

.download-hint {
  font-size: .8125rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ---- Message (error / info) ---- */
.message {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  display: none;
}

.message.visible { display: block; }

.message.error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid color-mix(in srgb, var(--error) 20%, transparent);
}

.message.info {
  background: var(--blue-light);
  color: var(--blue);
  border: 1px solid color-mix(in srgb, var(--blue) 15%, transparent);
}

/* ---- FAQ ---- */
.faq {
  margin-top: 48px;
  border-top: 1px solid var(--border);
  padding-top: 32px;
}

.faq h2 {
  font-size: 1.375rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 20px;
  letter-spacing: -.02em;
}

.faq details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--surface);
  transition: border-color .2s;
}

.faq details[open] { border-color: var(--blue); }

.faq summary {
  cursor: pointer;
  font-weight: 600;
  font-size: .9375rem;
  list-style: none;
  padding: 14px 40px 14px 16px;
  position: relative;
  transition: color .15s;
}

.faq summary:hover { color: var(--blue); }

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: translateY(-65%) rotate(45deg);
  transition: transform .2s;
}

.faq details[open] summary::after {
  transform: translateY(-65%) rotate(135deg);
}

.faq p {
  padding: 0 16px 14px;
  font-size: .875rem;
  color: var(--text-mid);
  line-height: 1.6;
}

/* ---- Legal Pages ---- */
.legal h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -.02em;
}

.legal .updated {
  font-size: .875rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.legal h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 28px 0 8px;
}

.legal p, .legal ol {
  font-size: .9375rem;
  color: var(--text-mid);
  margin-bottom: 12px;
}

.legal ol { padding-left: 1.5rem; }
.legal li { margin-bottom: 6px; }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  text-align: center;
  font-size: .8125rem;
  color: var(--text-muted);
}

.footer-nav {
  margin-bottom: 8px;
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.footer-nav a {
  color: var(--text-mid);
  font-weight: 500;
  font-size: .8125rem;
  padding: 0 4px;
}

.footer-nav a:hover { color: var(--text); }

.footer-nav .sep { color: var(--border); padding: 0; }

/* ---- Utility ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Animations ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn .3s ease forwards; }

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

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

/* ---- Download Arrow Animation ---- */
@keyframes downloadBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

.download-arrow {
  display: inline-block;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  color: var(--blue);
  animation: downloadBounce 1.5s var(--ease-out) infinite;
}

/* Shown when compression didn't shrink the file (no bounce — nothing to download) */
.no-change-icon {
  display: none;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  color: var(--text-muted);
}

/* ---- Compression Summary ---- */
.compression-summary {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
  margin: 20px auto 24px;
  max-width: 360px;
}

.summary-card {
  flex: 1;
  text-align: center;
  padding: 12px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.summary-card.highlight {
  border-color: var(--success);
  background: color-mix(in srgb, var(--success) 4%, var(--surface));
}

.summary-label {
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.summary-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.summary-card.highlight .summary-value { color: var(--success); }

.summary-ratio {
  flex-shrink: 0;
  font-size: .875rem;
  font-weight: 700;
  color: var(--success);
  padding: 0 4px;
}

.summary-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
  flex-shrink: 0;
}
