/*
 * intent — "newspaper" design language (docs/history/architecture-rev5.md 6.2).
 * Paper ground, ink text, one oxblood accent for rules and links. Flat by
 * design: no drop shading, blends or curved corners anywhere.
 */

@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/playfair-display-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/playfair-display-latin-700-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/source-serif-4-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/source-serif-4-latin-400-italic.woff2") format("woff2");
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/source-serif-4-latin-600-normal.woff2") format("woff2");
}

:root {
  --paper: #faf7f0;
  --ink: #1a1a1a;
  --oxblood: #7b2d26;
  --measure: 68ch;
  --masthead: "Playfair Display", Georgia, serif;
  --body: "Source Serif 4", Georgia, serif;
  color-scheme: light;
}

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

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 100%;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--paper);
  color: var(--ink);
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--ink);
}

.skip-link:focus {
  top: 1rem;
}

.masthead {
  width: 100%;
  max-width: calc(var(--measure) + 4rem);
  margin: 0 auto;
  padding: 1.5rem 1rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  border-bottom: 3px double var(--oxblood);
}

.masthead__title {
  margin: 0 0 0.5rem;
  font-family: var(--masthead);
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 3rem);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.04em;
  line-height: 1;
}

a {
  color: var(--oxblood);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

.masthead__title a {
  color: inherit;
  text-decoration: none;
}

main {
  flex: 1;
  width: 100%;
  max-width: calc(var(--measure) + 4rem);
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.deck {
  margin: 0 0 1rem;
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.875rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.12em;
  border-bottom: 1px solid var(--oxblood);
}

h1,
h2 {
  font-family: var(--masthead);
  font-weight: 400;
  line-height: 1.2;
}

h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin: 0 0 1rem;
}

p {
  max-width: var(--measure);
  margin: 0 0 1rem;
}

.dateline,
.count {
  font-variant-numeric: oldstyle-nums tabular-nums;
}

.dateline {
  font-style: italic;
}

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

form {
  max-width: var(--measure);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

label {
  font-weight: 600;
}

.hint {
  font-size: 0.875rem;
  font-style: italic;
  margin: 0;
}

input[type="password"],
input[type="text"],
textarea {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 0;
  padding: 0.5rem;
  width: 100%;
  max-width: 32rem;
}

fieldset {
  border: 1px solid var(--ink);
  margin: 0 0 1rem;
  padding: 0.5rem 0.75rem;
}

legend {
  font-weight: 600;
}

.choice {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--oxblood);
  border-width: 2px;
}

/* Buttons read as underlined typographic links, per the design language. */
button,
.button-link {
  font: inherit;
  font-weight: 600;
  color: var(--oxblood);
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0.25rem 0;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: pointer;
  min-height: 44px;
}

button:disabled,
button[aria-busy="true"] {
  color: var(--ink);
  cursor: progress;
  text-decoration-style: dotted;
}

.alert {
  max-width: var(--measure);
  margin: 0 0 1rem;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--oxblood);
  color: var(--oxblood);
  font-weight: 600;
}

.status {
  min-height: 1.5em;
  font-style: italic;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.colophon {
  width: 100%;
  max-width: calc(var(--measure) + 4rem);
  margin: 0 auto;
  padding: 0.75rem 1rem 1.5rem;
  border-top: 1px solid var(--oxblood);
  font-size: 0.875rem;
}

.inline-form {
  display: inline;
}

/*
 * Project DAG (/projects/graph). Edge kinds differ by stroke pattern and
 * marker, never color alone; the legend samples share the edge styles.
 *
 * Scaling (dashboard-dag.md §3.4): the SVG's width/height attributes are its
 * 1:1 size and max-width shrinks it (aspect kept via the view box) to the
 * page measure. The canvas's min-content width is the .dag-floor strut, 3/4
 * of the view-box width, so below that scale the canvas stops shrinking and
 * the figure frame scrolls instead; the document itself never scrolls.
 */
.dag-figure {
  margin: 0 0 2rem;
  overflow-x: auto;
}

.dag-canvas {
  min-width: min-content;
}

.dag-floor {
  display: block;
}

.dag {
  display: block;
  max-width: 100%;
  height: auto;
  font-family: var(--body);
}

.dag-group {
  fill: #f0ebdf;
  stroke: var(--ink);
  stroke-width: 0.5;
}

.dag-group__label {
  fill: var(--ink);
  font-family: var(--masthead);
  font-weight: 700;
}

.dag-edge,
.dag-sample {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
}

.dag-edge--blocks,
.dag-sample--blocks {
  stroke-dasharray: 6 4;
}

.dag-edge--follows-from,
.dag-sample--follows-from {
  stroke-dasharray: 1.5 3;
  stroke-linecap: round;
}

.dag-arrow {
  fill: var(--ink);
}

.dag-node rect {
  fill: var(--paper);
  stroke: var(--oxblood);
  stroke-width: 1.5;
}

.dag-node text {
  fill: var(--ink);
}

/* Context (collaborator) styling precedes the hover/focus rules: biome's
   noDescendingSpecificity requires ascending selector specificity. */
.dag-node--context rect {
  fill: #e6e3dc;
  stroke: #767676;
  stroke-dasharray: 3 2;
}

.dag-node--context text {
  fill: #4d4d4d;
  font-style: italic;
}

.dag-node:hover rect,
.dag-node:focus rect {
  stroke-width: 3;
}

.dag-node:focus {
  outline: none;
}

.dag-node:focus-visible rect {
  stroke: var(--ink);
  stroke-width: 3;
  stroke-dasharray: 4 2;
}

.dag-legend__defs {
  position: absolute;
}

.dag-legend__list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1rem;
  max-width: var(--measure);
}

.dag-legend__list dt {
  font-weight: 600;
}

.dag-legend__list dd {
  margin: 0;
}

.dag-legend__sample {
  vertical-align: middle;
}

.dag-text__tasks > li {
  margin-bottom: 1rem;
}

.dag-text__edges {
  margin: 0.25rem 0;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none;
    animation: none;
  }
}
