/* Lambda Symbolics · Interlisp Paper stylesheet.
   Black ink on one gentle off-white substrate. No second surface color,
   no flat gray, no solid shadows, no JavaScript.
   Reference: DESIGN.md (Interlisp Paper) in the Hiisi repository. */

@font-face {
  font-family: "Times New Roman";
  src: url("fonts/times-new-roman-regular.woff2") format("woff2"),
       url("fonts/times-new-roman-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Times New Roman";
  src: url("fonts/times-new-roman-bold.woff2") format("woff2"),
       url("fonts/times-new-roman-bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Times New Roman";
  src: url("fonts/times-new-roman-italic.woff2") format("woff2"),
       url("fonts/times-new-roman-italic.ttf") format("truetype");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Times New Roman";
  src: url("fonts/times-new-roman-bold-italic.woff2") format("woff2"),
       url("fonts/times-new-roman-bold-italic.ttf") format("truetype");
  font-style: italic;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Nimbus Roman Mono";
  src: url("fonts/nimbus-roman-mono-regular.woff2") format("woff2"),
       url("fonts/nimbus-roman-mono-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Nimbus Roman Mono";
  src: url("fonts/nimbus-roman-mono-bold.woff2") format("woff2"),
       url("fonts/nimbus-roman-mono-bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Nimbus Roman Mono";
  src: url("fonts/nimbus-roman-mono-italic.woff2") format("woff2"),
       url("fonts/nimbus-roman-mono-italic.ttf") format("truetype");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Nimbus Roman Mono";
  src: url("fonts/nimbus-roman-mono-bold-italic.woff2") format("woff2"),
       url("fonts/nimbus-roman-mono-bold-italic.ttf") format("truetype");
  font-style: italic;
  font-weight: 700;
  font-display: swap;
}

:root {
  --ink:   #000000;
  --paper: #fffefa;

  /* Semantic accents: tiny flare and rare semantic controls only. */
  --accent-blue:   #003a70;
  --accent-red:    #8a1c1c;
  --accent-green:  #12633a;
  --accent-yellow: #8a6a00;

  --font-serif: "Times New Roman", Times, "Nimbus Roman No9 L", "Liberation Serif", serif;
  --font-mono:  "Nimbus Roman Mono", "Courier New", Courier, "Liberation Mono", monospace;

  --bitmap-dither: radial-gradient(var(--ink) 1px, transparent 1px);
}

* {
  box-sizing: border-box;
}

html {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.52;
  color: var(--ink);
  background: var(--paper);
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

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

/* -- Shell -- */

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding-inline: 24px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 10;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: 4px 8px;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

/* -- Letterhead header -- */

.letterhead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px 32px;
  flex-wrap: wrap;
  padding: 30px 0 16px;
}

.wordmark {
  font-size: 62px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav {
  margin: 0;
  padding: 0;
}

.site-nav-list {
  display: flex;
  gap: 8px 24px;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  font-size: 19px;
  color: var(--ink);
  text-decoration: underline;
  font-style: italic;
  font-weight: 700;
  padding-block: 4px;
}

.wordmark:hover {
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* -- Document structure -- */

h1 {
  font-size: clamp(46px, 8vw, 92px);
  line-height: 0.95;
  letter-spacing: -0.025em;
  font-weight: 700;
  margin: 0 0 28px;
}

h2 {
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-weight: 700;
  padding-bottom: 6px;
  margin: 0 0 20px;
}

h3 {
  font-size: 22px;
  line-height: 1.18;
  letter-spacing: -0.01em;
  font-weight: 700;
  margin: 40px 0 8px;
}

p,
ul,
ol {
  max-width: 68ch;
  margin: 0 0 16px;
}

ul,
ol {
  padding-left: 1.4em;
}

li {
  margin-bottom: 6px;
}

a {
  color: var(--ink);
  text-decoration: none;
  font-style: initial;
  text-underline-offset: 2px;
}

/* Nimbus Roman Mono runs optically small and loose at a given size:
   set it slightly larger than Courier would need and track it tighter. */
code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.94em;
  letter-spacing: -0.05em;
}

pre {
  letter-spacing: -0.05em;
}

.doc-section {
  margin-top: 96px;
}

.lede {
  font-size: 21px;
  line-height: 1.35;
  max-width: 56ch;
}

.motto {
  font-size: 15px;
  margin-top: 24px;
}

/* -- Two-column hero with a document specimen -- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 32px 48px;
  align-items: start;
  padding-top: 56px;
}

.hero-copy h1 {
  font-size: clamp(42px, 7vw, 72px);
}

/* -- Actions -- */

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 28px 0 16px;
}

.button {
  display: inline-block;
  font-weight: 700;
  font-size: 17px;
  line-height: 1.2;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 9px 16px;
  text-decoration: none;
}

.button:hover,
.button:focus-visible,
.button:active {
  background: var(--ink);
  color: var(--paper);
}

/* -- Fields -- */

input,
select,
textarea {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.3;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 8px 10px;
  min-height: 42px;
  width: 100%;
  accent-color: var(--ink);
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-height: 0;
}

/* Ranges and progress are fully claimed; native tracks render gray. */
input[type="range"] {
  appearance: none;
  border: 0;
  padding: 0;
  height: 24px;
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--ink);
}

input[type="range"]::-moz-range-track {
  height: 2px;
  background: var(--ink);
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 20px;
  margin-top: -9px;
  background: var(--ink);
  border: 0;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 20px;
  background: var(--ink);
  border: 0;
  border-radius: 0;
}

progress {
  appearance: none;
  height: 12px;
  border: 1px solid var(--ink);
  background: var(--paper);
}

progress::-webkit-progress-bar {
  background: var(--paper);
}

progress::-webkit-progress-value {
  background: var(--ink);
}

progress::-moz-progress-bar {
  background: var(--ink);
}

input[type="file"] {
  padding: 6px;
}

::file-selector-button {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 4px 10px;
  margin-right: 10px;
  cursor: pointer;
}

input[type="file"]:hover::file-selector-button {
  background: var(--ink);
  color: var(--paper);
}

input:disabled,
select:disabled,
textarea:disabled {
  border-style: dashed;
}

label {
  font-weight: 700;
  font-size: 15px;
}

.field {
  display: grid;
  gap: 4px;
}

.field > span {
  font-weight: 700;
  font-size: 15px;
}

.field--inline {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 400;
}

.field--switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 400;
}

.helper-note {
  font-size: 14px;
  margin: 2px 0 0;
}

.field--error input,
.field--error select,
.field--error textarea {
  border: 1px solid var(--accent-red);
}

.error-note {
  font-size: 14px;
  margin: 2px 0 0;
}

.error-note::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  background: var(--accent-red);
}

/* -- Switch: a checkbox wearing its state.
   Square knob, no pill; on = track and knob invert together. -- */

input[type="checkbox"].switch {
  appearance: none;
  position: relative;
  width: 46px;
  height: 24px;
  min-height: 0;
  padding: 0;
  flex: 0 0 auto;
  cursor: pointer;
}

input[type="checkbox"].switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--ink);
}

