/* ============================================================================
 * skill.css — Skill.md builder  ·  Identity C: "Editorial / manuscript studio"
 * Violet ink on warm paper. Calm, textual, document-like — the deliberate
 * opposite of the two technical canvases (Automations blueprint, Agents
 * mission-control). Token-driven, light + dark + RTL safe.
 * ==========================================================================*/

.sk-body {
  background: var(--bg);
  color: var(--fg);
  /* Existing accents kept verbatim. */
  --sk-accent: #8b5cf6;
  --sk-accent-2: #6d28d9;
  /* Editorial violet "ink" — deeper, for solid fills + the masthead rule. */
  --sk-ink: #5b21b6;
  --sk-ink-soft: rgba(91, 33, 182, .10);
  --sk-ink-line: rgba(109, 40, 217, .22);
  --sk-ring: rgba(139, 92, 246, .22);
  /* Warm paper: a faint parchment overlay laid over --surface in light mode.
     Layered as a gradient so it stays token-derived, never a hard hex page. */
  --sk-paper: linear-gradient(0deg, rgba(124, 92, 38, .035), rgba(124, 92, 38, .035)), var(--surface);
  --sk-paper-2: linear-gradient(0deg, rgba(124, 92, 38, .05), rgba(124, 92, 38, .05)), var(--surface-2);
  /* Reading rhythm. */
  --sk-measure: 66ch;
}

/* hidden must beat the display:flex rules below (e.g. .sk-loading). */
.sk-body [hidden] { display: none !important; }

.sk-main { max-width: 980px; margin: 0 auto; padding: 18px 16px 64px; }
.sk-toggle-row { display: flex; justify-content: center; margin: 6px 0 22px; }

/* In dark mode there is no parchment — fall back to clean dark surfaces, and
   warm the ink so it stays legible against the deep ground. */
.sk-body.dark-mode {
  --sk-paper: var(--surface);
  --sk-paper-2: var(--surface-2);
  --sk-ink: #a78bfa;
  --sk-ink-soft: rgba(167, 139, 250, .14);
  --sk-ink-line: rgba(167, 139, 250, .30);
  --sk-ring: rgba(167, 139, 250, .26);
}

/* ── Masthead / hero ───────────────────────────────────────────────────────
 * Typeset like the head of a printed document: a kicker with a short violet
 * marker rule, a large Geist display headline with tight leading, and a fine
 * measure rule beneath that sets the column. */
.sk-hero { text-align: center; margin: 4px 0 26px; }

.sk-eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase;
  color: var(--sk-ink); margin-bottom: 14px;
}
.sk-eyebrow::before,
.sk-eyebrow::after {
  content: ""; width: 22px; height: 1.5px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--sk-ink-line));
}
.sk-eyebrow::after { background: linear-gradient(90deg, var(--sk-ink-line), transparent); }

.sk-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 4.6vw, 46px);
  font-weight: 760;
  letter-spacing: -.022em;
  line-height: 1.08;
  margin: 0 auto 16px;
  max-width: 18ch;
  color: var(--fg);
}
.sk-hero h1 .accent {
  background: linear-gradient(135deg, var(--sk-accent), var(--sk-accent-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.sk-hero p {
  position: relative;
  color: var(--fg-muted);
  font-size: 16px; line-height: 1.65;
  max-width: 56ch; margin: 0 auto;
  padding-top: 18px;
}
/* The measure rule — a thin centered hairline that reads as a typeset divider. */
.sk-hero p::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 56px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--sk-ink-line) 30%, var(--sk-ink-line) 70%, transparent);
}

/* ── Manuscript sheet (builder panel) ──────────────────────────────────────
 * A page: warm paper, a left violet accent rule, generous padding, and a soft
 * page-edge shadow so it lifts like a sheet on a desk. */
.sk-panel {
  position: relative;
  background: var(--sk-paper);
  border: 1px solid var(--border);
  border-left: 3px solid var(--sk-accent);
  border-radius: 4px 14px 14px 4px;
  padding: 26px 28px;
  box-shadow: var(--shadow-card);
}

.sk-label {
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--sk-ink);
  margin: 0 0 10px;
}

/* The writing surface — calm, comfortable, paper-toned. */
.sk-idea {
  width: 100%; resize: vertical; min-height: 108px;
  font-family: var(--font-body);
  font-size: 15.5px; line-height: 1.72;
  color: var(--fg);
  background: var(--sk-paper-2);
  border: 1px solid var(--border-input);
  border-radius: 8px;
  padding: 15px 17px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.sk-idea::placeholder { color: var(--fg-muted); opacity: .9; }
.sk-idea:focus {
  outline: none;
  border-color: var(--sk-accent);
  box-shadow: 0 0 0 3px var(--sk-ring);
}

/* ── Target pills — a curated catalog of destinations ──────────────────────*/
.sk-targets { display: block; margin: 18px 0 4px; }
.sk-target-group {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--fg-muted); opacity: .85;
  margin: 16px 0 8px;
}
.sk-target-group:first-child { margin-top: 0; }
.sk-target-row { display: flex; flex-wrap: wrap; gap: 8px; }

