/* CreatorKit – main stylesheet */
:root {
  --accent: #ff5a36;
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-2: #f3efe9;
  --ink: #1c1b1f;
  --ink-2: #4a4650;
  --muted: #77727c;
  --line: #e8e2da;
  --ok: #1f9d55;
  --err: #c9372c;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(28, 27, 31, .04), 0 8px 24px rgba(28, 27, 31, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max: 1120px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141316;
    --surface: #1d1c20;
    --surface-2: #26242a;
    --ink: #f3f1f4;
    --ink-2: #c9c5cc;
    --muted: #9a95a0;
    --line: #333037;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
}
img, svg, canvas { max-width: 100%; }
a { color: inherit; text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .5em; }
h1 { font-size: clamp(30px, 5vw, 46px); font-weight: 800; }
h2 { font-size: clamp(22px, 3vw, 28px); font-weight: 750; }
h3 { font-size: 19px; font-weight: 700; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.lead { font-size: 19px; color: var(--ink-2); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 19px; letter-spacing: -.02em; color: var(--ink); }
.logo:hover { color: var(--ink); }
.logo-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 18px; transform: rotate(-4deg);
}
.site-nav { display: flex; gap: 4px; align-items: center; }
.site-nav a { text-decoration: none; font-size: 15px; font-weight: 600; color: var(--ink-2); padding: 8px 12px; border-radius: 999px; }
.site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--surface-2); color: var(--ink); }
.nav-toggle { display: none; background: none; border: 0; padding: 10px; cursor: pointer; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--ink); margin: 5px 0; border-radius: 2px; transition: .2s; }

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .site-nav {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: 8px 16px 16px; display: none; box-shadow: var(--shadow);
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px; border-radius: var(--radius-sm); }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* ---------- Buttons & fields ---------- */
.btn, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 15px; font-weight: 700; line-height: 1;
  padding: 12px 18px; border-radius: 999px; cursor: pointer; text-decoration: none;
  border: 2px solid transparent; transition: transform .1s ease, background .15s ease;
}
.btn { background: var(--accent); color: #fff; }
.btn:hover { color: #fff; filter: brightness(1.05); }
.btn:active, .btn-ghost:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn-ghost.small, .btn.small { padding: 7px 12px; font-size: 14px; }
.btn[disabled], .btn-ghost[disabled] { opacity: .5; cursor: not-allowed; }

.field-label { display: block; font-weight: 700; font-size: 14px; margin: 0 0 6px; }
input[type="text"], input[type="email"], input:not([type]), textarea, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 12px;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="color"] { width: 48px; height: 38px; padding: 2px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.check-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; cursor: pointer; }
.check-label input { width: 18px; height: 18px; accent-color: var(--accent); }

.notice { border-radius: var(--radius-sm); padding: 12px 16px; background: var(--surface-2); border: 1px solid var(--line); margin: 0 0 16px; }
.notice.success { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.notice.error { background: color-mix(in srgb, var(--err) 10%, var(--surface)); border-color: color-mix(in srgb, var(--err) 35%, transparent); }
.notice ul { margin: 0; padding-left: 18px; }

/* ---------- Hero & home ---------- */
.hero { padding: 56px 0 32px; text-align: center; }
.hero h1 { max-width: 760px; margin: 0 auto 14px; }
.hero .lead { max-width: 640px; margin: 0 auto; }
.eyebrow {
  display: inline-block; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 6px 12px; border-radius: 999px; margin-bottom: 18px;
}

.tool-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 8px 0 40px; }
.tool-grid.compact { grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0; }
@media (max-width: 680px) { .tool-grid, .tool-grid.compact { grid-template-columns: 1fr; } }
.tool-card {
  display: flex; align-items: center; gap: 16px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease;
}
.tool-card:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--ink); }
.compact .tool-card { padding: 12px 14px; box-shadow: none; }
.tool-card-body { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.tool-card-body strong { font-size: 18px; letter-spacing: -.01em; }
.compact .tool-card-body strong { font-size: 16px; }
.tool-card-body span { color: var(--muted); font-size: 15px; line-height: 1.45; }
.tool-arrow { font-size: 20px; color: var(--muted); transition: transform .15s; }
.tool-card:hover .tool-arrow { transform: translateX(3px); color: var(--accent); }
.tool-icon {
  flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent);
}
.tool-icon svg { width: 26px; height: 26px; }
.compact .tool-icon { width: 40px; height: 40px; border-radius: 11px; }
.compact .tool-icon svg { width: 20px; height: 20px; }
.tool-icon.big { width: 64px; height: 64px; border-radius: 18px; }
.tool-icon.big svg { width: 32px; height: 32px; }
.tool-icon.sm { width: 32px; height: 32px; border-radius: 9px; }
.tool-icon.sm svg { width: 17px; height: 17px; }

