/*
 * The tips pages: /tips and every guide under /tips/<guide>.
 *
 * One stylesheet for all of them, because they are one document split by what
 * the reader is making. It used to be a <style> block inside the single tips
 * page; six inline copies of it would drift the first time one guide needed a
 * new component. 3d-brand.css still owns the palette, the header and the
 * footer links, and nothing here restyles those (public-nav.test.ts holds it).
 *
 * Served from the app's public/ like 3d-brand.css: nginx answers it from the
 * mounted directory and falls through to the app when the mount is missing.
 */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0; color: var(--ink); line-height: 1.6; -webkit-font-smoothing: antialiased;
  background: var(--bg);
}
.num { font-family: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums;
  /* A figure and its unit are one token to a reader: without this a
     narrow column broke `+0.15 mm` after the number and left the unit
     stranded on the next line. */
  white-space: nowrap; }

/* The build plate, receding to a horizon behind the whole page. */
.plate, .glow { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.plate {
  background-image:
    linear-gradient(to right, var(--plate-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--plate-line) 1px, transparent 1px);
  background-size: 54px 54px;
  transform: perspective(640px) rotateX(64deg) scale(2.1);
  transform-origin: 50% 94%;
  -webkit-mask-image: radial-gradient(ellipse 62% 46% at 50% 90%, #000 8%, transparent 70%);
  mask-image: radial-gradient(ellipse 62% 46% at 50% 90%, #000 8%, transparent 70%);
}
.glow { background: radial-gradient(ellipse 70% 46% at 50% 2%, var(--glow-top), transparent 62%),
    radial-gradient(ellipse 120% 60% at 50% 104%, var(--glow-bottom), transparent 58%); }

.wrap { position: relative; z-index: 1; max-width: 1152px; margin: 0 auto; padding: 0 24px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 0; }
.btn {
  display: inline-block; padding: 12px 24px; border-radius: 10px; font-weight: 700;
  text-decoration: none; font-size: 0.95rem; transition: background .15s, border-color .15s, transform .15s;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--accent-fill); color: var(--accent-ink);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent), 0 12px 38px -12px color-mix(in srgb, var(--accent) 65%, transparent);
}
.btn-primary:hover { background: var(--accent-fill-hover); transform: translateY(-1px); }
.btn-ghost { color: var(--ink); border: 1px solid var(--border); background: var(--card); }
.btn-ghost:hover { border-color: var(--accent); }

/* Which guide you are in. The same six links head every tips page, so a
   reader who landed on the wrong guide from an ad or a search is one tap from
   the right one, and the one they are reading is marked. */
.guides { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 4px auto 0; max-width: 60rem; }
.guides a {
  font-size: 0.8rem; font-weight: 600; text-decoration: none; color: var(--muted);
  border: 1px solid transparent; border-radius: 999px; padding: 6px 12px;
  transition: color .15s, border-color .15s, background .15s;
}
.guides a:hover { color: var(--ink); border-color: var(--line); }
.guides a[aria-current="page"] { color: var(--accent-soft); background: var(--accent-chip); border-color: var(--accent-tint-edge); }
/* The same row again at the foot of a guide, where the next guide is read. */
.guides-end { padding: 8px 0 0; }
.guides-end-label {
  display: block; text-align: center; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--muted); margin: 44px 0 10px;
}

/* Page head */
.masthead { text-align: center; padding: 40px 0 8px; }
.masthead h1 { font-size: clamp(2rem, 4.4vw, 2.9rem); line-height: 1.08; letter-spacing: -0.035em; margin: 0 0 16px; }
.masthead h1 em { font-style: normal; color: var(--accent); }
.masthead .lede { color: var(--muted); font-size: 1.05rem; margin: 0 auto; max-width: 42rem; }

