/* ===== CaptionMeme — Zine/Sticker Theme ===== */

:root{
  --paper: #f5f5f0;
  --ink: #0e0e10;
  --muted: #6b6f76;
  --line: #d8d8d0;
  --card: #ffffff;
  --accent: #ff5a8a;   /* hot pink */
  --accent-2: #8aff7a; /* acid green (used sparingly) */
  --shadow: 0 12px 30px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.08);
  --radius: 14px;
  --ctl-h: 38px;
  --focus: 0 0 0 3px rgba(255,90,138,.35);
}

*{box-sizing:border-box}
html, body { height: 100%; }
body{
  font-family: system-ui, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  margin:0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 20% -10%, rgba(255,90,138,.12) 0%, rgba(255,90,138,0) 50%),
    radial-gradient(ellipse at 110% 10%, rgba(138,255,122,.08) 0%, rgba(138,255,122,0) 50%),
    var(--paper);
  display:flex; flex-direction:column;
}

/* ===== Header (paper banner with sticker link) ===== */
.header{
  display:flex; gap:12px; align-items:center; justify-content:space-between;
  padding:14px 18px;
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
}
.header a{ color: var(--ink); text-decoration:none; }
.header a:hover{ text-decoration:underline; }
.banner{
  font-weight:700; letter-spacing:.1px;
  background: #fff3f8;
  border: 2px solid var(--ink);
  padding:6px 10px; border-radius:10px;
  box-shadow: 4px 4px 0 #00000020;
}

/* ===== Layout ===== */
.container{ max-width:1180px; margin:22px auto; padding:0 16px; flex:1; }
.lede{ margin-top:6px; color: var(--muted); }

.app-grid{
  display:grid;
  grid-template-columns: 1fr 360px; /* canvas | controls */
  gap: 22px;
  align-items: start;
}

/* Canvas “paper” with dotted edge */
.paper{
  background: var(--card);
  border: 2px dashed #333;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
  position:relative;
}
.paper::after{
  content:"";
  position:absolute; inset:-10px -10px auto auto;
  width:72px; height:24px;
  background: repeating-linear-gradient(90deg, rgba(0,0,0,.15), rgba(0,0,0,.15) 6px, transparent 6px, transparent 12px);
  transform: rotate(2deg);
  opacity:.55; border-radius:4px;
}

/* Canvas element itself */
canvas{
  max-width:100%;
  width:100%;
  display:block;
  background:#0a0b0e;
  border-radius:8px;
  border:1px dashed #9aa0a6;
}

/* ===== Sidebar / Toolbar ===== */
.sidebar{ position:sticky; top:16px; align-self:start; }
.panel{
  background:#fff;
  border:2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:14px;
}
.panel + .panel{ margin-top:14px; }

.panel h3{
  margin:0 0 10px 0; font-size:1rem; letter-spacing:.3px;
}

.toolbar{
  display:flex; flex-direction:column;
  gap:10px; margin:0;
}

/* Inputs & selects fill the panel width */
.input,
.toolbar select,
.toolbar input[type="text"],
.toolbar input[type="number"],
.toolbar input[type="file"],
.toolbar button.btn{
  height: var(--ctl-h);
  line-height: calc(var(--ctl-h) - 2px);
  padding: 8px 10px;
  border-radius:10px;
  width:100%;
}

/* Form skins */
.input, .toolbar select, .toolbar input[type="text"], .toolbar input[type="number"]{
  background:#fafafa; border:1.5px solid #cfd3d6; color:#111;
}
.input:focus, .toolbar select:focus, .toolbar input[type="text"]:focus, .toolbar input[type="number"]:focus{
  outline:none; box-shadow: var(--focus); border-color:#bbb;
}

.toolbar input[type="color"]{
  width: 100%; height: var(--ctl-h); padding:0; border:1.5px solid #cfd3d6; border-radius:10px;
}

/* Range controls */
.toolbar input[type="range"]{ margin: 0; }

/* Buttons */
.btn{
  background: var(--accent);
  border:2px solid var(--ink);
  color:#fff; cursor:pointer;
  padding:8px 14px; border-radius:10px;
  font-weight:700; letter-spacing:.2px;
  box-shadow: 3px 3px 0 #00000020;
}
.btn:hover{ filter: brightness(1.04); }
.btn.secondary{
  background:#111; color:#fff;
}
.btn.danger{ background:#7f1d1d; border-color:#b91c1c }
.btn.danger:hover{ background:#991b1b }

/* Small labels inside toolbar */
.small{ font-size:12px; color:#555; }

/* Group rows convert to vertical stacks */
.form-row{ display:flex; gap:10px; }
.form-row > *{ flex:1; }

/* Sticky actions at bottom of sidebar */
.actions{
  display:flex; gap:10px; margin-top:8px;
  position: sticky; bottom:0; background:#fff; padding-top:10px;
  border-top:1px dashed #ccc;
}

/* Cards & grid (used on template listing pages if any) */
.grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(220px,1fr)); gap:14px }
.card{ background:#fff; border:2px solid var(--ink); border-radius:10px; padding:12px; box-shadow: var(--shadow); }

/* Footer */
footer.site-footer{
  margin-top: 40px; padding: 16px 12px; border-top: 2px solid var(--ink);
  color: var(--muted); font-size: .9rem; background: var(--paper);
}
footer.site-footer .links{
  list-style:none; display:flex; justify-content:center; align-items:center; gap: 20px;
  flex-wrap:wrap; margin:0; padding:0;
}
footer.site-footer .links a{
  color:#111; text-decoration:none; padding:4px 6px; border-radius:6px; opacity:.9;
}
footer.site-footer .links a:hover{ text-decoration:underline; opacity:1; }
footer.site-footer .links a:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
footer.site-footer .smallprint{ margin-top:8px; text-align:center; font-size:.8rem; opacity:.7; }

/* Optional bundled fonts */
@font-face{
  font-family: "Anton LF";
  src: url("/assets/fonts/Anton-Regular.woff2") format("woff2");
  font-weight:400; font-style:normal; font-display:swap;
}
@font-face{
  font-family: "Oswald LF";
  src: url("/assets/fonts/OswaldLF.woff2") format("woff2");
  font-weight:400; font-style:normal; font-display:swap;
}
@font-face{
  font-family: "Inter LF";
  src: url("/assets/fonts/Inter-Variable.woff2") format("woff2");
  font-weight:400; font-style:normal; font-display:swap;
}

/* ===== Responsive ===== */
@media (max-width: 980px){
  .app-grid{ grid-template-columns: 1fr; }
  .sidebar{ position:static; }
  .paper::after{ display:none; }
  .actions{ position: static; }
}