.features { margin-bottom: 48px; }
.features > h2 { text-align: center; margin-bottom: 20px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 800px) { .feature-grid { grid-template-columns: 1fr; } }
.feature { background: var(--surface-2); border-radius: var(--radius); padding: 22px; }
.feature p { color: var(--ink-2); margin: 0; font-size: 16px; }

.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.section-head a { font-weight: 700; font-size: 15px; text-decoration: none; color: var(--accent); }
.latest { margin-bottom: 56px; }
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .post-grid { grid-template-columns: 1fr; } }
.post-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; }
.post-card h3 a { text-decoration: none; }
.post-card p { color: var(--ink-2); font-size: 16px; flex: 1; }
.post-card time, .post-row time { color: var(--muted); font-size: 14px; }

/* ---------- Tool page ---------- */
.tool-page { padding-top: 20px; padding-bottom: 56px; }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--muted); }
.crumbs span { margin: 0 6px; }
.tool-head { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
.tool-head h1 { margin-bottom: 4px; }
.tool-head .lead { margin: 0; }
@media (max-width: 600px) { .tool-head { align-items: flex-start; } .tool-head .tool-icon.big { width: 48px; height: 48px; } }
.tool-box {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 22px; box-shadow: var(--shadow); margin-bottom: 28px;
}
@media (max-width: 600px) { .tool-box { padding: 16px; border-radius: 16px; } }

.content-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; align-items: start; }
@media (max-width: 960px) { .content-layout { grid-template-columns: 1fr; } }
.side { position: sticky; top: 84px; }
.side-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.side-box h2 { font-size: 17px; }
.side-tools { list-style: none; margin: 0; padding: 0; }
.side-tools a { display: flex; align-items: center; gap: 10px; padding: 8px 0; text-decoration: none; font-weight: 600; font-size: 15px; }

/* ---------- Prose ---------- */
.prose { max-width: 720px; }
.prose h2 { margin-top: 1.6em; }
.prose h3 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 1.2em; }
.prose li { margin-bottom: .4em; }
.prose img { height: auto; border-radius: var(--radius-sm); }
.prose blockquote { margin: 1.2em 0; padding: 4px 18px; border-left: 4px solid var(--accent); color: var(--ink-2); }
.prose code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: .9em; }
.prose table { width: 100%; border-collapse: collapse; margin-bottom: 1.2em; font-size: 16px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }

/* ---------- Pages & blog ---------- */
.page-narrow { max-width: 780px; padding-top: 28px; padding-bottom: 64px; }
.page-head { margin-bottom: 24px; }
.post-list { display: flex; flex-direction: column; }
.post-row { padding: 22px 0; border-bottom: 1px solid var(--line); }
.post-row h2 { font-size: 23px; margin: 4px 0 8px; }
.post-row h2 a { text-decoration: none; }
.post-row p { color: var(--ink-2); margin: 0; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 28px; font-weight: 700; }
.tools-cta { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line); }
.related { margin-top: 28px; }
.related ul { padding-left: 20px; }
.notfound { padding-top: 56px; }
.big-num { font-size: 96px; font-weight: 900; line-height: 1; color: var(--accent); margin: 0 0 8px; letter-spacing: -.04em; }

