/* ==========================================================================
   Lailara Design System tokens — Data Standards Cheat Sheet
   ========================================================================== */

/* Playfair Display 700 — latin only (only weight used in this stylesheet) */
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: local('Playfair Display Bold'), local('PlayfairDisplay-Bold'),
       url('fonts/playfair-display-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Source Sans 3 — latin variable font; one file covers weights 400–700 */
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: local('Source Sans 3'),
       url('fonts/source-sans-3.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Canvas & London greyscale */
  --canvas:          #f5f3ee;
  --text-primary:    #333333;
  --text-secondary:  #595959;
  --gridline:        #d9d9d9;
  --reference:       #666666;
  --disabled:        #b3b3b3;
  --ink:             #0d0d0d;

  /* Chicago accent blue */
  --navy:            #1f2e7a;
  --navy-hover:      #141e52;
  --navy-light:      #8e9ad0;

  /* Brand red — text and 1px rules only, never fill */
  --red:             #cc100a;

  /* Hong Kong teal (sequential) */
  --hk-5:            #063d32;
  --hk-35:           #158f75;
  --hk-55:           #35b595;
  --hk-85:           #b5e4d8;
  --hk-95:           #e4f5f0;

  /* Singapore orange */
  --sg-20:           #7a3d10;
  --sg-55:           #ee8a2a;
  --sg-95:           #fdeee0;

  /* Tokyo berry */
  --tokyo-40:        #b82d4a;
  --tokyo-95:        #fbe9ed;

  /* Semantic status */
  --status-pass-bg:  #e4f5f0;
  --status-pass-text: #0e6e5a;
  --status-warn-bg:  #fdeee0;
  --status-warn-text: #7a3d10;
  --status-fail-bg:  #fde8e7;
  --status-fail-text: #7a0906;
  --status-info-bg:  #e5e8f5;
  --status-info-text: #1f2e7a;

  /* Typography */
  --font-serif:      'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans:       'Source Sans 3', 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;

  /* Layout */
  --max-width:       900px;
  --section-gap:     60px;
  --border-radius:   2px;
}

/* ==========================================================================
   Reset & base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background-color: var(--canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.6;
  padding: 48px 24px;
}

/* ==========================================================================
   Header / brand
   ========================================================================== */

.site-header {
  max-width: var(--max-width);
  margin: 0 auto 48px;
  border-bottom: 1px solid var(--gridline);
  padding-bottom: 32px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.brand-subtitle {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

h1 {
  font-family: var(--font-serif);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 12px;
}

.header-description {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 660px;
  margin-bottom: 16px;
}

.verified-stamp {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.pdf-link {
  color: var(--navy);
  text-decoration: none;
  font-weight: 600;
}
.pdf-link:hover { color: var(--navy-hover); text-decoration: underline; }

/* ==========================================================================
   Table of contents
   ========================================================================== */

.toc {
  max-width: var(--max-width);
  margin: 0 auto 48px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toc a {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
  padding: 5px 12px;
  border: 1px solid var(--navy-light);
  border-radius: var(--border-radius);
  background: white;
  transition: background 150ms ease, color 150ms ease;
}

.toc a:hover {
  background: var(--navy);
  color: white;
}

/* ==========================================================================
   Main content
   ========================================================================== */

main {
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ==========================================================================
   Sections
   ========================================================================== */

.section {
  margin-bottom: var(--section-gap);
  padding-bottom: var(--section-gap);
  border-bottom: 1px solid var(--gridline);
}

.section:last-child {
  border-bottom: none;
}

.section-label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 8px;
}

h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 20px;
}

h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 28px;
  margin-bottom: 12px;
}

p { margin-bottom: 16px; max-width: 660px; }

/* ==========================================================================
   Tables
   ========================================================================== */

.table-wrapper {
  overflow-x: auto;
  margin: 24px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

thead tr {
  border-bottom: 2px solid var(--text-primary);
}

thead th {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-align: left;
  padding: 8px 12px 10px;
}

tbody tr {
  border-bottom: 1px solid var(--gridline);
}

tbody tr:last-child { border-bottom: none; }

tbody td {
  padding: 10px 12px;
  vertical-align: top;
}

tbody tr:hover { background: rgba(31, 46, 122, 0.03); }

.gotcha {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
}

/* ==========================================================================
   Definition lists (for attribute tables, algorithm steps)
   ========================================================================== */

dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 24px;
  margin: 20px 0;
}

dt {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding-top: 2px;
}

dd { font-size: 15px; color: var(--text-primary); }

/* ==========================================================================
   Callout / insight blocks
   ========================================================================== */

.callout {
  border-left: 3px solid var(--gridline);
  padding: 12px 16px;
  margin: 20px 0;
  font-size: 15px;
  color: var(--text-secondary);
}

.callout.warn {
  border-left-color: var(--sg-55);
  background: var(--sg-95);
  color: var(--sg-20);
}

.callout.info {
  border-left-color: var(--navy-light);
  background: var(--status-info-bg);
  color: var(--navy);
}

/* ==========================================================================
   Diagram placeholder
   ========================================================================== */

.diagram-placeholder {
  width: 100%;
  min-height: 180px;
  background: white;
  border: 1px dashed var(--gridline);
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--disabled);
  font-size: 13px;
  margin: 24px 0;
}

/* ==========================================================================
   Tool cross-link chips
   ========================================================================== */

.tool-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid var(--navy-light);
  border-radius: var(--border-radius);
  margin-top: 16px;
  transition: background 150ms ease, color 150ms ease;
}

.tool-link:hover {
  background: var(--navy);
  color: white;
}

.section-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--gridline);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  max-width: var(--max-width);
  margin: 60px auto 0;
  padding-top: 24px;
  border-top: 2px solid var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.site-footer a {
  color: var(--navy);
  text-decoration: none;
}

