/* ─────────────────────────────────────────────────────────────────────
   inlay — the guide. Page styles, then the example frames.

   The editor UI in the examples is NOT styled here: it is inlay's own
   stylesheet, generated into inlay-ui.css by scripts/guide-ui.js. This
   file only (a) lays out the page, (b) draws the pretend Ferns & Flour
   site the editor sits on, and (c) overrides the handful of editor rules
   that assume a whole browser window — see "Fitting the editor in a box".
   ───────────────────────────────────────────────────────────────────── */

:root {
  --bg:            #141019;
  --surface:       #1A1522;
  --surface-2:     #201B2A;
  --surface-deep:  #12101A;

  --ink:      #F5F2F8;
  --ink-2:    #CAC3D4;
  --ink-3:    #948DA2;
  --ink-4:    #6A6379;

  --lilac:        #DDBBF1;
  --lilac-text:   #CBB4DD;
  --lilac-solid:  #D2B9E4;
  --blue:         #9DB0E4;
  --green:        #7FC7B2;
  --amber:        #FFB020;
  --amber-text:   #FFD86B;

  --line:      rgba(221, 187, 241, 0.09);
  --line-2:    rgba(221, 187, 241, 0.14);
  --tint:      rgba(221, 187, 241, 0.05);

  --sans: "Instrument Sans", system-ui, -apple-system, sans-serif;
  --serif: Newsreader, Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --nav-w: 264px;
  --bar-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--bar-h) + 18px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--lilac-text); text-decoration: none; }
a:hover { color: var(--lilac); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 4px; }

/* ── Depth switch ────────────────────────────────────────────────────
   One attribute on <html> decides which version is on screen. With no
   script at all the attribute is absent and everything shows — the
   detailed version, which is the one that loses nothing. */
html[data-depth="quick"] .d,
html[data-depth="quick"] .d-only { display: none !important; }
html[data-depth="detailed"] .q-only { display: none !important; }
html:not([data-depth]) .q-only { display: none !important; }

/* ── Top bar ─────────────────────────────────────────────────────── */
.bar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: rgba(20, 16, 25, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar__logo { display: flex; align-items: center; }
.bar__logo img { height: 20px; width: auto; display: block; }
.bar__badge {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.bar__spacer { flex: 1; }
.bar__home {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-3);
  white-space: nowrap;
}
.bar__home:hover { color: var(--lilac-text); }
.bar__menu {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--ink-2);
  font: inherit;
  cursor: pointer;
}

