/*
 * nandaaism — v0.1
 * A drafting-sheet design system: paper, grid, ink, one blue, one red.
 * Seeded from tinyapps. Plain CSS, no build step.
 */

/* ---------- tokens ---------- */

:root {
  --paper: #f4f1ea;
  --paper-2: #ebe7dc;
  --ink: #141414;
  --graphite: #5b5a56;
  --rule: rgba(20, 20, 20, 0.14);
  --grid: rgba(47, 91, 211, 0.07);
  --grid-major: rgba(47, 91, 211, 0.12);
  --blue: #2f5bd3;
  --blue-soft: #dfe6fb;
  --highlight: #ffe66d;
  --red: #d94f3d;

  --serif: "Instrument Serif", Georgia, serif;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1040px;

  color-scheme: light dark;
}

/* dark = blueprint */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #102448;
    --paper-2: #16305c;
    --ink: #eef2fb;
    --graphite: #a9b8d8;
    --rule: rgba(238, 242, 251, 0.18);
    --grid: rgba(238, 242, 251, 0.05);
    --grid-major: rgba(238, 242, 251, 0.1);
    --blue: #8fb0ff;
    --blue-soft: #1d3a6e;
    --highlight: rgba(143, 176, 255, 0.3);
    --red: #ff8f7d;
  }
}

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

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--blue);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 400;
}

p {
  margin: 0;
}

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

.mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.muted {
  color: var(--graphite);
}

/* ---------- sheet frame ---------- */

.sheet {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  min-height: 100vh;
  background: color-mix(in srgb, var(--paper) 55%, transparent);
}

/* ---------- nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1.5px solid var(--ink);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(6px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 18px;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand:hover {
  color: inherit;
}

.brand-mark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--ink);
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 3px;
  background: var(--blue);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  font-family: var(--mono);
  font-size: 13px;
}

.nav-links a:not(.btn) {
  text-decoration: none;
  color: var(--graphite);
}

.nav-links a:not(.btn):hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--paper);
  background: var(--ink);
  border: 1.5px solid var(--ink);
  box-shadow: 4px 4px 0 var(--blue);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.btn:hover {
  color: var(--paper);
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--blue);
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--blue);
}

.btn-ghost {
  color: var(--ink);
  background: transparent;
  box-shadow: none;
}

.btn-ghost:hover {
  color: var(--ink);
  background: var(--paper);
  box-shadow: 4px 4px 0 var(--ink);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 12px;
  box-shadow: 3px 3px 0 var(--blue);
}

/* ---------- type ---------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--graphite);
  margin-bottom: 22px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
}

h1 {
  font-family: var(--serif);
  font-size: clamp(48px, 7.4vw, 88px);
  line-height: 0.98;
  letter-spacing: -0.02em;
}

h1 em,
h2 em {
  font-style: italic;
  color: var(--blue);
}

mark {
  color: inherit;
  background: linear-gradient(transparent 58%, var(--highlight) 58%, var(--highlight) 92%, transparent 92%);
  padding: 0 0.06em;
}

.lede {
  margin-top: 28px;
  max-width: 36ch;
  font-size: 19px;
  color: var(--graphite);
}

/* ---------- sections ---------- */

.section {
  padding: clamp(48px, 7vw, 80px) 0;
  border-bottom: 1px solid var(--rule);
}

.section-head {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  align-items: baseline;
  gap: 16px;
  padding-bottom: 18px;
  margin-bottom: 32px;
  border-bottom: 1.5px solid var(--ink);
}

.section-no {
  color: var(--red);
}

.section-head h2 {
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1;
}

.section-head p {
  font-family: var(--mono);
  font-size: 13px;
  text-align: right;
}

/* ---------- cards ---------- */

.card {
  display: flex;
  flex-direction: column;
  padding: 18px 20px 22px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.card:hover {
  transform: translate(-3px, -3px);
  box-shadow: 6px 6px 0 var(--ink);
}

.card-top {
  display: flex;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px dashed var(--rule);
}

.card h3 {
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1.1;
}

.card p {
  margin-top: 6px;
  color: var(--graphite);
  font-size: 15px;
  flex: 1;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.tags li {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--ink);
  border-radius: 99px;
}

/* ---------- plate (framed callout box) ---------- */

.plate {
  margin: clamp(48px, 7vw, 80px) 0;
  padding: clamp(36px, 6vw, 72px) clamp(24px, 5vw, 64px);
  text-align: center;
  border: 1.5px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: 6px;
  background:
    repeating-linear-gradient(-45deg, transparent 0 14px, var(--rule) 14px 15px),
    var(--paper);
}

.plate h2,
.plate blockquote {
  margin: 0 auto;
  max-width: 24ch;
  font-family: var(--serif);
  font-size: clamp(32px, 4.6vw, 56px);
  line-height: 1.05;
}

/* ---------- drawing (inline SVG figures) ---------- */

.drawing {
  margin: 0;
  color: var(--ink);
}

.drawing svg {
  width: 100%;
  height: auto;
  display: block;
  font-family: var(--mono);
}

.drawing figcaption {
  margin-top: 10px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--graphite);
  text-align: center;
}

.drawing .window {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 2;
}

.drawing .shadow {
  fill: var(--ink);
}

.drawing .stroke {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.4;
}

.drawing .faint {
  opacity: 0.35;
  stroke-width: 3;
  stroke-linecap: round;
}

.drawing .caret {
  stroke: var(--blue);
  stroke-width: 2;
  animation: blink 1.1s steps(1) infinite;
}

.drawing .text {
  fill: var(--ink);
  font-size: 13px;
}

.drawing .text-blue {
  fill: var(--blue);
}

.drawing .label-sm {
  fill: var(--graphite);
  font-size: 11px;
}

.drawing .dim {
  stroke: var(--red);
  stroke-width: 1;
}

.drawing .dim text {
  fill: var(--red);
  stroke: none;
  font-size: 11px;
}

.drawing .dim-bg {
  fill: var(--paper);
  stroke: none;
}

.drawing .tick {
  stroke: var(--red);
}

.drawing .callout line {
  stroke: var(--ink);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.drawing .callout circle {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 1.2;
}

.drawing .callout text {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 500;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* ---------- footer title block ---------- */

.titleblock {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 40px;
  border: 1.5px solid var(--ink);
  font-size: 14px;
  background: var(--paper);
}

.titleblock > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  border-right: 1px solid var(--ink);
}

.titleblock > div:last-child {
  border-right: 0;
}

.tb-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--graphite);
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .section-head {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .section-head p {
    text-align: left;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .nav-links a:not(.btn) {
    display: none;
  }

  .titleblock {
    grid-template-columns: 1fr 1fr;
  }

  .titleblock > div:nth-child(2) {
    border-right: 0;
  }

  .titleblock > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--ink);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .drawing .caret {
    animation: none;
  }

  .btn,
  .card {
    transition: none;
  }
}