/* Jump links under the masthead. */
.toc { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 24px auto 0; max-width: 52rem; }
.toc a {
  font-size: 0.82rem; font-weight: 600; text-decoration: none; color: var(--muted);
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 13px;
  transition: border-color .15s, color .15s;
}
.toc a:hover { color: var(--ink); border-color: var(--accent); }
.guides a:focus-visible, .toc a:focus-visible, a.guide-card:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card h3 { margin: 0 0 8px; font-size: 1rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.card p + p { margin-top: 10px; }

/* A link inside the prose, where it has to look like one. */
.section-lede a, .card p a, ul.bullets a, .notice p a, table.tbl a, .closer .fineprint a {
  color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px;
}

/* The guide index on /tips. The whole card is the link. */
.guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
a.guide-card {
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  transition: border-color .15s, transform .15s;
}
a.guide-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.guide-card h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 1.05rem; }
.guide-card h3::after { content: "→"; color: var(--accent); flex: 0 0 auto; }
.guide-card .meta {
  margin-top: auto; padding-top: 12px; font-size: 0.8rem;
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
/* .card p + p would push the rule down by its own margin; the rule is the gap. */
.guide-card p + p.meta { margin-top: 14px; }
.guide-card .meta strong { color: var(--ink); font-weight: 600; }

/* Sections */
section.tip { padding-top: 14px; scroll-margin-top: 18px; }
/* A flex row, so a heading that wraps keeps its second line under its
   first word rather than under the numeral. On a phone "02 Give it the one
   number that matters" broke after "that" and put "matters" flush left,
   under the 02, which read as a new heading rather than a continuation. */
h2.section { display: flex; align-items: baseline; gap: 10px; font-size: 1.55rem; letter-spacing: -0.025em; margin: 52px 0 8px; }
h2.section .step {
  flex: 0 0 auto; min-width: 1.9rem; color: var(--accent);
  font-family: 'Space Mono', ui-monospace, monospace; font-size: 1.1rem; font-weight: 700;
}
.section-lede { color: var(--muted); margin: 0 0 22px; max-width: 46rem; font-size: 1rem; }
.section-lede strong { color: var(--ink); font-weight: 600; }

.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

/* An example chat message, as it would be typed into the composer. */
.msg {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 15px 18px; margin: 0;
  font-size: 0.93rem; color: var(--ink); white-space: pre-wrap; line-height: 1.55;
}
.msg-label {
  display: block; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 8px;
}

/* Weak / strong pairs. */
.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 16px; }
.pair > div { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; background: var(--card); }
.pair .tag {
  display: inline-flex; align-items: center; gap: 7px; font-size: 0.7rem; font-weight: 800;
  letter-spacing: 0.07em; text-transform: uppercase; margin-bottom: 10px;
}
.pair .tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.pair .weak .tag { color: var(--muted); }
.pair .weak .tag::before { background: var(--muted); }
.pair .strong { border-color: var(--accent-tint-edge); background: linear-gradient(180deg, var(--accent-tint), transparent 70%), var(--card); }
.pair .strong .tag { color: var(--accent-soft); }
.pair .strong .tag::before { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.pair p { margin: 0; font-size: 0.93rem; color: var(--ink); line-height: 1.55; }
.pair .weak p { color: var(--muted); }
.pair .why { margin-top: 10px !important; font-size: 0.85rem !important; color: var(--muted) !important; }

/* Tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 380px; }
table.tbl th {
  text-align: left; font-size: 0.7rem; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--line);
}
table.tbl td { padding: 11px 16px; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); color: var(--muted); vertical-align: top; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl td:first-child { color: var(--ink); font-weight: 600; white-space: nowrap; }
/* A first column that holds a phrase rather than a name wraps like prose. */
table.tbl.wrap-first td:first-child { white-space: normal; min-width: 9rem; }
/* The column head repeated on each cell. Only ever visible stacked, where
   the real <thead> is off screen and a value needs to say what it is. */
.col-lab { display: none; }

/* Below this a table cannot hold a sentence. At 360px the wrapper had
   310px to give a 380px table, so both tables scrolled sideways inside a
   page you scroll down, with no scrollbar and no edge fade to say so, and
   the clearance table's third column, the one that says when to use each
   fit, was off screen entirely rather than merely clipped.
   Each row becomes a card and each value carries its column head. */
@media (max-width: 520px) {
  .tbl-wrap { overflow-x: visible; border: 0; background: none; border-radius: 0; }
  table.tbl { display: block; min-width: 0; font-size: 0.95rem; }
  table.tbl thead { display: none; }
  table.tbl tbody, table.tbl tr, table.tbl td { display: block; }
  table.tbl tr {
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--card); padding: 14px 16px; margin-bottom: 10px;
  }
  table.tbl tr:last-child { margin-bottom: 0; }
  table.tbl td, table.tbl tr:last-child td { padding: 0; border-bottom: 0; }
  /* The row's name leads the card, so it is the one cell with no label. */
  table.tbl td:first-child { font-size: 1rem; white-space: normal; }
  table.tbl td + td { margin-top: 9px; }
  .col-lab {
    display: block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.07em;
    text-transform: uppercase; color: var(--muted); margin-bottom: 1px;
  }
}

