/* Liminaled Lab */
:root {
  --bg: #f7f4ee; --surface: #ffffff; --surface-2: #f1ede5; --line: #e4ded3;
  --ink: #1d1b2e; --muted: #6c6879; --accent: #6b4eff; --accent-ink: #fff; --accent-soft: #ece8ff;
  --amber: #f2a541; --teal: #1fa89a; --rose: #e2557b; --ok: #1f8a5b; --err: #c23b4a;
  --radius: 16px; --radius-sm: 10px; --shadow: 0 1px 2px rgba(29,27,46,.06), 0 8px 24px rgba(29,27,46,.06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; --serif: "Fraunces", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12111a; --surface: #1b1a26; --surface-2: #232232; --line: #2f2d42;
    --ink: #eeebf7; --muted: #a29eb3; --accent: #8f7bff; --accent-soft: #2a2550;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 30px rgba(0,0,0,.25); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); font-weight: 650; letter-spacing: -.01em; line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: clamp(28px, 4vw, 40px); } h2 { font-size: 22px; } h3 { font-size: 18px; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 24px 20px 80px; }

/* header */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 20px; padding: 12px 20px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 500; white-space: nowrap; }
.brand:hover { text-decoration: none; } .brand b { font-weight: 650; color: var(--accent); }
.brand-mark { width: 22px; height: 22px; border-radius: 7px; background: conic-gradient(from 210deg, var(--accent), var(--amber), var(--teal), var(--accent)); box-shadow: inset 0 0 0 5px var(--bg); }
.brand-mark.lg { width: 56px; height: 56px; border-radius: 18px; box-shadow: inset 0 0 0 12px var(--surface); display: block; margin: 0 auto 18px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a { padding: 7px 12px; border-radius: 999px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.nav a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.nav a.on { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.logout { margin: 0; }

/* buttons & inputs */
.btn, button { font: inherit; cursor: pointer; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; white-space: nowrap; transition: transform .1s, filter .15s; }
.btn:hover { filter: brightness(1.08); text-decoration: none; } .btn:active { transform: scale(.98); }
.btn.ghost, button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover, button.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--err); } .btn.danger:not(.ghost) { background: var(--err); color: #fff; }
.btn.sm, button.sm { padding: 6px 12px; font-size: 13px; } .btn.wide { width: 100%; justify-content: center; padding: 12px; }
button.ghost { border-radius: 999px; padding: 6px 12px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); } .link.danger { color: var(--err); }
.icon-btn { background: var(--surface-2); border: 0; width: 30px; height: 30px; border-radius: 8px; color: var(--muted); }
.icon-btn:hover { color: var(--ink); }
label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 14px; }
input[type=text], input[type=password], input[type=search], input:not([type]), select, textarea {
  display: block; width: 100%; margin-top: 6px; font: inherit; font-weight: 400; font-size: 15px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; }
textarea.code { font: 13px/1.5 var(--mono); min-height: 360px; tab-size: 2; white-space: pre; }
textarea.md { white-space: pre-wrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .two.narrow-first { grid-template-columns: 90px 1fr; }

/* layout bits */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .actions form { margin: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 18px 0 24px; flex-wrap: wrap; }
.page-head p.muted { max-width: 60ch; margin: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.eyebrow a { color: inherit; }
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin: 8px 0 16px; background: color-mix(in srgb, var(--ok) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.flash.err { background: color-mix(in srgb, var(--err) 12%, var(--surface)); border-color: color-mix(in srgb, var(--err) 35%, transparent); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.empty { text-align: center; padding: 60px 20px; border: 2px dashed var(--line); border-radius: var(--radius); }
.pill { display: inline-block; font: 600 11px/1 var(--font); text-transform: uppercase; letter-spacing: .06em; padding: 5px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); vertical-align: middle; white-space: nowrap; }
.st-pregem, .st-exploring { background: var(--accent-soft); color: var(--accent); }
.st-ready, .st-building { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.st-promising { background: color-mix(in srgb, var(--amber) 20%, transparent); color: #b06d0a; }
.tag { display: inline-block; font-size: 12px; color: var(--muted); margin-right: 6px; }
.meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 6px 0; }

/* home */
.hero { padding: 40px 0 26px; max-width: 760px; }
.hero h1 { font-size: clamp(36px, 6vw, 60px); }
.lede { font-size: 18px; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.tile { position: relative; overflow: hidden; display: flex; flex-direction: column; padding: 26px; min-height: 230px; border-radius: 22px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; }
.tile:hover { transform: translateY(-3px); text-decoration: none; box-shadow: 0 14px 40px rgba(29,27,46,.12); }
.tile::after { content: ""; position: absolute; width: 220px; height: 220px; right: -70px; top: -80px; border-radius: 50%; filter: blur(30px); opacity: .35; background: var(--c); }
.tile p { color: var(--muted); flex: 1; }
.tile-ico { font-size: 26px; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); margin-bottom: 18px; }
.tile-count { font-size: 13px; font-weight: 600; color: var(--c); }
.t-gallery { --c: var(--accent); } .t-principles { --c: var(--teal); } .t-ideas { --c: var(--amber); }
.section { margin-top: 44px; } .h-sec { font-size: 24px; margin: 0; }

/* gallery */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar input[type=search] { max-width: 320px; margin: 0; }
.toolbar select { width: auto; margin: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 500; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; margin-top: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.gem { display: flex; flex-direction: column; transition: transform .2s; } .gem:hover { transform: translateY(-2px); }
.thumb { position: relative; display: block; aspect-ratio: 16/10; overflow: hidden; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.thumb iframe { position: absolute; left: 0; top: 0; width: 400%; height: 400%; border: 0; transform: scale(.25); transform-origin: 0 0; pointer-events: none; background: #fff; }
.thumb-id { position: absolute; left: 10px; top: 10px; font: 600 11px var(--mono); background: rgba(0,0,0,.6); color: #fff; padding: 3px 7px; border-radius: 6px; }
.card-body { padding: 14px 16px 16px; } .card-body h3 { margin: 0; } .card-body h3 a { color: var(--ink); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 6px 0 0; }

/* editor */
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 18px; align-items: start; }
.preview-panel { position: sticky; top: 76px; }
.preview-stage { margin-top: 12px; background: repeating-conic-gradient(var(--surface-2) 0 25%, transparent 0 50%) 0 0/20px 20px; border: 1px solid var(--line); border-radius: var(--radius-sm); height: 62vh; display: flex; justify-content: center; overflow: hidden; }
.preview-stage.tall { height: calc(100vh - 250px); min-height: 420px; }
.preview-stage iframe { width: 100%; height: 100%; border: 0; background: #fff; transition: width .3s; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 999px; font-size: 13px; color: var(--muted); font-weight: 500; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 12px; }
.tab { border: 0; background: none; padding: 9px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.on { color: var(--ink); border-color: var(--accent); }
.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 48px 20px; border: 2px dashed var(--line); border-radius: var(--radius); cursor: pointer; transition: border-color .15s, background .15s; font-size: 15px; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input { display: none; } .drop-ico { font-size: 30px; color: var(--accent); } .drop-name { font-family: var(--mono); font-size: 13px; color: var(--accent); }
.viewer-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; flex-wrap: wrap; margin: 14px 0 6px; }
.viewer-head h1 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.viewer-head > div:first-child { max-width: 620px; }

/* principles */
.doc-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; align-items: start; }
.toc { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 2px; }
.toc a { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; }
.toc a:hover { background: var(--surface); color: var(--ink); text-decoration: none; }
.toc-ico, .sec-ico { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-family: var(--font); }
.sec-ico { width: 34px; height: 34px; margin-right: 12px; font-size: 16px; vertical-align: middle; }
.doc { display: flex; flex-direction: column; gap: 18px; }
.doc-sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 30px; box-shadow: var(--shadow); scroll-margin-top: 80px; }
.doc-sec header h2 { margin: 0; font-size: 26px; display: flex; align-items: center; }
.sec-tools { display: flex; gap: 6px; align-items: center; } .sec-tools form { margin: 0; }
.prose { margin-top: 14px; max-width: 72ch; } .prose.sm { margin-top: 4px; font-size: 14px; }
.prose h2 { font-size: 20px; margin: 1.2em 0 .4em; } .prose h3 { font-size: 17px; margin: 1.1em 0 .3em; } .prose h4, .prose h5 { font-size: 15px; margin: 1em 0 .3em; }
.prose > :first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 .9em; } .prose li { margin: .2em 0; }
.prose blockquote { margin: 1em 0; padding: 10px 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; }
.prose code { font: 13px var(--mono); background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }
.prose pre { background: #1d1b2e; color: #ece9f7; padding: 14px 16px; border-radius: 12px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose img { max-width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }
.prose mark { background: color-mix(in srgb, var(--amber) 35%, transparent); color: inherit; padding: 0 3px; border-radius: 4px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.live-sample { border: 1px solid var(--line); border-radius: 12px 12px 0 0; overflow: hidden; margin-top: 1em; } .live-sample + pre { border-radius: 0 0 12px 12px; margin-top: 0; }
.live-sample iframe { width: 100%; height: 140px; border: 0; background: #fff; display: block; }
.md-bar { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.md-bar button, .md-img { border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); border-radius: 8px; min-width: 34px; height: 32px; padding: 0 9px; font-size: 13px; margin: 0; display: inline-flex; align-items: center; cursor: pointer; }

/* ideas */
.ideas { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.idea { display: flex; gap: 14px; padding: 16px; border-top: 3px solid var(--c, var(--accent)); }
.idea h3 { margin: 4px 0 6px; }
.idea-main { flex: 1; min-width: 0; }
.vote { margin: 0; } .vote button { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 46px; padding: 8px 0; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 12px; }
.vote button span { font-size: 16px; font-weight: 700; color: var(--ink); } .vote button:hover { border-color: var(--accent); color: var(--accent); }
.vote button.bump { animation: bump .35s; } @keyframes bump { 50% { transform: scale(1.15); } }
.type-badge { font-size: 12px; font-weight: 600; color: var(--c); }
.ty-product { --c: var(--accent); } .ty-new-line { --c: var(--teal); } .ty-reconcept { --c: #3b82c4; } .ty-new-concept { --c: var(--rose); } .ty-crazy { --c: var(--amber); }
.idea-tools { display: inline-flex; gap: 12px; } .idea-tools form { margin: 0; display: inline; }
.idea-form { margin-bottom: 22px; max-width: 760px; }
.type-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.type-opt { margin: 0; } .type-opt input { position: absolute; opacity: 0; pointer-events: none; }
.type-opt span { display: inline-block; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); font-weight: 500; cursor: pointer; }
.type-opt input:checked + span { background: var(--accent); color: #fff; border-color: var(--accent); }
.type-opt input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

/* login */
.login-page .wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { position: relative; width: 100%; max-width: 400px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 40px 32px 28px; box-shadow: 0 30px 80px rgba(29,27,46,.14); overflow: hidden; }
.login-card form { text-align: left; margin: 26px 0 18px; }
.login-card h1 em { color: var(--accent); font-style: italic; }
.login-glow { position: absolute; inset: -40% -40% auto; height: 300px; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 30%, transparent), transparent); pointer-events: none; }
.login-card > *:not(.login-glow) { position: relative; }
.err { color: var(--err); font-weight: 500; }

@media (max-width: 900px) {
  .editor-grid, .doc-layout { grid-template-columns: 1fr; }
  .preview-panel, .toc { position: static; }
  .toc { flex-direction: row; overflow-x: auto; }
  .ideas { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .wrap { padding: 16px 16px 60px; }
  .top { gap: 10px; padding: 10px 16px; flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; }
  .brand span:last-child { font-size: 15px; }
  .doc-sec { padding: 20px; }
  .two { grid-template-columns: 1fr; } .two.narrow-first { grid-template-columns: 70px 1fr; }
  .preview-stage { height: 50vh; }
}
