/* Printable sheets for Tonight, the Sun, the Moon and the tides (ADR 0130),
   after the Outdoors trip sheet (ADR 0088). On screen the sheet is a paper
   preview in the site's light or dark colors; printed, it is black on white
   and fits one page of Letter or A4. Sky bands are shades of the ink, so the
   same rules serve light, dark and print. */

.ps-page {
  --ps-paper: var(--surface);
  --ps-ink: var(--text);
  --ps-muted: var(--muted);
  --ps-rule: var(--line);
  --ps-day: var(--ps-paper);
  --ps-civil: color-mix(in srgb, var(--ps-ink) 6%, var(--ps-paper));
  --ps-nautical: color-mix(in srgb, var(--ps-ink) 11%, var(--ps-paper));
  --ps-astro: color-mix(in srgb, var(--ps-ink) 16%, var(--ps-paper));
  --ps-night: color-mix(in srgb, var(--ps-ink) 22%, var(--ps-paper));
  --ps-shade: color-mix(in srgb, var(--ps-ink) 5%, var(--ps-paper));
}

/* ---- On screen: what the sheet is, and Print ---- */
.ps-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 24px;
  margin: 0 auto 16px;
  max-width: 860px;
}
.ps-intro-text { flex: 1 1 380px; min-width: 0; }
.ps-eyebrow {
  margin: 0 0 4px;
  color: var(--accent-sun);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ps-intro h1 { margin: 0 0 6px; font-size: clamp(1.5rem, 4vw, 2.1rem); line-height: 1.1; }
.ps-lead { margin: 0; color: var(--muted); font-size: 0.96rem; max-width: 60ch; line-height: 1.5; }
.ps-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: none; }
.ps-print {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--accent-moon);
  border-radius: 12px;
  background: var(--accent-moon);
  color: var(--surface);
  font: inherit;
  font-size: 0.96rem;
  font-weight: 650;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.ps-print:hover { filter: brightness(1.08); }
.ps-print:focus-visible { outline: 2px solid var(--accent-moon); outline-offset: 2px; }
.ps-print svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ps-hint { color: var(--muted); font-size: 0.78rem; text-align: end; }
.ps-others { margin: 0; font-size: 0.82rem; color: var(--muted); }
.ps-others a { color: var(--accent-moon); }

/* ---- The sheet ---- */
.ps-sheet {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 30px 20px;
  background: var(--ps-paper);
  color: var(--ps-ink);
  border: 1px solid var(--ps-rule);
  border-radius: 6px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 1rem;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}
.ps-sheet h2, .ps-sheet h3 { color: var(--ps-ink); }
.ps-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px 24px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ps-ink);
}
.ps-kicker { margin: 0; font-size: 0.72em; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ps-muted); }
.ps-head h2 { margin: 2px 0 0; font-size: 1.45em; line-height: 1.15; }
.ps-date { margin: 2px 0 0; font-weight: 600; }
.ps-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; font-size: 0.78em; }
.ps-meta div { display: flex; flex-direction: column; }
.ps-meta dt { color: var(--ps-muted); font-size: 0.68em; text-transform: uppercase; letter-spacing: 0.06em; }
.ps-meta dd { margin: 0; font-weight: 600; }

.ps-sec h3 {
  margin: 0 0 5px;
  font-size: 0.74em;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ps-note { margin: 4px 0 0; font-size: 0.74em; color: var(--ps-muted); }

/* Key facts across the top: big times. */
.ps-keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0; border: 1px solid var(--ps-rule); border-radius: 4px; }
.ps-key { padding: 7px 10px; border-inline-start: 1px solid var(--ps-rule); }
.ps-key:first-child { border-inline-start: 0; }
.ps-key dt { font-size: 0.68em; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ps-muted); }
.ps-key dd { margin: 1px 0 0; font-size: 1.15em; font-weight: 700; line-height: 1.15; }
.ps-key dd span { display: block; font-size: 0.74em; font-weight: 500; color: var(--ps-muted); }

.ps-two { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr); gap: 16px; align-items: start; }