/* Bulleted lists inside prose */
ul.bullets { margin: 0; padding-left: 20px; color: var(--muted); font-size: 0.95rem; max-width: 52rem; }
ul.bullets li { margin-bottom: 9px; }
ul.bullets li::marker { color: var(--accent); }
ul.bullets strong { color: var(--ink); font-weight: 600; }

/* Callout */
.notice {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, transparent), color-mix(in srgb, var(--accent) 3%, transparent));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin: 20px 0 0;
  display: flex; gap: 16px; align-items: flex-start;
}
.notice .badge {
  flex: 0 0 auto; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent-soft); background: var(--accent-chip); border: 1px solid var(--accent-tint-edge);
  border-radius: 999px; padding: 5px 12px; margin-top: 2px;
}
.notice p { margin: 0; color: var(--muted); font-size: 0.94rem; }
.notice strong { color: var(--ink); font-weight: 600; }

/* Tier cards */
.tier-card { display: flex; flex-direction: column; }
.tier-card h3 { display: flex; align-items: baseline; gap: 9px; }
.tier-card h3 span {
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--accent-soft); background: var(--accent-chip); border: 1px solid var(--accent-tint-edge);
  border-radius: 999px; padding: 3px 9px;
}

/* Checklist */
.check { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 34px; }
.check li {
  position: relative; padding-left: 26px; margin-bottom: 11px; break-inside: avoid;
  color: var(--muted); font-size: 0.95rem;
}
.check li::before {
  content: ""; position: absolute; left: 0; top: 0.42em; width: 13px; height: 7px;
  border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}
.check strong { color: var(--ink); font-weight: 600; }

.closer { text-align: center; padding: 52px 0 56px; }
.closer h2 { font-size: 1.6rem; letter-spacing: -0.025em; margin: 0 0 10px; }
.closer p { color: var(--muted); margin: 0 0 22px; }
.closer .fineprint { font-size: 0.85rem; color: var(--muted); margin-top: 14px; }
.closer .fineprint a { text-decoration: none; }

footer {
  position: relative; z-index: 1; border-top: 1px solid var(--line); padding: 28px 0 40px;
  text-align: center; color: var(--muted); font-size: 0.85rem;
}
footer a { color: var(--muted); text-decoration: none; margin: 0 8px; }
footer a:hover { color: var(--ink); }

@media (max-width: 640px) {
  .grid-4 { grid-template-columns: 1fr; }
  .check { columns: 1; }
  .notice { flex-direction: column; gap: 12px; }
  .masthead { padding-top: 24px; }
  h2.section { font-size: 1.35rem; }
  /* Ten jump links wrapped to five rows and spent 300px of a phone fold
     before the first tip began. One row that scrolls sideways inside its
     own box keeps all ten, bleeding to the screen edge so a half-visible
     chip says there is more; the page itself never moves sideways. The
     same pattern as the landing page's showcase strip. */
  .toc {
    flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto;
    margin: 20px -24px 0; padding: 2px 24px 8px; max-width: none;
    scroll-snap-type: x proximity; scroll-padding-inline: 24px;
    overscroll-behavior-x: contain; scrollbar-width: none;
  }
  .toc::-webkit-scrollbar { display: none; }
  .toc a { flex: 0 0 auto; scroll-snap-align: start; }
  /* The guide row does not take that pattern. Scrolling, the marked chip on
     the last three guides started off screen to the right, so the one link
     that says where you are was the one you could not see. Six short labels
     wrap to two rows at 390px once the chips tighten a little. */
  .guides { gap: 4px; }
  .guides a { padding: 5px 9px; font-size: 0.78rem; }
}
/* Chips 32–35px tall are a mistap apart on a phone; a floor of 40px on a
   touch screen keeps the rows readable and the targets honest. Boxes, so
   the padding above still sets the width. */
@media (pointer: coarse) {
  .guides a, .toc a { display: inline-flex; align-items: center; min-height: 40px; }
  /* The same trade the landing page makes: a full-width button is the
     bigger tap target and reads as the one thing to do. */
  .closer .btn { display: block; width: 100%; text-align: center; }
}
