/* Stylobate — Krepis dashboard chrome. Its own constant identity (Greek stone/marble,
   stepped krepis motif), separate from the themes it applies. A condensed top bar +
   collapsible menu frame a content area: a wall of small live previews, and a
   fit-to-stage full-page live preview — the standard admin-dashboard shell pattern. */

.k-admin {
  --stone: #e9e4d8; --stone-deep: #d8d1be; --marble: #f5f2ea; --ink: #23211c;
  --ink-soft: #6b6353; --vein: #b7ae98; --accent: #6a5e40; --accent-ink: #fffdf7;
  --bar-h: 56px; --k-menu-w: 200px; --step: 6px;
  margin: 0; min-height: 100vh; background: var(--marble); color: var(--ink);
  font-family: "Spectral", Georgia, serif;
  scroll-padding-top: calc(var(--bar-h) + 8px);  /* keep focus clear of the fixed top bar */
}
/* the Settings placeholder is a real (disabled) button so assistive tech announces it as an
   unavailable control rather than skipping bare text; strip the native button chrome. */
button.k-mlink { appearance: none; -webkit-appearance: none; background: none; border: 0;
  width: 100%; font: inherit; text-align: left; }
button.k-mlink[disabled] { opacity: 0.75; cursor: default; }
.k-admin.k-menu-collapsed { --k-menu-w: 64px; }

/* ---- top bar ---- */
.k-topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--bar-h); z-index: 20;
  display: flex; align-items: center; gap: 14px; padding: 0 16px;
  border-bottom: 2px solid var(--vein);
  background:
    linear-gradient(180deg, var(--stone) 0 calc(var(--bar-h) - 4px), var(--vein) calc(var(--bar-h) - 4px) calc(var(--bar-h) - 2px), var(--accent) calc(var(--bar-h) - 2px) var(--bar-h));
}
.k-menu-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--marble); border: 1px solid var(--vein); color: var(--ink);
}
.k-steps { width: 20px; height: 14px;
  background: linear-gradient(180deg, var(--stone-deep) 0 4px, var(--vein) 4px 8px, var(--accent) 8px 14px); }
.k-mark { margin: 0; font-family: "Cormorant Garamond", serif; font-weight: 600;
  font-size: 28px; letter-spacing: 0.02em; line-height: 1; }
.k-mark-sub { margin: 0; font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent); }
.k-readout { margin: 0 0 0 auto; font-size: 13px; color: var(--ink-soft); letter-spacing: 0.04em; }
.k-readout span#k-active-name { color: var(--ink); font-weight: 600; }

/* ---- frame: menu + content ---- */
.k-frame { display: grid; grid-template-columns: var(--k-menu-w) 1fr; padding-top: var(--bar-h); }
.k-menu {
  position: sticky; top: var(--bar-h); align-self: start; height: calc(100vh - var(--bar-h));
  display: flex; flex-direction: column; overflow: auto;
  border-right: 2px solid var(--vein); padding: 14px 10px; background: var(--stone);
}
.k-menu ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
/* the krepis stepped foundation, anchored at the base of the pillar (calm stone above it) */
.k-menu::after { content: ""; flex: none; margin-top: auto; height: 18px;
  background: linear-gradient(180deg, var(--stone-deep) 0 6px, var(--vein) 6px 12px, var(--accent) 12px 18px); }
.k-mlink {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px;
  color: var(--ink); text-decoration: none; border-left: 3px solid transparent;
}
a.k-mlink:hover { background: var(--marble); }
.k-mlink.is-current { background: var(--marble); border-left-color: var(--accent); font-weight: 600; }
.k-soon-row { color: var(--ink-soft); cursor: default; }
.k-mi { width: 20px; text-align: center; flex: none; font-size: 16px; }
.k-ml { letter-spacing: 0.03em; }
.k-soon { margin-left: auto; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--vein); padding: 1px 6px; }
.k-menu-collapsed .k-ml, .k-menu-collapsed .k-soon, .k-menu-collapsed .k-mark-sub { display: none; }
.k-menu-collapsed .k-mlink { justify-content: center; gap: 0; }

/* ---- content + screens ---- */
.k-content { padding: clamp(18px, 3vw, 40px); min-width: 0; }
.k-screen-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 14px; border-bottom: 1px solid var(--vein); padding-bottom: 14px; margin-bottom: 22px; }
.k-screen-titles h1 { margin: 0; font-family: "Cormorant Garamond", serif; font-weight: 600;
  font-size: clamp(28px, 3.4vw, 42px); line-height: 1; }
.k-screen-note { margin: 6px 0 0; color: var(--ink-soft); font-size: 14px; }
.k-search input { font: inherit; font-size: 15px; padding: 9px 12px; min-width: 240px;
  border: 1px solid var(--vein); background: #fff; color: var(--ink); }

/* ---- theme wall ---- */
.k-tgroup { margin-bottom: 30px; }
.k-tgroup > h2 { font-family: "Cormorant Garamond", serif; font-weight: 600; font-size: 22px;
  margin: 0 0 14px; display: flex; align-items: baseline; gap: 8px; }
.k-tcount { font-family: "Spectral", serif; font-size: 12px; color: var(--ink-soft);
  border: 1px solid var(--vein); padding: 1px 7px; }
.k-grid { list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.k-tcard { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--vein); }
.k-tcard[hidden] { display: none; }   /* explicit display above would otherwise beat [hidden] */
.k-tcard.is-active { outline: 2px solid var(--accent); outline-offset: -1px; }

.k-tthumb { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--stone);
  border-bottom: 1px solid var(--vein); }
