/* ---------------------------------------------------------------
   Maina Brian Waweru - portfolio
   Flat dark surface, single gold accent, no cards, no gradients.
   --------------------------------------------------------------- */

:root {
  --bg: #101219;
  --bg-soft: #161a24;
  --text: #e8eaf0;
  --muted: #a2a9b8;
  --faint: #767e8f;
  --line: #262b37;
  --line-soft: #1e2330;
  --accent: #fdc92b;          /* decorative: zigzag, marks */
  --accent-text: #fdc92b;     /* text + links, contrast checked */
  --heart: #e11d48;
  --r: 4px;
  --maxw: 780px;
  --pad: 22px;
  --header-h: 64px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;
}

html[data-theme="light"] {
  --bg: #f7f7f5;
  --bg-soft: #ffffff;
  --text: #14161c;
  --muted: #545c6b;
  --faint: #656c7b;
  --line: #e2e2dd;
  --line-soft: #e9e9e4;
  --accent: #c08400;
  --accent-text: #6b4b00;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: var(--accent);
  color: #101219;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 90;
  padding: 10px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 13px;
  text-decoration: none;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--pad);
}

/* ------------------------------- header ------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
}

.bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}
/* two-line rust signature, wrapped the way rustfmt would wrap it */
.brand .sig {
  display: flex;
  flex-direction: column;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.32;
  letter-spacing: 0;
}
.brand .sig-l { white-space: nowrap; }
.brand .sig-l + .sig-l { padding-left: 3ch; }
.brand .kw,
.brand .lt { color: var(--accent-text); }
.brand .kw { font-weight: 600; }
.brand .id,
.brand .ty { font-weight: 600; color: var(--text); }
.brand .dim { color: var(--faint); }
.brand:hover .id,
.brand:hover .ty { color: var(--accent-text); }
.brand:hover .dim { color: var(--muted); }

.bar-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav > a {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text);
  transition: color 0.18s var(--ease);
}
.nav > a:hover { color: var(--accent-text); }

.nav-sep {
  width: 1px;
  height: 16px;
  background: var(--line);
}

.nav-socials {
  display: flex;
  align-items: center;
  gap: 2px;
}

.bar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.18s var(--ease), background-color 0.18s var(--ease);
}
.icon-link:hover {
  color: var(--accent-text);
  background: var(--bg-soft);
}

/* svg brand marks Phosphor has no glyph for (forgejo) */
.brand-ico {
  display: inline-block;
  width: 1em;
  height: 1em;
  fill: currentColor;
}
.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.nav-toggle { display: none; font-size: 20px; }

/* -------------------------------- hero -------------------------------- */

.hero {
  padding-top: 84px;
  padding-bottom: 24px;
  text-align: center;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.95rem, 5.4vw, 2.6rem);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -0.028em;
}

.hl { color: var(--accent-text); }

.lede {
  margin: 22px auto 0;
  max-width: 55ch;  /* measured: 3 lines, last line ~46% - no widow */
  font-size: 1.06rem;
  line-height: 1.78;
  color: var(--text);
}

/* hero signal rail: a dim sawtooth that draws itself in, then carries a spark */
.zigzag {
  display: block;
  margin: 40px auto 0;
  width: 440px;              /* ~75% of the text column: a divider, not a blip */
  max-width: 100%;
  height: auto;
  color: var(--accent);
  overflow: visible;
}
.zigzag .zz-base {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.5;
  stroke-dasharray: 474.22;    /* exact path length: one dash = whole rail */
  stroke-dashoffset: 474.22;
  animation: zz-draw 1.4s var(--ease) 0.3s forwards;
}
.zigzag .zz-spark {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 26 520;    /* period > path length: never two sparks at once */
  stroke-dashoffset: 600;
  filter: drop-shadow(0 0 5px currentColor);
  animation: zz-travel 5.4s linear 1.7s infinite;
}
@keyframes zz-draw {
  to { stroke-dashoffset: 0; }
}
@keyframes zz-travel {
  from { stroke-dashoffset: 600; }   /* off the left end */
  to   { stroke-dashoffset: 20; }    /* off the right end */
}

