/* Shared styling for the ai-builder-portfolio. Matches the switchboard at /:
   Inter Tight, archival off-white paper (#eeeee8), single-tone rules. */

:root {
  --bg:   #eeeee8;
  --ink:  #171712;
  --sec:  #5a5a52;
  --rule: #d7d7cd;
  --hi:   #eae4c9;
  --red:  #7a1e1e;
  --amb:  #7a5a1e;

  /* Type tokens. The subtree had drifted to five uppercase sizes and four
     tracking values against the switchboard's single treatment at /, so an
     eyebrow looked slightly different on every page. One label scale, one
     mono stack, one measure. */
  --track:   0.16em;                 /* uppercase tracking, as at / */
  --label:   0.68rem;                /* eyebrows, section labels, table heads */
  --label-l: 0.78rem;                /* breadcrumbs */
  --mono:    ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --measure: 60rem;                  /* document column */
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vh, 3.5rem) clamp(1.25rem, 3.5vw, 3rem) 4rem;
}

.crumbs {
  font-size: var(--label-l);
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--sec);
  margin-bottom: clamp(1.25rem, 3vh, 2.25rem);
  font-weight: 700;
}
.crumbs a { color: var(--sec); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { padding: 0 0.6rem; }

h1.title {
  font-size: clamp(1.6rem, 4.5vh, 2.8rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.08;
  color: var(--ink);
  margin-bottom: 0.6rem;
}
p.lede {
  font-size: clamp(1rem, 2.1vh, 1.25rem);
  color: var(--sec);
  max-width: var(--measure);
}

hr.rule {
  border: 0;
  border-bottom: 1px solid var(--rule);
  margin: clamp(1.25rem, 3vh, 2.25rem) 0;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: clamp(1rem, 2.5vw, 1.75rem);
  margin-top: clamp(1.5rem, 3.5vh, 2.5rem);
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule);
  padding: 1.4rem 1.4rem 1.5rem;
  text-decoration: none;
  color: var(--ink);
  background: var(--bg);
  transition: background 0.12s ease, border-color 0.12s ease;
  min-height: 220px;
}
.card:hover, .card:focus-visible {
  background: var(--hi);
  border-color: var(--ink);
  outline: none;
}
.card .kicker {
  font-size: var(--label);
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--sec);
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin-bottom: 0.6rem;
  line-height: 1.2;
}
.card p {
  font-size: 0.92rem;
  color: var(--sec);
  line-height: 1.4;
  margin-bottom: 1rem;
}
.card .foot {
  margin-top: auto;
  font-size: var(--label);
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--sec);
  font-weight: 600;
}

.section-label {
  font-size: var(--label);
  font-weight: 700;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--sec);
  margin-bottom: 0.9rem;
}

.mono {
  font-family: var(--mono);
  font-size: 0.8rem;
}

.footer {
  margin-top: clamp(2.5rem, 6vh, 4rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.78rem;
  color: var(--sec);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.footer a { color: var(--sec); }
.footer a:hover { color: var(--ink); }

a { color: var(--ink); }

/* ---- Product doc primitives (Problem / Solution / Criteria / Metrics) ---- */

.doc-section { margin-top: clamp(1.5rem, 3.5vh, 2.5rem); }

.doc-label {
  font-size: var(--label);
  font-weight: 700;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--sec);
  margin-bottom: 0.6rem;
}

.doc-heading {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 0.75rem;
}

.doc-body {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  max-width: var(--measure);
}
.doc-body + .doc-body { margin-top: 0.75rem; }
.doc-body b, .doc-body strong { font-weight: 600; }

.criteria-list {
  list-style: none;
  padding: 0;
  margin-top: 0.75rem;
  max-width: var(--measure);
}
.criteria-list li {
  position: relative;
  padding: 0.55rem 0 0.55rem 1.75rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.95rem;
  line-height: 1.45;
}
.criteria-list li:last-child { border-bottom: 0; }
.criteria-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.85rem;
  width: 0.75rem;
  height: 0.75rem;
  border: 1px solid var(--ink);
}

.metrics-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.93rem;
}
.metrics-table th, .metrics-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--rule);
}
.metrics-table th {
  font-size: var(--label);
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--sec);
  font-weight: 700;
  border-bottom: 1px solid var(--ink);
}
.metrics-table td.k { font-weight: 600; width: 20%; }
.metrics-table td.v {
  font-family: var(--mono);
  font-size: 0.85rem;
  width: 22%;
  color: var(--ink);
}
.metrics-table td.note { color: var(--sec); font-size: 0.9rem; }

.gaps {
  margin-top: 0.6rem;
  padding: 0.9rem 1rem;
  background: #f6f6f0;
  border-left: 3px solid var(--sec);
  font-size: 0.9rem;
  color: var(--ink);
  line-height: 1.5;
  max-width: var(--measure);
}
.gaps b { font-weight: 600; }
.gaps ul { margin: 0.4rem 0 0 1.2rem; }
.gaps li { margin-bottom: 0.25rem; }

