/* Improvize design system — spruce / mist / teal / coral / amber */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/static/fonts/bricolage-grotesque-var.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-display: swap;
}

@font-face {
  font-family: "Public Sans";
  src: url("/static/fonts/public-sans-var.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --spruce: #10201b;
  --pine: #173028;
  --mist: #f4f7f2;
  --card: #ffffff;
  --ink: #17251f;
  --muted: #56655d;
  --line: #dde5da;
  --teal: #12a5a0;
  --teal-deep: #0b7a76;
  --teal-soft: rgba(18, 165, 160, 0.14);
  --coral: #ff6a4d;
  --coral-deep: #c6472e;
  --coral-soft: rgba(255, 106, 77, 0.14);
  --amber: #f0a62b;
  --amber-deep: #8a5d0d;
  --amber-soft: rgba(240, 166, 43, 0.17);
  --display: "Bricolage Grotesque", "Avenir Next", "Trebuchet MS", sans-serif;
  --body-font: "Public Sans", "Seravek", -apple-system, system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
  --radius: 14px;
  --pad-x: clamp(20px, 5vw, 72px);
}

* {
  box-sizing: border-box;
}

body {
  background: var(--mist);
  color: var(--ink);
  font-family: var(--body-font);
  line-height: 1.55;
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--display);
  text-wrap: balance;
}

img {
  max-width: 100%;
}

/* ---------- Header & footer ---------- */

