/*
 * Web Design Standard page. Builds on the Color Standard's page styles
 * (../color/standard.css) and adds the pieces this page needs: two-column
 * lists, table widths, and the page's own print rules, which follow
 * section 4 of the standard it publishes.
 */

.wd-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
  margin: var(--space-4) 0 var(--space-6);
}

.wd-two h3 {
  margin-top: 0;
}

.wd-two ul,
.wd-list {
  margin: 0;
  padding-left: var(--space-5);
}

.wd-two li,
.wd-list li {
  margin-bottom: var(--space-2);
  line-height: 1.55;
}

/* Long inline code (property paths, selectors) may break at 320px */
.cs-steps code,
.wd-list code,
.wd-two code {
  overflow-wrap: anywhere;
}

.wd-table {
  min-width: 560px;
}

.wd-table th[scope="row"] {
  white-space: nowrap;
}

.wd-note {
  margin: var(--space-4) 0 0;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

@media (max-width: 700px) {
  .wd-two {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media print {
  /* Header and footer on every printed page, drawn in the page margins.
     The sides are SVG images so each can carry two lines in two styles;
     the centre title comes from the named page of the section below. */
  @page {
    margin: 0.95in 0.6in 0.75in;
    background: #ffffff;

    @top-left {
      content: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22260%22 height=%2230.5%22%3E%3Ctext x=%220%22 y=%2214%22 font-family=%22Segoe UI, Calibri, sans-serif%22 font-size=%2214%22 font-weight=%22700%22 fill=%22%231f4fbf%22%3ETemplate Interface%3C/text%3E%3Ctext x=%220%22 y=%2226.5%22 font-family=%22Segoe UI, Calibri, sans-serif%22 font-size=%2210.5%22 font-weight=%22400%22 fill=%22%23222222%22%3EStandards%3C/text%3E%3C/svg%3E");
      vertical-align: bottom;
      padding-bottom: 6pt;
      margin-bottom: 10pt;
      border-bottom: 0.75pt solid #c8c8c8;
    }

    @top-center {
      content: "";
      vertical-align: bottom;
      padding-bottom: 6pt;
      margin-bottom: 10pt;
      border-bottom: 0.75pt solid #c8c8c8;
    }

    @top-right {
      content: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22260%22 height=%2230.5%22%3E%3Ctext x=%22260%22 y=%2214%22 font-family=%22Segoe UI, Calibri, sans-serif%22 font-size=%2214%22 font-weight=%22700%22 fill=%22%231f4fbf%22 text-anchor=%22end%22%3EVersion 1.0%3C/text%3E%3Ctext x=%22260%22 y=%2226.5%22 font-family=%22Segoe UI, Calibri, sans-serif%22 font-size=%2210.5%22 font-weight=%22400%22 fill=%22%23222222%22 text-anchor=%22end%22%3ENovember 22, 2026%3C/text%3E%3C/svg%3E");
      vertical-align: bottom;
      padding-bottom: 6pt;
      margin-bottom: 10pt;
      border-bottom: 0.75pt solid #c8c8c8;
    }

    @bottom-left {
      content: "Template Interface Web Design Standard. templateinterface.com";
      font: 8.5pt "Segoe UI", system-ui, sans-serif;
      color: #5c5c5c;
      vertical-align: middle;
      border-top: 0.75pt solid #c8c8c8;
    }

    @bottom-right {
      content: "Page " counter(page) " of " counter(pages);
      font: 8.5pt "Segoe UI", system-ui, sans-serif;
      color: #5c5c5c;
      vertical-align: middle;
      border-top: 0.75pt solid #c8c8c8;
    }
  }

  @page wd-start {
    @top-center {
      content: "Rules and Method";
      font: 700 19pt "Segoe UI", system-ui, sans-serif;
      white-space: nowrap;
      color: #1f1f1f;
    }
  }

  @page wd-print {
    @top-center {
      content: "Print";
      font: 700 19pt "Segoe UI", system-ui, sans-serif;
      white-space: nowrap;
      color: #1f1f1f;
    }
  }

  @page wd-patterns {
    @top-center {
      content: "Bug Patterns and Tools";
      font: 700 19pt "Segoe UI", system-ui, sans-serif;
      white-space: nowrap;
      color: #1f1f1f;
    }
  }

  @page wd-ship {
    @top-center {
      content: "Checklist and Sources";
      font: 700 19pt "Segoe UI", system-ui, sans-serif;
      white-space: nowrap;
      color: #1f1f1f;
    }
  }

  .cs-hero,
  #rules,
  #surfaces,
  #method {
    page: wd-start;
  }

  #print {
    page: wd-print;
  }

  #patterns,
  #tools {
    page: wd-patterns;
  }

  #checklist,
  #sources {
    page: wd-ship;
  }

  /* The page background also fills the paper margins, where the
     running footer sits, so it must be white too. */
  html,
  :root[data-theme] {
    background: #ffffff !important;
  }


  .cs-kicker {
    display: none;
  }

  :root,
  :root[data-theme="dark"] {
    color-scheme: light;
    --color-canvas: #ffffff;
    --color-surface: #ffffff;
    --color-surface-inset: #ffffff;
    --color-surface-raised: #ffffff;
    --color-text-primary: var(--ti-gray-90);
    --color-text-secondary: var(--ti-gray-70);
    --color-text-tertiary: var(--ti-gray-70);
    --color-border-default: var(--ti-gray-40);
    --color-border-muted: var(--ti-gray-40);
    --color-border-strong: var(--ti-gray-60);
    --color-accent: var(--ti-gray-90);
    --color-on-accent: #ffffff;
  }

  body {
    background: #ffffff;
    color: var(--color-text-primary);
    font-size: 10pt;
  }

  .cs-page {
    max-width: none;
    padding: 0;
  }

  .cs-toc,
  .cs-checklist input {
    display: none;
  }

  .cs-checklist label::before {
    content: "\2610";
    margin-right: 0.5em;
  }

  .cs-hero,
  .cs-section {
    margin: 0 0 20pt;
    padding: 0;
  }

  .cs-scroll {
    overflow: visible;
  }

  .cs-table,
  .wd-table {
    min-width: 0;
  }

  .cs-code {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .cs-section h2,
  .cs-section h3 {
    break-after: avoid;
  }

  .cs-rules li,
  .cs-steps li,
  .wd-two li,
  .wd-list li,
  .cs-checklist li,
  .cs-code,
  .cs-table tr {
    break-inside: avoid;
  }

  .cs-sources a[href^="http"]::after {
    content: " (" attr(href) ")";
    overflow-wrap: anywhere;
    font-size: 0.85em;
  }
}
