/* =============================================================
   DESIGN TOKENS
   ============================================================= */
:root {
  /* Colors */
  --c-ink:        #000000;
  --c-paper:      #ffffff;
  --c-ivory:      #fffff0;
  --c-beige:      #f5f5dc;
  --c-blue:       #2056d4;
  --c-paper-line: rgba(80, 130, 210, 0.28);

  /* Functional roles */
  --c-mark:       var(--c-beige);

  /* Type families */
  --ff-body: "Geneva", "Lucida Grande", "Helvetica Neue", sans-serif;
  --ff-mono: "Monaco", "Menlo", "Courier New", monospace;

  /* Type scale */
  --fs-h1:   24px;
  --fs-h2:   14px;
  --fs-h3:   12px;
  --fs-body: 12px;
  --fs-sm:   11px;

  /* Line heights — System 7 windows ran tight; 1.35 reads period
     without being illegible at modern rendering scale */
  --lh-body: 1.35;

  /* Tracking */
  --tr-soft: 0.06em;

  /* Geometry */
  --rule:           1px solid var(--c-ink);
  --shadow-hard:    2px 2px 0 rgba(0, 0, 0, 0.6);
  --shadow-hard-sm: 1px 1px 0 rgba(0, 0, 0, 0.5);
  --grid-step:      20px;

  /* Title-bar geometry */
  --titlebar-h:     19px;

  /* Spacing scale (2-based) — pulled in to match classic window density */
  --sp-1:  2px;
  --sp-2:  6px;
  --sp-3:  10px;
  --sp-4:  14px;
  --sp-5:  18px;
  --sp-6:  24px;
  --sp-7:  36px;
}

/* =============================================================
   RESET (minimal)
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
}
img, picture, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}
button, input, textarea, select { font: inherit; color: inherit; }

/* =============================================================
   BASE — DOCUMENT & PAPER
   ============================================================= */
html, body {
  min-height: 100vh;
}
body {
  color: var(--c-ink);
  font-family: var(--ff-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-feature-settings: "kern" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;

  /* Quadrille paper, parallax-fixed */
  background-color: var(--c-paper);
  background-image:
    linear-gradient(to right,  var(--c-paper-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--c-paper-line) 1px, transparent 1px);
  background-size: var(--grid-step) var(--grid-step);
  background-attachment: fixed;
  background-position: top left;
  background-repeat: repeat;

  overflow-x: hidden;
  padding: var(--sp-4) var(--sp-1) var(--sp-6);
}

/* =============================================================
   TYPOGRAPHY — HEADINGS
   ============================================================= */
h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
}

/* Display heading — pulled in from 28px; System 7 didn't do big
   display type but a personal site can have a name plate */
h1 {
  font-size: var(--fs-h1);
  font-weight: bold;
  line-height: 1.1;
  margin-bottom: var(--sp-2);
}

.h-card h1 { margin-bottom: var(--sp-1); }

/* Section labels */
h2 {
  font-size: var(--fs-h2);
  font-weight: bold;
  margin: var(--sp-4) 0 var(--sp-2);
}

h3 {
  font-size: var(--fs-h3);
  font-weight: bold;
  margin: var(--sp-3) 0 var(--sp-1);
}

h4, h5, h6 {
  font-size: var(--fs-body);
  font-weight: bold;
  margin: var(--sp-2) 0 var(--sp-1);
}

/* =============================================================
   TYPOGRAPHY — BODY
   ============================================================= */
p {
  margin: 0 0 var(--sp-2);
  text-wrap: pretty;
  hyphens: auto;
}
p:last-child { margin-bottom: 0; }

small { font-size: var(--fs-sm); }
em, cite, var, dfn { font-style: italic; }
strong, b { font-weight: bold; }
sub, sup { font-size: 0.75em; line-height: 0; }

abbr[title] {
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  cursor: help;
}

mark {
  background: var(--c-mark);
  color: var(--c-ink);
  padding: 0 var(--sp-1);
}

blockquote {
  margin: var(--sp-3) 0;
  padding-left: var(--sp-3);
  border-left: 3px solid var(--c-ink);
  font-style: italic;
}

hr {
  border: 0;
  border-top: 2px solid var(--c-ink);
  margin: var(--sp-5) 0;
}

address { font-style: normal; }

/* =============================================================
   LISTS — tightened to System 7 list density
   ============================================================= */
ul, ol {
  margin: var(--sp-2) 0;
  padding-left: var(--sp-5);
}
ul { list-style: disc; }
ol { list-style: decimal; }
li { margin: 0; }                   /* System 7 lists were nearly flush */
li::marker { color: var(--c-ink); }
li > ul, li > ol { margin: 0; }

dl { margin: var(--sp-2) 0; }
dt { font-weight: bold; margin-top: var(--sp-1); }
dt:first-child { margin-top: 0; }
dd { margin: 0 0 0 var(--sp-4); }

