/* =========================================================
   Image Resizer — Stylesheet
   Design tokens: blue→emerald gradient, amber lock accent,
   Space Grotesk display / Inter body / JetBrains Mono data
   ========================================================= */

:root {
  --grad-1: #3B82F6;
  --grad-2: #10B981;
  --accent-amber: #F59E0B;
  --success: #10B981;
  --danger: #EF4444;

  --bg: #F6F8FB;
  --bg-2: #EEF2F7;
  --surface: rgba(255, 255, 255, 0.65);
  --surface-solid: #FFFFFF;
  --border: rgba(15, 23, 42, 0.08);
  --text: #12141C;
  --text-muted: #5B6072;
  --text-faint: #8A8FA3;
  --shadow: 0 8px 30px rgba(31, 41, 76, 0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;

  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0B0E14;
  --bg-2: #0F1320;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-solid: #141826;
  --border: rgba(255, 255, 255, 0.09);
  --text: #E7E9EE;
  --text-muted: #A7ACBC;
  --text-faint: #6B7186;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  transition: background 0.35s ease, color 0.35s ease;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font-family: inherit; }
table { border-collapse: collapse; width: 100%; }
code {
  font-family: var(--font-mono);
  background: var(--bg-2);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.86em;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--grad-1);
  color: #fff;
  padding: 12px 18px;
  border-radius: 0 0 8px 0;
  z-index: 1000;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2.5px solid var(--grad-2);
  outline-offset: 3px;
  border-radius: 4px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--grad-1);
  font-weight: 600;
  margin: 0 0 10px;
}
.eyebrow.center { text-align: center; }

.accent-text {
  background: linear-gradient(120deg, var(--grad-1), var(--grad-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Glassmorphism base */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: var(--shadow);
}

/* =========================================================
   HEADER (sticky top — this is intentional and expected)
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark { display: flex; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; }

.main-nav { display: flex; gap: 28px; }
.main-nav a { text-decoration: none; font-size: 0.94rem; font-weight: 500; color: var(--text-muted); transition: color 0.2s ease; }
.main-nav a:hover { color: var(--text); }

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

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.icon-btn:hover { transform: translateY(-1px); border-color: var(--grad-2); }
.icon-sun, .icon-moon { position: absolute; }
html[data-theme="dark"] .icon-sun,
html:not([data-theme="dark"]) .icon-moon { display: none; }

/* =========================================================
   HERO / TOOL
   ========================================================= */
.hero { position: relative; padding: 64px 24px 80px; overflow: hidden; }

.hero-bg {
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 640px;
  background:
    radial-gradient(600px 320px at 20% 10%, rgba(59, 130, 246, 0.26), transparent 65%),
    radial-gradient(560px 320px at 85% 20%, rgba(16, 185, 129, 0.22), transparent 65%),
    radial-gradient(500px 300px at 50% 60%, rgba(245, 158, 11, 0.12), transparent 65%);
  filter: blur(10px);
  pointer-events: none;
  z-index: 0;
}

.hero-inner { position: relative; z-index: 1; max-width: 880px; margin: 0 auto; text-align: center; }
.hero-copy { margin-bottom: 40px; }

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}

.hero-sub {
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Tool card */
.tool-card { border-radius: var(--radius-lg); padding: 28px; text-align: left; }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 46px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--grad-1);
  background: rgba(59, 130, 246, 0.05);
}
.dropzone.dragover {
  border-color: var(--grad-2);
  background: rgba(16, 185, 129, 0.09);
  transform: scale(1.005);
}

.dropzone-content { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dropzone-icon { color: var(--grad-1); margin-bottom: 8px; animation: floatY 3.4s ease-in-out infinite; }
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.dropzone-title { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; margin: 4px 0 2px; }
.dropzone-sub { color: var(--text-faint); font-size: 0.85rem; margin: 0 0 10px; }
.dropzone-formats { color: var(--text-faint); font-size: 0.8rem; margin-top: 14px; }

/* Loading indicator */
.loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
}
.spinner-lg {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--grad-1);
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 999px; padding: 11px 22px;
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  font-family: var(--font-body);
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(120deg, var(--grad-1), var(--grad-2));
  color: #fff;
  box-shadow: 0 10px 24px rgba(59, 130, 246, 0.3);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 12px 28px rgba(59, 130, 246, 0.4); transform: translateY(-1px); }
.btn-lg { padding: 13px 28px; font-size: 1rem; }

.btn-secondary { background: var(--surface-solid); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--grad-2); }

.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid transparent; }
.btn-ghost:hover { color: var(--text); background: var(--surface-solid); }

/* Controls */
.controls { margin-top: 26px; display: flex; flex-direction: column; gap: 26px; }