.k-tframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; pointer-events: none; background: #fff; }
.k-tactions { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  gap: 8px; opacity: 0; pointer-events: none; transition: opacity 0.16s ease;
  background: rgba(35, 33, 28, 0.55); }
.k-tcard:hover .k-tactions, .k-tcard:focus-within .k-tactions { opacity: 1; pointer-events: auto; }
.k-tactions button { font: inherit; font-size: 13px; padding: 8px 12px; border: 1px solid var(--ink); }
.k-tactions button[data-act="preview"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.k-tactions button[data-act="activate"] { background: var(--marble); color: var(--ink); }

.k-tbar { display: flex; align-items: center; gap: 8px; padding: 9px 11px; min-width: 0; }
.k-tchips { display: inline-flex; gap: 3px; flex: none; }
.k-tchips span { width: 12px; height: 12px; border: 1px solid var(--vein); }
.k-tname { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-tver { flex: none; font-size: 11px; font-weight: 400; color: var(--ink-soft); letter-spacing: 0.02em; }
.k-tbadge { flex: none; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); }
.k-tcard.is-active .k-tver { color: var(--accent-ink); }
.k-tcard.is-active .k-tbar { background: var(--accent); color: var(--accent-ink); }
.k-tcard.is-active .k-tbadge { color: var(--accent-ink); }

/* ---- live preview screen ---- */
.k-preview-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--vein); padding-bottom: 14px; margin-bottom: 18px; }
.k-back { font: inherit; font-size: 14px; padding: 8px 14px; background: var(--marble); border: 1px solid var(--vein); color: var(--ink); }
.k-preview-name { margin: 0; flex: 1; min-width: 140px; font-family: "Cormorant Garamond", serif; font-weight: 600; font-size: 24px; }
.k-devices { display: inline-flex; border: 1px solid var(--vein); }
.k-devices button { font: inherit; font-size: 13px; padding: 8px 14px; background: #fff; color: var(--ink); border: 0; border-left: 1px solid var(--vein); }
.k-devices button:first-child { border-left: 0; }
.k-devices button.is-on { background: var(--accent); color: var(--accent-ink); }
.k-activate-live { font: inherit; font-size: 14px; padding: 9px 16px; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); }

.k-preview-stage { position: relative; display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - var(--bar-h) - 160px); overflow: auto; padding: 16px;
  border: 1px solid var(--vein);
  background: var(--stone)
    repeating-linear-gradient(45deg, transparent 0 10px, rgba(123, 111, 79, 0.05) 10px 20px); }
.k-live-wrap { position: relative; overflow: hidden; background: #fff; box-shadow: 0 8px 30px rgba(35, 33, 28, 0.18);
  transition: width 0.18s ease, height 0.18s ease; }
.k-live-frame { border: 0; transform-origin: 0 0; background: #fff; display: block; transition: transform 0.18s ease; }

/* ---- content screen: editable fields + live preview ---- */
.k-content-layout { display: grid; grid-template-columns: minmax(320px, 440px) 1fr; gap: 22px; align-items: start; }
@media (max-width: 900px) { .k-content-layout { grid-template-columns: 1fr; } }
.k-editor { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.k-ed-bar { position: sticky; top: var(--bar-h); z-index: 5; display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; background: var(--marble); padding: 10px 0; margin-bottom: 2px; border-bottom: 1px solid var(--vein); }
.k-ed-save { font: inherit; font-size: 14px; padding: 9px 16px; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); }
.k-ed-reset { font: inherit; font-size: 14px; padding: 9px 14px; background: var(--marble); color: var(--ink); border: 1px solid var(--vein); }
.k-ed-status { font-size: 13px; color: var(--accent); letter-spacing: 0.02em; }
.k-ed-group { border: 1px solid var(--vein); margin: 0; padding: 12px 16px 16px; background: #fff; }
.k-ed-group legend { font-family: "Cormorant Garamond", serif; font-weight: 600; font-size: 19px; padding: 0 8px; }
.k-ed-field { display: flex; flex-direction: column; gap: 5px; margin-top: 12px; }
.k-ed-field:first-of-type { margin-top: 4px; }
.k-ed-label { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.k-ed-input { font: inherit; font-size: 15px; padding: 9px 11px; width: 100%; border: 1px solid var(--vein); background: #fff; color: var(--ink); }
textarea.k-ed-input { resize: vertical; line-height: 1.5; min-height: 70px; }
.k-ed-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.k-content-preview { position: sticky; top: calc(var(--bar-h) + 16px); border: 1px solid var(--vein); background: var(--stone); }
.k-content-preview-head { display: flex; align-items: baseline; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--vein);
  font-size: 13px; color: var(--ink-soft); }
.k-content-preview-head strong { color: var(--ink); font-weight: 600; font-size: 14px; }
.k-content-frame { display: block; width: 100%; height: 72vh; border: 0; background: #fff; }

/* ---- narrow screens: fold the menu to icons ---- */
@media (max-width: 760px) {
  .k-admin { --k-menu-w: 56px; }
  .k-ml, .k-soon, .k-mark-sub { display: none; }
  .k-mlink { justify-content: center; gap: 0; }
}
@media (max-width: 520px) {
  .k-frame { grid-template-columns: 1fr; }
  .k-menu { position: static; height: auto; flex-direction: row; }
  .k-menu ul { flex-direction: row; }
}
