/* ==========================================================================
   paq — technical datasheet theme
   IBM Plex Mono + IBM Plex Sans · warm paper · vermilion signal
   ========================================================================== */

:root {
  --paper:      #f2ede1;
  --paper-2:    #ebe4d4;
  --paper-3:    #e3dbc8;
  --ink:        #191410;
  --ink-soft:   #4b4239;
  --ink-faint:  #8a7d6c;
  --rule:       rgba(25, 20, 16, 0.16);
  --rule-soft:  rgba(25, 20, 16, 0.09);
  --accent:     #d8401f;
  --accent-ink: #fbf6ec;

  --code-comment: #9c8a72;
  --code-keyword: #e8735a;
  --code-string:  #d9a05b;
  --code-number:  #8fae6a;
  --code-name:    #e4b8a0;

  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --maxw: 1080px;
  --measure: 46rem;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--rule-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule-soft) 1px, transparent 1px);
  background-size: 100% 4rem, 4rem 100%;
  background-position: 0 -1px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* paper grain overlay */
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 2;
}

/* ── section label ──────────────────────────────────────────────────────── */
.section-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.section-label .idx {
  color: var(--accent);
  font-weight: 700;
}
.section-label .tick { color: var(--accent); }

/* ── header ─────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(120%) blur(6px);
  border-bottom: 1px solid var(--ink);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--ink);
}
.brand-mark {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}
.brand-mark::before {
  content: "▚ ";
  color: var(--accent);
}
.brand-meta {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav a {
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  text-decoration: none;
  position: relative;
  padding: 0.25rem 0;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 0; height: 2px;
  background: var(--accent);
  transition: width 0.22s var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after { width: 100%; }

/* ── hero ───────────────────────────────────────────────────────────────── */
.hero {
  padding: 5rem 0 3.5rem;
  border-bottom: 1px solid var(--rule);
  position: relative;
}
/* corner registration marks */
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--accent);
  opacity: 0.7;
}
.hero::before { top: 1.5rem; right: 0; border-left: 0; border-bottom: 0; }
.hero::after  { bottom: -1px; left: 0; border-right: 0; border-top: 0; }

.wordmark {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(5rem, 24vw, 15rem);
  line-height: 0.82;
  letter-spacing: -0.05em;
  margin: 0.5rem 0 1.75rem -0.06em;
  padding-bottom: 0.14em;
  color: var(--ink);
  display: flex;
}
.wordmark span {
  display: inline-block;
  animation: rise 0.7s var(--ease) both;
}
.wordmark span:nth-child(1) { animation-delay: 0.05s; }
.wordmark span:nth-child(2) { animation-delay: 0.13s; color: var(--accent); }
.wordmark span:nth-child(3) { animation-delay: 0.21s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(0.3em); }
  to   { opacity: 1; transform: translateY(0); }
}

.tagline {
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  line-height: 1.4;
  color: var(--ink-soft);
  max-width: 34rem;
  margin: 0 0 2rem;
}

/* command box */
.cmd {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 30rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  padding: 0.85rem 0.85rem 0.85rem 1.1rem;
  border: 1px solid var(--ink);
  box-shadow: 6px 6px 0 var(--accent);
  margin-bottom: 2.25rem;
}
.cmd-prompt { color: var(--accent); font-weight: 700; }
.cmd-text {
  flex: 1;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow-x: auto;
}
.cmd-copy {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.cmd-copy:hover { background: var(--accent); color: var(--accent-ink); }
.cmd-copy.copied { background: var(--accent); color: var(--accent-ink); }

/* actions */
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 3rem;
}
.btn {
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  padding: 0.65rem 1.4rem;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: transparent;
  text-decoration: none;
  transition: transform 0.15s var(--ease), background 0.15s var(--ease), color 0.15s var(--ease);
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--ink); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.btn-primary:hover { box-shadow: 3px 3px 0 var(--ink); }

/* spec strip */
.spec-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--rule);
  margin: 0;
}
.spec-strip > div {
  padding: 0.85rem 1.1rem;
  border-right: 1px solid var(--rule);
}
.spec-strip > div:last-child { border-right: 0; }
.spec-strip dt {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.25rem;
}
.spec-strip dd {
  margin: 0;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.95rem;
}

/* ── principles ─────────────────────────────────────────────────────────── */
.principles { padding: 4rem 0; border-bottom: 1px solid var(--rule); }
.principle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}
.principle { position: relative; padding-left: 1.25rem; }
.principle::before {
  content: "";
  position: absolute;
  left: 0; top: 0.35rem;
  width: 3px; height: 1.55rem;
  background: var(--accent);
}
.principle h3 {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.6rem;
}
.principle p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; line-height: 1.55; }
.principle em { font-style: italic; color: var(--ink); }

/* ── capabilities grid ──────────────────────────────────────────────────── */
.specsheet { padding: 4rem 0; border-bottom: 1px solid var(--rule); }
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.cell {
  background: var(--paper);
  padding: 1.5rem 1.4rem 1.75rem;
  transition: background 0.2s var(--ease);
  counter-increment: cell;
  position: relative;
}
.cell::before {
  content: counter(cell, decimal-leading-zero);
  position: absolute;
  top: 1.4rem; right: 1.4rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--ink-faint);
}
.grid { counter-reset: cell; }
.cell:hover { background: var(--paper-2); }
.cell h3 {
  font-family: var(--mono);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.6rem;
}
.cell h3::before { content: "▚"; color: var(--accent); margin-right: 0.5rem; font-size: 0.8em; }
.cell p { margin: 0; color: var(--ink-soft); font-size: 0.92rem; line-height: 1.55; }
.cell code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--paper-3);
  padding: 0.05rem 0.3rem;
}

