/* =============================================
   GIF Panel — Design System v4
   ============================================= */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ── Design Tokens ── */
:root {
  /* Colors */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface2: #f1f5f9;
  --text: #0f172a;
  --text2: #334155;
  --muted: #64748b;
  --subtle: #94a3b8;
  --line: #e2e8f0;
  --line2: #cbd5e1;

  /* Brand gradient */
  --accent1: #4f46e5;
  --accent2: #7c3aed;
  --accent3: #a855f7;
  --accent-grad: linear-gradient(135deg, var(--accent1) 0%, var(--accent2) 50%, var(--accent3) 100%);

  /* Semantic */
  --ok: #10b981;
  --bad: #ef4444;
  --warn: #f59e0b;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.06);
  --shadow-md: 0 4px 16px rgba(15,23,42,.08), 0 2px 6px rgba(15,23,42,.06);
  --shadow-lg: 0 12px 40px rgba(15,23,42,.10), 0 4px 12px rgba(15,23,42,.06);
  --shadow-xl: 0 24px 60px rgba(15,23,42,.12), 0 8px 24px rgba(15,23,42,.08);
  --shadow-accent: 0 8px 32px rgba(79,70,229,.25);

  /* Radius */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 9999px;

  /* Transitions */
  --ease: cubic-bezier(.4,0,.2,1);
  --dur: 160ms;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--accent1); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.5em; }
h1, h2, h3, h4 { line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 .6em; }

/* ── Layout ── */
.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

/* =============================================
   HEADER
   ============================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(0,0,0,.04);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 20px;
}

/* ── Brand / Logo ── */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  text-decoration: none !important;
  flex-shrink: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  background: var(--accent-grad);
  box-shadow: var(--shadow-accent);
  font-size: 13px;
  font-weight: 900;
  color: #fff;
  letter-spacing: .5px;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.brand:hover .brand-mark {
  transform: scale(1.08) rotate(-2deg);
  box-shadow: 0 10px 36px rgba(79,70,229,.35);
}

.brand-name {
  font-size: 17px;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -.03em;
}

/* ── Nav ── */
.nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

.nav-link {
  padding: 7px 12px;
  border-radius: var(--r-sm);
  color: var(--text2);
  font-weight: 600;
  font-size: 14px;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: var(--surface2);
  text-decoration: none;
}

.nav-link.active {
  color: var(--accent1);
  font-weight: 700;
}

/* ── Dropdown ── */
.nav-dd { position: relative; }

.nav-dd summary { list-style: none; cursor: pointer; }
.nav-dd summary::-webkit-details-marker { display: none; }

.nav-dd > summary.nav-link {
  display: flex;
  align-items: center;
  gap: 5px;
}

.nav-dd > summary.nav-link::after {
  content: "";
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4.5px solid currentColor;
  opacity: .6;
  margin-top: 1px;
  transition: transform var(--dur) var(--ease);
}

.nav-dd[open] > summary.nav-link::after {
  transform: rotate(180deg);
}

.nav-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 270px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  padding: 8px;
  display: grid;
  gap: 2px;
  z-index: 200;
  animation: dropIn 140ms var(--ease) both;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nav-dd:not([open]) .nav-menu { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: var(--r-md);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  transition: background var(--dur) var(--ease);
}

.nav-item:hover {
  background: var(--surface2);
  text-decoration: none;
}