/* Preview area */
.preview-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}
.preview-frame {
  position: relative;
  width: 100%;
  max-width: 360px;
  min-height: 180px;
  border-radius: var(--radius-md);
  background:
    linear-gradient(45deg, var(--bg-2) 25%, transparent 25%) -8px 0/16px 16px,
    linear-gradient(-45deg, var(--bg-2) 25%, transparent 25%) -8px 0/16px 16px,
    linear-gradient(45deg, transparent 75%, var(--bg-2) 75%) -8px 0/16px 16px,
    linear-gradient(-45deg, transparent 75%, var(--bg-2) 75%) -8px 0/16px 16px,
    var(--surface-solid);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  padding: 10px;
}
.preview-img {
  max-width: 100%;
  max-height: 260px;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  transition: opacity 0.2s ease;
}
.preview-spinner {
  position: absolute;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--grad-2);
  animation: spin 0.8s linear infinite;
}

/* Resolution meter */
.resolution-meter {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-2);
  border: 1px solid var(--border);
}
.res-stat { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
.res-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); font-weight: 600; }
.res-value { font-family: var(--font-mono); font-weight: 700; font-size: 1.02rem; color: var(--text); }
.res-value.new { color: var(--success); }
.res-size { font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-muted); }
.res-arrow { color: var(--grad-1); display: flex; }

/* Control blocks */
.control-block { display: flex; flex-direction: column; gap: 10px; }
.control-label { font-weight: 600; font-size: 0.92rem; }

.percent-group { display: flex; gap: 8px; flex-wrap: wrap; }
.percent-btn {
  flex: 1;
  min-width: 70px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface-solid);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-mono);
}
.percent-btn:hover { border-color: var(--grad-1); color: var(--text); }
.percent-btn.active {
  background: linear-gradient(120deg, var(--grad-1), var(--grad-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.28);
}

.dimension-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: end;
}
.dimension-field { display: flex; flex-direction: column; gap: 6px; }
.dimension-field label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.dimension-field input {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  width: 100%;
}
.dimension-field input:focus {
  border-color: var(--grad-1);
  outline: none;
}

.lock-btn {
  width: 42px; height: 42px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface-solid);
  color: var(--text-faint);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
  margin-bottom: 1px;
}
.lock-btn:hover { border-color: var(--accent-amber); }
.lock-btn.active {
  background: rgba(245, 158, 11, 0.12);
  border-color: var(--accent-amber);
  color: var(--accent-amber);
}
.lock-btn .lock-icon-unlocked { display: none; }
.lock-btn:not(.active) .lock-icon-locked { display: none; }
.lock-btn:not(.active) .lock-icon-unlocked { display: block; }

.dim-hint { font-size: 0.78rem; color: var(--text-faint); margin: 0; }

.controls-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* =========================================================
   GENERIC SECTIONS
   ========================================================= */
.section { padding: 76px 24px; }
.section.alt { background: var(--bg-2); }
.section-inner { max-width: 1100px; margin: 0 auto; }
.section-inner.narrow { max-width: 760px; }

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}
.section-title.center { text-align: center; }
.section-sub { color: var(--text-muted); max-width: 640px; margin: 0 auto 40px; line-height: 1.65; }
.section-sub.center { text-align: center; }

.two-col { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 48px; align-items: start; }
.two-col.reverse { grid-template-columns: 1.1fr 0.9fr; }
.two-col.reverse > *:first-child { order: 2; }

/* Feature grid */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.feature-card { padding: 24px; border-radius: var(--radius-md); transition: transform 0.25s ease; }
.feature-card:hover { transform: translateY(-4px); }
.feature-icon {
  font-size: 1.8rem; width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px; background: var(--bg-2); margin-bottom: 14px;
}
.feature-card h3 { font-family: var(--font-display); margin: 0 0 8px; font-size: 1.08rem; }
.feature-card p { margin: 0; color: var(--text-muted); font-size: 0.92rem; line-height: 1.6; }

/* Benefits */
.benefits-list { display: flex; flex-direction: column; gap: 22px; max-width: 800px; margin: 0 auto; }
.benefit-row { padding: 20px 24px; border-radius: var(--radius-md); background: var(--surface-solid); border: 1px solid var(--border); }
.benefit-row h3 { font-family: var(--font-display); margin: 0 0 6px; font-size: 1.05rem; }
.benefit-row p { margin: 0; color: var(--text-muted); line-height: 1.65; }

/* Steps */
.steps-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; }
.step-card { padding: 24px; border-radius: var(--radius-md); position: relative; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(120deg, var(--grad-1), var(--grad-2));
  color: #fff; font-family: var(--font-mono); font-weight: 700; margin-bottom: 14px;
}
.step-card h3 { font-family: var(--font-display); margin: 0 0 6px; font-size: 1.02rem; }
.step-card p { margin: 0; color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }

