/* ==========================================================================
   Yeats's Vision — site stylesheet
   One shared file for every page. Conventions are documented in STYLE-GUIDE.md.
   Change colours and fonts in the :root block below; nothing else needs touching.
   ========================================================================== */

:root {
  /* palette: moonlit indigo, parchment paper, lunar gold */
  --paper:       #fbf9f4;
  --paper-2:     #f3efe4;   /* panels, table stripes */
  --ink:         #26231f;
  --ink-soft:    #5f584d;
  --rule:        #d9d0bc;
  --indigo:      #2b2f6b;
  --indigo-deep: #1b1e47;
  --gold:        #b8892f;
  --link:        #34408f;
  --link-visited:#6b3f7c;
  --red:         #a3301f;
  --blue:        #2a4fa0;
  --green:       #2f6f3e;

  --shade-light: #f0eadb;
  --shade-mid:   #ded5bf;
  --shade-dark:  #4a4660;

  --serif: Charter, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono:  ui-monospace, "SFMono-Regular", Menlo, Consolas, "Courier New", monospace;

  --measure: 46rem;     /* comfortable line length for prose */
  --page:    64rem;     /* widest content column */
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:       #17181f;
    --paper-2:     #20222c;
    --ink:         #e8e4d8;
    --ink-soft:    #a9a595;
    --rule:        #3a3c4a;
    --indigo:      #8b93e0;
    --indigo-deep: #0f1020;
    --gold:        #d7aa52;
    --link:        #9fa8f0;
    --link-visited:#c9a0dc;
    --red:         #ff8a78;
    --blue:        #8fb0ff;
    --green:       #7fd08f;
    --shade-light: #23252f;
    --shade-mid:   #2c2f3c;
    --shade-dark:  #4a4660;
  }
  img { background: #fff; }   /* the diagrams are drawn for a white page */
}

/* ---------- base ---------- */

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.125rem/1.65 var(--serif);
  border-top: 5px solid var(--tint, var(--indigo));
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: var(--page);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

/* ---------- site header ---------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .25rem 1.5rem;
  padding: .7rem 1.25rem;
  background: var(--indigo-deep);
  color: #f3efe4;
  font-family: var(--sans);
  font-size: .9rem;
}
.site-header a { color: inherit; text-decoration: none; }
.site-header .site-title { font-family: var(--serif); font-size: 1.05rem; letter-spacing: .01em; }
.site-header nav { display: flex; gap: 1.25rem; }
.site-header nav a { opacity: .85; }
.site-header a:hover, .site-header a:focus-visible { opacity: 1; text-decoration: underline; text-underline-offset: .2em; }

/* ---------- headings ---------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.25;
  margin: 1.8em 0 .5em;
  text-wrap: balance;
}
h1 { font-size: 2.1rem; text-align: center; margin: .6em 0 .4em; }
h1::after {
  content: "";
  display: block;
  width: 4.5rem;
  height: 3px;
  margin: .55em auto 0;
  background: var(--gold);
  border-radius: 2px;
}
h2 { font-size: 1.6rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.15rem; }
h5 { font-size: 1rem; }
h6 { font-size: .9rem; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); }

/* ---------- text ---------- */

p, ul, ol, dl, blockquote { margin: 0 0 1em; }
p, li, dd, blockquote { max-width: var(--measure); }
td p, th p, td li, th li, td dd, td blockquote { max-width: none; }

ul, ol { padding-left: 1.5rem; }
li { margin-bottom: .25em; }
dt { font-weight: 700; margin-top: .75em; }
dd { margin-left: 1.5rem; }

blockquote {
  margin: 1.25em 0 1.25em 0;
  padding: .1em 0 .1em 1.1rem;
  border-left: 3px solid var(--gold);
  color: var(--ink-soft);
}

h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { text-decoration: none; }
h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover { text-decoration: underline; }

a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:visited { color: var(--link-visited); }
a:hover, a:focus-visible { text-decoration-thickness: 2px; }

strong { font-weight: 700; }
small, .small  { font-size: .85em; }
.xsmall        { font-size: .75em; }
.large         { font-size: 1.2em; }
.xlarge        { font-size: 1.45em; }
sub, sup { line-height: 0; }
del, s { color: var(--ink-soft); text-decoration-thickness: 1px; }
.mono { font-family: var(--mono); font-size: .92em; }

hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
hr.short { width: 33%; min-width: 6rem; margin-left: auto; margin-right: auto; }

/* ---------- images ---------- */