/* ── Language Switch ── */
.lang-switch {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.lang-link {
  padding: 5px 9px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.lang-link:hover, .lang-link.active {
  color: var(--accent1);
  border-color: rgba(79,70,229,.4);
  background: rgba(79,70,229,.06);
  text-decoration: none;
}

/* =============================================
   HERO SECTION
   ============================================= */
.hero {
  padding: 56px 0 36px;
  position: relative;
  overflow: hidden;
}

/* Subtle gradient background for hero */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(79,70,229,.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(168,85,247,.07) 0%, transparent 55%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.hero-copy {
  max-width: 720px;
  text-align: center;
}

h1 {
  font-size: 48px;
  line-height: 1.08;
  letter-spacing: -.03em;
  color: var(--text);
  margin-bottom: .4em;
}

/* Gradient text on h1 */
h1 .gradient-word {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.lead {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
  margin: 0 0 8px;
  max-width: 560px;
}

/* =============================================
   CARD & TOOL CARD
   ============================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
}

.tool-card {
  padding: 28px;
}

.tool-banner {
  width: min(860px, 100%);
}

/* =============================================
   TOOL FORM
   ============================================= */
.tool-form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
}

input[type="url"] {
  width: 100%;
  padding: 16px 18px;
  border-radius: var(--r-lg);
  border: 1.5px solid var(--line2);
  background: var(--surface);
  color: var(--text);
  outline: none;
  font-size: 16px;
  font-family: inherit;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

input[type="url"]::placeholder { color: var(--subtle); }

input[type="url"]:focus {
  border-color: var(--accent1);
  box-shadow: 0 0 0 4px rgba(79,70,229,.14);
}

.select {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--r-lg);
  border: 1.5px solid var(--line2);
  background: var(--surface);
  color: var(--text);
  outline: none;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.select:focus {
  border-color: var(--accent1);
  box-shadow: 0 0 0 4px rgba(79,70,229,.14);
}

input[type="file"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  border: 1.5px dashed var(--line2);
  background: var(--surface2);
  color: var(--text2);
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease);
}

input[type="file"]:hover {
  border-color: var(--accent1);
}

/* ── Mode radio buttons ── */
.tool-modes {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--surface2);
  padding: 5px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
}

.radio {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--r-md);
  color: var(--text2);
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  justify-content: center;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
  user-select: none;
}

.radio:has(input:checked) {
  background: var(--surface);
  color: var(--accent1);
  box-shadow: var(--shadow-sm);
}

.radio input { display: none; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: var(--r-lg);
  border: 1.5px solid var(--line2);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  font-size: 15px;
  font-family: inherit;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--line2);
  background: var(--surface2);
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: var(--accent-grad);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-accent);
  font-size: 16px;
  padding: 16px 28px;
  letter-spacing: -.01em;
}

.btn.primary:hover {
  box-shadow: 0 12px 40px rgba(79,70,229,.38);
  transform: translateY(-1px);
  background: var(--accent-grad);
}

.btn.primary:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-accent);
}

.btn.primary.full { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ── Misc form UI ── */
.hint { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.linklike { border: 0; background: none; color: var(--accent1); padding: 0; cursor: pointer; font-size: inherit; font-family: inherit; }
.linklike:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* =============================================
   TOOL RESULT
   ============================================= */
.tool-result { margin-top: 16px; display: grid; gap: 12px; }
.result-meta { font-size: 13px; color: var(--muted); font-weight: 600; }

.preview-wrap { display: grid; gap: 12px; }

.preview {
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface2);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.preview img, .preview video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 380px;
  object-fit: contain;
}

.downloads { display: flex; flex-wrap: wrap; gap: 10px; }
.downloads .btn { flex: 1; min-width: 160px; }

.errors {
  border: 1px solid rgba(239,68,68,.3);
  background: rgba(239,68,68,.07);
  padding: 12px 16px;
  border-radius: var(--r-md);
  color: #b91c1c;
  font-size: 13px;
  font-weight: 600;
}

/* =============================================
   CONTENT SECTIONS
   ============================================= */
.content {
  padding: 20px 0 60px;
}

.section {
  padding: 28px 0;
}

.section h2 {
  font-size: 24px;
  margin-bottom: 14px;
  color: var(--text);
}

.section h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--text);
}

.section p {
  color: var(--text2);
  line-height: 1.7;
}

.section ul, .section ol {
  color: var(--text2);
  line-height: 1.9;
}

/* ── Feature Cards (2-col grid) ── */
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.list {
  margin: 0;
  padding-left: 1.5em;
  color: var(--text2);
  line-height: 1.9;
}

.feature {
  padding: 20px 22px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.feature:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--line2);
}

.feature h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  margin-bottom: 8px;
}

/* Step number badge */
.feature h3::before {
  content: attr(data-step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-full);
  background: var(--accent-grad);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.feature p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.65;
}

/* ── FAQ ── */
.faq details {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 0;
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.faq details:hover {
  border-color: var(--line2);
  box-shadow: var(--shadow-sm);
}

.faq details[open] {
  border-color: rgba(79,70,229,.3);
  box-shadow: 0 0 0 3px rgba(79,70,229,.08);
}

.faq summary {
  cursor: pointer;
  font-weight: 700;
  padding: 15px 18px;
  font-size: 15px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
  user-select: none;
  transition: background var(--dur) var(--ease);
}

.faq summary:hover { background: var(--surface2); }

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  font-size: 20px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1;
  transition: transform var(--dur) var(--ease);
  flex-shrink: 0;
}

