/* ── Variables ──────────────────────────────────────────────────── */
:root {
  --flame-dark:   #3f5439;
  --flame-mid:    #57705a;
  --flame-light:  #7c9473;
  --bg:           #faf7f1;
  --bg-panel:     #f2ecdf;
  --bg-card:      #ffffff;
  --bg-input:     #f5f0e6;
  --border:       #e3ddcc;
  --border-dim:   #ece5d4;
  --text:         #2b2e28;
  --text-dim:     #565b4f;
  --text-muted:   #8a8f80;
  --accent:       #57705a;
  --accent-hover: #3f5439;
  --radius:       12px;
  --radius-sm:    8px;
}

/* ── Reset & Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────────────────────────── */
#app-header {
  background: linear-gradient(135deg, var(--flame-dark) 0%, var(--flame-mid) 50%, var(--flame-light) 100%);
  border-bottom: 1px solid rgba(0,0,0,0.3);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  text-decoration: none;
}

.brand > div {
  min-width: 0;
}

.brand img {
  height: 2.5rem;
  width: 2.5rem;
  object-fit: contain;
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1.2;
}

.brand-tagline {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.03em;
}

/* ── Main ───────────────────────────────────────────────────────── */
main {
  flex: 1;
  padding: 1.5rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* ── Generator layout ─────────────────────────────────────────────── */
#generator-screen {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
  margin-top: 1rem;
}

@media (max-width: 900px) {
  #generator-screen { grid-template-columns: 1fr; }
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.editor-header span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Preview area ───────────────────────────────────────────────── */
#preview-area {
  background: #e7d9c6;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 20rem;
  padding: 1rem;
  overflow: auto;
}

#preview-canvas {
  background: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  max-width: 100%;
  height: auto;
  display: block;
}

.orig-dims {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.6rem;
}

/* ── Generate button ────────────────────────────────────────────── */
#generate-btn { margin-top: 1rem; }

/* ── SEO content block ──────────────────────────────────────────── */
.seo-block { text-align: center; margin-top: 2.5rem; }

.seo-block h1 {
  font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.seo-block p {
  font-size: 0.825rem;
  color: var(--text-dim);
  line-height: 1.7;
  max-width: 520px;
  margin: 0 auto 1rem;
}

.network-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

.network-chips span {
  font-size: 0.7rem;
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-dim);
  border: 1px solid var(--border-dim);
}

/* ── Controls panel ─────────────────────────────────────────────── */
#controls-panel {
  background: #ffffff;
  border: 1px solid #e3ddcc;
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.ctrl-section { display: flex; flex-direction: column; gap: 0.6rem; }

.ctrl-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

hr.ctrl-divider { border: none; border-top: 1px solid var(--border-dim); }

/* ── Segmented control (paper type / orientation) ────────────────── */
.seg-control { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.seg-btn {
  flex: 1 1 auto;
  background: var(--bg-input);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.6rem;
  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.seg-btn:hover { background: #ece5d4; }
.seg-btn[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Color swatch row ─────────────────────────────────────────────── */
.color-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.color-row input[type="color"] {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  cursor: pointer;
}

/* ── Form elements ──────────────────────────────────────────────── */
select, input[type="number"] {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  transition: border-color 0.15s;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
  cursor: pointer;
}

select:focus, input[type="number"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(87,112,90,0.25);
}

/* ── Range slider ───────────────────────────────────────────────── */
.range-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.range-header .range-val { color: var(--accent); font-family: monospace; }

input[type="range"] {
  width: 100%;
  height: 4px;
  background: var(--bg-input);
  border-radius: 999px;
  border: none;
  accent-color: var(--accent);
  padding: 0;
  cursor: pointer;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  margin-bottom: 0.6rem;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  width: 100%;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.8rem;
  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  box-shadow: 0 4px 20px rgba(87,112,90,0.35);
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Utility ─────────────────────────────────────────────────────── */
[hidden] { display: none !important; }

.crop-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ── Sticky global header ─────────────────────────────────────── */
.global-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.85rem 1.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.global-header a {
  font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
}

.global-header a:hover {
  color: var(--accent);
}
