/* ==========================================================================
   templates.html — the asset/template library.

   The page is a catalogue of finished formats, so it needs three things the
   shell does not already give it: a dense factual table, a preview card that
   carries its own metadata strip, and a quiet note block for the places where
   a shipped file disagrees with its own written rule.
   ========================================================================== */

/* ---- Format index -------------------------------------------------------- */

.tpl-scroll { overflow-x: auto; }

.tpl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-s);
  text-align: left;
}
.tpl-table th {
  font-weight: 600;
  font-size: var(--text-xs);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--neutral-400);
  padding: 0 20px 10px 0;
  border-bottom: 1px solid var(--neutral-200);
  white-space: nowrap;
}
.tpl-table td {
  padding: 14px 20px 14px 0;
  border-bottom: 1px solid var(--neutral-100);
  color: var(--neutral-600);
  line-height: 1.5;
  vertical-align: top;
}
.tpl-table td:first-child {
  color: var(--neutral-900);
  font-weight: 600;
  white-space: nowrap;
}
.tpl-table tr:last-child td { border-bottom: 0; }
.tpl-table .num {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--text-xs);
  color: var(--neutral-900);
  white-space: nowrap;
}
.tpl-table .path {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--text-xs);
  color: var(--neutral-400);
  white-space: nowrap;
}

/* ---- Preview card -------------------------------------------------------- */

.tpl-card { margin: 0; }

.tpl-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-2xl);
  border: 1px solid var(--neutral-200);
  background: var(--neutral-50);
}

.tpl-card__name {
  margin-top: 14px;
  font-size: var(--text-m);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--neutral-900);
}
.tpl-card__what {
  margin-top: 6px;
  font-size: var(--text-s);
  line-height: 1.55;
  color: var(--neutral-600);
}
.tpl-card__meta {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--neutral-200);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--neutral-400);
}
.tpl-card__meta b { color: var(--neutral-600); font-weight: 500; }

/* Two big portrait pages side by side, and a wider gutter than the shell grid. */
.tpl-pages { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 32px; }

/* Previews earn more width than the shell's card grids give them: two up, never
   three, so a 16:9 slide is still legible at reading distance. */
.tpl-previews {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr));
  gap: 32px 28px;
  align-items: start;
}

/* ---- Spec list ----------------------------------------------------------- */

.tpl-spec { margin: 0; display: grid; grid-template-columns: 160px 1fr; gap: 0; }
.tpl-spec dt {
  padding: 9px 16px 9px 0;
  border-top: 1px solid var(--neutral-200);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--neutral-400);
}
.tpl-spec dd {
  margin: 0;
  padding: 9px 0;
  border-top: 1px solid var(--neutral-200);
  font-size: var(--text-s);
  line-height: 1.55;
  color: var(--neutral-600);
}
.tpl-spec dd b { color: var(--neutral-900); font-weight: 600; }
.tpl-spec dd code { font-size: 12px; }
@media (max-width: 620px) {
  .tpl-spec { grid-template-columns: 1fr; }
  .tpl-spec dd { border-top: 0; padding-top: 0; }
}

/* ---- Rule lists ---------------------------------------------------------- */

.tpl-rules { margin: 0; padding: 0; list-style: none; counter-reset: r; }
.tpl-rules li {
  position: relative;
  counter-increment: r;
  padding: 0 0 0 34px;
  margin-bottom: 14px;
  font-size: var(--text-s);
  line-height: 1.6;
  color: var(--neutral-600);
}
.tpl-rules li:last-child { margin-bottom: 0; }
.tpl-rules li::before {
  content: counter(r, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--text-xs);
  color: var(--neutral-300);
}
.tpl-rules b { color: var(--neutral-900); font-weight: 600; }

.tpl-plain { margin: 0; padding-left: 18px; font-size: var(--text-s); line-height: 1.6; color: var(--neutral-600); }
.tpl-plain li { margin-bottom: 8px; }
.tpl-plain li:last-child { margin-bottom: 0; }
.tpl-plain b { color: var(--neutral-900); font-weight: 600; }

/* ---- Note: where a shipped file disagrees with its own written rule ------- */

.tpl-note {
  margin-top: 24px;
  padding: 18px 22px;
  background: var(--neutral-50);
  border-radius: var(--radius-lg);
  box-shadow: var(--ring-default);
}
.tpl-note__label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--amber-800);
}
.tpl-note p {
  margin: 8px 0 0;
  font-size: var(--text-s);
  line-height: 1.6;
  color: var(--neutral-600);
}
.tpl-note p + p { margin-top: 10px; }
.tpl-note b { color: var(--neutral-900); font-weight: 600; }
.tpl-note code { font-size: 12px; }

/* ---- Avatar capsule row -------------------------------------------------- */

.tpl-capsules {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 22px;
  border-radius: var(--radius-2xl);
  background: var(--gradient-immersive);
}
.tpl-capsules img {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-full);
  display: block;
}

/* ---- Command block ------------------------------------------------------- */

.tpl-cmds pre + pre { margin-top: 10px; }
.tpl-cmds .tpl-cmd-note {
  margin: 6px 0 18px;
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--neutral-400);
}

/* ---- Section sub-heading ------------------------------------------------- */

.tpl-sub {
  margin: 44px 0 18px;
  font-size: var(--text-l);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--neutral-900);
}
.tpl-sub--first { margin-top: 0; }

.tpl-lede-inline {
  margin: -6px 0 20px;
  max-width: 660px;
  font-size: var(--text-s);
  line-height: 1.65;
  color: var(--neutral-600);
}

/* Sits two columns of unequal weight side by side without centring anything. */
.tpl-split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}
@media (max-width: 860px) { .tpl-split { grid-template-columns: 1fr; gap: 28px; } }

/* ---- Rule extract -------------------------------------------------------- */
/* One block of the slide stylesheet quoted verbatim, so the page shows the
   fix rather than only describing it. */

.tpl-code { max-width: 820px; margin: 0 0 20px; }
.tpl-code pre { font-size: 12px; }

/* Sub-heading inside a format section — smaller than .sec__title, which belongs
   to the format itself, so the spec blocks under one format read as its parts. */
.tpl-h3 {
  margin: 40px 0 14px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--neutral-900);
}

/* Download link for a source file that ships with the site. */
.tpl-dl { color: var(--brand-600); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