.depth {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface-deep);
}
.depth__btn {
  font: 500 13px var(--sans);
  color: var(--ink-3);
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s ease, color .16s ease;
}
.depth__btn:hover { color: var(--ink); }
.depth__btn[aria-pressed="true"] { background: var(--lilac-solid); color: #1B1524; font-weight: 600; }
.depth__btn small { font: inherit; font-weight: 400; opacity: .7; margin-left: 5px; }

/* The same control again, large, at the top of the page — the one a first
   visit actually sees. The bar's copy is the one that follows you down. */
.depth--hero { margin: 26px 0 6px; }
.depth--hero .depth__btn { padding: 9px 20px; font-size: 14.5px; }
.depth-note { font-size: 13.5px; color: var(--ink-3); margin: 8px 0 0; min-height: 1.6em; }

/* ── Shell ───────────────────────────────────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr);
  max-width: 1320px;
  margin: 0 auto;
}
.side {
  position: sticky;
  top: var(--bar-h);
  align-self: start;
  height: calc(100vh - var(--bar-h));
  overflow-y: auto;
  padding: 28px 18px 40px;
  border-right: 1px solid var(--line);
}
.side::-webkit-scrollbar { width: 8px; }
.side::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
.side__group { margin-bottom: 22px; }
.side__head {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 0 10px;
  margin-bottom: 6px;
}
.side a {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink-2);
  border-left: 2px solid transparent;
}
.side a:hover { color: var(--ink); background: var(--tint); }
.side a.is-active {
  color: var(--lilac-text);
  background: var(--tint);
  border-left-color: var(--lilac-solid);
}

.main { min-width: 0; padding: 44px clamp(20px, 4vw, 56px) 120px; }
.measure { max-width: 720px; }

/* ── Type ────────────────────────────────────────────────────────── */
.intro-kicker {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.h1 {
  margin: 10px 0 16px;
  font-weight: 500;
  font-size: clamp(30px, 4vw, 42px);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.lede { font-size: 17.5px; color: var(--ink-2); max-width: 640px; }

.doc-section + .doc-section { border-top: 1px solid var(--line); padding-top: 56px; margin-top: 56px; }
.part {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lilac-text);
  margin: 0 0 14px;
}
.h2 {
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0 0 8px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
/* Numbered by counter, not by hand: a section hidden by the depth switch is
   display:none, which takes it out of the count, so the quick version never
   skips a number. */
.main { counter-reset: sec; }
.doc-section:has(> .h2) { counter-increment: sec; }
.h2 .num { font-family: var(--mono); font-size: 13px; color: var(--ink-4); flex: none; }
.h2 .num::before { content: counter(sec, decimal-leading-zero); }
p code, li code, td code {
  font-family: var(--mono);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 0.87em;
  color: var(--lilac-text);
}
.h3 { font-weight: 600; font-size: 17px; margin: 34px 0 8px; color: var(--ink); }
p { color: var(--ink-2); margin: 0 0 14px; }
strong { color: var(--ink); font-weight: 600; }
.doc-section > p, .doc-section > ul, .doc-section > ol, .doc-section > .callout,
.doc-section > .h3, .doc-section > .tbl-wrap, .doc-section > .steps { max-width: 720px; }

/* The one-line answer under each heading. Present in both versions; in the
   quick one it is most of the section. */
.gist { font-size: 17px; color: var(--ink); max-width: 680px; margin-bottom: 16px; }

ul.plain, ol.plain { color: var(--ink-2); padding-left: 22px; margin: 0 0 16px; }
ul.plain li, ol.plain li { margin: 6px 0; }
ul.plain li::marker { color: var(--ink-4); }

ol.steps { list-style: none; counter-reset: step; padding: 0; margin: 14px 0 18px; color: var(--ink-2); }
ol.steps > li { counter-increment: step; position: relative; padding-left: 38px; margin: 10px 0; }
ol.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 1px;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font: 500 12px var(--mono);
  color: var(--lilac-text);
  border: 1px solid var(--line-2);
  background: var(--surface-2);
}

/* A name as it appears in the editor — a button, a panel, a menu item. */
.k {
  font: 600 0.86em var(--sans);
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 1px 7px;
  white-space: nowrap;
}
kbd {
  font: 500 0.8em var(--mono);
  color: var(--ink);
  background: var(--surface-deep);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  white-space: nowrap;
}

.callout {
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--amber);
  background: var(--tint);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 18px 0;
  font-size: 14.5px;
  color: var(--ink-2);
}
.callout strong:first-child { color: var(--amber-text); }
.callout--green { border-left-color: var(--green); }
.callout--green strong:first-child { color: var(--green); }
.callout--blue { border-left-color: var(--blue); }
.callout--blue strong:first-child { color: var(--blue); }

.tbl-wrap { overflow-x: auto; margin: 16px 0 22px; border: 1px solid var(--line-2); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-4); background: var(--surface); font-weight: 500; }
tr:last-child td { border-bottom: none; }
td { color: var(--ink-2); }
td:first-child { white-space: nowrap; }

.depth-more {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 13.5px var(--sans);
  color: var(--lilac-text);
  background: transparent; border: 0; padding: 0; cursor: pointer;
}
.depth-more:hover { color: var(--lilac); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 22px 0 8px; }
.card {
  display: block;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface);
  padding: 14px 16px;
  color: var(--ink-2);
  font-size: 14px;
}
.card:hover { border-color: rgba(221, 187, 241, 0.3); color: var(--ink-2); }
.card b { display: block; color: var(--ink); font-weight: 600; font-size: 15px; margin-bottom: 2px; }

footer.docfoot {
  margin-top: 70px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-4);
}

