/* ============================================================
   "Certificate of Trust" — a security-engraved credential world.
   Direction 512c6f9b · mode: persuade.
   Registers: Bodoni (engraved display) · Spectral (document body)
   · Share Tech Mono (machine-readable data). One wax-seal crimson
   active mark; steel-blue guilloché lines on cool ivory.
   ============================================================ */

:root {
  --paper: #f2efe6;
  --panel: #eae4d5;
  --ink: #1b2127;
  --ink-soft: #54574f;
  --steel: #2f5d7c;
  --line: #d5cdb9;
  --line-strong: #c1b79c;
  --seal: #8c2f2a;
  --gold: #957a34;

  --maxw: 1040px;
  --font-display: "Bodoni Moda", Georgia, "Times New Roman", serif;
  --font-body: "Spectral", Georgia, "Times New Roman", serif;
  --font-mono: "Share Tech Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #10161b;
    --panel: #161d24;
    --ink: #e9e3d2;
    --ink-soft: #9aa199;
    --steel: #6f9cbb;
    --line: #29323a;
    --line-strong: #3a454e;
    --seal: #cf5f4c;
    --gold: #c6a44e;
  }
}
html[data-theme="dark"] {
  --paper: #10161b;
  --panel: #161d24;
  --ink: #e9e3d2;
  --ink-soft: #9aa199;
  --steel: #6f9cbb;
  --line: #29323a;
  --line-strong: #3a454e;
  --seal: #cf5f4c;
  --gold: #c6a44e;
}
html[data-theme="light"] {
  --paper: #f2efe6;
  --panel: #eae4d5;
  --ink: #1b2127;
  --ink-soft: #54574f;
  --steel: #2f5d7c;
  --line: #d5cdb9;
  --line-strong: #c1b79c;
  --seal: #8c2f2a;
  --gold: #957a34;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--seal); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

h1, h2, h3,
.site-title__name, .credential__name, .cred__title, .ledger__title,
.author__name, .post__title, .post-list__title, .page-title, .val__n {
  font-family: var(--font-display);
  font-weight: 700;
}

/* ---------- Icons ---------- */
.icon { width: 1em; height: 1em; fill: currentColor; flex-shrink: 0; vertical-align: middle; }
.theme-toggle .icon, .nav-toggle .icon { width: 18px; height: 18px; }
.site-footer .social a { display: inline-flex; align-items: center; gap: 7px; }
.site-footer .social .icon { width: 15px; height: 15px; }
.author__social .icon { width: 16px; height: 16px; }

/* ---------- Document header ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 3px double var(--line-strong);
}
.masthead__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px;
  height: 66px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.site-title {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  white-space: nowrap;
}
.site-title:hover { text-decoration: none; }
.site-title__seal { width: 26px; height: 26px; color: var(--steel); }
.site-title__name { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; }
.site-title__ref {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: var(--steel);
  border-left: 1px solid var(--line-strong);
  padding-left: 12px;
}
.site-nav { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.site-nav a {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.site-nav a:hover { color: var(--seal); text-decoration: none; }
.theme-toggle {
  background: none;
  border: 1px solid var(--line-strong);
  color: var(--steel);
  border-radius: 2px;
  width: 34px;
  height: 30px;
  cursor: pointer;
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--steel); }
.nav-toggle { display: none; background: none; border: 0; color: var(--ink); cursor: pointer; }

/* ---------- Document sheet ---------- */
.doc {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 44px 28px 96px;
}

/* ---------- Credential header (hero) ---------- */
.credential {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 34px;
  align-items: start;
  padding: 40px;
  border: 1px solid var(--line-strong);
  overflow: hidden;
}
.credential::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid var(--line);
  pointer-events: none;
}
.credential__guilloche {
  position: absolute;
  top: -40px;
  right: -30px;
  width: 300px;
  opacity: 0.5;
  pointer-events: none;
}
@media (prefers-color-scheme: dark) { .credential__guilloche { opacity: 0.28; } }
html[data-theme="dark"] .credential__guilloche { opacity: 0.28; }

.credential__photo { position: relative; margin: 0; width: 118px; }
.credential__photo img {
  display: block;
  width: 118px;
  height: 148px;
  object-fit: cover;
  border: 1px solid var(--line-strong);
  filter: grayscale(0.15) contrast(1.02);
}
.credential__photo::before,
.credential__photo::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--steel);
}
.credential__photo::before { top: -5px; left: -5px; border-right: 0; border-bottom: 0; }
.credential__photo::after { bottom: 22px; right: -5px; border-left: 0; border-top: 0; }
.credential__photo figcaption {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--steel);
  margin-top: 8px;
  text-align: center;
}