input[type="checkbox"].switch:checked {
  background: var(--ink);
}

input[type="checkbox"].switch:checked::before {
  left: auto;
  right: 3px;
  background: var(--paper);
}

/* Disabled keeps position as the state signal: dashed track, dithered knob. */
input[type="checkbox"].switch:disabled {
  cursor: default;
  border-style: dashed;
  background: var(--paper);
}

input[type="checkbox"].switch:disabled::before {
  background: var(--paper);
  background-image: var(--bitmap-dither);
  background-size: 3px 3px;
}

/* -- Catalogue entries -- */

.product {
  max-width: 68ch;
}

.product-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

.product-head h3 {
  margin: 0;
}

.product-head a {
  font-size: 15px;
  text-decoration: underline;
  font-style: italic;
}

.entry,
.entry-head {
  max-width: 68ch;
}

.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

.entry-head h3 {
  margin: 0;
}

.entry-head a {
  font-size: 15px;
  text-decoration: underline;
  font-style: italic;
}

.service-link {
  font-size: 15px;
  text-decoration: underline;
  font-style: italic;
}

.property-sheet a {
  text-decoration: underline;
  font-style: italic;
}

.product p,
.entry p {
  margin-top: 8px;
}

/* -- Window and property sheet -- */

.window {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--ink);
  max-width: 620px;
}

.window::after {
  content: "";
  position: absolute;
  inset: 15px -15px -15px 15px;
  background-image: var(--bitmap-dither);
  background-size: 3px 3px;
  z-index: -1;
}

.window-titlebar {
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.15;
  min-height: 26px;
  display: flex;
  align-items: center;
  padding: 5px 8px;
}

.window-body {
  padding: 12px 14px;
}

.property-sheet {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 16px;
  border: 1px solid var(--ink);
  padding: 12px 16px;
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.38;
}

.property-sheet dt {
  font-weight: 700;
}

.property-sheet dd {
  margin: 0;
}

.window .property-sheet {
  border: 0;
  padding: 0;
  margin: 0;
}

/* -- Tables -- */

table {
  border-collapse: collapse;
  width: 100%;
  max-width: 880px;
  font-size: 15px;
  line-height: 1.38;
  margin: 0 0 16px;
}

caption {
  text-align: left;
  font-size: 13px;
  letter-spacing: 0.015em;
  padding-bottom: 6px;
}

th,
td {
  border: 1px solid var(--ink);
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  font-weight: 700;
}

/* -- Two-column groups -- */

.duo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 32px 48px;
  align-items: start;
  max-width: 1180px;
}

.duo h3 {
  margin-top: 0;
}

/* -- Syllabus -- */

.syllabus {
  max-width: 1180px;
  columns: 2 340px;
  column-gap: 48px;
}

.syllabus li {
  break-inside: avoid;
  margin-bottom: 12px;
}

/* -- Colophon footer -- */

.colophon {
  display: flex;
  justify-content: space-between;
  gap: 8px 24px;
  flex-wrap: wrap;
  margin-top: 128px;
  padding: 12px 0 48px;
}

.colophon p {
  margin: 0;
  font-size: 18px;
  font-style: italic;
  letter-spacing: 0.015em;
}

/* -- Small screens -- */

@media (max-width: 880px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 32px;
  }

  .doc-section {
    margin-top: 72px;
  }

  .colophon {
    margin-top: 96px;
  }

  .site-nav a {
    padding-block: 8px;
  }
}

@media (max-width: 480px) {
  .shell {
    padding-inline: 20px;
  }

  .property-sheet {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .property-sheet dd {
    margin-bottom: 8px;
  }
}

/* -- Print -- */

@media print {
  .skip-link,
  .site-nav {
    display: none;
  }

  .window::after {
    display: none;
  }

  .doc-section {
    margin-top: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
