/* ==========================================================================
   profile.cloudofthings.net

   Tokens, fonts and the console look come from the Cloud of Things
   WordPress theme (theme.json, styles/light.json, assets/css/theme.css),
   so the profile and the blog read as one site.

   Everything is first-party: fonts are self-hosted, icons are inline SVG,
   and there is no JavaScript. The CSP in template.yaml relies on that, and
   it also means no inline style="" attributes anywhere in index.html.
   ========================================================================== */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-latin-variable.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("fonts/jetbrains-mono-latin-variable.woff2") format("woff2");
}

/* --------------------------------------------------------------------------
   Tokens. Dark is the default, as on the blog; light is the theme's "Light"
   style variation, used when the visitor's system asks for it.
   -------------------------------------------------------------------------- */
:root {
  --base: #0a0c10;
  --surface: #12161d;
  --surface-2: #1a1f28;
  --line: #232a35;
  --line-strong: #313a48;
  --text: #e6edf3;
  --muted: #9aa7b4;
  --dim: #6b7785;
  --accent: #22d3ee;
  --accent-2: #fbbf24;
  --on-accent: #04181d;
  --accent-ghost: rgb(34 211 238 / 0.10);
  --accent-line: rgb(34 211 238 / 0.35);
  --accent-glow: rgb(34 211 238 / 0.18);

  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "Cascadia Code", Menlo, Consolas, monospace;

  /* The theme's fluid type scale. */
  --fs-xs: clamp(0.69rem, 0.66rem + 0.13vw, 0.77rem);
  --fs-s: clamp(0.83rem, 0.79rem + 0.18vw, 0.94rem);
  --fs-m: clamp(1rem, 0.96rem + 0.21vw, 1.13rem);
  --fs-l: clamp(1.2rem, 1.13rem + 0.35vw, 1.42rem);
  --fs-xl: clamp(1.44rem, 1.33rem + 0.56vw, 1.8rem);
  --fs-5xl: clamp(2.6rem, 1.9rem + 3.4vw, 4.57rem);

  --gutter: clamp(1rem, 0.6rem + 2vw, 2.5rem);
  --header-h: 3.75rem;
  --wide: 76rem;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --dur: 220ms;
  --dur-fast: 120ms;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --base: #f7f9fb;
    --surface: #ffffff;
    --surface-2: #eef2f6;
    --line: #dde3ea;
    --line-strong: #c3ccd6;
    --text: #0f172a;
    --muted: #475569;
    --dim: #64748b;
    --accent: #0e7490;
    --accent-2: #b45309;
    --on-accent: #ffffff;
    --accent-ghost: rgb(14 116 144 / 0.08);
    --accent-line: rgb(14 116 144 / 0.30);
    --accent-glow: rgb(14 116 144 / 0.10);
    color-scheme: light;
  }
}

@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root {
    --muted: #c4cdd6;
    --dim: #9aa7b4;
    --line: #3a4350;
    --line-strong: #566173;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-block-start: calc(var(--header-h) + 1rem);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-block-size: 100svh;
  overflow-x: hidden;
  background: var(--base);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--fs-m);
  line-height: 1.7;
}