img { max-width: 100%; height: auto; vertical-align: middle; }
img.mapped { max-width: none; height: auto; }   /* image maps must keep their natural size */
.map-wrap { overflow-x: auto; max-width: 100%; }
img.float-left  { float: left;  margin: .25rem 1.25rem .75rem 0; }
img.float-right { float: right; margin: .25rem 0 .75rem 1.25rem; }

/* ---------- utilities (replace the old align= / valign= / <font color> attributes) ---------- */

.center { text-align: center; }
.right  { text-align: right; }
.left   { text-align: left; }
.top    { vertical-align: top; }
.middle { vertical-align: middle; }
.bottom { vertical-align: bottom; }
.nowrap { white-space: nowrap; }
table.center { margin-left: auto; margin-right: auto; }
table.float-left  { float: left;  margin-right: 1.25rem; }
table.float-right { float: right; margin-left: 1.25rem; }
div.center, p.center, blockquote.center { max-width: none; }

.c-red    { color: var(--red); }
.c-blue   { color: var(--blue); }
.c-green  { color: var(--green); }
.c-muted  { color: var(--ink-soft); }
.c-light  { color: #f6f1e4; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; max-width: 100%; margin: 0 0 1.25rem; }

table { border-collapse: collapse; border-spacing: 0; }
td, th { padding: .3rem .6rem; vertical-align: middle; text-align: left; }
th { font-weight: 700; }

/* real data tables (they had border="1") */
table.grid { font-size: .95rem; }
table.grid td, table.grid th { border: 1px solid var(--rule); }
table.grid th { background: var(--shade-light); }

/* tables that were only used for page layout */
table.layout td, table.layout th { padding: .25rem .5rem; vertical-align: top; }

/* a single-cell table that was used as a framed or tinted box */
.box {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: .9rem 1.2rem;
  margin: 1.25rem 0;
}

/* cell shading: the old bgcolor= values collapsed to a few shades */
.shade-light { background: var(--shade-light); }
.shade-mid   { background: var(--shade-mid); }
.shade-dark  { background: var(--shade-dark); color: #fff; }
.shade-dark a, .shade-dark a:visited { color: #ffe9a8; }
.tint        { background: color-mix(in srgb, var(--tint, #ccc) 38%, var(--paper)); }
.tint-dark   { background: var(--tint, var(--shade-dark)); color: #fff; }
.tint-dark a, .tint-dark a:visited { color: #ffe9a8; }

/* ---------- forms (Numerology, Buy, Reviews, Yeats) ---------- */

input, select, textarea, button { font: inherit; }
input[type="text"], textarea, select { padding: .25rem .4rem; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); color: var(--ink); }
input[type="submit"], input[type="button"], input[type="reset"], button {
  padding: .3rem .9rem; border: 1px solid var(--indigo); border-radius: 4px;
  background: var(--indigo); color: var(--paper); cursor: pointer;
}

/* ---------- pages shown inside a frame/iframe (side lists, strips) ---------- */

body.embedded { font-size: 1rem; line-height: 1.5; }
body.embedded main { padding: .75rem 1rem 1.5rem; }
body.embedded h5, body.embedded h4 { margin: .6em 0; font-size: 1rem; }

/* ---------- pages that used to be framesets ---------- */

body.frames { height: 100vh; overflow: hidden; border-top: 0; }
.frameset { display: grid; grid-template-columns: var(--side, 11rem) 1fr; height: 100vh; }
.frameset iframe { width: 100%; height: 100%; border: 0; }
.frameset iframe:first-child { border-right: 1px solid var(--rule); background: var(--paper-2); }
@media (max-width: 40rem) {
  .frameset { grid-template-columns: 1fr; grid-template-rows: 35vh 1fr; }
  .frameset iframe:first-child { border-right: 0; border-bottom: 1px solid var(--rule); }
}

/* ---------- small screens & print ---------- */

@media (max-width: 40rem) {
  body { font-size: 1.0625rem; }
  h1 { font-size: 1.7rem; }
  main { padding: 1rem .9rem 3rem; }
  img.float-left, img.float-right, table.float-left, table.float-right { float: none; display: block; margin: .5rem auto; }
}

@media print {
  :root { --paper: #fff; --ink: #000; --ink-soft: #333; --link: #000; --link-visited: #000; }
  body { font-size: 11pt; border-top: 0; }
  .site-header { display: none; }
  main { max-width: none; padding: 0; }
  a { text-decoration: none; }
  .table-wrap, .map-wrap { overflow: visible; }
  .shade-dark, .tint-dark { background: #ccc; color: #000; }
}