.site-header {
  align-items: center;
  background: rgba(244, 247, 242, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 16px var(--pad-x);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  align-items: center;
  display: flex;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  gap: 10px;
}

.brand-mark {
  display: block;
}

.site-nav {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 500;
  gap: 24px;
}

.site-nav a:hover {
  color: var(--ink);
}

.nav-pill {
  background: var(--spruce);
  border-radius: 999px;
  color: #fff;
  font-weight: 600;
  padding: 8px 18px;
}

.nav-pill:hover {
  color: #fff;
  opacity: 0.9;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13.5px;
  gap: 16px;
  justify-content: space-between;
  padding: 28px var(--pad-x);
}

.site-footer strong {
  color: var(--ink);
}

/* ---------- Type helpers ---------- */

.eyebrow {
  color: var(--teal-deep);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  margin: 0 0 16px;
  text-transform: uppercase;
}

.chip {
  border-radius: 999px;
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  text-transform: uppercase;
}

.chip.teal {
  background: var(--teal-soft);
  color: var(--teal-deep);
}

.chip.coral {
  background: var(--coral-soft);
  color: var(--coral-deep);
}

.chip.amber {
  background: var(--amber-soft);
  color: var(--amber-deep);
}

/* ---------- Buttons ---------- */

.button {
  border: none;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  justify-content: center;
  padding: 12px 24px;
}

.button.primary {
  background: var(--coral);
  box-shadow: 0 8px 22px rgba(255, 106, 77, 0.35);
  color: #fff7f3;
}

.button.primary:hover {
  background: #f05a3d;
}

.button.ghost {
  background: transparent;
  border: 1.5px solid var(--ink);
  color: var(--ink);
}

.button.ghost.light {
  border-color: rgba(255, 255, 255, 0.4);
  color: #eaf3ec;
}

/* ---------- Hero ---------- */

.hero {
  align-items: center;
  background:
    linear-gradient(rgba(244, 247, 242, 0) 60%, var(--mist)),
    repeating-linear-gradient(0deg, rgba(18, 165, 160, 0.055) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(90deg, rgba(18, 165, 160, 0.055) 0 1px, transparent 1px 34px);
  display: grid;
  gap: 48px;
  grid-template-columns: 1.05fr 0.95fr;
  padding: 72px var(--pad-x) 84px;
}

.hero h1 {
  font-size: clamp(38px, 4.6vw, 60px);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.04;
  margin-bottom: 0;
}

.hero-body {
  color: var(--muted);
  font-size: 17.5px;
  margin-top: 20px;
  max-width: 46ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.hero-visual img {
  border-radius: 16px;
  box-shadow: 0 30px 60px rgba(16, 32, 27, 0.35);
  display: block;
  width: 100%;
}

/* ---------- Sections ---------- */

.section {
  padding: 68px var(--pad-x);
}

.section-heading {
  margin-bottom: 36px;
  max-width: 680px;
}

.section h2 {
  font-size: clamp(28px, 3.2vw, 40px);
  font-weight: 700;
  line-height: 1.1;
}

.section-heading p:not(.eyebrow) {
  color: var(--muted);
  margin-top: 12px;
}

/* ---------- Services ---------- */

.service-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.service-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 14px;
  grid-template-rows: auto auto auto 1fr auto;
  padding: 26px 24px;
}

.service-card .glyph {
  align-items: center;
  border-radius: 12px;
  display: flex;
  height: 52px;
  justify-content: center;
  width: 52px;
}

.service-card .glyph img {
  max-height: 32px;
  max-width: 32px;
}

.service-card.teal .glyph {
  background: var(--teal-soft);
}

.service-card.coral .glyph {
  background: var(--coral-soft);
}

.service-card.amber .glyph {
  background: var(--amber-soft);
}

.service-card h3 {
  font-size: 21px;
  font-weight: 700;
  margin: 0;
}

.service-card > p {
  color: var(--muted);
  font-size: 14.5px;
  margin: 0;
}

.service-card ul {
  display: grid;
  gap: 7px;
  font-size: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.service-card ul li {
  padding-left: 20px;
  position: relative;
}

.service-card ul li::before {
  content: "→";
  font-family: var(--mono);
  left: 0;
  position: absolute;
}

.service-card.teal ul li::before {
  color: var(--teal);
}

.service-card.coral ul li::before {
  color: var(--coral);
}

.service-card.amber ul li::before {
  color: var(--amber);
}

.card-link {
  color: var(--teal-deep);
  font-size: 14px;
  font-weight: 700;
}

/* ---------- Flexible blocks: image + text, image, diagram, text ---------- */

.split-section {
  align-items: center;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: grid;
  gap: 48px;
  grid-template-columns: 0.95fr 1.05fr;
}

.split-section.image-left .split-copy {
  order: 2;
}

.split-section.image-left .split-figure {
  order: 1;
}

.split-section.image-full {
  grid-template-columns: 1fr;
}

.split-copy h2 {
  font-size: clamp(26px, 3vw, 36px);
}

.split-summary {
  color: var(--muted);
  margin-top: 14px;
  max-width: 52ch;
}

.prose-inline {
  color: var(--muted);
  max-width: 62ch;
}

.figure-plate {
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.figure-plate img {
  border-radius: 8px;
  display: block;
  width: 100%;
}

.figure-plate.wide {
  padding: 24px;
}

.figcap {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  margin-top: 10px;
}

.image-section .figure-plate,
.text-section .prose-inline {
  margin-top: 8px;
}

.diagram-block {
  padding: 0 var(--pad-x) 68px;
}

.diagram-title {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.figure-plate.diagram pre {
  margin: 0;
  overflow-x: auto;
}

.figure-plate.diagram .mermaid,
.prose .mermaid {
  display: flex;
  justify-content: center;
}

.figure-plate.diagram .mermaid svg,
.prose .mermaid svg {
  height: auto;
  max-width: 100%;
}

/* ---------- Workbench (dark band) ---------- */

.workbench-section {
  background: linear-gradient(160deg, var(--spruce), var(--pine));
  color: #eaf3ec;
}

.workbench-section .eyebrow {
  color: #7fd6cb;
}

.workbench-section h2 {
  font-size: clamp(26px, 3vw, 36px);
}

.workbench-copy > p:not(.eyebrow) {
  color: #a9bdb1;
  max-width: 48ch;
}

.workbench-grid {
  display: grid;
  gap: 44px;
  grid-template-columns: 0.9fr 1.1fr;
}

.tool-list {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.tool-row {
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 18px 20px;
}

.tool-row:hover {
  background: rgba(255, 255, 255, 0.1);
}

.tool-name b {
  font-family: var(--display);
  font-size: 17px;
}

.tool-name small {
  color: #a9bdb1;
  display: block;
  font-size: 13px;
  margin-top: 3px;
}

.tool-row .launch {
  color: var(--amber);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.workbench-blocks .diagram-block {
  padding: 0;
}

.workbench-blocks .diagram-title {
  color: #8fa79b;
}

.workbench-blocks .figure-plate {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.14);
}

.workbench-blocks .split-section,
.workbench-blocks .text-section,
.workbench-blocks .image-section {
  background: transparent;
  border: none;
  padding: 0 0 24px;
}

/* ---------- Articles ---------- */

.article-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.article-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.article-card .thumb {
  display: block;
  height: 156px;
  overflow: hidden;
}

.article-card .thumb img,
.thumb-fallback {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.thumb-fallback.teal {
  background: radial-gradient(circle at 75% 25%, rgba(18, 165, 160, 0.85), transparent 60%), var(--spruce);
}

.thumb-fallback.coral {
  background: radial-gradient(circle at 25% 80%, rgba(255, 106, 77, 0.75), transparent 55%), var(--spruce);
}

.thumb-fallback.amber {
  background: radial-gradient(circle at 70% 70%, rgba(240, 166, 43, 0.8), transparent 55%), var(--spruce);
}

.article-body {
  display: grid;
  gap: 10px;
  padding: 20px;
}

.article-body .chip {
  justify-self: start;
}

.article-card h3 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
}

.article-card h3 a:hover {
  color: var(--teal-deep);
}

.article-body p {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.article-body .meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
}

/* ---------- Closing CTA ---------- */

.closing-cta {
  align-items: center;
  background: var(--spruce);
  border-radius: 18px;
  color: #eaf3ec;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin: 0 var(--pad-x) 68px;
  overflow: hidden;
  padding: 40px 44px;
  position: relative;
}

.closing-cta::before {
  background:
    radial-gradient(circle at 85% 20%, rgba(18, 165, 160, 0.35), transparent 55%),
    radial-gradient(circle at 70% 90%, rgba(255, 106, 77, 0.22), transparent 45%);
  content: "";
  inset: 0;
  position: absolute;
}

.closing-cta h2 {
  font-size: clamp(24px, 2.8vw, 34px);
  margin: 0;
  max-width: 24ch;
  position: relative;
}

.closing-cta .button {
  position: relative;
}

/* ---------- Detail pages ---------- */

.detail-page {
  margin: 0 auto;
  max-width: 880px;
  padding: 56px var(--pad-x) 80px;
}

.back-link {
  color: var(--teal-deep);
  display: inline-block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 26px;
}

.detail-page .chip {
  margin-bottom: 14px;
}

.detail-page h1 {
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 700;
  line-height: 1.06;
}

.detail-summary {
  color: var(--muted);
  font-size: 19px;
  line-height: 1.55;
  max-width: 62ch;
}

.detail-meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.detail-cover {
  margin: 28px 0 0;
}

.detail-cover img {
  border-radius: var(--radius);
  display: block;
  width: 100%;
}

.prose {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 28px;
  padding: 32px;
}

.prose img {
  border-radius: 8px;
}

.prose pre {
  overflow-x: auto;
}

/* ---------- Idea Finder ---------- */

.idea-finder,
.planned-tool {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 28px;
  padding: 24px;
}

.planned-tool {
  color: var(--muted);
}

.idea-form label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

.search-line {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) 150px auto;
}

.idea-results {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.result-card {
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
}

.result-card h2 {
  font-size: 18px;
  margin: 0 0 6px;
}

.result-card p {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

/* ---------- Forms ---------- */

input,
select,
textarea {
  background: #ffffff;
  border: 1px solid #cdd8d0;
  border-radius: 9px;
  color: var(--ink);
  font: inherit;
  padding: 10px 13px;
  width: 100%;
}

textarea {
  line-height: 1.6;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
.button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

.form-error {
  background: #ffe9e3;
  border: 1px solid #ef9c88;
  border-radius: 9px;
  color: var(--coral-deep);
  padding: 12px 14px;
}

.login-page {
  max-width: 460px;
}

.login-form {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 16px;
  margin-top: 20px;
  padding: 24px;
}

/* ---------- Improvize Studio (admin) ---------- */

.studio-body {
  background: #eef2ec;
}

.studio {
  margin: 0 auto;
  max-width: 1320px;
  padding: 24px clamp(16px, 3vw, 40px) 64px;
}

.studio-top {
  align-items: center;
  background: var(--spruce);
  border-radius: var(--radius);
  color: #eaf3ec;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
  padding: 16px 24px;
}

.studio-brand {
  align-items: baseline;
  display: flex;
  gap: 12px;
}

.studio-brand h1 {
  font-size: 20px;
  margin: 0;
}

.studio-brand span {
  color: #7fd6cb;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.studio-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.studio-actions .button {
  font-size: 13.5px;
  padding: 8px 16px;
}

.studio .form-error {
  margin-top: 16px;
}

.studio-workspace {
  align-items: start;
  display: grid;
  gap: 20px;
  grid-template-columns: 300px minmax(0, 1fr);
  margin-top: 20px;
}

.outline {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-height: 80vh;
  overflow: auto;
  padding: 16px 14px 22px;
  position: sticky;
  top: 84px;
}

.outline-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 6px;
}

.outline-head strong {
  font-family: var(--display);
  font-size: 14px;
}

.add-link {
  color: var(--teal-deep);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

.outline-section {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  margin: 16px 6px 7px;
  text-transform: uppercase;
}

.outline-item {
  align-items: center;
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: 9px;
  display: flex;
  gap: 9px;
  margin-bottom: 6px;
  padding: 9px 11px;
}

.outline-item.active {
  background: #ffffff;
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(18, 165, 160, 0.22);
}

.outline-item .name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kind-chip {
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2.5px 7px;
  text-transform: uppercase;
}

.kind-chip.hero {
  background: var(--coral-soft);
  color: var(--coral-deep);
}

.kind-chip.cards {
  background: var(--teal-soft);
  color: var(--teal-deep);
}

.kind-chip.imgtxt {
  background: var(--amber-soft);
  color: var(--amber-deep);
}

.kind-chip.diagram {
  background: rgba(23, 48, 40, 0.1);
  color: var(--pine);
}

.kind-chip.text {
  background: #edf0ec;
  color: var(--muted);
}

.kind-chip.cta {
  background: var(--spruce);
  color: #cfe7d9;
}

.status-dot {
  background: #4caf7a;
  border-radius: 50%;
  flex: none;
  height: 7px;
  width: 7px;
}

.status-dot.draft {
  background: #c9b037;
}

.outline-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 0 6px;
}

.editor {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 28px 32px;
}

.crumbs {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  margin-bottom: 6px;
}

.editor h2 {
  font-size: 22px;
  margin-bottom: 20px;
}

.editor-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 12.5px;
  font-weight: 700;
}

.field label small {
  color: var(--muted);
  font-weight: 500;
}

.field-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.image-panel {
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 16px;
  grid-template-columns: 190px minmax(0, 1fr);
  padding: 14px;
}

.image-preview {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  min-height: 130px;
  overflow: hidden;
}

.image-preview img {
  display: block;
  max-height: 160px;
  object-fit: contain;
  width: 100%;
}

.no-image {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.image-meta {
  display: grid;
  gap: 12px;
}

.media-library {
  border-top: 1px solid var(--line);
  margin-top: 26px;
  padding-top: 20px;
}

.media-head {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.media-head strong {
  font-family: var(--display);
  font-size: 15px;
}

.media-head span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.media-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.media-thumb {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  display: grid;
  overflow: hidden;
  padding: 0;
  text-align: left;
}

.media-thumb:hover {
  border-color: var(--teal);
}

.media-thumb img {
  aspect-ratio: 5 / 3;
  display: block;
  object-fit: cover;
  width: 100%;
}

.media-thumb span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  overflow: hidden;
  padding: 6px 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-upload {
  align-content: center;
  border: 1.5px dashed #afbcae;
  border-radius: 9px;
  display: grid;
  gap: 8px;
  padding: 12px;
  text-align: center;
}

.media-upload label b {
  color: var(--teal-deep);
  display: block;
  font-size: 12.5px;
}

.media-upload label span {
  color: var(--muted);
  font-size: 10.5px;
}

.media-upload input[type="file"],
.media-upload input {
  font-size: 11px;
  padding: 6px 8px;
}

.media-upload .button {
  font-size: 12.5px;
  padding: 7px 14px;
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .hero,
  .split-section,
  .workbench-grid {
    grid-template-columns: 1fr;
  }

  .service-grid,
  .article-grid {
    grid-template-columns: 1fr;
  }

  .split-section.image-left .split-copy {
    order: 1;
  }

  .split-section.image-left .split-figure {
    order: 2;
  }

  .studio-workspace,
  .field-grid,
  .field-grid.four,
  .image-panel {
    grid-template-columns: 1fr;
  }

  .outline {
    max-height: none;
    position: static;
  }

  .search-line {
    grid-template-columns: 1fr;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .hero {
    padding-top: 44px;
  }

  .closing-cta {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
