/* ---------------------------------------------------------------
   Kogzy Builder
   The app chrome (entry screens, toolbars, panels) follows the
   Kogzy brand kit. The wireframe canvas itself stays deliberately
   plain so conversations stay about structure, copy, and menus.
   --------------------------------------------------------------- */

:root {
  /* Kogzy chrome (brand kit v2.0) */
  --bg: #0a1128;
  --bg-elev: #0f1835;
  --bg-card: #111a3a;
  --k-line: rgba(120, 140, 220, 0.14);
  --k-line-strong: rgba(120, 140, 220, 0.28);
  --k-ink: #f4f5fb;
  --k-ink-dim: #9ba3c4;
  --k-ink-mute: #5b6590;
  --accent: #5b5fef;
  --accent-hover: #6c70ff;
  --accent-soft: rgba(91, 95, 239, 0.14);
  --warn: #ef5b7a;

  /* wireframe canvas (kept plain on purpose) */
  --ink: #1a1a1a;
  --ink-soft: #555;
  --ink-faint: #999;
  --line: #d9d9d9;
  --paper: #ffffff;
  --paper-dim: #f5f5f4;
  --note: #fef9c3;
  --note-border: #eab308;
  --danger: #dc2626;
  --radius: 6px;
  --page-width: 860px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--k-ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(1000px 700px at 50% 20%, rgba(91, 95, 239, 0.12), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

#app { position: relative; z-index: 1; }

.loading { padding: 4rem; text-align: center; color: var(--k-ink-mute); }

.brandmark {
  font-family: "Inter Tight", "Inter", sans-serif;
  font-weight: 800;
  font-style: italic;
  font-size: 26px;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.1rem;
}

/* ============ Wireframe canvas (the client's site skeleton) ============ */

.site {
  max-width: var(--page-width);
  margin: 2rem auto 6rem;
  min-height: calc(100vh - 8rem);
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--k-line-strong);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.site-header {
  padding: 1.4rem 2rem 0;
}

.site-name {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.site-tagline {
  margin: 0.1rem 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* --- Nav --- */

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  padding: 0.9rem 2rem;
  border-bottom: 2px solid var(--ink);
  margin-top: 0.9rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  border-radius: var(--radius);
}

.nav-link {
  background: none;
  border: none;
  font: inherit;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.nav-link:hover { background: var(--paper-dim); color: var(--ink); }
.nav-item.active .nav-link { color: var(--ink); background: var(--paper-dim); }

.nav-item.active { box-shadow: inset 0 -3px 0 var(--ink); border-radius: var(--radius) var(--radius) 0 0; }

/* --- Main content --- */

.page-main {
  flex: 1;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2.2rem;
}

.section { position: relative; }

.section h2 {
  font-size: 1.35rem;
  margin: 0 0 0.5rem;
}

.section p { margin: 0; color: var(--ink-soft); white-space: pre-wrap; }

/* hero */
.sec-hero {
  text-align: center;
  padding: 1rem 0 0.5rem;
}
.sec-hero .hero-heading {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 0.6rem;
  color: var(--ink);
}
.sec-hero p { max-width: 34rem; margin: 0 auto; }
.sec-hero .img-ph { margin-top: 1.4rem; }

.btn-ph {
  display: inline-block;
  margin-top: 1.1rem;
  padding: 0.6rem 1.5rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  font-weight: 700;
  background: var(--paper);
  cursor: default;
}

/* text + image split */
.sec-textImage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.6rem;
  align-items: center;
}
.sec-textImage.img-left .ti-text { order: 2; }
.sec-textImage.img-left .img-ph { order: 1; }

/* gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

/* ---- Image placeholders ---- */

.img-ph {
  position: relative;
  border: 2px dashed var(--ink-faint);
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(45deg, transparent, transparent 14px, rgba(0,0,0,0.025) 14px, rgba(0,0,0,0.025) 28px),
    var(--paper-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: var(--ink-soft);
  text-align: center;
  padding: 0.8rem;
  overflow: hidden;
}

.img-ph.ratio-wide   { aspect-ratio: 16 / 9; }
.img-ph.ratio-banner { aspect-ratio: 3 / 1; }
.img-ph.ratio-square { aspect-ratio: 1 / 1; }
.img-ph.ratio-tall   { aspect-ratio: 3 / 4; }

.img-ph svg { width: 30px; height: 30px; opacity: 0.45; flex-shrink: 0; }

.img-label {
  font-size: 0.85rem;
  font-weight: 600;
  max-width: 100%;
}

.img-caption {
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-top: 0.4rem;
}

/* ---- Sticky notes (comments) ---- */

.sticky-note {
  margin-top: 0.8rem;
  background: var(--note);
  border: 1px solid var(--note-border);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  font-size: 0.88rem;
  white-space: pre-wrap;
  color: #713f12;
  position: relative;
}
.sticky-note::before {
  content: "Note";
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.6;
  margin-bottom: 0.15rem;
}

/* --- Footer --- */

.site-footer {
  border-top: 2px solid var(--ink);
  padding: 1.2rem 2rem 1.6rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  white-space: pre-wrap;
}

/* ============ Editor chrome (minimal on the canvas) ============ */

.hint-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-elev);
  color: var(--k-ink-dim);
  border-bottom: 1px solid var(--k-line);
  text-align: center;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
}

[contenteditable] {
  outline: none;
  border-radius: 3px;
  transition: box-shadow 0.1s;
  cursor: text;
  min-width: 1ch;
}
[contenteditable]:hover { box-shadow: 0 0 0 2px var(--accent-soft); }
[contenteditable]:focus { box-shadow: 0 0 0 2px var(--accent); background: #fff; }

[contenteditable].is-empty { color: var(--ink-faint) !important; font-style: italic; }

/* section toolbar */
.sec-tools {
  position: absolute;
  top: -0.9rem;
  right: 0;
  display: none;
  gap: 2px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2px;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.section:hover .sec-tools, .sec-tools:focus-within { display: flex; }

.editing .section { border: 1px dashed transparent; border-radius: var(--radius); padding: 0.4rem; margin: -0.4rem; }
.editing .section:hover { border-color: var(--accent); }

.tool-btn {
  background: none;
  border: none;
  font: inherit;
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  color: var(--ink-soft);
  white-space: nowrap;
}
.tool-btn:hover { background: var(--paper-dim); color: var(--ink); }
.tool-btn.danger:hover { background: #fee2e2; color: var(--danger); }

/* add-section row */
.add-section {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.8rem;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
}
.add-section span { width: 100%; text-align: center; font-size: 0.8rem; color: var(--ink-faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

.add-btn {
  background: var(--paper-dim);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  color: var(--ink-soft);
}
.add-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* nav page tools */
.nav-tools { display: flex; gap: 2px; }
.nav-tools .tool-btn { padding: 0.2rem 0.3rem; font-size: 0.75rem; }
.nav-add { margin-left: 0.4rem; }

/* ---- Per-page search-listing fields ---- */

.page-seo {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-dim);
  font-size: 0.9rem;
}
.page-seo summary {
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-soft);
  list-style-position: inside;
}
.page-seo[open] summary { border-bottom: 1px solid var(--line); }
.seo-fields { padding: 0.8rem 0.9rem 1rem; }
.seo-fields label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0.7rem 0 0.25rem;
}
.seo-fields label:first-child { margin-top: 0; }
.seo-input {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.45rem 0.6rem;
}

/* ---- Floating action bar (Kogzy pills) ---- */

.action-bar {
  position: fixed;
  bottom: 1.2rem;
  right: 1.2rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  z-index: 50;
}

.fab {
  border: 1px solid var(--k-line-strong);
  background: var(--bg-card);
  color: var(--k-ink);
  font: inherit;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.65rem 1.25rem;
  border-radius: 100px;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
  transition: border-color 0.25s, background 0.2s;
}
.fab:hover { border-color: var(--accent); }

.fab.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.fab.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.fab.primary:disabled { opacity: 0.55; cursor: default; }

.fab.subtle { color: var(--k-ink-dim); }
.fab.subtle:hover { color: var(--k-ink); }

.save-status {
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--k-ink-dim);
  background: var(--bg-card);
  border: 1px solid var(--k-line-strong);
  border-radius: 100px;
  padding: 0.4rem 0.9rem;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
}
.save-status.dirty { color: #eab308; }
.save-status.error { color: var(--warn); }
.save-status.ok { color: #4ade80; }

/* ---- Site Details modal (Kogzy card) ---- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 24, 0.7);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 3vh 1rem;
}

.modal {
  background: var(--bg-card);
  color: var(--k-ink);
  border: 1px solid var(--k-line-strong);
  border-radius: 14px;
  max-width: 34rem;
  width: 100%;
  padding: 1.6rem 1.8rem 1.8rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  margin-bottom: 3vh;
}

.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 {
  margin: 0;
  font-family: "Bricolage Grotesque", "Inter", sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
}
.modal-head .tool-btn { color: var(--k-ink-dim); }
.modal-head .tool-btn:hover { background: var(--accent-soft); color: var(--k-ink); }
.modal-intro { color: var(--k-ink-dim); font-size: 0.9rem; margin: 0.4rem 0 1.1rem; }

.modal-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--k-ink-dim);
  margin: 0.9rem 0 0.3rem;
}
.modal-field input, .modal-field textarea {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--k-ink);
  background: rgba(10, 17, 40, 0.5);
  border: 1px solid var(--k-line-strong);
  border-radius: 10px;
  padding: 12px 14px;
  resize: vertical;
}
.modal-field input::placeholder, .modal-field textarea::placeholder { color: var(--k-ink-mute); }
.modal-field input:focus, .modal-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-standard {
  margin-top: 1.2rem;
  padding: 0.7rem 0.9rem;
  background: var(--accent-soft);
  border: 1px solid var(--k-line);
  border-radius: 10px;
  font-size: 0.82rem;
  color: var(--k-ink-dim);
  line-height: 1.5;
}
.modal-standard strong { color: var(--k-ink); }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.2rem;
}
.modal-foot .fab { box-shadow: none; }

.modal-narrow { max-width: 26rem; margin-top: 14vh; }
.modal .error-msg { color: var(--warn); font-size: 0.85rem; margin-top: 0.8rem; }
.modal-foot .foot-left { margin-right: auto; }

.modal-warning {
  margin: 0.8rem 0 0.4rem;
  padding: 0.7rem 0.9rem;
  background: rgba(239, 91, 122, 0.1);
  border: 1px solid rgba(239, 91, 122, 0.35);
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--k-ink-dim);
  line-height: 1.5;
}
.modal-warning strong { color: var(--warn); }

.blueprint-preview {
  margin-top: 0.9rem;
  padding: 0.7rem 0.9rem;
  background: var(--accent-soft);
  border: 1px solid var(--k-line);
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--k-ink-dim);
}
.blueprint-preview strong { color: var(--k-ink); }
.blueprint-preview ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.blueprint-preview li { margin: 0.15rem 0; }

/* ============ Entry & admin screens (Kogzy card) ============ */

.start {
  max-width: 30rem;
  margin: 10vh auto 6vh;
  background: var(--bg-card);
  border: 1px solid var(--k-line-strong);
  border-radius: 14px;
  padding: 2.2rem 2.4rem 2.6rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  position: relative;
  overflow: hidden;
}
.start::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(400px 200px at 50% 0%, rgba(91, 95, 239, 0.12), transparent 70%);
  pointer-events: none;
}
.start > * { position: relative; }

.start h1 {
  font-family: "Bricolage Grotesque", "Inter", sans-serif;
  font-weight: 700;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 0 0 0.4rem;
  color: var(--k-ink);
}
.start p { color: var(--k-ink-dim); font-size: 0.94rem; margin: 0 0 1.4rem; }

.start label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--k-ink-dim);
  margin: 1rem 0 0.3rem;
}
.start input {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--k-ink);
  background: rgba(10, 17, 40, 0.5);
  border: 1px solid var(--k-line-strong);
  border-radius: 10px;
  padding: 14px 16px;
}
.start input::placeholder { color: var(--k-ink-mute); }
.start input:focus { outline: none; border-color: var(--accent); }

.start .row { display: flex; gap: 0.6rem; margin-top: 1.6rem; }
.start button {
  font: inherit;
  font-weight: 500;
  font-size: 15px;
  padding: 13px 28px;
  border-radius: 100px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--k-ink);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.start button:hover { background: var(--accent); color: #fff; }
.start button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.start button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.start .field-hint { font-size: 0.78rem; color: var(--k-ink-mute); margin-top: 0.3rem; }
.start .error-msg { color: var(--warn); font-size: 0.85rem; margin-top: 0.9rem; }

/* ============ Small screens ============ */

@media (max-width: 640px) {
  .site { margin: 0.8rem 0.6rem 6rem; min-height: 0; }
  .site-header, .site-nav, .page-main, .site-footer { padding-left: 1rem; padding-right: 1rem; }
  .sec-textImage { grid-template-columns: 1fr; }
  .sec-textImage.img-left .ti-text { order: 0; }
  .sec-textImage.img-left .img-ph { order: 0; }
  .sec-hero .hero-heading { font-size: 1.6rem; }
  .start { margin: 6vh 1rem; padding: 1.8rem 1.4rem 2rem; }
}