.sk-target {
  font-family: var(--font-body);
  font-size: 13px; font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}
.sk-target:hover { border-color: var(--sk-accent); color: var(--sk-ink); }
.sk-target.is-on {
  background: linear-gradient(135deg, var(--sk-accent), var(--sk-accent-2));
  color: #fff; border-color: transparent;
  box-shadow: 0 1px 6px rgba(109, 40, 217, .28);
}
.sk-body.dark-mode .sk-target.is-on { color: #f5f3ff; }

/* ── Controls + the editorial "compose" button ─────────────────────────────
 * A restrained solid deep-violet ink button with a faint top sheen — not a
 * squared RUN key, not a glowing capsule. */
.sk-controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.sk-hint { font-size: 13px; color: var(--fg-muted); line-height: 1.5; }

.sk-btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-body);
  font-size: 14px; font-weight: 600; letter-spacing: .01em;
  border: 0; border-radius: 8px;
  padding: 11px 20px; cursor: pointer; color: #fff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0) 42%),
    linear-gradient(180deg, var(--sk-accent-2), var(--sk-ink));
  box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 4px 12px rgba(91, 33, 182, .26);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease),
              filter var(--dur-fast) var(--ease);
}
.sk-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .22) inset, 0 7px 18px rgba(91, 33, 182, .32);
}
.sk-btn:active:not(:disabled) { transform: translateY(0); filter: brightness(.97); }
.sk-btn:disabled { opacity: .5; cursor: not-allowed; }

.sk-btn-ghost {
  color: var(--fg);
  background: var(--sk-paper);
  border: 1px solid var(--border-strong);
  box-shadow: none;
}
.sk-btn-ghost:hover:not(:disabled) {
  background: var(--sk-paper-2);
  border-color: var(--sk-accent);
  color: var(--sk-ink);
  transform: none;
}

.sk-cost-pill {
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 600;
  padding: 1px 7px; border-radius: 5px;
  background: rgba(255, 255, 255, .2);
  letter-spacing: .02em;
}
.sk-btn-ghost .sk-cost-pill,
.sk-download.sk-btn .sk-cost-pill { background: var(--sk-ink-soft); color: var(--sk-ink); }

/* ── Template gallery — a quiet "library shelf" of starters ─────────────────*/
.sk-templates { margin-top: 30px; }
.sk-tpl-group {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.sk-tpl-group:last-child { border-bottom: 0; }
.sk-tpl-cat {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--fg-muted);
  margin: 0 0 9px;
}
.sk-tpl-row { display: flex; flex-wrap: wrap; gap: 8px; }
.sk-tpl {
  font-family: var(--font-body);
  font-size: 12.5px; color: var(--fg);
  background: var(--sk-paper);
  border: 1px solid var(--border);
  border-left: 2px solid var(--sk-ink-line);
  border-radius: 3px 8px 8px 3px;
  padding: 6px 12px; cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}
.sk-tpl:hover {
  border-color: var(--sk-accent);
  border-left-color: var(--sk-accent);
  color: var(--sk-ink);
  background: var(--sk-ink-soft);
}

/* ── Loading — a calm, editorial pause ─────────────────────────────────────*/
.sk-loading {
  display: flex; align-items: center; justify-content: center; gap: 11px;
  color: var(--fg-muted); font-size: 14px; padding: 44px 24px;
  font-style: italic;
}
.sk-spin {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--sk-ink-line);
  border-top-color: var(--sk-accent);
  animation: sk-spin .8s linear infinite;
}
@keyframes sk-spin { to { transform: rotate(360deg); } }

/* ── Result — the printed manuscript page ──────────────────────────────────*/
.sk-result {
  margin-top: 26px;
  background: var(--sk-paper);
  border: 1px solid var(--border);
  border-left: 3px solid var(--sk-accent);
  border-radius: 4px 14px 14px 4px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.sk-result-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--sk-paper-2);
}
.sk-result-title {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 640; color: var(--fg);
  letter-spacing: -.01em;
}
.sk-result-actions { display: flex; gap: 8px; }

/* The reading column: a comfortable measure, generous leading, refined
   heading hierarchy, ruled dividers, elegant code. Reads like a typeset page,
   not a textarea. */
.sk-md {
  padding: 28px clamp(20px, 5vw, 44px) 36px;
  max-height: 62vh; overflow-y: auto;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15.5px; line-height: 1.78;
}
.sk-md > * { max-width: var(--sk-measure); }

