/* ============================================================
   Mustapha Pelumi Babatunde — DevOps / Cloud Engineer
   Order: tokens, reset, base type, utilities, header, hero,
   sections, projects, stack, notes, contact, footer, motion.
   ============================================================ */

/* ---------- design tokens ---------- */

:root,
[data-theme="light"] {
  color-scheme: light;

  --bg: #fbfbfa;
  --surface: #ffffff;
  --surface-sunken: #f4f5f6;

  --text: #16191d;
  --text-muted: #5a636d;

  --border: #e3e6ea;
  --border-strong: #b6bec7;

  --accent: #15587f;

  --focus: #15587f;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --wrap: 68rem;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --radius: 6px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0b0b;
  --surface: #1a1e22;
  --surface-sunken: #1f242a;

  --text: #e7eaed;
  --text-muted: #9aa4ae;

  --border: #2a3037;
  --border-strong: #4b545d;

  --accent: #7cb8e6;

  --focus: #7cb8e6;
}

/* ---------- reset ---------- */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* The theme swap should feel deliberate, not like a repaint glitch. */
body,
.site-header,
.case__figure,
.to-top,
.skip-link {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

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

ul,
ol {
  list-style: none;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

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

/* ---------- base type ---------- */

h1,
h2,
h3,
h4 {
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-weight: 600;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 1.35rem + 3.1vw, 3rem);
  line-height: 1.06;
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(1.55rem, 1.2rem + 1.5vw, 2.05rem);
}

h3 {
  font-size: clamp(1.15rem, 1.02rem + 0.6vw, 1.4rem);
}

p {
  text-wrap: pretty;
}

code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ---------- utilities ---------- */

.wrap {
  width: min(100% - (var(--gutter) * 2), var(--wrap));
  margin-inline: auto;
}

.icon {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--brand {
  fill: currentColor;
  stroke: none;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

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

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
}

.brand__name {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-header__end {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  flex: none;
  font-size: 1.05rem;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.icon-button:hover {
  color: var(--text);
  border-color: var(--border);
}

.theme-toggle__sun,
.theme-toggle__moon,
.nav-toggle__open,
.nav-toggle__close {
  display: none;
}

[data-theme="light"] .theme-toggle__sun,
[data-theme="dark"] .theme-toggle__moon {
  display: block;
}

.site-nav__list {
  display: flex;
  align-items: center;
  gap: 1.6rem;
}

.site-nav__link {
  position: relative;
  padding-block: 0.4rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.site-nav__link:hover {
  color: var(--text);
}

.site-nav__link[aria-current="true"] {
  color: var(--text);
}

.site-nav__link[aria-current="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.3rem;
  height: 1px;
  background: var(--accent);
}

.nav-toggle {
  display: none;
}

/* Controls that cannot do anything without JavaScript stay out of the way,
   and the navigation is never hidden behind a button that does not work. */
html:not(.js) .nav-toggle,
html:not(.js) .theme-toggle,
html:not(.js) .to-top {
  display: none;
}

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

.hero {
  padding-top: clamp(3rem, 7vw, 5.5rem);
  padding-bottom: clamp(3rem, 7vw, 5rem);
  border-bottom: 1px solid var(--border);
}

.hero__lead {
  max-width: 62ch;
  margin-top: 1.5rem;
  font-size: clamp(1.02rem, 0.97rem + 0.3vw, 1.15rem);
  color: var(--text-muted);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.95rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.button:hover {
  border-color: var(--border-strong);
}

.button--primary {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.button--primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, #000000);
  border-color: color-mix(in srgb, var(--accent) 88%, #000000);
}

[data-theme="dark"] .button--primary {
  color: #10161c;
}

[data-theme="dark"] .button--primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, #ffffff);
  border-color: color-mix(in srgb, var(--accent) 88%, #ffffff);
}

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

.section {
  padding-top: clamp(3rem, 7vw, 5rem);
}

.section + .section {
  border-top: 1px solid var(--border);
  margin-top: clamp(3rem, 7vw, 5rem);
}

.section__title {
  margin-top: 0.6rem;
  max-width: 26ch;
}

.section__intro {
  margin-top: 1.25rem;
}

.prose {
  max-width: 68ch;
  margin-top: 1.5rem;
  color: var(--text-muted);
}

.prose > * + * {
  margin-top: 1rem;
}

.prose .lead {
  font-size: clamp(1.05rem, 0.99rem + 0.3vw, 1.18rem);
  color: var(--text);
}

/* ---------- experience ---------- */

.timeline {
  display: grid;
  gap: 2.75rem;
  margin-top: clamp(2rem, 5vw, 3rem);
}

.job {
  position: relative;
  display: grid;
  grid-template-columns: minmax(11rem, 15rem) 1fr;
  gap: 1rem 2.5rem;
  padding-left: 1.4rem;
  border-left: 1px solid var(--border);
}

.job::before {
  content: "";
  position: absolute;
  top: 0.6rem;
  left: -3.5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.job__role {
  font-size: 1.02rem;
}

.job__org {
  margin-top: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.job__summary {
  max-width: 62ch;
  color: var(--text-muted);
}

.areas {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.25rem;
  padding-left: 1.2rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.areas li {
  list-style: disc;
}
.areas__label {
  color: var(--text);
  font-weight: 500;
}

/* ---------- projects: case studies ---------- */

.case {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  padding-top: clamp(1.75rem, 4vw, 2.5rem);
  border-top: 1px solid var(--border);
}

.case__index {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.case__title {
  margin-top: 0.55rem;
  max-width: 38ch;
}

.case__body {
  display: grid;
  gap: 1.75rem 2.5rem;
  margin-top: 1.75rem;
}

.case__column {
  max-width: 62ch;
  color: var(--text-muted);
}

.case__column > * + * {
  margin-top: 0.9rem;
}

.case__label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.case__label:not(:first-child) {
  margin-top: 1.6rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--border);
}

.concerns li {
  position: relative;
  padding-left: 1.05rem;
}

.concerns li + li {
  margin-top: 0.4rem;
}

.concerns li::before {
  content: "";
  position: absolute;
  top: 0.62em;
  left: 0;
  width: 5px;
  height: 5px;
  background: var(--accent);
  opacity: 0.75;
}

.case__figure {
  display: grid;
  gap: 1.25rem;
  margin-top: clamp(1.75rem, 4vw, 2.5rem);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.case__caption {
  max-width: 52ch;
  font-size: 0.87rem;
  line-height: 1.6;
  color: var(--text-muted);
}

/* ---------- architecture diagrams ---------- */

.diagram {
  width: 100%;
  height: auto;
  max-width: 26rem;
  margin-inline: auto;
}

.arrow-head {
  fill: var(--border-strong);
}

.diagram text {
  font-family: var(--font-mono);
  fill: var(--text);
}

.diagram .n-box {
  fill: var(--surface);
  stroke: var(--border-strong);
  stroke-width: 1;
}

.diagram .n-box--accent {
  stroke: var(--accent);
}

.diagram .n-group {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}

.diagram .n-line {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1.25;
}

.diagram .n-line--dashed {
  stroke-dasharray: 3 3;
}

.diagram .n-loop {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.1;
  stroke-dasharray: 3 3;
}

.diagram .n-label {
  font-size: 11.5px;
  font-weight: 600;
}

.diagram .n-sub {
  font-size: 9.5px;
  fill: var(--text-muted);
}

.diagram .n-sub--strong {
  font-size: 10.5px;
  font-weight: 500;
  fill: var(--text);
}

.diagram .n-tag {
  font-size: 9px;
  letter-spacing: 0.07em;
  fill: var(--text-muted);
}

/* ---------- technology labels ---------- */

.tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  margin-top: 1.5rem;
}

.tech li {
  padding: 0.22rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
}

.tech--inline {
  margin-top: 0.75rem;
}

/* ---------- additional work ---------- */

.additional {
  margin-top: clamp(3rem, 7vw, 4.5rem);
  padding-top: clamp(1.75rem, 4vw, 2.5rem);
  border-top: 1px solid var(--border);
}

.additional__title {
  font-size: 1.1rem;
}

.work {
  margin-top: 1rem;
}

.work__item {
  padding: 1.35rem 0;
  border-top: 1px solid var(--border);
}

.work__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.work__name {
  font-size: 1rem;
}

.work__links {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: flex-end;

}

.work__link,
.work__blog {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding-block: 0.15rem;
  font-size: 0.83rem;
  color: var(--accent);
}
.work__link .icon {
  font-size: 0.9em;
}

.work__link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.work__desc {
  max-width: 72ch;
  margin-top: 0.5rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* ---------- stack ---------- */

.stack {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1.75rem 2.5rem;
  margin-top: clamp(2rem, 5vw, 2.75rem);
}

.stack__group {
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.stack__title {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.45rem;
  margin-top: 0.9rem;
}

.tags li {
  padding: 0.2rem 0.45rem;
  font-size: 0.84rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
}

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

.site-footer {
  margin-top: clamp(4rem, 9vw, 6.5rem);
  padding-top: 2.5rem;
  padding-bottom: 3rem;
  border-top: 1px solid var(--border);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}

.site-footer__links a {
  display: inline-block;
  padding-block: 0.25rem;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.site-footer__links a:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer__meta {
  margin-top: 2rem;
  padding-top: 1.25rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ---------- back to top ---------- */

.to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 30;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  font-size: 1.05rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
}

.to-top[hidden] {
  display: none;
}

.to-top:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ============================================================
   responsive
   ============================================================ */

/* two-column case study body once there is room for it */
@media (min-width: 52em) {
  .case__body {
    grid-template-columns: 1fr 1fr;
  }

  .case__figure {
    grid-template-columns: minmax(15rem, 24rem) 1fr;
    align-items: center;
    gap: 2rem;
  }

  .diagram {
    margin-inline: 0;
  }
}

@media (max-width: 60em) {
  /* With JavaScript the links collapse behind the menu button; without it they
     stay in the header and wrap onto another line. */
  html:not(.js) .site-nav__list {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.25rem 1.1rem;
  }

  html:not(.js) .site-header__inner {
    flex-wrap: wrap;
    padding-block: 0.6rem;
  }

  html.js .nav-toggle {
    display: grid;
  }

  html.js .site-nav {
    position: absolute;
    top: calc(100% + 1px);
    right: calc(var(--gutter) * -1);
    left: calc(var(--gutter) * -1);
    padding: 0.5rem var(--gutter) 1.25rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-0.4rem);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
  }

  html.js .site-nav--open {
    visibility: visible;
    opacity: 1;
    transform: none;
  }

  html.js .site-nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  html.js .site-nav__list li + li {
    border-top: 1px solid var(--border);
  }

  html.js .site-nav__link {
    display: block;
    padding: 0.85rem 0.25rem;
    font-size: 0.95rem;
  }

  html.js .site-nav__link[aria-current="true"]::after {
    display: none;
  }

  html.js .site-nav__link[aria-current="true"] {
    color: var(--accent);
  }
}

@media (max-width: 48em) {
  .job {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .job__meta {
    padding-bottom: 0.75rem;
  }

  .brand__name {
    font-size: 0.9rem;
  }
}

@media (max-width: 34em) {
  .brand__name {
    font-size: 0.85rem;
  }

  .site-header__end {
    gap: 0.85rem;
  }

  .hero__actions .button {
    flex: 1 1 8rem;
    justify-content: center;
  }

  .site-footer__inner {
    flex-direction: column;
  }
}

/* Narrower than the name and the controls can share: the monogram carries the
   header, and the name stays in the accessibility tree. */
@media (max-width: 27em) {
  .brand__name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* ============================================================
   motion preferences
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
