/* The Code: 10 Prompting Tips for Better AI-Assisted Code
   Brand tokens per CODEBRAND.md */

:root {
  /* Palette is The Code's design system, verbatim from the brand skill.
     Names on the left are ours; values on the right are authoritative. */
  --bg:          #F9F9F9;   /* page ground */
  --bg-elev:     #FFFFFF;   /* surface */
  --bg-tint:     #E9F2FF;   /* wash: the blue panel ground */
  --wash-line:   #C4DDFF;

  --ink:         #000000;
  --ink-soft:    #3F3F3F;   /* ink-2, secondary prose */
  --ink-mute:    #5C5C5C;   /* ink-3, mono metadata and captions */

  --line:        #E4E4E4;   /* border */
  --line-soft:   #EFEFEF;   /* hairline */

  /* --accent is a FILL only: 3.17:1 on --bg is too low for text.
     Anything that reads as text uses --accent-ink instead. */
  --accent:      #288CFF;
  --accent-ink:  #0F6FDB;   /* links and small text, 4.62:1 */
  --accent-hover:#0F6FDB;
  --accent-soft: #E9F2FF;

  --code-bg: #000000;
  --code-ink: #FFFFFF;
  --code-mute: #5C5C5C;

  /* Reserved for "the problem" callouts only. The library expresses
     weak-versus-strong with fill, not with a second hue. */
  --danger: #BF2E1C;
  --danger-bg: #FDF0EE;
  --danger-line: #F3CFC9;

  --ok: #0F6FDB;
  --ok-bg: #E9F2FF;
  --ok-line: #C4DDFF;

  --font-display: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --font-kicker: 'Eczar', 'Newsreader', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Square. Every corner on every page is 90 degrees. */
  --radius: 0;
  --radius-sm: 0;

  --shadow-card: none;
  --shadow-hover: none;

  --header-h: 66px;
  --shell: 1280px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

a { color: inherit; }

/* ---------- Brand ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.18em;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1;
  text-decoration: none;
}
.brand__mark {
  position: relative;
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  background: var(--accent);
  border-radius: 0;
  margin: 0 0.06em;
  vertical-align: -0.06em;
}
.brand__cursor {
  position: absolute;
  inset: 15%;
  display: block;
  background: #fff;
  border-radius: 0;
}
.brand__cursor svg {
  position: absolute;
  inset: 16%;
  width: 68%;
  height: 68%;
  display: block;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header__row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  max-width: var(--shell);
  margin: 0 auto;
}

.join-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 0;
  text-decoration: none;
  white-space: nowrap;
  transition: background 150ms, transform 150ms;
}
.join-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.join-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Eyebrow ---------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 14px;
}
.eyebrow__dot {
  width: 5px; height: 5px;
  border-radius: 0;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  flex-shrink: 0;
}

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

.hero {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 64px 24px 40px;
  text-align: center;
}
.hero-rule {
  max-width: var(--shell);
  margin: 0 auto 32px;
  border: 0;
  border-top: 1px solid var(--line);
}
.hero__title {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.05;
  margin: 0 auto 16px;
  max-width: 20ch;
}
.hero__lede {
  color: var(--ink-soft);
  font-size: 17px;
  max-width: 62ch;
  margin: 0 auto;
}
/* ---------- Layout ---------- */

/* Single centred column, capped well under --shell so card text keeps a
   readable measure now that the sidebar no longer constrains it. */
.layout {
  max-width: 940px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

/* ---------- Tip ---------- */

.tip {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 4px 22px 6px;
  margin-bottom: 14px;
  scroll-margin-top: calc(var(--header-h) + 20px);
  transition: border-color 140ms, box-shadow 140ms;
}
.tip:hover { border-color: #dcdce4; }
.tip.is-open {
  box-shadow: 0 1px 2px rgba(7, 7, 10, 0.03), 0 6px 18px -12px rgba(7, 7, 10, 0.08);
}
.tip__head { padding: 14px 0 16px; }

.tip__toggle {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.tip__toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
  border-radius: 0;
}
.tip__toggle-text { display: block; }
.tip__chev {
  flex-shrink: 0;
  line-height: 0;
  margin-top: 4px;
  color: var(--ink-mute);
  transition: transform 200ms ease, color 140ms;
}
.tip__chev svg { width: 18px; height: 18px; }
.tip__toggle:hover .tip__chev { color: var(--accent); }
.tip.is-open .tip__chev { transform: rotate(180deg); color: var(--accent); }

/* Collapsible body: 0fr -> 1fr keeps the transition without a fixed height. */
.tip__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 240ms ease;
}
.tip.is-open .tip__body { grid-template-rows: 1fr; }
.tip__body-inner { overflow: hidden; min-height: 0; }
.tip.is-open .tip__body-inner { padding-bottom: 18px; }

@media (prefers-reduced-motion: reduce) {
  .tip__body, .tip__chev { transition: none; }
}
.tip__kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}
.tip__anchor {
  border: 0;
  background: none;
  padding: 0;
  margin-left: 2px;
  color: var(--ink-mute);
  cursor: pointer;
  opacity: 0;
  transition: opacity 130ms, color 130ms;
  line-height: 0;
}
.tip:hover .tip__anchor, .tip__anchor:focus-visible { opacity: 1; }
.tip__anchor:hover { color: var(--accent); }
.tip__anchor:focus-visible { outline: none; color: var(--accent); }
.tip__anchor svg { width: 13px; height: 13px; }
.tip__title {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 27px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0;
}
.tip__note {
  display: block;
  color: var(--ink-mute);
  font-size: 13.5px;
  margin: 9px 0 0;
  max-width: 78ch;
}

/* ---------- Compare panes ---------- */

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

.pane {
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg-elev);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pane--bad { border-color: var(--danger-line); }
.pane--good { border-color: var(--ok-line); }

.pane__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.pane--bad .pane__head { background: var(--danger-bg); color: var(--danger); border-bottom-color: var(--danger-line); }
.pane--good .pane__head { background: var(--ok-bg); color: var(--ok); border-bottom-color: var(--ok-line); }
.pane__head svg { width: 13px; height: 13px; flex-shrink: 0; }

.pane__copy {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 9px;
  border-radius: 0;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 130ms, background 130ms;
}
.pane__copy:hover { opacity: 1; background: rgba(26,138,79,0.09); }
.pane__copy:focus-visible { outline: none; opacity: 1; box-shadow: 0 0 0 3px var(--ok-line); }
.pane__copy svg { width: 12px; height: 12px; }
.pane__copy.is-done { opacity: 1; }

.pane__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.pane__result {
  margin-top: auto;
  display: flex;
  gap: 9px;
  padding: 11px 16px;
  border-top: 1px solid var(--line-soft);
  background: var(--bg-tint);
  font-size: 13px;
  color: var(--ink-soft);
}
.pane__result-label {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-mute);
  padding-top: 2px;
}
.pane--bad .pane__result { background: var(--danger-bg); border-top-color: var(--danger-line); color: #8a3a35; }
.pane--good .pane__result { background: var(--ok-bg); border-top-color: var(--ok-line); color: #216b45; }

/* ---------- Pane body items ---------- */

.say {
  position: relative;
  border-left: 2px solid var(--line);
  padding: 2px 34px 2px 13px;
  color: var(--ink);
  font-size: 13.5px;
}
.pane--bad .say { border-left-color: var(--danger-line); }
.pane--good .say { border-left-color: var(--ok-line); }
.say__cap {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-mute);
  margin-bottom: 3px;
}
.say .copy { position: absolute; top: 0; right: 0; }
.say:hover .copy, .say .copy:focus-visible { opacity: 1; }

.note { font-size: 13px; color: var(--ink-soft); margin: 0; }

/* The cheat sheet's own voice, not prompt text. Never included in a copy payload. */
.aside {
  font-size: 12.5px;
  font-style: italic;
  color: var(--ink-mute);
  margin: 0;
  padding-left: 10px;
  border-left: 2px solid var(--line);
}

.wrap { position: relative; padding-right: 30px; }
.wrap > .copy { position: absolute; top: -3px; right: 0; }
.wrap:hover .copy, .wrap .copy:focus-visible { opacity: 1; }

.cap {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-mute);
  margin-bottom: 6px;
}

