/* mateus — profile page.
   Text first, like an essay index. Ink on paper: dither, dot grids, registration marks,
   dotted rules and a few cyan and magenta pixels. */

:root {
  --paper: #f4f2ec;
  --ink: #0e0e0e;
  --ink-2: #2a2a2a;
  --muted: #555555;
  --faint: #6a6a6a;
  --cyan: #00b4d8;
  --magenta: #e6007e;
  --magenta-text: #b0005f;

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --black: "UnifrakturMaguntia", "Newsreader", serif;

  --measure: 1120px;
  --text: 760px;
  --gutter: clamp(16px, 4vw, 40px);

  /* marks, drawn once and reused */
  --cross: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15'%3E%3Cpath d='M0 7.5h15M7.5 0v15' stroke='%230e0e0e' stroke-width='1.2'/%3E%3C/svg%3E");
  --cluster: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='176' height='24' viewBox='0 0 176 24'%3E%3Cg fill='%230e0e0e'%3E%3Crect x='0' y='4' width='3' height='16'/%3E%3Crect x='6' y='4' width='7' height='16'/%3E%3Crect x='16' y='4' width='2' height='16'/%3E%3Crect x='21' y='4' width='4' height='16'/%3E%3Crect x='28' y='4' width='2' height='16'/%3E%3Ccircle cx='42' cy='6' r='1.3'/%3E%3Ccircle cx='48' cy='6' r='1.3'/%3E%3Ccircle cx='54' cy='6' r='1.3'/%3E%3Ccircle cx='42' cy='12' r='1.3'/%3E%3Ccircle cx='48' cy='12' r='1.3'/%3E%3Ccircle cx='54' cy='12' r='1.3'/%3E%3Ccircle cx='42' cy='18' r='1.3'/%3E%3Ccircle cx='48' cy='18' r='1.3'/%3E%3Ccircle cx='54' cy='18' r='1.3'/%3E%3Cpath d='M78 3a9 9 0 0 0 0 18z'/%3E%3C/g%3E%3Ccircle cx='78' cy='12' r='9' fill='none' stroke='%230e0e0e' stroke-width='1.4'/%3E%3Cpath d='M96 12h18M105 3v18' stroke='%230e0e0e' stroke-width='1.4'/%3E%3Ccircle cx='105' cy='12' r='4' fill='none' stroke='%230e0e0e' stroke-width='1.4'/%3E%3Crect x='126' y='8' width='8' height='8' fill='%2300b4d8'/%3E%3Crect x='136' y='8' width='8' height='8' fill='%23e6007e'/%3E%3Crect x='152' y='8' width='8' height='8' fill='%230e0e0e'/%3E%3Crect x='164.5' y='8.5' width='7' height='7' fill='none' stroke='%230e0e0e'/%3E%3C/svg%3E");
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

html { -webkit-text-size-adjust: 100%; background: var(--paper); }

body {
  margin: 0;
  background: var(--grain) 0 0 / 180px 180px repeat var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.55;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}
a:hover { color: var(--magenta-text); text-decoration-style: solid; }
a:focus-visible,
button:focus-visible,
canvas:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.mono {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  line-height: 1.7;
  color: var(--muted);
}

/* ---------- top bar ---------- */
/* Both labels sit on the left: on HF the Space's mini header floats top-right. */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 28px;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 18px var(--gutter) 18px calc(var(--gutter) + 26px);
  border-bottom: 1px dotted var(--ink);
  background: var(--cross) var(--gutter) center / 15px 15px no-repeat;
}
.topbar .mono:first-child { color: var(--ink); }

/* ---------- hero ---------- */

.hero { margin: 0 auto; max-width: 1440px; }
.hero img {
  width: 100%;
  aspect-ratio: 3 / 1;
  object-fit: cover;
  object-position: 50% 50%;
}

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- opening ---------- */

.opening {
  max-width: var(--text);
  padding: clamp(36px, 6vw, 72px) 0 clamp(40px, 6vw, 64px);
}
.opening h1 {
  margin: 0 0 clamp(20px, 3vw, 32px);
  font-weight: 400;
  font-size: clamp(56px, 9vw, 104px);
  line-height: 1;
  letter-spacing: -0.02em;
}
.g-black { font-family: var(--black); font-weight: 400; letter-spacing: 0; }
.g-ital { font-style: italic; font-weight: 600; }
.g-mono {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.62em;
  letter-spacing: -0.04em;
  vertical-align: 0.18em;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.16em;
  margin: 0 0.04em;
}
.lede {
  margin: 0;
  font-weight: 300;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.3;
  letter-spacing: -0.005em;
  text-wrap: pretty;
}
.turn {
  margin: 18px 0 0;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(22px, 2.6vw, 28px);
  line-height: 1.3;
}
.turn::before {
  content: "";
  display: inline-block;
  width: 0.42em;
  height: 0.42em;
  margin-right: 1.05em;
  vertical-align: 0.12em;
  background: var(--magenta);
  box-shadow: 0.52em 0 0 var(--cyan);
}
.links {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
}
.links a { color: var(--ink); }

/* ---------- definition ---------- */