/* =============================================================
   CODE, TIME, KBD, SAMP — yellow tag style
   ============================================================= */
code, samp, time, output {
  font-family: var(--ff-mono);
  font-size: 0.9em;
  background: var(--c-beige);
  border: var(--rule);
  padding: 0 var(--sp-1);
}

time {
  font-feature-settings: "tnum" 1, "kern";
  font-variant-numeric: tabular-nums;
}

kbd {
  font-family: var(--ff-mono);
  font-size: 0.9em;
  background: var(--c-paper);
  border: var(--rule);
  padding: 0 var(--sp-1);
  box-shadow: var(--shadow-hard-sm);
}

pre {
  font-family: var(--ff-mono);
  font-size: 0.9em;
  background: var(--c-paper);
  border: var(--rule);
  box-shadow: var(--shadow-hard);
  padding: var(--sp-3);
  overflow-x: auto;
  margin: var(--sp-3) 0;
}
pre code { background: transparent; border: 0; padding: 0; }

/* =============================================================
   TABLES
   ============================================================= */
table {
  width: 100%;
  border-collapse: collapse;
  border: var(--rule);
  margin: var(--sp-3) 0;
  font-variant-numeric: tabular-nums;
}
th, td {
  text-align: left;
  border: var(--rule);
  padding: var(--sp-1) var(--sp-2);
}
th {
  background: var(--c-beige);
  font-weight: bold;
  font-size: var(--fs-sm);
  letter-spacing: var(--tr-soft);
}
caption {
  font-size: var(--fs-sm);
  text-align: left;
  padding: var(--sp-1) 0;
}

/* =============================================================
   FIGURES
   ============================================================= */
figure {
  margin: var(--sp-3) 0;
  border: var(--rule);
  box-shadow: var(--shadow-hard);
  background: var(--c-paper);
}
figure img { width: 100%; }
figcaption {
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--fs-sm);
  border-top: var(--rule);
}

/* =============================================================
   FORMS (just in case)
   ============================================================= */
input, textarea, select {
  background: var(--c-paper);
  border: var(--rule);
  padding: var(--sp-1) var(--sp-2);
  box-shadow: var(--shadow-hard-sm);
}
button {
  background: var(--c-paper);
  border: var(--rule);
  box-shadow: var(--shadow-hard-sm);
  padding: var(--sp-1) var(--sp-3);
  font-weight: bold;
  cursor: pointer;
}
button:hover { background: var(--c-beige); }
button:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}

/* =============================================================
   LAYOUT
   ============================================================= */
main {
  position: relative;
  z-index: 1;
  margin: 0 var(--sp-1) 0 0;
}

/* =============================================================
   COMPONENT — PANEL (System 7 chrome with pinstripes)
   ============================================================= */
.panel {
  background: var(--c-paper);
  border: var(--rule);
  box-shadow: var(--shadow-hard);
  margin-bottom: var(--sp-5);
}

/* Title bar: ivory background with beige pinstripes; title left-aligned
   and sitting over an ivory "notch" so it stays legible above the
   stripes. Stripes drawn with a repeating gradient (period 3px = 1px
   beige + 2px ivory); inset 2px on the bar so the first stripe doesn't
   sit on the panel edge. */
.title-bar {
  position: relative;
  height: var(--titlebar-h);
  border-bottom: var(--rule);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  user-select: none;

  background-color: var(--c-ivory);
  background-image:
    repeating-linear-gradient(
      to bottom,
      var(--c-beige) 0,
      var(--c-beige) 1px,
      transparent 1px,
      transparent 3px
    );
  background-position: 0 2px;
  background-size: 100% calc(var(--titlebar-h) - 3px);
  background-repeat: no-repeat;
}

/* Title text sits over the stripes with an ivory notch */
.title-bar span {
  position: relative;
  z-index: 1;
  background: var(--c-ivory);
  padding: 0 var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: bold;
  line-height: 1;
}

.body {
  padding: var(--sp-4) var(--sp-5);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

.body > h1:first-child,
.body > h2:first-child,
section > h2:first-child { margin-top: 0; }

/* =============================================================
   ACCESSIBILITY
   ============================================================= */
.skip {
  position: absolute;
  top: -100px; left: 0;
  background: var(--c-ink);
  color: var(--c-paper);
  padding: var(--sp-2) var(--sp-3);
  z-index: 1000;
  border-bottom: 0;
  font-weight: bold;
}
.skip:focus { top: 0; }

:focus-visible {
  outline: 2px solid var(--c-blue);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =============================================================
   MEDIA QUERIES
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  body { background-attachment: scroll; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  body { background: none; padding: 0; color: var(--c-ink); }
  .panel {
    box-shadow: none;
    page-break-inside: avoid;
    margin-bottom: 1em;
  }
  .title-bar { background: var(--c-paper) !important; }
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
  }
  a[rel*="me"]::after,
  a[href^="#"]::after,
  a[href^="mailto:"]::after { content: ""; }
}