/* Console grid texture plus a soft accent glow, as on the blog. Fixed
   pseudo-element rather than background-attachment: fixed, which janks on
   mobile. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    radial-gradient(60rem 40rem at 70% -10rem, var(--accent-glow), transparent 70%),
    repeating-linear-gradient(to right, var(--line) 0 1px, transparent 1px 4rem),
    repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 4rem);
  mask-image: linear-gradient(to bottom, #000 0, #000 40rem, transparent 70rem);
}

h1, h2, h3 {
  font-family: var(--mono);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0;
}

p { margin: 0; text-wrap: pretty; }
ul { margin: 0; padding: 0; list-style: none; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

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

.wrap {
  inline-size: min(var(--wide), 100% - 2 * max(var(--gutter), env(safe-area-inset-left)));
  margin-inline: auto;
}

.skip {
  position: absolute;
  inset-inline-start: 1rem;
  inset-block-start: -3rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--mono);
  font-size: var(--fs-s);
  border-radius: 8px;
}

.skip:focus { inset-block-start: 1rem; }

.icon { inline-size: 1.05em; block-size: 1.05em; flex: none; }

/* --------------------------------------------------------------------------
   Buttons (the theme's button element: accent fill, mono, 8px radius)
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6ch;
  min-block-size: 2.75rem;
  padding: 0.6rem 1.15rem;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--mono);
  font-size: var(--fs-s);
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}

.btn:hover { background: color-mix(in srgb, var(--accent) 86%, var(--text)); }

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line-strong);
}

.btn--ghost:hover {
  background: var(--accent-ghost);
  border-color: var(--accent-line);
  color: var(--accent);
}

.btn--small { min-block-size: 2.25rem; padding: 0.35rem 0.9rem; font-size: var(--fs-xs); }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 50;
  padding-block-start: env(safe-area-inset-top);
  background: var(--base);
  border-block-end: 1px solid var(--line);
}

@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .site-header {
    background: color-mix(in srgb, var(--base) 78%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    backdrop-filter: blur(14px) saturate(160%);
  }
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-block-size: var(--header-h);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55ch;
  color: var(--text);
  text-decoration: none;
  font-family: var(--mono);
  font-size: var(--fs-m);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.mark { display: block; flex: none; color: var(--accent); }

/* Blinking block cursor after the wordmark, as on the blog. */
.wordmark__text::after {
  content: "";
  display: inline-block;
  inline-size: 0.55ch;
  block-size: 1.05em;
  margin-inline-start: 0.2ch;
  translate: 0 0.15em;
  background: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--mono);
  font-size: var(--fs-s);
}

.site-nav__link {
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}

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

.site-nav .btn { margin-inline-start: 0.5rem; }

/* On a phone the section links would crowd the wordmark; the page is short
   and the graph in the hero links the sections too. */
@media (width < 44rem) {
  .site-nav__link { display: none; }
  .wordmark { font-size: var(--fs-s); }
}

/* --------------------------------------------------------------------------
   Hero: text on the left, the graph on the right
   -------------------------------------------------------------------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 1rem + 4vw, 4rem);
  padding-block: clamp(3rem, 2rem + 5vw, 6rem) clamp(2.5rem, 2rem + 3vw, 4.5rem);
}

@media (width >= 60rem) {
  .hero {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    min-block-size: min(calc(100svh - var(--header-h)), 40rem);
  }
}

.hero__text { display: grid; gap: 1.25rem; justify-items: start; }

.prompt {
  font-family: var(--mono);
  font-size: var(--fs-s);
  color: var(--muted);
}

.prompt::before { content: "$ "; color: var(--accent); }

.hero__name {
  font-size: var(--fs-5xl);
  letter-spacing: -0.035em;
  line-height: 1.02;
}

.hero__role {
  font-family: var(--mono);
  font-size: var(--fs-l);
  font-weight: 500;
  color: var(--accent);
}

.hero__lede {
  max-inline-size: 44ch;
  color: var(--muted);
  font-size: var(--fs-l);
  line-height: 1.45;
}

.hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-block-start: 0.5rem; }

.hero__status {
  display: inline-flex;
  align-items: center;
  gap: 0.75ch;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.hero__status::before {
  content: "";
  flex: none;
  inline-size: 0.5rem;
  block-size: 0.5rem;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-2) 20%, transparent);
}

/* --------------------------------------------------------------------------
   The graph. Colours come from the tokens, so it follows light and dark.
   -------------------------------------------------------------------------- */
.graph { inline-size: 100%; max-inline-size: 36rem; justify-self: center; }

.graph__svg { display: block; inline-size: 100%; block-size: auto; overflow: visible; }

.graph__sats path { stroke: var(--line-strong); stroke-width: 1.5; fill: none; }
.graph__sats circle { fill: var(--line-strong); }

.spoke { text-decoration: none; outline: none; }

.spoke__edge {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  transition: stroke var(--dur) var(--ease);
}