.credential__body { position: relative; z-index: 1; min-width: 0; }
.credential__name {
  font-size: clamp(2.9rem, 6.2vw, 4.6rem);
  line-height: 0.94;
  letter-spacing: -0.01em;
  margin: 0;
}
.credential__attest {
  font-family: var(--font-body);
  font-size: 1.15rem;
  color: var(--ink);
  margin: 14px 0 0;
}
.credential__attest em { font-style: italic; color: var(--steel); }
.credential__lead {
  font-size: 1.02rem;
  color: var(--ink-soft);
  max-width: 48ch;
  margin: 16px 0 0;
  line-height: 1.55;
}
.credential__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.stamp-btn, .ghost-btn {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 11px 20px;
  border-radius: 2px;
  border: 1px solid;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.stamp-btn { background: var(--seal); color: var(--paper); border-color: var(--seal); }
.stamp-btn:hover { background: transparent; color: var(--seal); text-decoration: none; }
.ghost-btn { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.ghost-btn:hover { border-color: var(--steel); color: var(--steel); text-decoration: none; }

.credential__mark { position: relative; z-index: 1; }
.seal--hero { width: clamp(118px, 15vw, 164px); height: auto; color: var(--steel); }
.seal__micro { fill: var(--steel); font-family: var(--font-mono); letter-spacing: 0.32em; }
.seal__mono { fill: var(--seal); font-family: var(--font-display); font-weight: 700; }
@media (prefers-reduced-motion: no-preference) {
  .seal--hero { animation: stampIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; transform-origin: center; }
  @keyframes stampIn {
    0% { opacity: 0; transform: scale(1.14) rotate(-5deg); }
    60% { opacity: 1; }
    100% { opacity: 1; transform: none; }
  }
}

/* ---------- Machine-readable strip ---------- */
.mrz {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  line-height: 1.7;
  color: var(--ink-soft);
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 0;
  margin: 0;
  padding: 12px 20px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: clip;
}

/* ---------- Ledger sections ---------- */
.ledger { margin-top: 60px; }
.ledger__head {
  border-bottom: 3px double var(--line-strong);
  padding-bottom: 12px;
  margin-bottom: 6px;
}
.ledger__title { font-size: 1.85rem; margin: 0; }
.ledger__sub { color: var(--ink-soft); margin: 8px 0 0; font-size: 0.98rem; }

/* ---------- Credential rows ---------- */
.cred {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 22px;
  align-items: center;
  padding: 22px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  transition: background 0.15s ease;
}
.cred:hover { background: var(--panel); text-decoration: none; }
.cred__seal { color: var(--steel); transition: color 0.15s ease; }
.cred:hover .cred__seal { color: var(--seal); }
.cred__seal svg { width: 46px; height: 46px; display: block; }
.cred__main { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cred__title { font-size: 1.3rem; line-height: 1.1; }
.cred__serial {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  color: var(--steel);
  word-break: break-all;
}
.cred__desc { color: var(--ink-soft); font-size: 0.96rem; max-width: 62ch; line-height: 1.5; }
.cred__lang {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-top: 3px;
}
.cred__validity { display: flex; gap: 26px; }
.val { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.val__k {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--steel);
}
.val__n { font-size: 1.7rem; line-height: 1; color: var(--ink); }

/* ---------- Endorsed instrument ---------- */
.endorse {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 26px 14px;
  color: var(--ink);
  transition: background 0.15s ease;
}
.endorse:hover { background: var(--panel); text-decoration: none; }
.endorse__stamp {
  display: block;
  padding: 8px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  transform: rotate(-3deg);
}
.endorse__stamp img { display: block; width: 52px; height: 52px; object-fit: contain; }
.endorse__main { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.endorse__cta {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--seal);
  white-space: nowrap;
}

/* ---------- Addenda ---------- */
.addenda {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 22px;
}
.note {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 22px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  transition: background 0.15s ease;
}
a.note:hover { background: var(--panel); text-decoration: none; }
.note__cta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--steel);
  margin-top: 2px;
}
.note--pending { opacity: 0.82; }
.note__stamp {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--seal);
  border: 1px solid var(--seal);
  border-radius: 2px;
  padding: 4px 9px;
  transform: rotate(-3deg);
  margin-top: 2px;
}