.hero-block {
  margin: 42px auto 0;
  max-width: 620px;
}
.label {
  margin: 0 0 14px;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.social-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 30px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social-row a {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  text-decoration: none;
  color: var(--text);
  transition: color 0.18s var(--ease);
}
.social-row a i,
.social-row a .brand-ico {
  font-size: 17px;
  color: var(--muted);
  transition: color 0.18s var(--ease);
}
.social-row a:hover,
.social-row a:hover i,
.social-row a:hover .brand-ico { color: var(--accent-text); }

.contact-line {
  margin: 0;
  font-size: 15.5px;
  color: var(--muted);
}
.contact-line + .social-row { margin-top: 22px; }

.accent-link {
  color: var(--accent-text);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.accent-link:hover { text-decoration-thickness: 2px; }

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

.section {
  padding-top: 78px;
  padding-bottom: 78px;
}

/* sticky header must never cover an anchor target */
.hero-block,
.section { scroll-margin-top: calc(var(--header-h) + 20px); }

.section-ruled { border-top: 1px solid var(--line); }

.section h2,
.page-title {
  margin: 0 0 18px;
  font-size: clamp(1.35rem, 3.4vw, 1.55rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.section-intro {
  margin: 0 0 42px;
  max-width: 66ch;
  font-size: 1rem;
  line-height: 1.78;
  color: var(--muted);
}

/* skills */

.skill-groups {
  display: grid;
  gap: 34px;
}

.group-label {
  margin: 0 0 18px;
  font-size: 11.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.skill {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
  color: var(--text);
}

.skill img {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.skill-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 20px;
  height: 18px;
  padding: 0 3px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--accent-text);
}

/* topics */

.topic {
  padding: 26px 0;
  border-top: 1px solid var(--line-soft);
}
.topic:first-of-type { padding-top: 8px; border-top: 0; }

.topic h3 {
  margin: 0 0 9px;
  font-size: 1.03rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.topic p {
  margin: 0;
  max-width: 68ch;
  font-size: 15.5px;
  line-height: 1.82;
  color: var(--muted);
}


/* -------------------------------- projects ------------------------------- */

.project-heading { margin: 0; font-size: inherit; font-weight: inherit; }

.project-head {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 18px 0;
  border: 0;
  border-top: 1px solid var(--line-soft);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.project:first-of-type .project-head {
  border-top: 0;
  padding-top: 4px;
}

.project-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-soft);
  overflow: hidden;
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-mark {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--accent-text);
}

.project-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.project-name {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--text);
  transition: color 0.18s var(--ease);
}

.project-tagline {
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

.project-tech { display: flex; flex-wrap: wrap; gap: 6px; }

.tech {
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 2px 6px;
}

.project-year {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}

.project-plus {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 18px;
  color: var(--muted);
  transition: transform 0.3s var(--ease), color 0.2s var(--ease);
}

.project-head:hover .project-name,
.project-head:hover .project-plus { color: var(--accent-text); }

.project.is-open .project-plus {
  transform: rotate(45deg);
  color: var(--accent-text);
}

.project-panel { padding: 2px 0 36px; }
.project-panel[hidden] { display: none; }
.project-panel:not([hidden]) { animation: panel-in 0.34s var(--ease) both; }

@keyframes panel-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

.project-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.project-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: #000;
}
.project-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.project-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}
.project-gallery img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.gallery-caption {
  display: block;
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--faint);
}

.project-story {
  margin-top: 26px;
  max-width: 68ch;
  font-size: 15.5px;
  line-height: 1.8;
  color: var(--muted);
}
.project-story > *:first-child { margin-top: 0; }
.project-story p { margin: 0 0 16px; }
.project-story h1,
.project-story h2,
.project-story h3,
.project-story h4 {
  margin: 26px 0 10px;
  font-size: 1.03rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.project-story ul,
.project-story ol { margin: 0 0 16px; padding-left: 22px; }
.project-story li { margin-bottom: 7px; }
.project-story a { color: var(--accent-text); }
.project-story blockquote {
  margin: 0 0 16px;
  padding-left: 15px;
  border-left: 2px solid var(--accent);
  color: var(--text);
}
.project-story code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 5px;
}
.project-story pre {
  margin: 0 0 16px;
  padding: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow-x: auto;
}
.project-story pre code { border: 0; background: none; padding: 0; }
.project-story img {
  max-width: 100%;
  border-radius: var(--r);
  margin: 4px 0 16px;
}
.project-story table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 16px;
  font-size: 14px;
}
.project-story th,
.project-story td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
}
.project-story th { color: var(--text); font-weight: 600; }
.project-story hr { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin: 26px 0 0;
  font-size: 14.5px;
}
.project-links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  text-decoration: none;
}
.project-links a:hover {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.project-links a.accent-link { color: var(--accent-text); }

/* ------------------------------- footer ------------------------------- */

.site-footer {
  margin-top: 38px;
  border-top: 1px solid var(--line);
  padding: 56px 0 34px;
}

.footer-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.footer-mark {
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.06em;
  color: var(--accent-text);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 26px;
}

.footer-nav a {
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.18s var(--ease);
}
.footer-nav a:hover { color: var(--accent-text); }

.footer-socials {
  display: flex;
  gap: 6px;
}

.footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
}