.definition {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 12px 36px;
  padding: 30px 26px;
  border: 1px dashed var(--ink);
  background:
    var(--cross) -7px -7px / 15px 15px no-repeat,
    var(--cross) calc(100% + 7px) -7px / 15px 15px no-repeat,
    var(--cross) -7px calc(100% + 7px) / 15px 15px no-repeat,
    var(--cross) calc(100% + 7px) calc(100% + 7px) / 15px 15px no-repeat;
  overflow: visible;
}
.definition__term { margin: 0; }
.definition__term dfn {
  display: block;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.1;
}
.definition__term .mono { display: block; margin-top: 6px; letter-spacing: 0.04em; }
.definition__body p { margin: 0; font-size: 20px; line-height: 1.45; }
.definition__body .definition__note { margin-top: 12px; font-size: 17px; color: var(--muted); }

/* ---------- noise ---------- */

.noise { margin: clamp(40px, 6vw, 64px) 0 0; }
.noise canvas {
  display: block;
  width: 100%;
  height: clamp(240px, 34vw, 400px);
  border: 1px dotted var(--ink);
  cursor: crosshair;
}
.noise figcaption { margin-top: 14px; }
.noise__caption {
  margin: 0;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(19px, 2.2vw, 22px);
}
.noise__meta {
  margin: 6px 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 24px;
}
.noise__meta button {
  font: inherit;
  letter-spacing: inherit;
  color: var(--ink);
  background: none;
  border: 1px solid var(--ink);
  padding: 1px 8px;
  cursor: pointer;
}
.noise__meta button:hover { background: var(--ink); color: var(--paper); }

/* ---------- section heads ---------- */

.section-head {
  position: relative;
  margin-top: clamp(72px, 10vw, 112px);
  padding: 0 200px 16px 0;
  border-bottom: 1px dotted var(--ink);
}
.section-head::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 14px;
  width: 176px;
  height: 24px;
  background: var(--cluster) right center / 176px 24px no-repeat;
}
.section-head h2 {
  margin: 0;
  font-weight: 400;
  font-size: clamp(30px, 3.6vw, 42px);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.section-head__sub {
  margin: 10px 0 0;
  max-width: 52ch;
  color: var(--muted);
  font-size: 17px;
}

/* ---------- essays ---------- */

.essays .section-head { max-width: 880px; }

.essay-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 880px;
}
.essay-list li {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  padding: 22px 0 24px;
  border-bottom: 1px dotted var(--ink);
}
.essay-list__num { color: var(--magenta-text); padding-top: 9px; }
.essay-list__num::before { content: "["; }
.essay-list__num::after { content: "]"; }
.essay-list h3 {
  margin: 0;
  font-weight: 400;
  font-size: clamp(23px, 2.6vw, 28px);
  line-height: 1.2;
  letter-spacing: -0.005em;
}
.essay-list p {
  margin: 6px 0 0;
  max-width: 58ch;
  color: var(--ink-2);
  font-size: 18px;
  line-height: 1.5;
}

/* ---------- building ---------- */

.build-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(24px, 4vw, 48px);
}
.build-list li {
  display: grid;
  grid-template-columns: 144px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 22px 0;
  border-bottom: 1px dotted var(--ink);
}
.build-list img {
  width: 144px;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border: 1px solid var(--ink);
  padding: 3px;
  background: var(--paper);
}
.build-list h3 {
  margin: 0 0 4px;
  font-weight: 500;
  font-size: 20px;
  line-height: 1.25;
}
.build-list h3 a { text-decoration-color: transparent; }
.build-list h3 a:hover { text-decoration-color: currentColor; }
.build-list p {
  margin: 0 0 8px;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.45;
}

.private {
  text-align: right;
  margin: 16px 0 0;
  color: var(--faint);
}

/* ---------- coda ---------- */

.coda {
  position: relative;
  max-width: var(--measure);
  margin: clamp(80px, 10vw, 128px) auto 0;
  padding: 40px var(--gutter) 56px;
  border-top: 1px dotted var(--ink);
  text-align: center;
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
}
.coda::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -12px;
  width: 176px;
  height: 24px;
  transform: translateX(-50%);
  background: var(--paper) var(--cluster) center / 176px 24px no-repeat;
  padding: 0 12px;
}
.coda p { margin: 0; }
.coda span { margin-left: 0.6em; }

/* ---------- smaller screens ---------- */

@media (max-width: 860px) {
  .build-list { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  body { font-size: 17px; }
  .topbar__axes { display: none; }
  .hero img { aspect-ratio: 16 / 9; }
  .definition { grid-template-columns: 1fr; padding: 24px 18px; }
  .section-head { padding-right: 0; padding-bottom: 44px; }
  .section-head::after { left: 0; right: auto; bottom: 12px; background-position: left center; }
  .essay-list li { grid-template-columns: 48px minmax(0, 1fr); }
  .build-list li { grid-template-columns: 104px minmax(0, 1fr); gap: 14px; }
  .build-list img { width: 104px; }
  .private { text-align: left; }
  .coda span { display: block; margin-left: 0; }
}

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