/* imgtogif — site styles. Tokens follow seo-collab/design/app-screens.md defaults. */

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --ground: #f9fafb;
  --surface: #ffffff;
  --raised: #f4f5f6;
  --active: #eeeeee;
  --border: #e8e8e8;
  --rule: #f2f2f2;
  --control: #d1d5db;
  --text: #111111;
  --muted: #5f6368;
  --faint: #6b6b6b;
  --primary: #1d1f20;
  --accent: #0f766e;
  --accent-ink: #0b4f4a;
  --accent-tint: #e6f4f2;
  --negative: #c4242a;
  --radius-card: 8px;
  --radius-control: 6px;
  --gap: 16px;
  --card-pad: 20px;
  --font: "IBM Plex Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--ground);
}

/* ---- top bar ---- */

.topbar {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}

.nav { display: flex; gap: 4px; }

.nav a {
  display: block;
  padding: 4px 10px;
  border-radius: var(--radius-control);
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.nav a:hover { background: var(--raised); color: var(--text); }
.nav a.active { color: var(--text); background: var(--active); }

/* ---- layout ---- */

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 24px 0;
}

h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
  text-wrap: balance;
}

.sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 640px;
  text-wrap: pretty;
}

.tool {
  margin-top: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--card-pad);
}

.panel h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 12px;
}

/* ---- drop zone / empty slot ---- */

.dropzone {
  border: 1px dashed var(--control);
  border-radius: var(--radius-card);
  background: var(--surface);
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
}

.dropzone.over { border-color: var(--accent); background: var(--accent-tint); }
.dropzone:hover { border-color: var(--accent); }

.dropzone .dz-title { font-size: 16px; font-weight: 500; }
.dropzone .dz-hint { color: var(--muted); font-size: 13px; }

.dz-sample {
  background: none;
  border: 0;
  padding: 2px 4px;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.dz-sample:hover { color: var(--accent-ink); }

/* the one signature motion: three frames cycling, a nod to what a GIF is */
.dz-anim { display: flex; gap: 6px; }

.dz-anim i {
  width: 15px;
  height: 19px;
  border-radius: 3px;
  background: var(--control);
  animation: framecycle 1.6s infinite;
}

.dz-anim i:nth-child(2) { animation-delay: 0.2s; }
.dz-anim i:nth-child(3) { animation-delay: 0.4s; }

@keyframes framecycle {
  0%, 100% { background: var(--control); }
  40% { background: var(--accent); }
}

/* ---- buttons & fields ---- */

.btn {
  appearance: none;
  border: 1px solid var(--control);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-control);
  cursor: pointer;
}

.btn:hover { background: var(--raised); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:disabled:hover { background: var(--surface); }

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

.btn-primary:hover { background: #000000; }
.btn-primary:disabled:hover { background: var(--primary); }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
}

.field .hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

input[type="number"],
input[type="text"],
select {
  font: inherit;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--control);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text);
  width: 100%;
  font-variant-numeric: tabular-nums;
}

input[type="number"]:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.dims { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

input[type="color"] {
  width: 100%;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--control);
  border-radius: var(--radius-control);
  background: var(--surface);
  cursor: pointer;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

/* filmstrip for frame-level tools (extractor, cutter) */
.film { display: flex; flex-wrap: wrap; gap: 8px; }

.frame-cell {
  position: relative;
  width: 96px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background:
    conic-gradient(#e8e8e8 25%, #ffffff 0 50%, #e8e8e8 0 75%, #ffffff 0) 0 0 / 12px 12px;
  cursor: pointer;
  user-select: none;
}

.frame-cell canvas { display: block; width: 100%; height: auto; }

.frame-cell .idx {
  position: absolute;
  left: 2px;
  top: 2px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 3px;
  padding: 0 4px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.frame-cell.off,
.frame-cell.cut { opacity: 0.3; }

/* "more tools" cards (homepage) */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 0 0 12px;
}

.tool-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
}

.tool-card:hover { border-color: var(--accent); }
.tool-card b { display: block; font-weight: 600; margin-bottom: 2px; }
.tool-card span { color: var(--muted); font-size: 13px; }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  border: 1px solid var(--control);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.chip:hover { background: var(--raised); }
.chip.on { border-color: var(--accent); background: var(--accent-tint); color: var(--accent-ink); }

/* ---- preview & results ---- */

.stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--card-pad);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.canvas-holder {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  background:
    conic-gradient(#e8e8e8 25%, #ffffff 0 50%, #e8e8e8 0 75%, #ffffff 0) 0 0 / 16px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  touch-action: none;
}

.canvas-holder canvas { display: block; max-width: 100%; height: auto; }

.crop-rect {
  position: absolute;
  border: 2px solid var(--accent);
  background: rgba(15, 118, 110, 0.12);
  cursor: move;
  box-sizing: border-box;
}

.crop-rect .handle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 2px;
  cursor: nwse-resize;
}

.kv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px solid var(--rule);
}

.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-variant-numeric: tabular-nums; text-align: right; }

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }

.thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: #ffffff;
}

.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.thumb .rm {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.progress { color: var(--muted); font-size: 13px; min-height: 20px; }

.result-note { color: var(--muted); font-size: 13px; }

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

.batch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  font-size: 13px;
}

.batch-row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-row .meta { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- content sections ---- */

.section { margin-top: 56px; max-width: 760px; }

.section h2 { font-size: 18px; font-weight: 600; margin: 0 0 12px; text-wrap: balance; }
.section h3 { font-size: 15px; font-weight: 600; margin: 24px 0 8px; }
.section p { margin: 0 0 12px; color: #333333; text-wrap: pretty; }
.section ol, .section ul { margin: 0 0 12px; padding-left: 22px; color: #333333; }
.section li { margin-bottom: 6px; }

table.plain {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 12px;
  font-size: 13px;
}

table.plain th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
  padding: 6px 8px 6px 0;
}

table.plain th.num, table.plain td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

table.plain td {
  padding: 7px 8px 7px 0;
  border-top: 1px solid var(--rule);
}

/* ---- footer ---- */

.footer {
  margin-top: 80px;
  border-top: 1px solid var(--border);
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.footer a { color: var(--muted); text-decoration: none; margin-right: 16px; }
.footer a:hover { color: var(--text); }

/* ---- phone ---- */

@media (max-width: 900px) {
  .tool { grid-template-columns: 1fr; }
  .nav { gap: 0; }
  .nav a { padding: 4px 8px; font-size: 13px; }
  .topbar { gap: 14px; padding: 0 16px; }
  .wrap { padding: 20px 16px 0; }
  h1 { font-size: 22px; }
  .dropzone { min-height: 180px; }
}

@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; height: auto; padding-top: 8px; padding-bottom: 8px; row-gap: 2px; }
}
