/* Sil Blog Studio — editorial/rich, light theme */
@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400..800&family=Literata:ital,opsz,wght@0,7..72,400..600;1,7..72,400..500&display=swap");

:root {
  --paper: oklch(0.985 0.008 85);
  --paper-2: oklch(0.965 0.011 82);
  --ink: oklch(0.24 0.02 60);
  --ink-soft: oklch(0.44 0.02 60);
  --ink-faint: oklch(0.62 0.015 60);
  --line: oklch(0.88 0.012 75);
  --line-strong: oklch(0.78 0.015 70);
  --accent: oklch(0.47 0.14 25);       /* oxblood */
  --accent-soft: oklch(0.47 0.14 25 / 0.1);
  --ok: oklch(0.5 0.11 150);
  --warn: oklch(0.55 0.13 70);
  --danger: oklch(0.5 0.17 27);

  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Literata", Georgia, serif;

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px; --sp-9: 96px;
  --radius: 10px;
  --measure: 70ch;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.02rem;
  line-height: 1.65;
  font-optical-sizing: auto;
}

/* ---------- shell ---------- */
.app { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }

.topbar {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--sp-4); padding: var(--sp-4) clamp(var(--sp-4), 5vw, var(--sp-8));
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: color-mix(in oklch, var(--paper) 90%, transparent);
  backdrop-filter: blur(6px); z-index: 5;
}
.wordmark { font-family: var(--display); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; }
.wordmark b { color: var(--accent); }
.gear { font-family: var(--display); background: none; border: 0; color: var(--ink-faint); cursor: pointer; font-size: 0.85rem; letter-spacing: 0.04em; text-transform: uppercase; }
.gear:hover { color: var(--accent); }

.steps { display: flex; gap: var(--sp-4); list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.steps li { font-family: var(--display); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); display: flex; gap: var(--sp-2); align-items: center; }
.steps li .n { font-variant-numeric: tabular-nums; width: 1.4em; height: 1.4em; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; font-size: 0.68rem; }
.steps li[aria-current="true"] { color: var(--accent); }
.steps li[aria-current="true"] .n { border-color: var(--accent); background: var(--accent); color: var(--paper); }
.steps li.done { color: var(--ink-soft); }
.steps li.done .n { border-color: var(--ink-soft); }

main { padding: clamp(var(--sp-5), 4vw, var(--sp-8)) clamp(var(--sp-4), 5vw, var(--sp-8)) var(--sp-9); }
.screen { display: none; max-width: 1040px; margin: 0 auto; animation: rise 0.5s var(--ease) both; }
.screen.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- type ---------- */
.eyebrow { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.74rem; color: var(--accent); margin: 0 0 var(--sp-2); }
h1.title { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; line-height: 1.02; font-size: clamp(2rem, 5vw, 3.2rem); margin: 0 0 var(--sp-4); max-width: 18ch; }
h2.title { font-family: var(--display); font-weight: 600; font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.01em; margin: 0 0 var(--sp-3); }
.lede { color: var(--ink-soft); max-width: 60ch; margin: 0 0 var(--sp-6); }

/* ---------- forms ---------- */
.field { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-5); max-width: var(--measure); }
label { font-family: var(--display); font-size: 0.82rem; font-weight: 600; letter-spacing: 0.01em; }
label .hint { display: block; font-family: var(--body); font-weight: 400; font-size: 0.82rem; color: var(--ink-faint); margin-top: 2px; }
input[type=text], input[type=password], input[type=date], input[type=url], textarea, select {
  font-family: var(--body); font-size: 1rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4); width: 100%; transition: border-color 0.2s, box-shadow 0.2s;
}
select, input[type=date] { font-family: var(--display); }
textarea { resize: vertical; line-height: 1.6; }
input:focus, textarea:focus, select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.row { display: flex; gap: var(--sp-5); flex-wrap: wrap; }
.row .field { flex: 1 1 240px; }
.check { display: flex; align-items: center; gap: var(--sp-3); font-family: var(--display); font-weight: 600; cursor: pointer; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.counter { font-family: var(--display); font-size: 0.75rem; color: var(--ink-faint); text-align: right; }
.counter.over { color: var(--danger); }

/* ---------- buttons ---------- */
.actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; margin-top: var(--sp-6); }
button.btn { font-family: var(--display); font-weight: 600; font-size: 0.92rem; cursor: pointer; border-radius: var(--radius); padding: var(--sp-3) var(--sp-5); border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink); transition: transform 0.15s var(--ease), background 0.2s, border-color 0.2s, color 0.2s; }
button.btn:hover { transform: translateY(-1px); border-color: var(--ink-soft); }
button.btn:active { transform: none; }
button.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--paper); }
button.btn.primary:hover { background: oklch(0.42 0.15 25); }
button.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-soft); }
button.btn.ghost:hover { color: var(--accent); background: var(--paper-2); }
button.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.spacer { flex: 1; }