/* Checklists */
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.checklist li {
  padding: 14px 16px 14px 42px;
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  position: relative;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
}
.checklist li strong { color: var(--text); }
.checklist li::before {
  content: "✓";
  position: absolute; left: 14px; top: 13px;
  color: var(--success); font-weight: 700;
}
.checklist.mistakes li::before { content: "✕"; color: var(--danger); }

/* Size guide table */
.size-guide-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-solid);
}
.size-guide-table { min-width: 560px; }
.size-guide-table th, .size-guide-table td {
  text-align: left;
  padding: 13px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.size-guide-table th {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text);
  background: var(--bg-2);
}
.size-guide-table td:nth-child(2) { font-family: var(--font-mono); color: var(--grad-1); font-weight: 600; }
.size-guide-table td { color: var(--text-muted); }
.size-guide-table tr:last-child td { border-bottom: none; }

/* Accordion / FAQ */
.accordion { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.accordion-item { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-solid); overflow: hidden; }
.accordion-item h3 { margin: 0; }
.accordion-trigger {
  width: 100%; text-align: left; background: none; border: none;
  padding: 16px 44px 16px 18px; font-size: 0.95rem; font-weight: 600;
  color: var(--text); cursor: pointer; position: relative;
}
.accordion-trigger::after {
  content: "+"; position: absolute; right: 18px; top: 50%;
  transform: translateY(-50%); font-size: 1.3rem; color: var(--grad-1);
  transition: transform 0.25s ease; font-weight: 400;
}
.accordion-trigger[aria-expanded="true"]::after { transform: translateY(-50%) rotate(45deg); }

.accordion-panel { max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease; padding: 0 18px; }
.accordion-item:has(.accordion-trigger[aria-expanded="true"]) .accordion-panel { max-height: 400px; padding: 0 18px 16px; }
.accordion-panel p { margin: 0; color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }

/* Related tools */
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.related-card { padding: 22px; border-radius: var(--radius-md); transition: transform 0.25s ease, border-color 0.25s ease; cursor: default; }
.related-card:hover { transform: translateY(-3px); border-color: var(--grad-1); }
.related-card h3 { font-family: var(--font-display); margin: 0 0 6px; font-size: 1rem; }
.related-card p { margin: 0; font-size: 0.88rem; color: var(--text-muted); line-height: 1.55; }

/* =========================================================
   FOOTER — normal flow, pinned to bottom only via flexbox
   ========================================================= */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.footer-brand p { margin: 4px 0 0; color: var(--text-faint); font-size: 0.82rem; }
.footer-nav { display: flex; gap: 20px; }
.footer-nav a { text-decoration: none; font-size: 0.85rem; color: var(--text-muted); }
.footer-nav a:hover { color: var(--text); }
.footer-copy { font-size: 0.78rem; color: var(--text-faint); margin: 0; width: 100%; text-align: center; }

@media (min-width: 640px) {
  .footer-copy { width: auto; }
}

/* =========================================================
   TOASTS
   ========================================================= */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  max-width: min(340px, calc(100vw - 40px));
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-radius: 12px;
  background: var(--surface-solid); border: 1px solid var(--border);
  box-shadow: var(--shadow); font-size: 0.86rem; font-weight: 500; color: var(--text);
  animation: toastIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.toast.leaving { animation: toastOut 0.25s ease forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }
.toast-icon { flex-shrink: 0; font-size: 1.05rem; }
.toast.success { border-color: rgba(16, 185, 129, 0.4); }
.toast.error { border-color: rgba(239, 68, 68, 0.4); }
.toast.info { border-color: rgba(59, 130, 246, 0.4); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 860px) {
  .two-col, .two-col.reverse { grid-template-columns: 1fr; }
  .two-col.reverse > *:first-child { order: 0; }
}

@media (max-width: 720px) {
  .main-nav { display: none; }
  .hero { padding: 44px 16px 56px; }
  .tool-card { padding: 20px; }
  .dropzone { padding: 32px 14px; }
  .section { padding: 56px 16px; }
  .resolution-meter { grid-template-columns: 1fr; text-align: center; }
  .res-arrow { transform: rotate(90deg); justify-self: center; }
  .header-inner { padding: 12px 16px; }
  .dimension-row { grid-template-columns: 1fr; }
  .lock-btn { justify-self: center; width: 100%; }
}

@media (max-width: 420px) {
  .controls-actions { flex-direction: column; }
  .controls-actions .btn { width: 100%; }
  .percent-btn { min-width: 60px; }
}