/* ---------- Blog: sidebar + content ---------- */
.layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 52px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 44px 28px 96px;
}
.author { position: sticky; top: 92px; align-self: start; }
.author__avatar {
  width: 108px;
  height: 108px;
  object-fit: cover;
  display: block;
  margin: 0 0 16px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
}
.author__name { font-size: 1.4rem; margin: 0 0 4px; }
.author__bio { color: var(--ink-soft); font-size: 0.95rem; margin: 0 0 18px; }
.btn-follow {
  display: inline-block;
  background: var(--seal);
  color: var(--paper);
  padding: 9px 20px;
  border: 1px solid var(--seal);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.btn-follow:hover { background: transparent; color: var(--seal); text-decoration: none; }
.author__social {
  list-style: none;
  padding: 0;
  margin: 22px 0 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.author__social a {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.author__social a:hover { color: var(--seal); text-decoration: none; }

.content h1.page-title {
  font-size: 2.4rem;
  margin: 0 0 32px;
  padding-bottom: 14px;
  border-bottom: 3px double var(--line-strong);
}

/* ---------- Blog post list ---------- */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list__item { padding: 28px 0; border-bottom: 1px solid var(--line); }
.post-list__item:first-child { padding-top: 0; }
.post-list__title { font-size: 1.7rem; margin: 0 0 6px; line-height: 1.2; }
.post-list__title a { color: var(--ink); }
.post-list__title a:hover { color: var(--seal); }
.post-meta {
  color: var(--steel);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  margin: 0 0 12px;
}
.post-list__excerpt { color: var(--ink-soft); margin: 0; }

/* ---------- Single post ---------- */
.post { max-width: 720px; }
.post__title { font-size: clamp(2.2rem, 5vw, 3rem); line-height: 1.08; margin: 0 0 12px; }
.post__body { font-size: 1.08rem; }
.post__body h2 { margin-top: 2em; font-size: 1.6rem; }
.post__body h3 { margin-top: 1.6em; font-size: 1.25rem; }
.post__body img { margin: 1.5em 0; border: 1px solid var(--line); }
.post__body pre {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 16px;
  overflow-x: auto;
  font-size: 0.9rem;
}
.post__body code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--panel);
  padding: 0.12em 0.4em;
}
.post__body pre code { background: none; padding: 0; }
.post__body blockquote {
  margin: 1.5em 0;
  padding: 0.8em 1.2em;
  background: var(--panel);
  border-left: 1px solid var(--steel);
  color: var(--ink-soft);
}

/* ---------- Issuing office (footer) ---------- */
.site-footer {
  border-top: 3px double var(--line-strong);
  background: var(--paper);
  padding: 40px 28px 48px;
  text-align: center;
  color: var(--ink-soft);
}
.site-footer__rule {
  height: 22px;
  max-width: 420px;
  margin: 0 auto 22px;
  background: url("../images/guilloche.svg") repeat-x center / auto 60px;
  opacity: 0.5;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
}
.site-footer .social { display: flex; gap: 22px; justify-content: center; margin-bottom: 16px; flex-wrap: wrap; }
.site-footer .social a {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}
.site-footer .social a:hover { color: var(--seal); text-decoration: none; }
.colophon {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 32px; }
  .author { position: static; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
  .author__avatar { margin: 0; width: 84px; height: 84px; }
  .author__social { flex-direction: row; flex-wrap: wrap; margin-top: 0; }
  .site-nav {
    display: none;
    position: absolute;
    top: 66px;
    left: 0;
    right: 0;
    background: var(--paper);
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 28px;
    border-bottom: 3px double var(--line-strong);
    gap: 16px;
  }
  .site-nav.open { display: flex; }
  .nav-toggle { display: block; margin-left: auto; }
  .site-title__ref { display: none; }
}

@media (max-width: 680px) {
  .credential { grid-template-columns: 1fr; gap: 24px; padding: 26px; }
  .credential__mark { order: -1; }
  .seal--hero { width: 120px; }
  .credential__photo { width: 96px; }
  .credential__photo img { width: 96px; height: 120px; }
  .cred { grid-template-columns: auto 1fr; gap: 16px; }
  .cred__validity { grid-column: 2; justify-content: flex-start; gap: 30px; margin-top: 4px; }
  .endorse { grid-template-columns: auto 1fr; }
  .endorse__cta { grid-column: 2; }
  .mrz { font-size: 0.7rem; letter-spacing: 0.1em; }
}