/* ── Example frames ──────────────────────────────────────────────── */
.fig { margin: 22px 0 26px; max-width: 860px; }
.fig__scroll { overflow-x: auto; border-radius: 16px; border: 1px solid var(--line-2); background: var(--surface-deep); }
.fig figcaption, .fig__cap { font-size: 13.5px; color: var(--ink-3); margin-top: 10px; max-width: 720px; }
.fig__cap b { color: var(--ink-2); font-weight: 600; }

/* Fitting the editor in a box. The editor positions itself against the
   browser window (position: fixed, 100vw, 100vh). A transform on the frame
   makes the frame the containing block for fixed descendants, so the dock
   lands at the bottom of the example instead of the bottom of your screen. */
.ui {
  position: relative;
  transform: translate(0);
  overflow: hidden;
  min-width: 660px;
  font-family: var(--cdd-font);
  isolation: isolate;
}
.ui svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ui button { font-family: inherit; }
.ui, .ui * { cursor: default !important; }
.ui input, .ui textarea, .ui select { pointer-events: none; }
/* Examples are pictures: nothing in them should take focus or a click. The
   `inert` attribute on .ui does the real work; this is the visual half. */
.ui *, .ui *::before, .ui *::after { animation: none !important; }

.ui .cdd-dock { position: absolute; }
.ui .cdd-window { position: absolute; max-height: calc(100% - 100px); }
.ui .cdd-notif-tray, .ui .cdd-comment-nav, .ui .cdd-toast,
.ui .cdd-orb, .ui .cdd-orb-pop, .ui .cdd-photo-move, .ui .cdd-rte-colors { position: absolute; }
.ui .cdd-modal-backdrop { position: absolute; }
.ui .cdd-more-menu, .ui .cdd-notif-panel { display: flex; }
.ui .cdd-comments { display: block; position: static; }

/* A component on its own, out of any site: a panel, a toolbar, a popover. */
.ui--part {
  display: flex; align-items: flex-start; justify-content: center; gap: 22px; flex-wrap: wrap;
  padding: 30px 24px;
  background:
    radial-gradient(circle at 1px 1px, rgba(221,187,241,.07) 1px, transparent 0) 0 0 / 18px 18px,
    var(--surface-deep);
}
.ui--part .cdd-window, .ui--part .cdd-dock, .ui--part .cdd-rte-toolbar, .ui--part .cdd-rte-colors,
.ui--part .cdd-orb-pop, .ui--part .cdd-cc, .ui--part .cdd-comment-nav, .ui--part .cdd-notif-panel,
.ui--part .cdd-more-menu, .ui--part .cdd-modal, .ui--part .cdd-toast, .ui--part .cdd-secmove,
.ui--part .cdd-cms-open {
  position: relative; inset: auto; transform: none; max-height: none; flex: none; opacity: 1;
}
.ui--part .cdd-rte-toolbar, .ui--part .cdd-secmove, .ui--part .cdd-cms-open { display: inline-flex; }
.ui--part .cdd-secmove { display: flex; }
.ui--part .cdd-comment-nav { display: flex; }

/* The whole dock with its labels is about a thousand pixels wide — wider than
   an example. Inside a site frame it gets what the editor itself does below
   1000px: icons only, Publish keeps its word. On its own it is scaled to fit. */
.ui--compact .cdd-dock .cdd-btn:not(.cdd-primary):not(.cdd-pagedown) > .cdd-btn-label { display: none; }
.ui--compact .cdd-dock .cdd-btn { padding: 8px 10px; }
.ui--compact .cdd-dock .cdd-btn.cdd-primary { padding: 7px 13px; }
.ui--dock { min-width: 0; padding: 26px 12px; }
.ui--dock .cdd-dock { zoom: 0.8; max-width: none; }
/* Two windows side by side have to share the frame. */
.ui--part:has(.cdd-window + .cdd-window) .cdd-window { width: 384px; }