.spoke__hit { fill: transparent; }

.spoke__node {
  fill: var(--base);
  stroke: var(--accent);
  stroke-width: 3;
  transition: fill var(--dur) var(--ease), r var(--dur) var(--ease);
}

.spoke__label {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 500;
  text-anchor: middle;
  transition: fill var(--dur) var(--ease);
}

/* The graph scales down on a phone; keep the labels readable (about 13px). */
@media (width < 44rem) {
  .spoke__label { font-size: 26px; }
}

.spoke:hover .spoke__edge,
.spoke:focus-visible .spoke__edge { stroke: var(--accent); }

.spoke:hover .spoke__node,
.spoke:focus-visible .spoke__node { fill: var(--accent); r: 18px; }

.spoke:hover .spoke__label,
.spoke:focus-visible .spoke__label { fill: var(--text); }

/* An outline on an SVG link is unreliable, so focus gets a dashed ring. */
.spoke:focus-visible .spoke__hit { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 4; }

.graph__packets circle { fill: var(--accent); }

.graph__hub-ring { fill: var(--surface); stroke: var(--accent); stroke-width: 3; }

/* One orchestrated moment on load: the spokes grow out of the hub, then the
   nodes appear, then the packets start (their SMIL begin times match). */
@media (prefers-reduced-motion: no-preference) {
  .spoke__edge { animation: draw 0.9s var(--ease) both; }
  .spoke__node, .spoke__label { animation: appear 0.5s var(--ease) both; }
  .graph__sats { animation: appear 0.8s var(--ease) 1.1s both; }

  .spoke--2 .spoke__edge { animation-delay: 0.08s; }
  .spoke--3 .spoke__edge { animation-delay: 0.16s; }
  .spoke--4 .spoke__edge { animation-delay: 0.24s; }
  .spoke--5 .spoke__edge { animation-delay: 0.32s; }
  .spoke--1 .spoke__node, .spoke--1 .spoke__label { animation-delay: 0.7s; }
  .spoke--2 .spoke__node, .spoke--2 .spoke__label { animation-delay: 0.78s; }
  .spoke--3 .spoke__node, .spoke--3 .spoke__label { animation-delay: 0.86s; }
  .spoke--4 .spoke__node, .spoke--4 .spoke__label { animation-delay: 0.94s; }
  .spoke--5 .spoke__node, .spoke--5 .spoke__label { animation-delay: 1.02s; }
}

@media (prefers-reduced-motion: reduce) {
  .graph__packets { display: none; }
}

/* Each edge path runs from its node to the hub. A negative offset hides the
   dash past the hub end, so animating it to 0 grows the edge from the hub. */
@keyframes draw { from { stroke-dashoffset: -1; } to { stroke-dashoffset: 0; } }
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */
.section { padding-block: clamp(2.5rem, 2rem + 3vw, 4.5rem); }

.section__title {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-block-end: 2rem;
  font-size: var(--fs-s);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.section__title::before { content: "//"; color: var(--accent); }

.section__title::after {
  content: "";
  flex: 1;
  block-size: 1px;
  background: linear-gradient(to right, var(--line), transparent);
}

.subhead {
  margin-block: 2.25rem 0.75rem;
  font-size: var(--fs-s);
  font-weight: 500;
  color: var(--dim);
}

.note {
  margin-block-start: 1.75rem;
  max-inline-size: 70ch;
  color: var(--muted);
  font-size: var(--fs-s);
}

.note a { font-family: var(--mono); white-space: nowrap; margin-inline-start: 0.5ch; }

/* --------------------------------------------------------------------------
   Certifications. Current ones are large, earlier ones a quiet list.
   -------------------------------------------------------------------------- */
.certs--current {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 1rem;
}

.certs--current .cert {
  display: grid;
  gap: 0.75rem;
  align-content: space-between;
  padding: 1.5rem 1.5rem 1.25rem;
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--accent);
  border-radius: 4px 14px 14px 4px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}

