/* AGAFUA — site styles. Colors and sizes are defined once in :root. */
:root {
  --bg: #0d0d0d;
  --surface: #161616;
  --border: #2a2a2a;
  --text: #f0f0f0;
  --text-2: #a0a0a0;
  --accent: #4da6ff;
  --accent-ink: #06121f;

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

  --max: 1160px;      /* maximum content width */
  --measure: 44rem;   /* maximum width of running text */
  --gutter: clamp(20px, 4vw, 40px);
  --radius: 10px;
  --header-h: 64px;
}

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

html {
  background: var(--bg);
  color-scheme: dark;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.7 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, video { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration: none; text-underline-offset: 0.2em; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
main:focus { outline: none; }
::selection { background: rgba(77, 166, 255, 0.35); }

.wrap, .prose {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  padding: 8px 14px; border-radius: 6px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.skip-link:focus { top: 12px; }

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

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(13, 13, 13, 0.82);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.logo {
  color: var(--text);
  font-weight: 700; font-size: 1.12rem; letter-spacing: 0.16em;
}
.logo:hover { text-decoration: none; color: #fff; }
.site-nav { display: flex; gap: clamp(14px, 3vw, 34px); }
.site-nav a {
  position: relative;
  padding: 6px 0;
  color: var(--text-2);
  font-size: 0.94rem;
  transition: color 0.15s;
}
.site-nav a:hover { color: var(--text); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--text); }
.site-nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 2px; border-radius: 2px; background: var(--accent);
}

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

.page { flex: 1 0 auto; padding-block: clamp(40px, 7vw, 88px) clamp(64px, 9vw, 120px); }
.is-loading .page { opacity: 0.55; transition: opacity 0.2s 0.15s; }

/* Running text keeps a readable width; media and layout blocks use the full width. */
.prose > :is(p, ul, ol, h1, h2, h3, h4, pre, hr),
.block-list > * { max-width: var(--measure); }

.prose :is(h1, h2, h3, h4) { margin: 0; line-height: 1.2; font-weight: 650; letter-spacing: -0.015em; text-wrap: balance; }
.prose h1 { font-size: clamp(2.1rem, 4.6vw, 3.25rem); line-height: 1.08; letter-spacing: -0.028em; margin-bottom: 0.55em; }
.prose h2 { font-size: clamp(1.5rem, 2.6vw, 1.95rem); margin-top: 2.6em; margin-bottom: 0.6em; }
.prose h3 { font-size: 1.28rem; margin-top: 2em; margin-bottom: 0.45em; }
.prose h4 { font-size: 1.04rem; margin-top: 1.7em; margin-bottom: 0.35em; }
.prose h4, .prose h3 { letter-spacing: -0.01em; }
.prose :is(h1, h2, h3, h4) a { color: inherit; }
.prose :is(h1, h2, h3, h4) a:hover { color: var(--accent); text-decoration: none; }

.prose p, .prose ul, .prose ol { margin: 0 0 1.15em; color: var(--text-2); text-wrap: pretty; }
.prose h1 + p { font-size: 1.16rem; color: var(--text-2); }
.prose strong { color: var(--text); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li { margin: 0.3em 0; padding-left: 0.2em; }
.prose li::marker { color: #5a5a5a; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 3em 0; }

.prose code {
  font: 0.88em/1.5 var(--mono);
  padding: 0.14em 0.4em; border-radius: 5px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.prose pre {
  margin: 1.6em 0; padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow-x: auto; tab-size: 4;
}
.prose pre code { padding: 0; border: 0; background: none; font-size: 0.86rem; line-height: 1.65; color: #d6d6d6; }

/* ---------- media ---------- */

.media { margin: 1.9em 0; }
.media img, .media video {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.media video { aspect-ratio: 16 / 9; object-fit: contain; background: #000; }
.media img { cursor: zoom-in; }
.media figcaption { margin-top: 0.7em; font-size: 0.88rem; color: var(--text-2); }

.gallery { display: grid; gap: 14px; margin: 1.9em 0; }
.gallery .media { margin: 0; }
.gallery-2 { grid-template-columns: repeat(2, 1fr); }
.gallery-3 { grid-template-columns: repeat(3, 1fr); }
.gallery img { aspect-ratio: 4 / 3; object-fit: cover; }
.media + .gallery, .gallery + .media, .media + .media { margin-top: 14px; }
.media:has(+ .gallery), .media:has(+ .media), .gallery:has(+ .media) { margin-bottom: 14px; }

.inline-img { display: inline-block; max-height: 1.4em; vertical-align: -0.3em; border-radius: 3px; }

.lightbox {
  width: 100vw; height: 100vh; max-width: none; max-height: none;
  margin: 0; padding: 3vmin; border: 0;
  background: rgba(0, 0, 0, 0.92); cursor: zoom-out;
}
.lightbox::backdrop { background: transparent; }
.lightbox img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 22px; margin: 4px 10px 4px 0;
  border: 1px solid var(--border); border-radius: 8px;
  background: transparent; color: var(--text);
  font: 600 0.96rem/1 var(--font); letter-spacing: 0.005em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { border-color: #5a5a5a; background: var(--surface); text-decoration: none; }
/* The first button in a row is the main action. */
p > .btn:first-child, button.btn { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
p > .btn:first-child:hover, button.btn:hover { background: #73b9ff; border-color: #73b9ff; }
.btn[target="_blank"]::after { content: "↗"; margin-left: 0.45em; font-weight: 500; }

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

.block-hero { padding-block: clamp(28px, 7vw, 96px) clamp(40px, 8vw, 104px); }
.block-hero h1 {
  font-size: clamp(3.4rem, 12vw, 8rem); line-height: 0.95;
  font-weight: 700; letter-spacing: 0.035em; margin: 0 0 0.22em -0.04em;
}
.block-hero h2 {
  margin: 0 0 1.1em; font-size: clamp(1.25rem, 2.8vw, 1.9rem);
  font-weight: 500; letter-spacing: -0.01em; color: var(--text);
}
.block-hero p { max-width: 36rem; font-size: 1.14rem; }
.block-hero p:last-child { margin: 1.9em 0 0; }

/* ---------- ::: cards ---------- */

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 1.6em 0 1.4em; }
.card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: inherit;
  transition: border-color 0.2s, transform 0.2s;
}
a.card:hover { border-color: #4a4a4a; transform: translateY(-3px); text-decoration: none; }
.card-media { aspect-ratio: 4 / 3; overflow: hidden; background: #111; }
.card-media img, .card-media video { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
a.card:hover .card-media :is(img, video) { transform: scale(1.035); }
.card-body { padding: 18px 20px 20px; }
.prose .card-body h3 { margin: 0 0 0.35em; font-size: 1.14rem; color: var(--text); }
.prose .card-body p { margin: 0; font-size: 0.95rem; line-height: 1.55; }

/* ---------- ::: list ---------- */

.block-list { margin: 1.4em 0; border-bottom: 1px solid var(--border); }
.block-list > :is(h2, h3, h4) {
  margin: 0; padding-top: 1.05em; border-top: 1px solid var(--border);
  max-width: none; font-size: 1.16rem; font-weight: 600;
}
.block-list > :is(h2, h3, h4):last-child { padding-bottom: 1.05em; }
.block-list > p { margin: 0.3em 0 0; padding-bottom: 1.1em; font-size: 0.98rem; }
.block-list > h3 { font-size: 1.3rem; padding-top: 1.25em; }
.block-list > h3 + p { padding-bottom: 1.35em; }

/* ---------- page specifics ---------- */

/* Home: section headings are quiet labels. */
.page-home { padding-top: 0; }
.page-home .prose > h2 {
  margin: 4.2em 0 0; padding-top: 1.5em; border-top: 1px solid var(--border); max-width: none;
  font: 500 0.8rem/1.4 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-2);
}
.page-home .block-hero + h2 { margin-top: 0; }
.page-home .block-list { border-bottom: 0; margin-top: 0.6em; }
.page-home .block-list > :first-child { border-top: 0; }

/* Projects: each project is a separated block. */
.page-projects .prose > h2 { margin-top: 3.2em; padding-top: 2.2em; border-top: 1px solid var(--border); max-width: none; }

/* Notes: single article pages. */
.page-article .prose > :is(p, ul, ol) { color: #c4c4c4; }
.page-article .prose > p:first-child { margin-bottom: 2.2em; font-size: 0.9rem; }
.page-article .prose > p:first-child a { color: var(--text-2); }
.page-article .prose > p:first-child a:hover { color: var(--accent); text-decoration: none; }

.page-not-found .prose { padding-block: 8vh; }

/* ---------- ::: form ---------- */

.contact-form { display: grid; gap: 18px; max-width: 34rem; margin: 2.2em 0; }
.contact-form label { display: grid; gap: 7px; }
.contact-form label span { font-size: 0.86rem; color: var(--text-2); }
.contact-form input, .contact-form textarea {
  width: 100%; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font: inherit; font-size: 1rem; line-height: 1.5;
}
.contact-form textarea { resize: vertical; min-height: 9em; }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(77, 166, 255, 0.18); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.form-actions .btn { margin: 0; }
.prose .form-status { margin: 0; font-size: 0.9rem; flex: 1 1 16rem; }

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

.site-footer { border-top: 1px solid var(--border); color: var(--text-2); font-size: 0.9rem; line-height: 1.6; }
.site-footer .wrap {
  display: grid; grid-template-columns: 1fr auto auto; align-items: start; gap: 12px 56px;
  padding-block: 34px 40px;
}
.site-footer strong { color: var(--text); font-weight: 600; letter-spacing: 0.02em; }
.footer-company, .footer-links { display: grid; gap: 2px; }
.site-footer a { color: var(--text-2); }
.site-footer a:hover { color: var(--accent); text-decoration: none; }

/* ---------- small screens ---------- */

@media (max-width: 860px) {
  .cards { grid-template-columns: 1fr; max-width: 34rem; }
  .gallery-3 { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}
@media (max-width: 620px) {
  body { font-size: 16px; }
  :root { --header-h: 58px; }
  .logo { font-size: 1rem; letter-spacing: 0.12em; }
  .site-nav a { font-size: 0.86rem; }
  .gallery-2, .gallery { gap: 8px; }
  .site-footer .wrap { grid-template-columns: 1fr; }
  .btn { margin-right: 8px; padding: 0 18px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