.faq details[open] summary::after {
  transform: rotate(45deg);
}

.faq details[open] summary {
  background: rgba(79,70,229,.04);
  color: var(--accent1);
}

.faq .faq-body {
  padding: 0 18px 16px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.75;
  border-top: 1px solid var(--line);
}

/* Fallback for plain div wrapper in faq details */
.faq details > div:last-child,
.faq details > p {
  padding: 8px 18px 16px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.75;
}

/* ── Breadcrumb ── */
.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  padding: 16px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.breadcrumb a { color: var(--accent1); font-weight: 600; }
.breadcrumb span { color: var(--subtle); }

/* ── Related tools / blog article inline links ── */
.section a:not(.btn) {
  color: var(--accent1);
  font-weight: 600;
  border-bottom: 1px solid rgba(79,70,229,.25);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.section a:not(.btn):hover {
  color: var(--accent2);
  border-bottom-color: var(--accent2);
  text-decoration: none;
}

/* ── Tables (for comparison tables in blog) ── */
table {
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  font-size: 14px;
  margin: 8px 0 16px;
}

thead {
  background: var(--surface2);
}

th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text2);
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(79,70,229,.03); }

/* ── Next Steps / Hub CTA ── */
.hub-cta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.next-steps {
  margin-top: 16px;
  padding: 18px 20px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(79,70,229,.04) 0%, rgba(168,85,247,.04) 100%);
  box-shadow: var(--shadow-sm);
}

.next-steps h3 { margin: 0 0 10px; font-size: 16px; }
.next-steps .next-links { display: flex; flex-wrap: wrap; gap: 10px; }
.next-steps .next-links a { font-weight: 700; }

/* ── Blog / Article content styles ── */
.blog-article h2 {
  font-size: 22px;
  margin: 2em 0 .7em;
  padding-top: 1.5em;
  border-top: 1px solid var(--line);
  color: var(--text);
}

.blog-article h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.blog-article h3 {
  font-size: 17px;
  margin: 1.4em 0 .5em;
  color: var(--text);
}

.blog-article p {
  color: var(--text2);
  line-height: 1.8;
  margin-bottom: 1.2em;
}

.blog-article ul, .blog-article ol {
  color: var(--text2);
  line-height: 1.9;
  margin-bottom: 1.2em;
}

.blog-article li { margin-bottom: .4em; }

.blog-article strong { color: var(--text); font-weight: 700; }

.blog-article code {
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: .875em;
  font-family: ui-monospace, 'Cascadia Code', 'Fira Code', monospace;
  color: var(--accent1);
}

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 48px 0 32px;
}

.footer-inner { display: grid; gap: 32px; }

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.footer-tagline {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 260px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 32px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--bg);
}

.footer-col h4 {
  margin: 0 0 14px;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--subtle);
  font-weight: 700;
}

.footer-col a {
  display: block;
  padding: 5px 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  transition: color var(--dur) var(--ease);
  border-bottom: none !important;
}

.footer-col a:hover {
  color: var(--accent1);
  text-decoration: none;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  align-items: center;
}

.footer-meta a {
  color: var(--muted);
  transition: color var(--dur) var(--ease);
}

.footer-meta a:hover { color: var(--accent1); text-decoration: none; }
.sep { color: var(--line2); }

/* =============================================
   BLOG LIST PAGE
   ============================================= */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.post-card {
  display: flex;
  flex-direction: column;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(79,70,229,.3);
  text-decoration: none;
}

.post-card-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent1);
  background: rgba(79,70,229,.08);
  padding: 3px 8px;
  border-radius: var(--r-full);
  width: fit-content;
  margin-bottom: 10px;
}

.post-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 10px;
  flex: 1;
}

.post-card-desc {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 14px;
}

.post-card-date {
  font-size: 12px;
  color: var(--subtle);
  font-weight: 600;
}

/* =============================================
   TRUST BADGES & STATS BAR (Homepage)
   ============================================= */
.trust-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 6px 0 0;
}
.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
}
.trust-badge .trust-icon { color: var(--ok); font-size: 14px; }

.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 32px 0 8px;
}
.stat-item { text-align: center; }
.stat-number {
  font-size: 32px;
  font-weight: 900;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
  margin-bottom: 4px;
}
.stat-label { font-size: 13px; font-weight: 600; color: var(--muted); }

