/* =========================================================
   Herman Ngugi — portfolio site
   Design concept: the library card catalog.
   A researcher/librarian's world of index cards, ruled
   ledger lines, brass drawer pulls and ink stamps, crossed
   with a teal "digital" accent for the tech/freelance side.
   ========================================================= */

:root {
  --paper: #e9e4d3;
  --paper-deep: #e1dac4;
  --card: #f6f2e7;
  --ink: #1d231f;
  --ink-soft: #4a5850;
  --ink-faint: #78826f;
  --brass: #9c7a2e;
  --brass-soft: #b6975a;
  --teal: #1b6e6a;
  --teal-deep: #124d4a;
  --rust: #b4432f;
  --rule: #c9bfa0;
  --rule-soft: #d9d2ba;

  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --max: 1120px;
  --radius: 3px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--teal-deep); text-decoration-color: var(--brass-soft); text-underline-offset: 3px; }
a:hover { color: var(--rust); }

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  color: var(--ink);
  margin: 0 0 0.5em;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.4rem, 5vw, 3.6rem); line-height: 1.05; font-weight: 700; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.15; }
h3 { font-size: 1.25rem; line-height: 1.3; }

p { margin: 0 0 1em; max-width: 62ch; color: var(--ink-soft); }
.lede { font-size: 1.15rem; color: var(--ink-soft); }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 28px;
}

.label {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--brass);
  letter-spacing: 0.04em;
}

.rule {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 0;
}

/* ---------- skip link ---------- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  z-index: 200;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ---------- header / drawer nav ---------- */
.site-header {
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}
.brand-mark {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 2px solid var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 700;
  color: var(--teal);
  font-size: 1rem;
  flex: none;
}
.brand-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.1rem;
}
.brand-role {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--ink-faint);
  font-weight: 400;
  letter-spacing: 0.03em;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-family: var(--mono);
  cursor: pointer;
}

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
}
.main-nav a {
  display: inline-block;
  padding: 8px 12px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.95rem;
  border-radius: var(--radius);
}
.main-nav a:hover { color: var(--teal-deep); background: var(--paper-deep); }
.main-nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  border-bottom: 2px solid var(--rust);
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; align-items: center; gap: 8px; }
  .main-nav {
    display: none;
    position: absolute;
    left: 0; right: 0; top: 100%;
    background: var(--paper);
    border-bottom: 2px solid var(--ink);
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; padding: 10px 28px 18px; gap: 2px; }
  .main-nav a { display: block; padding: 10px 6px; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 13px 24px;
  border-radius: var(--radius);
  text-decoration: none;
  border: 2px solid var(--ink);
  cursor: pointer;
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--teal-deep); border-color: var(--teal-deep); color: #fff; }
.btn-secondary { background: transparent; color: var(--ink); }
.btn-secondary:hover { background: var(--ink); color: var(--paper); }
.btn-block { width: 100%; text-align: center; }
.cta-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 28px; }

/* ---------- hero ---------- */
.hero {
  padding: 64px 0 56px;
  border-bottom: 1px solid var(--rule);
  background-image: repeating-linear-gradient(var(--paper) 0 33px, var(--rule-soft) 33px 34px);
  background-position: 0 92px;
}
.hero-card {
  max-width: 46rem;
  background: var(--card);
  border: 1px solid var(--ink);
  border-left: 6px solid var(--rust);
  padding: 40px clamp(20px, 5vw, 52px);
  box-shadow: 6px 6px 0 var(--rule);
}
.hero-card .label { display: block; margin-bottom: 18px; }
.hero-role {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--ink-soft);
  margin-top: 4px;
  margin-bottom: 18px;
}
.hero-role span:not(:last-child)::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 1em;
  background: var(--brass);
  margin: 0 12px -2px;
}

/* ---------- sections ---------- */
section { padding: 64px 0; }
.section-head { max-width: 42rem; margin-bottom: 40px; }
.section-head .label { display: block; margin-bottom: 10px; }

.alt { background: var(--paper-deep); }

/* index-card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
}
.index-card {
  background: var(--card);
  border: 1px solid var(--ink);
  padding: 26px 24px;
  position: relative;
}
.index-card::before {
  content: "";
  position: absolute;
  top: -1px; left: 20px;
  width: 26px; height: 8px;
  background: var(--brass-soft);
  opacity: 0.8;
}
.index-card .label { display: block; margin-bottom: 10px; }
.index-card h3 { margin-bottom: 8px; }
.index-card p { margin-bottom: 0; font-size: 0.97rem; }
.index-card .tags { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.index-card .tags li {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--teal-deep);
  border: 1px solid var(--teal);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ledger rows (why-work-with-me style lists) */
.ledger { border-top: 1px solid var(--rule); }
.ledger-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--rule);
}
.ledger-row h3 { margin: 0; }
.ledger-row p { margin: 0; }
@media (max-width: 640px) {
  .ledger-row { grid-template-columns: 1fr; gap: 6px; }
}