/* ---------- text editor screen ---------- */
.editor { display: grid; grid-template-columns: 1fr; gap: var(--sp-6); }
@media (min-width: 900px) { .editor { grid-template-columns: 1fr 1fr; } }
.editor .pane-edit .field { max-width: none; }
.editor textarea.body { min-height: 460px; font-family: var(--body); }
.preview { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-6); background: var(--paper-2); overflow: auto; max-height: 70dvh; }
.preview h2 { font-family: var(--display); font-weight: 700; font-size: 1.5rem; letter-spacing: -0.01em; margin: var(--sp-5) 0 var(--sp-2); }
.preview h3 { font-family: var(--display); font-weight: 600; font-size: 1.18rem; margin: var(--sp-4) 0 var(--sp-2); }
.preview p { max-width: var(--measure); }
.preview ul, .preview ol { max-width: var(--measure); padding-left: 1.3em; }
.preview a { color: var(--accent); }

/* ---------- ai prompt inline ---------- */
.aibox { margin-top: var(--sp-4); display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.35s var(--ease); }
.aibox.open { grid-template-rows: 1fr; }
.aibox > div { overflow: hidden; }
.aibox textarea { margin-top: var(--sp-3); min-height: 70px; }

/* ---------- image screen ---------- */
.concepts { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-bottom: var(--sp-5); }
.concept { text-align: left; padding: var(--sp-4); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--paper); cursor: pointer; font-family: var(--body); transition: border-color 0.2s, background 0.2s; }
.concept:hover { border-color: var(--ink-soft); }
.concept[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.concept .n { font-family: var(--display); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); }
.gallery { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.gallery img { width: 100%; border-radius: var(--radius); border: 3px solid transparent; cursor: pointer; display: block; aspect-ratio: 16/10; object-fit: cover; }
.gallery img[aria-pressed="true"] { border-color: var(--accent); }

/* ---------- summary ---------- */
.summary { display: grid; gap: var(--sp-6); grid-template-columns: 1fr; }
@media (min-width: 860px) { .summary { grid-template-columns: 1.4fr 1fr; } }
.meta dl { display: grid; grid-template-columns: max-content 1fr; gap: var(--sp-2) var(--sp-4); margin: 0; }
.meta dt { font-family: var(--display); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-faint); }
.meta dd { margin: 0; }
.tag { display: inline-block; font-family: var(--display); font-size: 0.8rem; color: var(--accent); margin-right: var(--sp-2); }
.thumb { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }

/* ---------- success ---------- */
.success .big { font-family: var(--display); font-weight: 800; font-size: clamp(2.4rem, 7vw, 4rem); letter-spacing: -0.02em; color: var(--accent); line-height: 1; }
.success a.link { color: var(--accent); word-break: break-all; }

/* ---------- feedback ---------- */
.status { font-family: var(--display); font-size: 0.85rem; color: var(--ink-soft); display: flex; align-items: center; gap: var(--sp-2); min-height: 1.4em; }
.status.err { color: var(--danger); }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }
.callout { border: 1px solid var(--warn); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); background: color-mix(in oklch, var(--warn) 10%, var(--paper)); font-size: 0.9rem; margin-bottom: var(--sp-5); }

.center-card { max-width: 420px; margin: 8vh auto 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
