/* Edible Seaweeds of the Salish Sea – print-friendly layout (updated borders for better printing) */

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

html,
body {
  margin: 0;
  padding: 0;
}

/* Base typography and colors */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12pt;
  line-height: 1.5;
  color: #111111;
  background-color: #f3f3f3;
}

/* Main page column */
.page {
  max-width: 6.5in;           /* matches requested content width */
  margin: 1.25rem auto 2rem;  /* centers the column on screen */
  padding: 1.25rem 1.5rem 1.5rem;
  background-color: #ffffff;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.08);
}

/* Headings */
h1,
h2,
h3,
h4 {
  font-weight: 600;
  color: #000000;
  margin-top: 1.2em;
  margin-bottom: 0.4em;
}

h1 {
  font-size: 1.7rem;
  margin-top: 0;
}

h2 {
  font-size: 1.25rem;
  border-bottom: 1px solid #dddddd;
  padding-bottom: 0.2rem;
}

h3 {
  font-size: 1.05rem;
}

/* Header meta text */
header {
  margin-bottom: 1rem;
}

header .subtitle {
  font-style: italic;
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

header .meta {
  font-size: 0.9em;
  color: #555555;
}

/* Table of contents */
.toc {
  border: 1px solid #bbbbbb;
  background-color: #fafafa;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.toc h2 {
  margin-top: 0;
  border-bottom: none;
}

.toc ol {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
}

/* Paragraphs and lists */
p,
ul,
ol {
  margin-top: 0.4rem;
  margin-bottom: 0.6rem;
}

ul,
ol {
  padding-left: 1.2rem;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.6rem;
  margin-bottom: 1.2rem;
}

th,
td {
  border: 1px solid #555555;  /* darker on-screen so it tends to print better */
  padding: 0.3rem 0.4rem;
  vertical-align: top;
}

th {
  background-color: #f2f2f2; /* light shading for header row */
  text-align: left;
}

tbody tr:nth-child(even) td {
  background-color: #fcfcfc; /* very light shading for readability */
}

/* Footnotes */
.footnotes {
  border-top: 1px solid #dddddd;
  margin-top: 2rem;
  padding-top: 0.75rem;
  font-size: 0.9em;
}

.footnotes ol {
  padding-left: 1.2rem;
  margin: 0.25rem 0 0;
}

.footnote-ref {
  text-decoration: none;
  font-size: 0.8em;
}

.footnote-backref {
  text-decoration: none;
  margin-left: 0.25rem;
}

/* Links */
a {
  color: #004a99;
}

a:visited {
  color: #663399;
}

a:hover,
a:focus {
  text-decoration: underline;
}

/* Footer */
footer {
  margin-top: 2rem;
  padding-top: 0.75rem;
  border-top: 1px solid #dddddd;
  font-size: 0.9em;
  color: #555555;
}

/* Section spacing */
section + section {
  margin-top: 1.6rem;
}

/* Print styles */
@page {
  size: letter portrait;
  margin: 1in; /* 1-inch margins on all sides */
}

@media print {
  body {
    background-color: #ffffff;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .page {
    max-width: 6.5in; /* main content column width */
    margin: 0 auto;
    padding: 0;
    box-shadow: none;
  }

  /* Force strong, solid table borders for print */
  table {
    border-collapse: collapse;
  }

  th,
  td {
    border: 0.75pt solid #000000;  /* heavier, pure black grid lines for printers */
  }

  .toc {
    page-break-inside: avoid;
    border: 0.75pt solid #000000;
  }

  h2 {
    page-break-after: avoid;
  }

  table {
    page-break-inside: auto;
  }

  tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  /* Show URLs after external links when printing */
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
  }

  /* Do not append for in-page anchors */
  a[href^="#"]:after {
    content: "";
  }

  /* Hide buttons and interactive controls (if any) when printing */
  .no-print,
  button,
  input,
  select,
  textarea {
    display: none !important;
  }
}