.footer-copy {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--faint);
}

.to-top {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.18s var(--ease);
}
.to-top:hover { color: var(--accent-text); }

/* ---------------------------- articles page --------------------------- */

.article-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line-soft);
}

.article-list li { border-bottom: 1px solid var(--line-soft); }

.article-list a {
  display: block;
  padding: 22px 0;
  text-decoration: none;
}

.article-title {
  display: block;
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--text);
  transition: color 0.18s var(--ease);
}
.article-list a:hover .article-title { color: var(--accent-text); }

.article-summary {
  display: block;
  margin-top: 7px;
  max-width: 64ch;
  font-size: 14.5px;
  color: var(--muted);
}

.article-list time,
.article-date {
  display: block;
  margin-top: 10px;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.empty {
  padding: 34px 0 10px;
  max-width: 60ch;
}
.empty-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}
.empty-body {
  margin: 9px 0 20px;
  font-size: 15.5px;
  color: var(--muted);
}

/* homepage showcase: rides on the .article-* rules above, adds the meta
   column, the hover arrow and the stacked mobile layout */
.article-row a {
  display: grid;
  grid-template-columns: 152px minmax(0, 1fr) 22px;
  grid-template-areas:
    "meta title go"
    "meta summary go";
  column-gap: 30px;
  row-gap: 6px;
  padding: 24px 0;
}
.article-meta {
  grid-area: meta;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.article-meta time { margin-top: 0; }
.meta-sep { display: none; }
.article-title {
  grid-area: title;
  margin: 0;
  line-height: 1.35;
}
.article-summary {
  grid-area: summary;
  margin-top: 0;
  font-size: 15px;
  line-height: 1.6;
}
.article-go {
  grid-area: go;
  align-self: center;
  font-size: 18px;
  color: var(--faint);
  transition: color 0.18s var(--ease), transform 0.18s var(--ease);
}
.article-row a:hover .article-go { color: var(--accent-text); transform: translate(3px, -3px); }
.section-more { margin: 26px 0 0; font-size: 14.5px; }

.crumbs {
  margin: 0 0 16px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.crumbs a { color: var(--faint); text-decoration: none; }
.crumbs a:hover { color: var(--accent-text); }

.prose .section-intro { margin-bottom: 30px; }

.article-body {
  max-width: 68ch;
  font-size: 16px;
  line-height: 1.85;
  color: var(--muted);
}
.article-body p { margin: 0 0 20px; }

/* --------------------------- reveal on scroll -------------------------- */

.js .reveal {
  opacity: 0;
  transform: translateY(16px);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

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

@media (max-width: 759px) {
  .zigzag { width: 288px; }
  .article-row a {
    grid-template-columns: minmax(0, 1fr) 22px;
    grid-template-areas:
      "meta go"
      "title go"
      "summary go";
    row-gap: 8px;
    padding: 22px 0;
  }
  .article-meta {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }
  .meta-sep {
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
  }

  .nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px var(--pad) 18px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .nav.is-open { display: flex; }

  .nav > a {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 11px 0;
    font-size: 13px;
  }
  .nav-sep { display: none; }

  .nav-socials {
    flex-direction: row;
    gap: 6px;
    margin-top: 8px;
  }
  .nav .icon-link,
  .bar-actions .icon-link {
    width: 44px;
    height: 44px;
  }

  .nav-toggle { display: inline-flex; }

  .hero { padding-top: 48px; }
  .section { padding-top: 54px; padding-bottom: 54px; }
  .skill-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
  .project-head { grid-template-columns: 44px minmax(0, 1fr) auto 22px; gap: 13px; }
  .project-thumb { width: 44px; height: 44px; }
  .project-gallery { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
  .hero { padding-top: 56px; }
  .footer-bar { flex-direction: column; text-align: center; gap: 14px; }
  .site-footer { padding-top: 44px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (min-width: 760px) {
  .nav-toggle { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .zigzag .zz-base { stroke-dashoffset: 0; animation: none; }
  .zigzag .zz-spark { display: none; }
  .js .reveal,
  .js .reveal.is-visible {
    opacity: 1;
    transform: none;
    transition: none;
  }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
