/* Caslon Analytics — modern overlay for archived site */
/* Transforms the legacy table layout into a clean, readable design */

/* ===== Foundation ===== */

@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,400;0,600;1,400&family=Inter:wght@400;500;600&display=swap');

:root {
  --color-bg: #f5f1eb;
  --color-surface: #ffffff;
  --color-text: #2c2c2c;
  --color-text-muted: #666666;
  --color-accent: #8b1a1a;
  --color-accent-hover: #a52a2a;
  --color-link: #1a4a7a;
  --color-link-hover: #2a6aaa;
  --color-border: #e0d8cc;
  --color-sidebar-bg: #faf8f5;
  --font-heading: 'Crimson Pro', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-width: 960px;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-lg: 0 2px 8px rgba(0,0,0,0.1), 0 8px 24px rgba(0,0,0,0.06);
}

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

html {
  background-color: var(--color-bg) !important;
  background-image: none !important;
  scroll-behavior: smooth;
}

body {
  max-width: var(--max-width) !important;
  margin: 24px auto !important;
  padding: 0 20px !important;
  background: none !important;
  background-color: transparent !important;
  background-image: none !important;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Typography ===== */

body, td, th, p, li, div, span, font, a, blockquote {
  font-family: var(--font-body) !important;
  color: var(--color-text);
}

font[size="1"] {
  font-size: 14px !important;
}

font[size="2"] {
  font-size: 15px !important;
}

font[size="3"] {
  font-size: 17px !important;
}

font[size="4"] {
  font-size: 22px !important;
  font-family: var(--font-heading) !important;
  font-weight: 600;
}

font[size="5"],
font[size="6"] {
  font-size: 26px !important;
  font-family: var(--font-heading) !important;
  font-weight: 600;
  color: var(--color-accent) !important;
}

b, strong {
  font-weight: 600;
}

td, p, div {
  line-height: 1.65;
}

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

body > br {
  display: none;
}

body > br + table,
body > table,
body > center > table {
  width: 100% !important;
  max-width: var(--max-width);
  background-color: var(--color-surface) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

/* Nested tables — make responsive */
table[width="570"],
table[width="550"],
table[width="710"],
table[width="700"],
table[width="650"],
table[width="600"] {
  width: 100% !important;
  max-width: var(--max-width);
}

table {
  border-collapse: collapse;
}

td, th {
  padding-top: 4px;
  padding-bottom: 4px;
}

/* ===== Links ===== */

a {
  color: var(--color-link) !important;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

a:hover {
  color: var(--color-link-hover) !important;
  border-bottom-color: var(--color-link-hover);
  opacity: 1;
}

a:visited {
  color: #5a4a7a !important;
}

/* Red text links (current page indicators) */
font[color="#FF0000"],
font[color="red"],
font[color="#ff0000"] {
  color: var(--color-accent) !important;
  font-weight: 600;
}

/* ===== Navigation bar ===== */

/* The pipe-separated nav: home | about | site use | ... */
td > div > font > a,
td > div > font > b > a {
  padding: 2px 0;
}

/* ===== Horizontal rules ===== */

hr {
  border: none !important;
  border-top: 1px solid var(--color-border) !important;
  margin: 16px 0 !important;
  height: 0 !important;
}

/* ===== Images ===== */

img {
  max-width: 100%;
  height: auto;
}

/* Header images — the title graphics */
img[src*="header"],
img[src*="subhead"] {
  opacity: 0.9;
}

/* The elephant logo */
img[src*="subpage.gif"],
img[src*="name.gif"] {
  border: none !important;
  outline: none !important;
}

/* Decorative red/blue box spacers — hide them */
img[src*="bbox"],
img[src*="rbox"] {
  display: none;
}

/* ===== Forms (search) ===== */

input[type="text"],
input[name="sp-q"] {
  font-family: var(--font-body) !important;
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  width: 180px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]:focus,
input[name="sp-q"]:focus {
  border-color: var(--color-link);
  box-shadow: 0 0 0 3px rgba(26, 74, 122, 0.1);
}

input[type="submit"] {
  font-family: var(--font-body) !important;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 18px;
  background: var(--color-link);
  color: #fff !important;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease;
  margin-top: 6px;
}

input[type="submit"]:hover {
  background: var(--color-link-hover);
}

/* ===== Sidebar styling ===== */

/* Sidebar cells (the narrow left column, typically ~110px) */
td[width="110"],
td[width="120"],
td[width="100"],
td[width="130"] {
  background: var(--color-sidebar-bg) !important;
  border-right: 1px solid var(--color-border) !important;
  padding: 16px 14px !important;
  vertical-align: top;
}

td[width="110"] a,
td[width="120"] a,
td[width="100"] a,
td[width="130"] a {
  display: inline-block;
  padding: 3px 0;
  font-size: 13px !important;
  line-height: 1.5;
}

/* ===== Content area ===== */

/* Main content cells */
td[valign="top"] {
  padding: 16px 20px !important;
}

/* ===== Blockquotes & indented content ===== */

blockquote {
  border-left: 3px solid var(--color-border);
  margin: 16px 0 16px 0;
  padding: 8px 16px;
  color: var(--color-text-muted);
  background: var(--color-sidebar-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ===== Lists ===== */

ul, ol {
  padding-left: 24px;
}

li {
  margin-bottom: 4px;
}

/* ===== Section markers (the red/blue squares) ===== */

img[width="10"][height="10"],
img[width="12"][height="12"] {
  display: none;
}

/* ===== Copyright footer area ===== */

font[size="1"] > br + font[size="1"],
td[bgcolor="#CCCCCC"],
td[bgcolor="#cccccc"] {
  font-size: 12px !important;
  color: var(--color-text-muted) !important;
}

/* ===== Background color overrides ===== */

/* Override all bgcolor on tables/tds/trs to white */
table[bgcolor],
td[bgcolor="#FFFFFF"],
td[bgcolor="#ffffff"],
tr[bgcolor="#FFFFFF"],
tr[bgcolor="#ffffff"] {
  background-color: transparent !important;
}

td[bgcolor="#CCCCCC"],
td[bgcolor="#cccccc"] {
  background-color: var(--color-sidebar-bg) !important;
  border-radius: var(--radius);
}

/* ===== Archive banner ===== */

body::before {
  content: "Caslon Analytics Archive";
  display: block;
  text-align: center;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 8px;
  margin-bottom: 12px;
  opacity: 0.6;
}

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

@media print {
  html {
    background: #fff !important;
  }

  body {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body::before {
    display: none;
  }

  body > br + table,
  body > table,
  body > center > table {
    box-shadow: none;
    border: none;
  }

  a {
    color: #000 !important;
    border-bottom: none;
  }

  a::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #666;
  }
}

/* ===== Responsive ===== */

@media (max-width: 768px) {
  body {
    margin: 12px auto !important;
    padding: 0 10px !important;
  }

  body::before {
    font-size: 10px;
    margin-bottom: 8px;
  }

  body > br + table,
  body > table,
  body > center > table {
    border-radius: var(--radius) !important;
  }

  /* Keep sidebar links visible but stack below header on small screens */
  td[width="110"],
  td[width="120"],
  td[width="100"],
  td[width="130"] {
    display: block !important;
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid var(--color-border) !important;
    padding: 12px 16px !important;
  }

  td[width="110"] a,
  td[width="120"] a,
  td[width="100"] a,
  td[width="130"] a {
    display: inline;
    margin-right: 12px;
  }

  td[width="110"] br,
  td[width="120"] br,
  td[width="100"] br,
  td[width="130"] br {
    display: none;
  }

  td[valign="top"] {
    padding: 12px 14px !important;
  }
}

@media (max-width: 480px) {
  font[size="4"] {
    font-size: 19px !important;
  }

  font[size="5"],
  font[size="6"] {
    font-size: 22px !important;
  }

  input[name="sp-q"] {
    width: 100%;
  }
}

/* ===== Smooth transitions ===== */

* {
  transition-property: color, background-color, border-color, box-shadow;
  transition-duration: 0.15s;
  transition-timing-function: ease;
}

/* Exclude layout properties from transitions */
img, table, td, tr, body, html {
  transition: none;
}