.site-footer a:hover { text-decoration: underline; }

/* ==========================================================================
   Footnotes & code-like formula blocks
   ========================================================================== */

p.footnote {
  font-size: 11px;
  font-style: italic;
  color: var(--text-secondary);
  margin-top: 6px;
  margin-bottom: 0;
}

.formula-block {
  font-family: var(--font-sans);
  font-size: 15px;
  background: white;
  border: 1px solid var(--gridline);
  border-radius: var(--border-radius);
  padding: 12px 16px;
  max-width: 480px;
  line-height: 1.8;
  margin: 16px 0 8px;
}

.formula-example {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* ==========================================================================
   Mobile — 640px
   ========================================================================== */

@media (max-width: 640px) {
  body { padding: 32px 16px; font-size: 15px; }

  .brand-name { font-size: 20px; }
  .brand-subtitle { font-size: 12px; }

  h1 { font-size: 28px; }
  h2 { font-size: 18px; }
  h3 { font-size: 16px; }

  table { font-size: 13px; }

  dl { grid-template-columns: 1fr; gap: 2px 0; }
  dt { padding-bottom: 0; }

  .toc { flex-direction: column; }
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
  @page {
    size: letter;
    margin: 0.6in;
    @bottom-left { content: "Lailara LLC — lailarallc.com"; font-size: 9pt; color: #595959; }
    @bottom-right { content: counter(page); font-size: 9pt; color: #595959; }
  }

  body {
    background: white;
    color: black;
    font-size: 10pt;
    padding: 0;
  }

  .toc { display: none; }
  /* Download PDF link is non-functional in PDF; date appears in footer */
  .verified-stamp { display: none; }
  /* Tool links: show in print as hyperlinks + visible URL for printed copies */
  a.tool-link::after {
    content: " (" attr(href) ")";
    font-size: smaller;
    color: #595959;
  }

  h1 { font-size: 22pt; }
  h2 { font-size: 14pt; page-break-after: avoid; break-after: avoid; }
  h3 { font-size: 12pt; page-break-after: avoid; break-after: avoid; }

  /* Each Part starts on a new page (skip the first section — no leading blank page) */
  section.section + section.section {
    page-break-before: always;
    break-before: always;
  }

  /* Avoid breaks inside content blocks */
  .section { page-break-inside: avoid; break-inside: avoid; }
  table { page-break-inside: avoid; break-inside: avoid; }
  .callout, .formula-block { page-break-inside: avoid; break-inside: avoid; }
  img { max-width: 100%; page-break-inside: avoid; break-inside: avoid; }

  /* Keep DIM freshness footnote attached to the table above it */
  .table-wrapper + p.footnote { page-break-before: avoid; break-before: avoid; }

  .site-footer {
    position: running(footer);
    font-size: 9pt;
    color: #595959;
  }
}