/* ── content / docs ─────────────────────────────────────────────────────── */
.content { padding: 3rem 0 5rem; }
.content.readme { padding-top: 4rem; }

.content > *:not(pre):not(table):not(.highlight) { max-width: var(--measure); }

.content h1 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 1.5rem;
}
.content h2 {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  margin: 3.25rem 0 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  position: relative;
}
.content h2::before {
  content: "";
  position: absolute;
  top: -1px; left: 0;
  width: 3rem; height: 2px;
  background: var(--accent);
}
.content h3 {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.12rem;
  margin: 2rem 0 0.75rem;
}
.content h3::before { content: "› "; color: var(--accent); }

.content p, .content li { color: var(--ink-soft); }
.content strong { color: var(--ink); font-weight: 600; }
.content a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}
.content a:hover { color: var(--accent); }

.content code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: 0.08rem 0.35rem;
}

/* code blocks */
.content pre,
.content .highlight {
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  padding: 1.1rem 1.2rem;
  overflow-x: auto;
  margin: 1.25rem 0;
  position: relative;
  box-shadow: 5px 5px 0 var(--paper-3);
}
.content .highlight pre { margin: 0; padding: 0; border: 0; box-shadow: none; background: transparent; }
.content pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: inherit;
}
.pre-copy {
  position: absolute;
  top: 0.6rem; right: 0.6rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  padding: 0.28rem 0.55rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s var(--ease), background 0.15s var(--ease), color 0.15s var(--ease);
}
.content pre:hover .pre-copy,
.content .highlight:hover .pre-copy { opacity: 0.85; }
.pre-copy:hover,
.pre-copy.copied { background: var(--accent); color: var(--accent-ink); opacity: 1; }

/* syntax highlighting (chroma) */
.chroma .c, .chroma .c1, .chroma .cm,
.chroma .ch, .chroma .cs, .chroma .cp, .chroma .cpf {
  color: var(--code-comment);
  font-style: italic;
}
.chroma .k, .chroma .kc, .chroma .kd, .chroma .kn,
.chroma .kp, .chroma .kr, .chroma .kt, .chroma .ow, .chroma .or {
  color: var(--code-keyword);
}
.chroma .s, .chroma .sa, .chroma .sb, .chroma .sc, .chroma .dl,
.chroma .sd, .chroma .s1, .chroma .s2, .chroma .se, .chroma .sh,
.chroma .si, .chroma .sx, .chroma .sr, .chroma .ss {
  color: var(--code-string);
}
.chroma .m, .chroma .mb, .chroma .mf, .chroma .mh,
.chroma .mi, .chroma .il, .chroma .mo {
  color: var(--code-number);
}
.chroma .na, .chroma .nb, .chroma .bp, .chroma .nc, .chroma .nd,
.chroma .nf, .chroma .fm, .chroma .nl, .chroma .ni, .chroma .nn,
.chroma .no, .chroma .nt, .chroma .nv, .chroma .vc, .chroma .vg,
.chroma .vi, .chroma .vm {
  color: var(--code-name);
}
.chroma .err { color: var(--accent-ink); background: var(--accent); }

/* tables — datasheet style */
.content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  border: 1px solid var(--ink);
}
.content th, .content td {
  text-align: left;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--rule);
  vertical-align: top;
}
.content th {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.content tbody tr:nth-child(even) { background: var(--paper-2); }
.content td code { background: var(--paper-3); }
.content th code {
  background: rgba(242, 237, 225, 0.16);
  border-color: rgba(242, 237, 225, 0.28);
  color: var(--paper);
}

.content blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.25rem 0;
  padding: 0.25rem 0 0.25rem 1.1rem;
  color: var(--ink-soft);
}

/* docs page list */
.page-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  border-top: 1px solid var(--rule);
}
.page-list li { border-bottom: 1px solid var(--rule); }
.page-list a {
  display: block;
  padding: 0.85rem 0.25rem;
  font-family: var(--mono);
  text-decoration: none;
  color: var(--ink);
  transition: padding 0.18s var(--ease), background 0.18s var(--ease);
}
.page-list a::before { content: "→ "; color: var(--accent); }
.page-list a:hover { padding-left: 1rem; background: var(--paper-2); }

/* ── footer ─────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--ink);
  background: var(--paper-2);
  position: relative;
  z-index: 2;
}
.footer-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  padding: 2rem 1.5rem;
}
.footer-col { display: flex; flex-direction: column; gap: 0.2rem; margin-right: auto; }
.footer-brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05rem;
}
.footer-brand::before { content: "▚ "; color: var(--accent); }
.footer-note { font-size: 0.82rem; color: var(--ink-faint); max-width: 24rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer-links a {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
  text-decoration: none;
}
.footer-links a:hover { color: var(--accent); }
.footer-version {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
  border: 1px solid var(--rule);
  padding: 0.2rem 0.55rem;
}

/* ── responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .principle-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .spec-strip { grid-template-columns: repeat(2, 1fr); }
  .spec-strip > div:nth-child(2) { border-right: 0; }
  .spec-strip > div:nth-child(1),
  .spec-strip > div:nth-child(2) { border-bottom: 1px solid var(--rule); }
}
@media (max-width: 560px) {
  .hero { padding: 3rem 0 2.5rem; }
  .brand-meta { display: none; }
  .nav { gap: 1rem; }
  .grid { grid-template-columns: 1fr; }
  .cmd { box-shadow: 4px 4px 0 var(--accent); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; scroll-behavior: auto; }
  .btn:hover { transform: none; }
}