.hero-video {
  margin-top: 1.5rem;
  border: 1px solid var(--ink);
  /* The console renders on a light ground, so a black letterbox reads as a
     rendering fault rather than as framing. */
  background: var(--bg);
  display: block;
  width: 100%;
  height: auto;
}
.hero-cap {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: var(--sec);
  line-height: 1.4;
}

/* ---- Widescreen index: one screen, four cards across, then four ----

   Same contract as the switchboard at /: the page is exactly one viewport
   tall and never scrolls. Everything is sized in vh so the whole set is
   legible at a glance on a laptop and simply larger on a big display.
   Narrow or short windows fall back to ordinary document scrolling,
   because eight cards in 500 px of height would be type nobody can read. */
.page.wide {
  max-width: 100rem;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: clamp(0.9rem, 2.6vh, 2.25rem) clamp(1rem, 3vw, 2.75rem) clamp(0.7rem, 1.8vh, 1.5rem);
}
.page.wide .crumbs { margin-bottom: clamp(0.5rem, 1.6vh, 1.5rem); font-size: clamp(0.6rem, 1.15vh, 0.78rem); }
.page.wide h1.title { font-size: clamp(1.25rem, 3.4vh, 2.5rem); margin-bottom: clamp(0.25rem, 0.8vh, 0.6rem); }
.page.wide p.lede { max-width: 62rem; font-size: clamp(0.8rem, 1.6vh, 1.1rem); }
.page.wide hr.rule { margin: clamp(0.6rem, 1.8vh, 1.5rem) 0; }
.page.wide .section-label { margin-bottom: clamp(0.4rem, 1.2vh, 0.9rem); font-size: clamp(0.6rem, 1.15vh, 0.68rem); }

/* The card grid takes whatever height is left and splits it into two
   equal rows, so the cards size themselves to the window. */
.page.wide .grid-cards {
  flex: 1;
  min-height: 0;
  margin-top: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: clamp(0.5rem, 1.5vh, 1.25rem);
}
.page.wide .card {
  min-height: 0;
  overflow: hidden;
  padding: clamp(0.6rem, 1.6vh, 1.25rem) clamp(0.7rem, 1vw, 1.25rem);
}
.page.wide .card .kicker { font-size: clamp(0.52rem, 1vh, 0.68rem); margin-bottom: clamp(0.15rem, 0.5vh, 0.5rem); }
.page.wide .card h3 { font-size: clamp(0.85rem, 1.9vh, 1.25rem); margin-bottom: clamp(0.2rem, 0.7vh, 0.6rem); }
.page.wide .card p { font-size: clamp(0.7rem, 1.4vh, 0.92rem); line-height: 1.35; margin-bottom: clamp(0.3rem, 0.8vh, 1rem); }
.page.wide .card .foot { font-size: clamp(0.5rem, 0.95vh, 0.68rem); }
.page.wide .card .fig { margin-bottom: clamp(0.3rem, 1vh, 1rem); }
.page.wide .schem { height: clamp(2.1rem, 6.2vh, 5.5rem); }
.page.wide .footer { margin-top: clamp(0.5rem, 1.5vh, 1.5rem); padding-top: clamp(0.4rem, 1.2vh, 1.25rem); font-size: clamp(0.6rem, 1.15vh, 0.78rem); }

@media (max-width: 1100px), (max-height: 620px) {
  .page.wide { height: auto; overflow: visible; }
  .page.wide .grid-cards { grid-auto-rows: auto; }
}

/* ---- Card internals, shared by both layouts ----

   The measure widens for the index only; the case-study pages keep the
   document column. Each card opens with a small schematic, drawn in the
   same hand as the machines on the switchboard: isometric wireframe,
   one stroke weight, hidden edges dashed, the project's one thing in
   the working blue. Small on purpose: a glyph for the project, not an
   illustration competing with the text. */
.card .fig { margin-bottom: 1rem; }
.card .text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.card .text .foot { margin-top: auto; }

.schem {
  display: block;
  height: 5.5rem;
  width: auto;
  max-width: 100%;
  color: var(--sec);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: color 0.12s ease;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.08em;
}
.card:hover .schem, .card:focus-visible .schem { color: var(--ink); }
.schem .hid   { stroke-dasharray: 2 3; opacity: 0.5; }
.schem .hair  { opacity: 0.35; }
.schem .link  { stroke-dasharray: 3 3; opacity: 0.7; }
.schem .road  { opacity: 0.7; }
.schem .scr   { opacity: 0.6; }
.schem .frame { opacity: 0.55; }
.schem .bar   { stroke-width: 2; opacity: 0.6; }
.schem .hot, .schem .bar.hot { stroke: #1c54dc; opacity: 1; }
.schem .swath { stroke: #1c54dc; opacity: 0.6; }
.schem .lead  { stroke-width: 1.6; }
/* Captions are for the large rendering; at glyph size they are noise. */
.schem text   { display: none; }

@media (max-width: 1100px) {
  .page.wide .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .grid-cards, .page.wide .grid-cards { grid-template-columns: 1fr; }
  .footer { flex-direction: column; align-items: flex-start; }
}