/* =============================================
   TOOL / PLATFORM GRIDS (Homepage)
   ============================================= */
.tools-grid,
.platform-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.tool-grid-card {
  display: flex;
  flex-direction: column;
  padding: 20px 22px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
  text-decoration: none !important;
}
.tool-grid-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(79,70,229,.3);
}
.tool-grid-card .card-icon { font-size: 26px; margin-bottom: 10px; }
.tool-grid-card .card-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.tool-grid-card .card-desc { font-size: 13px; color: var(--muted); line-height: 1.6; margin: 0; }

/* =============================================
   SECTION INTRO & CTA
   ============================================= */
.section-intro {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 16px;
  max-width: 680px;
}
.section-cta {
  margin-top: 16px;
  padding: 36px 32px;
  border-radius: var(--r-xl);
  background: var(--accent-grad);
  text-align: center;
  color: #fff;
}
.section-cta h2 { color: #fff !important; font-size: 24px; margin-bottom: 10px; }
.section-cta p {
  color: rgba(255,255,255,.85);
  font-size: 15px;
  margin-bottom: 20px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.65;
}
.section-cta .btn {
  background: #fff;
  color: var(--accent1);
  border-color: transparent;
  font-weight: 800;
  font-size: 16px;
  padding: 14px 32px;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
}
.section-cta .btn:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0,0,0,.2); }

/* =============================================
   MISC / UTILITY
   ============================================= */

/* Highlight box (tip, note) */
.tip-box {
  background: rgba(79,70,229,.06);
  border: 1px solid rgba(79,70,229,.2);
  border-left: 4px solid var(--accent1);
  border-radius: var(--r-md);
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text2);
  line-height: 1.65;
}

/* Tag pill */
.tag {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: var(--r-full);
  background: var(--surface2);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

/* Status indicators */
.ok-badge  { color: var(--ok);  font-weight: 700; }
.bad-badge { color: var(--bad); font-weight: 700; }

/* Divider */
hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
  .container { padding: 0 20px; }
}

@media (max-width: 920px) {
  h1 { font-size: 36px; }
  .hero { padding: 40px 0 24px; }
  .grid2 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; padding: 20px; }
  .nav { gap: 2px; }
  .tools-grid, .platform-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .nav-menu {
    position: static;
    min-width: unset;
    box-shadow: none;
    padding: 6px;
    margin-top: 6px;
    border: none;
    background: var(--surface2);
    border-radius: var(--r-md);
    animation: none;
  }
}

@media (max-width: 680px) {
  h1 { font-size: 28px; }
  .hero { padding: 28px 0 16px; }
  .tool-card { padding: 18px; }
  .btn.primary { font-size: 15px; padding: 14px 20px; }
  .lang-switch { gap: 4px; }
  .lang-link { padding: 4px 7px; font-size: 11px; }
  .lead { font-size: 15px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px; }
  .section h2 { font-size: 20px; }
  .tools-grid, .platform-grid { grid-template-columns: 1fr; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-number { font-size: 24px; }
  .section-cta { padding: 24px 20px; }

}

@media (max-width: 420px) {
  .footer-grid { grid-template-columns: 1fr; }
  .header-inner { height: 60px; }
  .brand-name { display: none; }
  .container { padding: 0 16px; }
}

/* =============================================
   DARK MODE  (prefers-color-scheme)
   ============================================= */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b22;
    --surface2: #1c2333;
    --text: #f0f6fc;
    --text2: #c9d1d9;
    --muted: #8b949e;
    --subtle: #484f58;
    --line: #21262d;
    --line2: #30363d;
  }

  .site-header {
    background: rgba(22,27,34,.95);
  }

  input[type="url"], .select, input[type="file"] {
    background: var(--surface2);
    color: var(--text);
    border-color: var(--line2);
  }

  .btn {
    background: var(--surface2);
    color: var(--text);
    border-color: var(--line2);
  }

  .btn:hover {
    background: var(--surface);
  }

  .card, .feature, .faq details, .post-card, .next-steps, .tool-grid-card, .trust-badge {
    background: var(--surface);
  }

  .footer-grid {
    background: var(--surface);
  }

  .blog-article code {
    background: var(--surface2);
    border-color: var(--line2);
  }

  table { border-color: var(--line); }
  thead { background: var(--surface2); }
  td { border-color: var(--line); }

  .section-cta .btn { color: var(--accent1); }
}