/* Tables. */
.ps-table { width: 100%; border-collapse: collapse; font-size: 0.8em; }
.ps-table th, .ps-table td { padding: 2px 5px; border-bottom: 1px solid var(--ps-rule); text-align: start; white-space: nowrap; }
.ps-table thead th { font-size: 0.68em; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ps-muted); border-bottom: 1.5px solid var(--ps-ink); font-weight: 700; vertical-align: bottom; }
.ps-table td.ps-num, .ps-table th.ps-num { text-align: end; }
.ps-table tr.is-chosen th, .ps-table tr.is-chosen td { background: var(--ps-shade); font-weight: 700; }
.ps-table tr.is-chosen th:first-child { box-shadow: inset 3px 0 0 var(--ps-ink); }
.ps-table tr.is-week th, .ps-table tr.is-week td { border-top: 1.5px solid var(--ps-ink); }
.ps-table .ps-sub { color: var(--ps-muted); font-weight: 400; font-size: 0.92em; }
.ps-times th { font-weight: 500; }
.ps-times td { font-weight: 700; text-align: end; }
.ps-times tr.is-key th, .ps-times tr.is-key td { font-weight: 800; border-bottom-color: var(--ps-ink); }

/* Charts: SVG drawn on the server. */
.ps-chart { display: block; width: 100%; height: auto; overflow: visible; }
.ps-chart text { fill: var(--ps-ink); font-size: 9px; font-family: inherit; }
.ps-chart .ps-tick { fill: var(--ps-muted); font-size: 8px; }
.ps-chart .ps-grid { stroke: var(--ps-rule); stroke-width: 0.5; }
.ps-chart .ps-axis { stroke: var(--ps-ink); stroke-width: 1; }
.ps-chart .ps-frame { fill: none; stroke: var(--ps-ink); stroke-width: 0.8; }
.ps-b-day { fill: var(--ps-day); }
.ps-b-civil { fill: var(--ps-civil); }
.ps-b-nautical { fill: var(--ps-nautical); }
.ps-b-astro { fill: var(--ps-astro); }
.ps-b-night { fill: var(--ps-night); }
.ps-line { fill: none; stroke: var(--ps-ink); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.ps-line.is-main { stroke-width: 2.4; }
.ps-line.is-dash { stroke-dasharray: 5 3; }
.ps-line.is-dot { stroke-dasharray: 1 3; stroke-width: 1.6; }
.ps-line.is-dashdot { stroke-dasharray: 7 3 1 3; }
.ps-line.is-long { stroke-dasharray: 10 4; }
.ps-line.is-thin { stroke-width: 0.9; }
.ps-chart .ps-label { font-size: 8.5px; font-weight: 700; paint-order: stroke; stroke: var(--ps-paper); stroke-width: 2.5px; }
.ps-chart .ps-dot { fill: var(--ps-ink); }
.ps-chart .ps-dot.is-open { fill: var(--ps-paper); stroke: var(--ps-ink); stroke-width: 1; }
.ps-legend { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 4px 0 0; padding: 0; list-style: none; font-size: 0.72em; color: var(--ps-muted); }
.ps-legend li { display: inline-flex; align-items: center; gap: 5px; }
.ps-legend svg { width: 26px; height: 8px; overflow: visible; }
.ps-swatch { display: inline-block; width: 12px; height: 9px; border: 0.5px solid var(--ps-rule); }
.ps-swatch.ps-b-day { background: var(--ps-day); }
.ps-swatch.ps-b-civil { background: var(--ps-civil); }
.ps-swatch.ps-b-nautical { background: var(--ps-nautical); }
.ps-swatch.ps-b-astro { background: var(--ps-astro); }
.ps-swatch.ps-b-night { background: var(--ps-night); }

/* Moon drawings: lit white, dark part in ink, outlined. */
.ps-moon-dark { fill: var(--ps-night); }
.ps-moon-lit { fill: var(--ps-paper); }
.ps-moon-rim { fill: none; stroke: var(--ps-ink); stroke-width: 0.8; }

/* The Moon's month as a calendar. */
.ps-cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ps-cal th { font-size: 0.68em; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ps-muted); padding: 2px 0; }
.ps-cal td { border: 1px solid var(--ps-rule); vertical-align: top; padding: 3px 4px; height: 76px; font-size: 0.72em; line-height: 1.25; }
.ps-cal td.is-out { background: transparent; border-color: transparent; }
.ps-cal td.is-chosen { box-shadow: inset 0 0 0 2px var(--ps-ink); }
.ps-cal .ps-cal-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 2px; }
.ps-cal .ps-cal-day { font-size: 0.95em; font-weight: 750; }
.ps-cal svg { width: 24px; height: 24px; flex: none; }
.ps-cal .ps-cal-pct { color: var(--ps-muted); }
.ps-cal .ps-cal-phase { font-weight: 750; }
.ps-cal .ps-cal-times { display: block; white-space: nowrap; }

