@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Serif:ital,wght@0,300;0,400;0,600;1,400&family=IBM+Plex+Sans:wght@300;400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --ink: #111111;
  --paper: #f9f9f7;
  --mid: #5c5c5c;
  --light: #e2e2de;
  --lighter: #f0f0ec;
  --serif: 'IBM Plex Serif', Georgia, serif;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', 'Courier New', monospace;
}

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

html { font-size: 17px; scroll-behavior: smooth; }

body {
  font-family: var(--serif);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Navigation ── */
.site-nav {
  border-bottom: 1px solid var(--light);
  padding: 1rem 2.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-logo {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
}

.nav-logo sup {
  font-size: 0.65rem;
  color: var(--mid);
  letter-spacing: 0.06em;
  font-weight: 400;
}

.site-nav nav {
  display: flex;
  gap: 1.75rem;
  margin-left: auto;
}

.site-nav nav a {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--mid);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.12s;
}

.site-nav nav a:hover,
.site-nav nav a.active { color: var(--ink); }

/* ── Layout ── */
main {
  flex: 1;
  max-width: 780px;
  margin: 0 auto;
  padding: 4.5rem 2.5rem;
  width: 100%;
}

main.wide {
  max-width: 920px;
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--light);
  padding: 1.5rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--mid);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-footer a { color: var(--mid); text-decoration: none; }
.site-footer a:hover { color: var(--ink); }

/* ── Typography ── */
h1 {
  font-family: var(--sans);
  font-size: 2.1rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 1.25rem;
}

h2 {
  font-family: var(--sans);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 3rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--light);
}

h3 {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--mid);
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--ink); text-underline-offset: 3px; }

ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

li { margin-bottom: 0.35rem; }

code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--lighter);
  padding: 0.1em 0.35em;
  border-radius: 2px;
  letter-spacing: -0.01em;
}

pre {
  font-family: var(--mono);
  font-size: 0.8rem;
  background: var(--lighter);
  border: 1px solid var(--light);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  line-height: 1.65;
  margin-bottom: 1.25rem;
  border-radius: 2px;
}

pre code { background: none; padding: 0; font-size: inherit; }

hr { border: none; border-top: 1px solid var(--light); margin: 2.5rem 0; }

/* ── AIPM Mark ── */
.aipm-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 2px solid var(--ink);
  padding: 0.45rem 1rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 1;
}

.aipm-badge .badge-version {
  font-size: 0.65rem;
  color: var(--mid);
  font-weight: 400;
  letter-spacing: 0.08em;
  border-left: 1px solid var(--light);
  padding-left: 0.5rem;
}

/* ── Buttons ── */
.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.6rem 1.3rem;
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  line-height: 1.2;
}

.btn:hover { background: var(--ink); color: var(--paper); }

.btn-fill {
  background: var(--ink);
  color: var(--paper);
}

.btn-fill:hover { background: #333; color: var(--paper); }

.btn-sm { font-size: 0.78rem; padding: 0.45rem 0.9rem; }

/* ── Cards ── */
.card {
  border: 1px solid var(--light);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
}

/* ── Form Elements ── */
.field { margin-bottom: 1.35rem; }

.field-label {
  display: block;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--mid);
  margin-bottom: 0.45rem;
}

.field-hint {
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--mid);
  margin-top: 0.3rem;
}

input[type="text"],
input[type="date"],
textarea,
select {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--light);
  background: #fff;
  color: var(--ink);
  outline: none;
  border-radius: 0;
  appearance: none;
  transition: border-color 0.12s;
}

input[type="text"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus { border-color: var(--ink); }

textarea { resize: vertical; min-height: 80px; line-height: 1.55; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235c5c5c' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

/* Radio buttons as pill-style toggles */
.radio-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.1rem;
}

.radio-pills input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }

.radio-pills label {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--light);
  background: #fff;
  color: var(--mid);
  cursor: pointer;
  transition: all 0.12s;
  letter-spacing: 0.02em;
  user-select: none;
}

.radio-pills input[type="radio"]:checked + label {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.radio-pills label:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* ── URL Preview ── */
.url-preview-wrap {
  margin-bottom: 1.5rem;
}

.url-preview-wrap .field-label { margin-bottom: 0.3rem; }

.url-preview {
  font-family: var(--mono);
  font-size: 0.72rem;
  background: var(--lighter);
  border: 1px solid var(--light);
  padding: 0.75rem 1rem;
  word-break: break-all;
  color: var(--mid);
  line-height: 1.6;
  min-height: 2.5rem;
}

/* ── QR Output ── */
#qr-output {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.75rem;
  border: 1px solid var(--light);
  background: #fff;
}

#qr-canvas-wrap { line-height: 0; }
#qr-canvas-wrap canvas, #qr-canvas-wrap img { display: block; }

/* ── Provenance Card ── */
.provenance-card {
  border: 2px solid var(--ink);
  padding: 2.25rem;
  margin-bottom: 2rem;
}

.provenance-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--light);
  flex-wrap: wrap;
}

.provenance-header h1 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
  letter-spacing: -0.01em;
}

.provenance-header p {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--mid);
  margin: 0;
}

.prov-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0.5rem 1.25rem;
  align-items: baseline;
  margin-bottom: 0.9rem;
  font-size: 0.95rem;
}

.prov-key {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--mid);
  padding-top: 0.15rem;
}

.prov-val { font-family: var(--serif); }

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--ink);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--light);
  vertical-align: top;
}

/* ── Hero area ── */
.hero {
  margin-bottom: 3rem;
}

.hero-mark {
  margin-bottom: 2rem;
}

.hero p {
  font-size: 1.1rem;
  color: var(--mid);
  max-width: 560px;
  line-height: 1.65;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--light);
  border: 1px solid var(--light);
  margin: 2.5rem 0;
}

.feature-cell {
  background: var(--paper);
  padding: 1.5rem;
}

.feature-cell h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 0.68rem;
}

.feature-cell p {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--mid);
  line-height: 1.55;
  margin: 0;
}

/* ── Notice / empty state ── */
.notice {
  border: 1px solid var(--light);
  background: var(--lighter);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--mid);
}

.notice strong { color: var(--ink); }

/* ── Generate layout ── */
.gen-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

@media (max-width: 680px) {
  .gen-layout { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  html { font-size: 15px; }
  main { padding: 2.5rem 1.5rem; }
  .site-nav { padding: 1rem 1.5rem; }
  .site-nav nav { gap: 1rem; }
  h1 { font-size: 1.65rem; }
}