.codeblock {
  position: relative;
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: 0;
  padding: 15px 17px;
  overflow-x: auto;
  margin: 0;
}
.codeblock code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre;
}
.codeblock .copy {
  position: absolute;
  top: 9px; right: 9px;
  opacity: 1;
  color: var(--code-mute);
  background: rgba(255,255,255,0.06);
}
.codeblock .copy:hover { background: rgba(255,255,255,0.14); color: #fff; }

.ilist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ilist li { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; color: var(--ink-soft); }
.ilist svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 3px; }
.ilist .i-ok { color: var(--ok); }
.ilist .i-no { color: var(--danger); }
.ilist .i-dot { color: var(--ink-mute); }
.ilist code { font-family: var(--font-mono); font-size: 12.5px; }

/* Test-runner output: a red line here is a failing test, not a negated rule. */
.runner { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.runner li { display: flex; gap: 10px; align-items: baseline; font-size: 13.5px; color: var(--ink-soft); }
.verdict {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 0;
  line-height: 1.4;
}
.verdict.is-pass { color: var(--ok); background: var(--ok-bg); border: 1px solid var(--ok-line); }
.verdict.is-fail { color: var(--danger); background: var(--danger-bg); border: 1px solid var(--danger-line); }
.runner__sum {
  margin: 10px 0 0;
  font-size: 12.5px;
  font-style: italic;
  color: var(--ink-mute);
}

.flow { list-style: none; margin: 0; padding: 0; counter-reset: flow; }
.flow li {
  position: relative;
  padding: 0 0 16px 30px;
  font-size: 13.5px;
  color: var(--ink-soft);
}
.flow li::before {
  counter-increment: flow;
  content: counter(flow);
  position: absolute;
  left: 0; top: 0;
  width: 20px; height: 20px;
  border-radius: 0;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10.5px;
  display: grid;
  place-items: center;
}
.flow li::after {
  content: "";
  position: absolute;
  left: 9.5px; top: 24px; bottom: 4px;
  width: 1px;
  background: var(--line);
}
.flow li:last-child { padding-bottom: 0; }
.flow li:last-child::after { display: none; }
.flow__pass {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ok);
}