.contact-form { margin-top: 12px; display: grid; gap: 4px; }
.contact-form .field-label { margin-top: 12px; }
.contact-form .btn { margin-top: 18px; justify-self: start; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Ads ---------- */
.ad-slot { margin: 20px auto; text-align: center; min-height: 50px; overflow: hidden; }
.ad-label { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 40px 0 16px; margin-top: 24px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-about { grid-column: 1 / -1; } }
.footer-about p { color: var(--muted); font-size: 15px; margin-top: 12px; max-width: 360px; }
.site-footer h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer li a { text-decoration: none; font-size: 15px; }
.footer-bottom { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 16px; }
.footer-bottom p { color: var(--muted); font-size: 14px; margin: 0; }

/* =========================================================
   Fancy text generator
   ========================================================= */
.ft-input { font-size: 20px; min-height: 64px; }
.ft-bar { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 16px; }
.ft-results { display: grid; gap: 8px; }
.ft-row {
  display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 10px 10px 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
}
.ft-row:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.ft-name { font-size: 13px; font-weight: 700; color: var(--muted); }
.ft-out { font-size: 20px; overflow-wrap: anywhere; line-height: 1.4; cursor: pointer; }
.ft-copy { min-width: 84px; }
.ft-copy.copied { background: var(--ok); }
@media (max-width: 600px) {
  .ft-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
  .ft-name { grid-column: 1 / -1; }
  .ft-out { font-size: 18px; }
}

/* =========================================================
   Image tools (compressor & converter)
   ========================================================= */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 180px; padding: 24px; border: 2px dashed var(--line); border-radius: 16px;
  background: var(--bg); cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--bg)); }
.dz-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 24px; margin-bottom: 6px; }
.dropzone strong { font-size: 18px; }

.controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 18px; align-items: start; }
.controls.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
@media (max-width: 700px) { .controls { grid-template-columns: 1fr; } }
.control .muted { display: block; margin-top: 4px; }
.control[hidden] { display: none; }

.seg { display: inline-flex; background: var(--bg); border: 1.5px solid var(--line); border-radius: 999px; padding: 3px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 8px 18px; border-radius: 999px; font-weight: 700; font-size: 15px; }
.seg input:checked + span { background: var(--accent); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.results-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin: 22px 0 10px; }
.results-head[hidden] { display: none; }
.summary { margin: 0; font-weight: 700; }
.summary .good { color: var(--ok); }
.results-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.results { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.result {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
}
.result img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 50% / 12px 12px; }
.result .r-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result .r-meta { font-size: 14px; color: var(--muted); }
.result .r-meta b { color: var(--ink); }
.result .r-save { color: var(--ok); font-weight: 800; }
.result .r-bad { color: var(--err); font-weight: 700; }
.result .r-note { display: block; font-size: 13px; color: var(--muted); }
.result.busy { opacity: .6; }
@media (max-width: 520px) {
  .result { grid-template-columns: 48px minmax(0, 1fr); }
  .result img { width: 48px; height: 48px; }
  .result .btn { grid-column: 1 / -1; width: 100%; }
}

/* =========================================================
   Meme generator
   ========================================================= */
.meme { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .meme { grid-template-columns: 1fr; } }
@media (min-width: 861px) { .meme-stage { position: sticky; top: 84px; } }
.meme-stage canvas {
  display: block; width: 100%; height: auto; border-radius: 12px; touch-action: none;
  background: repeating-conic-gradient(#e9e5df 0 25%, #f7f5f2 0 50%) 50% / 20px 20px;
  border: 1px solid var(--line); cursor: grab;
}
.meme-stage canvas.dragging { cursor: grabbing; }
.meme-stage p { margin-top: 8px; }
.meme-panel { display: flex; flex-direction: column; gap: 14px; }
.meme-source { display: flex; flex-direction: column; gap: 10px; }
.file-btn { align-self: flex-start; }
.blank-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.swatch:hover { transform: scale(1.1); }
.meme-layers { display: flex; flex-direction: column; gap: 10px; }
.layer { background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px; }
.layer.active { border-color: var(--accent); }
.layer-top { display: flex; gap: 8px; align-items: center; }
.layer-top input { flex: 1; }
.layer-remove { background: none; border: 0; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.layer-remove:hover { color: var(--err); background: var(--surface-2); }
.layer-size { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.meme-style { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.meme-style summary { font-weight: 700; cursor: pointer; }
.meme-download { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; border-top: 1px solid var(--line); }