.certs--current .cert__name {
  font-family: var(--mono);
  font-size: var(--fs-l);
  font-weight: 600;
  line-height: 1.25;
}

.cert__meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.6ch;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-ghost);
  color: var(--accent);
}

.status::before {
  content: "";
  inline-size: 0.45rem;
  block-size: 0.45rem;
  border-radius: 50%;
  background: currentColor;
}

.certs--earlier .cert {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem 1.5rem;
  padding-block: 0.85rem;
  border-block-end: 1px solid var(--line);
}

.certs--earlier .cert:first-child { border-block-start: 1px solid var(--line); }

/* --------------------------------------------------------------------------
   Stack: a definition list, one row per group
   -------------------------------------------------------------------------- */
.stack { margin: 0; display: grid; }

.stack__group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem 2rem;
  padding-block: 1.1rem;
  border-block-end: 1px solid var(--line);
}

.stack__group:first-child { border-block-start: 1px solid var(--line); }

@media (width >= 44rem) {
  .stack__group { grid-template-columns: 14rem minmax(0, 1fr); align-items: baseline; }
}

.stack dt {
  font-family: var(--mono);
  font-size: var(--fs-s);
  font-weight: 600;
  color: var(--text);
}

.stack dd { margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.chips li {
  padding: 0.2rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Work: one featured repository as a console window, then plain links
   -------------------------------------------------------------------------- */
.work {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.5rem, 1rem + 2vw, 3rem);
  align-items: start;
}

@media (width >= 60rem) {
  .work { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
}

.console {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}

.console__bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-block-size: 2.5rem;
  padding: 0.5rem 1rem;
  background: var(--surface-2);
  border-block-end: 1px solid var(--line);
}

.console__dots { display: inline-flex; gap: 0.4rem; }

.console__dots i {
  inline-size: 0.6rem;
  block-size: 0.6rem;
  border-radius: 50%;
  background: var(--line-strong);
}

.console__dots i:first-child { background: var(--accent-2); }

.console__path {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  overflow-wrap: anywhere;
}

.console__body { display: grid; gap: 1rem; padding: clamp(1.25rem, 1rem + 1.5vw, 2rem); }

.console__title { font-size: var(--fs-xl); letter-spacing: -0.02em; }
.console__title a { color: var(--text); text-decoration: none; }
.console__title a:hover { color: var(--accent); }

.console__body p { color: var(--muted); max-inline-size: 60ch; }

.console__body .console__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-family: var(--mono);
  font-size: var(--fs-s);
}

.links { display: grid; }

.links__item {
  display: grid;
  gap: 0.35rem;
  padding-block: 1.1rem;
  border-block-end: 1px solid var(--line);
}

.links__item:first-child { padding-block-start: 0; }

.links__title {
  justify-self: start;
  font-family: var(--mono);
  font-size: var(--fs-m);
  font-weight: 600;
  text-decoration: none;
}

.links__title:hover { text-decoration: underline; }

.links__item p { color: var(--muted); font-size: var(--fs-s); }

/* --------------------------------------------------------------------------
   Off the keyboard
   -------------------------------------------------------------------------- */
.off {
  max-inline-size: 40ch;
  font-size: var(--fs-l);
  line-height: 1.45;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
  margin-block-start: clamp(2rem, 1rem + 4vw, 5rem);
  padding-block: clamp(2.5rem, 2rem + 3vw, 4rem) calc(2rem + env(safe-area-inset-bottom));
  border-block-start: 1px solid var(--line);
  background: var(--surface);
}

.contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2rem;
}

.contact__text {
  font-family: var(--mono);
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-block-start: 2.5rem;
  padding-block-start: 1.5rem;
  border-block-start: 1px solid var(--line);
}

.credit {
  display: inline-flex;
  align-items: center;
  gap: 0.6ch;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--dim);
}

/* --------------------------------------------------------------------------
   Preferences
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .wordmark__text::after { animation: blink 1.2s steps(1) infinite; }
}

@keyframes blink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  body::before, .site-header, .graph, .skip { display: none; }
  body { background: #fff; color: #000; }
}