.sk-md h1, .sk-md h2, .sk-md h3 {
  font-family: var(--font-display);
  color: var(--fg);
  line-height: 1.22; letter-spacing: -.015em;
}
.sk-md h1 {
  font-size: 27px; font-weight: 720;
  margin: 4px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.sk-md h2 {
  font-size: 20px; font-weight: 660;
  margin: 30px 0 10px;
}
.sk-md h3 {
  font-size: 16px; font-weight: 640;
  margin: 22px 0 8px;
  color: var(--sk-ink);
}
/* A violet first-line accent on the opening heading — the manuscript's mark. */
.sk-md > h1:first-child,
.sk-md > h2:first-child {
  position: relative; padding-left: 16px;
}
.sk-md > h1:first-child::before,
.sk-md > h2:first-child::before {
  content: ""; position: absolute; left: 0; top: .12em; bottom: .28em;
  width: 3px; border-radius: 3px;
  background: linear-gradient(180deg, var(--sk-accent), var(--sk-accent-2));
}
.sk-md > h1:first-child { padding-left: 18px; }

.sk-md p { margin: 12px 0; }
/* A subtle drop-cap on the first paragraph for editorial flourish. */
.sk-md > p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-weight: 720;
  font-size: 3.1em; line-height: .82;
  float: left;
  margin: .04em .09em -.02em 0;
  color: var(--sk-ink);
}
.sk-body[dir="rtl"] .sk-md > p:first-of-type::first-letter,
[dir="rtl"] .sk-md > p:first-of-type::first-letter { float: right; margin: .04em 0 -.02em .09em; }

.sk-md ul, .sk-md ol { margin: 12px 0; padding-left: 26px; }
.sk-md li { margin: 6px 0; padding-left: 4px; }
.sk-md ul li::marker { color: var(--sk-accent); }
.sk-md ol li::marker { color: var(--sk-ink); font-variant-numeric: tabular-nums; }

.sk-md strong { font-weight: 680; color: var(--fg); }
.sk-md em { font-style: italic; }
.sk-md a { color: var(--sk-ink); text-decoration: underline; text-underline-offset: 2px; }

/* Ruled section divider — quiet centered ornament rather than a hard line. */
.sk-md hr {
  border: 0; height: 1px; margin: 26px auto;
  background: linear-gradient(90deg, transparent, var(--sk-ink-line) 30%, var(--sk-ink-line) 70%, transparent);
}

.sk-md code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--sk-ink-soft);
  color: var(--sk-ink);
  padding: 1.5px 6px; border-radius: 5px;
}
.sk-md pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 2px solid var(--sk-ink-line);
  border-radius: 4px 10px 10px 4px;
  padding: 14px 16px; overflow-x: auto;
  margin: 14px 0;
  max-width: 100%;
}
.sk-md pre code {
  background: none; padding: 0; color: var(--fg);
  font-size: 12.5px; line-height: 1.6;
}

/* ── RTL: keep the accent rule + chip bevels on the leading edge ───────────*/
[dir="rtl"] .sk-panel,
[dir="rtl"] .sk-result {
  border-left: 1px solid var(--border);
  border-right: 3px solid var(--sk-accent);
  border-radius: 14px 4px 4px 14px;
}
[dir="rtl"] .sk-result-head { padding: 14px 22px 14px 18px; }
[dir="rtl"] .sk-tpl,
[dir="rtl"] .sk-md pre {
  border-left: 1px solid var(--border);
  border-right: 2px solid var(--sk-ink-line);
  border-radius: 8px 3px 3px 8px;
}
[dir="rtl"] .sk-md ul, [dir="rtl"] .sk-md ol { padding-left: 0; padding-right: 26px; }

/* ── Accessibility ─────────────────────────────────────────────────────────*/
.sk-target:focus-visible,
.sk-tpl:focus-visible,
.sk-btn:focus-visible {
  outline: 2px solid var(--sk-accent);
  outline-offset: 2px;
}
.sk-idea:focus-visible { outline: none; }

/* Generous targets on touch devices. */
@media (pointer: coarse) {
  .sk-target, .sk-tpl { min-height: 40px; }
  .sk-btn { min-height: 44px; }
}

/* Respect reduced-motion — no spinner motion, no lift transitions. */
@media (prefers-reduced-motion: reduce) {
  .sk-spin { animation: none; }
  .sk-idea, .sk-target, .sk-tpl, .sk-btn, .sk-btn-ghost { transition: none; }
  .sk-btn:hover:not(:disabled) { transform: none; }
}

/* ── Responsive ────────────────────────────────────────────────────────────*/
@media (max-width: 640px) {
  .sk-panel { padding: 20px 18px; }
  .sk-hero h1 { font-size: clamp(26px, 8vw, 34px); }
  .sk-controls { flex-direction: column; align-items: stretch; }
  .sk-btn { justify-content: center; }
  .sk-result-head { flex-wrap: wrap; }
  .sk-md { padding: 22px 18px 28px; font-size: 15px; }
  .sk-md > p:first-of-type::first-letter { font-size: 2.7em; }
}