/* Ruled lines to write on. */
.ps-lines { display: flex; flex-direction: column; }
.ps-lines span { display: block; height: 22px; border-bottom: 1px solid var(--ps-rule); }

.ps-boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.ps-box { border: 1px solid var(--ps-rule); border-radius: 4px; padding: 7px 10px; }
.ps-moon-box { display: flex; align-items: center; gap: 12px; }
.ps-moon-box svg { width: 58px; height: 58px; flex: none; }
.ps-moon-box p { margin: 0; }
.ps-big { font-size: 1.05em; font-weight: 750; }
.ps-list { margin: 0; padding: 0; list-style: none; font-size: 0.8em; }
.ps-list li { display: flex; justify-content: space-between; gap: 10px; white-space: nowrap; border-bottom: 1px solid var(--ps-rule); padding: 1px 0; }
.ps-list li:last-child { border-bottom: 0; }

.ps-empty { margin: 0; padding: 18px; border: 1px dashed var(--ps-rule); border-radius: 4px; text-align: center; color: var(--ps-muted); }

.ps-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 16px;
  padding-top: 6px;
  border-top: 1px solid var(--ps-ink);
  font-size: 0.68em;
  color: var(--ps-muted);
}
.ps-foot p { margin: 0; }

@media (max-width: 720px) {
  .ps-sheet { padding: 16px 12px; border-radius: 0; margin-inline: -12px; }
  .ps-two { grid-template-columns: 1fr; }
  .ps-wide { display: none; }
  .ps-cal td { height: 64px; padding: 2px; font-size: 0.62rem; }
  .ps-cal svg { display: none; }
  .ps-table-wrap { overflow-x: auto; }
}

/* ---- Printed: one page, black on white ---- */
@media print {
  @page { margin: 10mm; }

  html,
  html[data-theme="night"],
  body {
    filter: none !important;
    background: #fff !important;
    color: #000 !important;
  }
  .site-header,
  .circumstances,
  .site-footer,
  .consent,
  .language-offer,
  dialog,
  .no-print,
  main.page > :not(.ps-page) {
    display: none !important;
  }
  main.page { padding: 0 !important; margin: 0 !important; max-width: none !important; }

  .ps-page {
    --ps-paper: #fff;
    --ps-ink: #000;
    --ps-muted: #444;
    --ps-rule: #9a9a9a;
  }
  .ps-sheet {
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    gap: 3.2mm;
    font-size: 8.6pt;
    line-height: 1.3;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .ps-head h2 { font-size: 15pt; }
  .ps-key dd { font-size: 11pt; }
  .ps-key dt, .ps-meta dt, .ps-kicker, .ps-table thead th, .ps-cal th { font-size: 6.6pt; }
  .ps-two { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr) !important; }
  .ps-wide { display: table-cell !important; }
  .ps-table { font-size: 7.6pt; line-height: 1.2; }
  .ps-table th, .ps-table td { padding: 0.25mm 1.2mm; }
  .ps-cal td { height: 21mm; font-size: 7pt; padding: 0.8mm 1mm; }
  .ps-cal svg { width: 6.5mm; height: 6.5mm; }
  .ps-lines span { height: 6.5mm; }
  .ps-chart, .ps-box, .ps-cal tr, .ps-table tr { break-inside: avoid; }
  .ps-foot { font-size: 6.6pt; }
}