/* ========== GIF Maker ========== */
.maker-frames { margin-top: 18px; }

.frame-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 4px 0;
  min-height: 40px;
}

.frame-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px;
  cursor: grab;
  transition: box-shadow 0.15s, border-color 0.15s;
  user-select: none;
}
.frame-item:hover {
  border-color: var(--accent1);
  box-shadow: 0 2px 8px rgba(79,70,229,.12);
}
.frame-item.dragging {
  opacity: 0.5;
  border-style: dashed;
}

.frame-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg2, #eef);
  display: block;
}

.frame-item .frame-index {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted, #64748b);
  position: absolute;
  top: 4px;
  left: 6px;
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 3px;
  line-height: 1.3;
}

.frame-item .frame-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.frame-item .frame-actions button {
  font-size: 0.72rem;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  line-height: 1.3;
  transition: background 0.15s;
}
.frame-item .frame-actions button:hover {
  background: var(--accent1);
  color: #fff;
  border-color: var(--accent1);
}
.frame-item .frame-actions .btn-remove:hover {
  background: #ef4444;
  border-color: #ef4444;
}

.frame-delay-input {
  width: 54px;
  font-size: 0.75rem;
  text-align: center;
  padding: 2px 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}

.frame-delay-unit {
  font-size: 0.65rem;
  color: var(--muted, #64748b);
}

@media (max-width: 480px) {
  .frame-thumb { width: 60px; height: 60px; }
  .frame-list { gap: 8px; }
  .frame-item { padding: 6px; }
}

/* ========== Tools Category Headers ========== */
.tools-category-header {
  margin-top: 32px;
  padding-bottom: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent1, #6366f1);
  border-bottom: 2px solid var(--line, #e2e8f0);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tools-category-header:first-of-type { margin-top: 12px; }

/* ========== Nested nav submenu ========== */
.nav-submenu {
  position: absolute;
  left: 100%;
  top: 0;
  min-width: 200px;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: var(--r-sm, 8px);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 6px 0;
  display: none;
  z-index: 10;
}
.nav-item:hover > .nav-submenu,
.nav-item:focus-within > .nav-submenu {
  display: block;
}
.nav-item.has-submenu { position: relative; }

.nav-subheader {
  display: block;
  padding: 6px 16px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent1, #6366f1);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: default;
}

@media (max-width: 768px) {
  .nav-submenu {
    position: static;
    box-shadow: none;
    border: none;
    padding-left: 12px;
  }
}

/* ========== Edit Tools (rotate / flip / trim / text / loop / mp4) ========== */
.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-group .btn { flex: 1; min-width: 80px; text-align: center; }

.angle-btn, .flip-btn {
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.angle-btn.active, .flip-btn.active {
  background: var(--accent1, #6366f1);
  color: #fff;
  border-color: var(--accent1, #6366f1);
  box-shadow: 0 2px 8px rgba(79,70,229,.18);
}

.trim-timeline {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--surface2, #f1f5f9);
  border-radius: var(--r-sm, 8px);
  border: 1px solid var(--line, #e2e8f0);
}
.trim-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
.trim-info .field { margin: 0; }

.atg-text-controls {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--surface2, #f1f5f9);
  border-radius: var(--r-sm, 8px);
  border: 1px solid var(--line, #e2e8f0);
}
.atg-text-controls .field { margin: 0; }
.atg-text-controls .field + .field { margin-top: 10px; }

.atg-options-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px 16px;
  margin-top: 12px;
}
.atg-options-row .field { margin: 0; }

.atg-options-row input[type="number"],
.atg-options-row input[type="color"] {
  width: 100%;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0 2px;
}
.radio-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--text);
}
.radio-group input[type="radio"] {
  accent-color: var(--accent1, #6366f1);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.radio-group .radio-custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.radio-group .radio-custom-row input[type="number"] {
  width: 80px;
  font-size: 0.9rem;
  padding: 6px 8px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: var(--r-sm, 8px);
  font-family: inherit;
}

.g4m-options {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--surface2, #f1f5f9);
  border-radius: var(--r-sm, 8px);
  border: 1px solid var(--line, #e2e8f0);
}
.g4m-options .field { margin: 0; }
.g4m-options .field + .field { margin-top: 10px; }

@media (max-width: 480px) {
  .trim-info { grid-template-columns: 1fr; }
  .atg-options-row { grid-template-columns: 1fr; }
}