/* Labels that point at parts of an example. */
.tag {
  position: absolute; z-index: 2147483600;
  font: 600 11px var(--sans); letter-spacing: .01em;
  color: #1B1524; background: var(--lilac-solid);
  border-radius: 999px; padding: 3px 9px; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.tag--num { width: 20px; height: 20px; padding: 0; display: grid; place-items: center; font-family: var(--mono); }
.legend { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 6px 22px; font-size: 14px; color: var(--ink-2); max-width: 860px; }
.legend li { display: flex; gap: 9px; align-items: baseline; }
.legend .tag { position: static; flex: none; box-shadow: none; transform: translateY(-1px); }

/* ── The pretend site ────────────────────────────────────────────── */
.site {
  --page: #191423; --s-ink: #F5F2F8; --s-body: #CAC3D4; --s-dim: #948DA2; --s-line: rgba(221,187,241,.08);
  background: var(--page); color: var(--s-body);
  font: 15px/1.6 var(--sans);
  min-height: 380px;
  padding-bottom: 84px;
}
.site__mast { display: flex; justify-content: space-between; align-items: center; padding: 13px 34px; border-bottom: 1px solid var(--s-line); }
.site__brand { font: italic 400 17px var(--serif); color: var(--s-ink); }
.site__links { display: flex; gap: 20px; font: 400 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--s-dim); }
.site__wrap { padding: 30px 34px 0; position: relative; }
.site h4 { font: 400 27px/1.15 var(--sans); letter-spacing: -.02em; color: var(--s-ink); margin: 0 0 10px; padding: 3px 5px; position: relative; left: -5px; width: fit-content; }
.site p { color: var(--s-body); max-width: 520px; margin: 0 0 16px; padding: 3px 5px; position: relative; left: -5px; }
.site__cta { display: flex; gap: 12px; margin-top: 4px; }
.site__btn { position: relative; display: inline-block; font: 600 12.5px var(--sans); color: #1B1524; background: #DDBBF1; border-radius: 999px; padding: 10px 18px; }
.site__btn--ghost { background: transparent; color: var(--s-ink); border: 1px solid rgba(221,187,241,.2); }
.site__photo {
  position: relative; display: grid; place-items: center; height: 170px; margin-top: 22px; border-radius: 10px;
  font: 400 11px var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--s-dim);
  background: repeating-linear-gradient(135deg, rgba(221,187,241,.05) 0 2px, transparent 2px 12px), #231C30;
}
.site__eyebrow { font: 400 10px var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--s-dim); margin-bottom: 8px; }
.site__rows { border-top: 1px solid var(--s-line); margin-top: 6px; }
.site__row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 8px; border-bottom: 1px solid var(--s-line); font-size: 14px; }
.site__row b { color: var(--s-ink); font-weight: 500; }
.site__row span { color: var(--s-dim); }
.site__sec { position: relative; padding: 22px 34px; }
.site__sec + .site__sec { border-top: 1px solid var(--s-line); }

/* States the editor reaches by hover or focus, held still for the picture. */
.ui .is-hover.cdd-autotext { outline-color: var(--cdd-affordance); }
.ui .is-focus { outline: 2px solid var(--cdd-editing) !important; outline-offset: var(--cdd-affordance-offset); border-radius: 4px; }
.ui .is-hover.cdd-section { outline-color: rgba(55, 93, 231, 0.35); }
.ui .is-hover > .cdd-secmove, .ui .is-hover > .cdd-cms-open { opacity: 1; }
.ui .is-hover.cdd-cms { outline-color: var(--cdd-cms-affordance-strong); }
.ui .sel { background: rgba(55, 93, 231, .45); color: #fff; border-radius: 2px; }
.ui .caret { display: inline-block; width: 1.5px; height: 1.05em; background: #fff; vertical-align: -0.15em; margin-left: 1px; }
.ui .cdd-rte-toolbar { display: inline-flex; }
.ui .cdd-cms-open { display: inline-flex; }
.ui .cdd-secmove { display: flex; }
.ui .cdd-edit-badge { display: grid; }

/* ── Mobile ──────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .bar { gap: 10px; padding: 0 14px; }
  .bar__menu { display: flex; }
  .bar__badge, .bar__home { display: none; }
  .shell { grid-template-columns: 1fr; }
  .side {
    position: fixed;
    inset: var(--bar-h) 0 0 0;
    z-index: 39;
    height: auto;
    background: var(--bg);
    transform: translateX(-100%);
    transition: transform .22s ease;
    border-right: none;
  }
  .side.is-open { transform: translateX(0); }
  .main { padding: 32px 16px 100px; }
  .depth__btn small { display: none; }
}