/* ---------- Copy button ---------- */

.copy {
  flex-shrink: 0;
  width: 26px; height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--ink-mute);
  cursor: pointer;
  opacity: 0;
  transition: opacity 130ms, background 130ms, color 130ms;
}
.copy:hover { background: var(--accent-soft); color: var(--accent); }
.copy:focus-visible { outline: none; opacity: 1; border-color: var(--accent); }
.copy.is-done { opacity: 1; color: var(--ok); }
.copy svg { width: 15px; height: 15px; }

/* ---------- Blocks (summary) ---------- */

.block { padding-top: 60px; scroll-margin-top: calc(var(--header-h) + 20px); }
.block__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 27px;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.block__note { color: var(--ink-mute); font-size: 13.5px; margin: 0 0 18px; max-width: 78ch; }

/* ---------- Summary matrix ---------- */

.matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.matrix__col {
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg-elev);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.matrix__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 17px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--line-soft);
}
.matrix__col--ok .matrix__head { background: var(--ok-bg); color: var(--ok); border-bottom-color: var(--ok-line); }
.matrix__col--no .matrix__head { background: var(--danger-bg); color: var(--danger); border-bottom-color: var(--danger-line); }
.matrix__col--ok { border-color: var(--ok-line); }
.matrix__col--no { border-color: var(--danger-line); }
.matrix__head svg { width: 14px; height: 14px; }
.matrix ul { list-style: none; margin: 0; padding: 6px 17px 12px; }
.matrix li { padding: 8px 0; font-size: 13.5px; color: var(--ink-soft); }
.matrix li + li { border-top: 1px solid var(--line-soft); }

.closing {
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1.45;
  color: var(--ink);
  margin: 26px 0 0;
  max-width: 62ch;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms, transform 180ms;
  z-index: 95;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-tint);
}
.site-footer__row {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 34px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.site-footer p { margin: 0; color: var(--ink-mute); font-size: 13px; }
.site-footer__brand { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.site-footer__tagline { font-size: 13.5px !important; }

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

@media (max-width: 1020px) {
  .layout { padding-bottom: 48px; }
  .layout > * { min-width: 0; }
  .compare { grid-template-columns: minmax(0, 1fr); }
  .copy { opacity: 1; }
  .tip__anchor { opacity: 1; }
  .pane__copy { opacity: 1; }
  .site-header .join-btn { display: none; }
}

@media (max-width: 620px) {
  .hero { padding: 40px 20px 30px; }
  .layout { padding-left: 20px; padding-right: 20px; }
  .matrix { grid-template-columns: minmax(0, 1fr); }
  .site-header__row { padding: 12px 20px; }
  .site-footer__row { padding-left: 20px; padding-right: 20px; }
  .tip__title, .block__title { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