/* pricing / service cards */
.service-card {
  background: var(--card);
  border: 1px solid var(--ink);
  padding: 30px clamp(20px,4vw,34px);
  margin-bottom: 22px;
}
.service-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 14px;
  margin-bottom: 16px;
}
.service-card-head .from {
  font-family: var(--mono);
  color: var(--teal-deep);
  font-size: 0.95rem;
  white-space: nowrap;
}
.price-table { width: 100%; border-collapse: collapse; margin: 16px 0 20px; }
.price-table td { padding: 9px 0; border-bottom: 1px solid var(--rule-soft); font-size: 0.95rem; }
.price-table td:last-child { text-align: right; font-family: var(--mono); color: var(--ink); white-space: nowrap; padding-left: 12px; }
.feature-list { list-style: none; margin: 0 0 20px; padding: 0; }
.feature-list li { padding: 6px 0 6px 22px; position: relative; color: var(--ink-soft); font-size: 0.96rem; }
.feature-list li::before { content: "—"; position: absolute; left: 0; color: var(--brass); }

/* pull quote */
.pull-quote {
  text-align: center;
  padding: 20px 0 8px;
}
.pull-quote blockquote {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  color: var(--ink);
  max-width: 40rem;
  margin: 0 auto;
  line-height: 1.4;
}

/* CTA band */
.cta-band {
  background: var(--teal-deep);
  color: #f2ede0;
  padding: 60px 0;
}
.cta-band h2 { color: #f2ede0; }
.cta-band p { color: #cfe3e0; }
.cta-band .btn-primary { background: var(--rust); border-color: var(--rust); color: #fff; }
.cta-band .btn-primary:hover { background: #92311f; border-color: #92311f; }
.cta-band .btn-secondary { border-color: #cfe3e0; color: #f2ede0; }
.cta-band .btn-secondary:hover { background: #f2ede0; color: var(--teal-deep); }

/* two-column bio */
.split {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 48px;
  align-items: start;
}
@media (max-width: 780px) { .split { grid-template-columns: 1fr; } }

.stamp-portrait {
  border: 1px solid var(--ink);
  background: var(--card);
  aspect-ratio: 4/5;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.stamp-portrait .ring {
  width: 62%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px double var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.6rem, 8vw, 4rem);
  color: var(--teal);
}
.stamp-portrait .cardno {
  position: absolute;
  bottom: 14px; left: 0; right: 0;
  text-align: center;
}

.value-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 32px;
}
@media (max-width: 560px) { .value-grid { grid-template-columns: 1fr; } }
.value-grid .index-card p { color: var(--ink-soft); }

/* portfolio groups */
.portfolio-group + .portfolio-group { margin-top: 52px; }
.portfolio-group h2 {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 14px;
  margin-bottom: 28px;
}

/* blog cards */
.blog-card {
  background: var(--card);
  border: 1px solid var(--ink);
  padding: 24px;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.blog-card .label { margin-bottom: 12px; }
.blog-card h3 { margin-bottom: 10px; }
.blog-card p { font-size: 0.95rem; flex-grow: 1; }
.blog-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--rule-soft);
}

/* forms */
.form-field { margin-bottom: 18px; }
.form-field label {
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.form-field input, .form-field textarea {
  width: 100%;
  border: 1px solid var(--ink);
  background: var(--card);
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 0.96rem;
  color: var(--ink);
  border-radius: var(--radius);
}
.form-field textarea { min-height: 140px; resize: vertical; }
.form-field input:focus, .form-field textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; }

.contact-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
}
@media (max-width: 780px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-card {
  background: var(--card);
  border: 1px solid var(--ink);
  padding: 30px;
}
.contact-line { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--rule-soft); }
.contact-line:last-child { border-bottom: none; }
.contact-line .k { font-family: var(--mono); font-size: 0.72rem; color: var(--brass); width: 100px; flex: none; padding-top: 3px; }
.contact-line .v { color: var(--ink); }
.contact-line a { font-weight: 600; }

/* footer */
.site-footer {
  border-top: 2px solid var(--ink);
  background: var(--paper-deep);
  padding: 48px 0 26px;
  margin-top: 40px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-grid h4 {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--brass);
  text-transform: none;
  margin-bottom: 14px;
}
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 8px; }
.footer-grid a { color: var(--ink-soft); text-decoration: none; font-size: 0.95rem; }
.footer-grid a:hover { color: var(--teal-deep); }
.footer-bottom {
  border-top: 1px solid var(--rule);
  padding-top: 20px;
  font-size: 0.85rem;
  color: var(--ink-faint);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* blog post body (rendered markdown) */
.post-body {
  max-width: 62ch;
}
.post-body p { margin-bottom: 1.2em; }
.post-body strong { color: var(--ink); }
.post-hero {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 32px;
  margin-bottom: 8px;
}
.post-hero .blog-meta { border-top: none; padding-top: 0; margin-top: 18px; }
.back-link { display: inline-block; margin-bottom: 18px; font-family: var(--mono); font-size: 0.85rem; }

/* utility */
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}
