/* Public site: premium dark graphite theme. Electric blue and violet accents, subtle technical grid. */
:root {
  --bg: #0d0f14;
  --bg-2: #11141b;
  --surface: #151923;
  --surface-2: #1b2030;
  --line: #262c3b;
  --line-2: #323a4e;
  --text: #e9ecf3;
  --muted: #9aa3b8;
  --blue: #4c8dff;
  --blue-2: #2f6bff;
  --violet: #8b6cff;
  --ok: #4ade80;
  --err: #ff7a7a;
  --grad: linear-gradient(135deg, var(--blue-2), var(--violet));
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 14px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { overflow-x: hidden; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}
/* technical grid, fading out towards the bottom of the first screen */
body::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 46rem;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.35;
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 0%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 70% at 50% 0%, #000 20%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: '';
  position: absolute;
  top: -10rem;
  right: 0;
  width: 38rem;
  height: 30rem;
  background: radial-gradient(closest-side, rgba(139, 108, 255, 0.22), transparent);
  pointer-events: none;
  z-index: 0;
}
.site-header, main, .site-footer { position: relative; z-index: 1; }

img { max-width: 100%; display: block; }
a { color: var(--blue); text-underline-offset: 0.2em; }
a:hover { color: #86b1ff; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 4px; }
p { margin: 0 0 1em; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 0.5em; font-weight: 650; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--surface-2); padding: 0.1em 0.4em; border-radius: 6px; }

.wrap { width: min(100% - 2.5rem, 70rem); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 0; background: var(--blue); color: #fff; padding: 0.6rem 1rem; z-index: 50; }
.skip:focus { left: 0.5rem; top: 0.5rem; }
.loading { color: var(--muted); padding: 4rem 0; }
/* Without JavaScript the <noscript> fallback has element children; then "Loading…" is hidden. */
.wrap:has(> noscript > *) > .loading { display: none; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(13, 15, 20, 0.78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4rem; }
.brand { display: inline-flex; align-items: center; gap: 0.7rem; color: var(--text); text-decoration: none; font-weight: 600; letter-spacing: -0.01em; }
.logo { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 10px; background: var(--grad); color: #fff; font-family: var(--mono); font-size: 0.8rem; font-weight: 500; }
nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
nav a { color: var(--muted); text-decoration: none; padding: 0.45rem 0.85rem; border-radius: 999px; font-size: 0.95rem; transition: color 0.2s, background 0.2s; }
nav a:hover { color: var(--text); background: var(--surface); }
nav a[aria-current='page'] { color: #fff; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.menu-btn { display: none; background: var(--surface); color: var(--text); border: 1px solid var(--line-2); border-radius: 10px; padding: 0.45rem 0.9rem; font: inherit; font-size: 0.9rem; cursor: pointer; }

/* ---------- blocks and reveal ---------- */
main { flex: 1; }
.block { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .reveal.in { opacity: 1; transform: none; }

.eyebrow { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--blue); margin: 0 0 0.9rem; }
.sec-head { margin-bottom: 1.8rem; }
.sec-head h1, .sec-head h2 { font-size: clamp(1.7rem, 3.2vw, 2.3rem); margin: 0; }
.sec-head::after { content: ''; display: block; width: 3rem; height: 3px; border-radius: 3px; background: var(--grad); margin-top: 0.9rem; }
.intro { color: var(--muted); max-width: 42rem; margin-bottom: 1.6rem; }

/* ---------- buttons, chips ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 1.6rem 0 0; }
.btn { display: inline-block; background: var(--grad); color: #fff; border: 0; border-radius: 10px; padding: 0.7rem 1.3rem; font: inherit; font-weight: 550; font-size: 0.97rem; text-decoration: none; cursor: pointer; box-shadow: 0 6px 22px rgba(76, 100, 255, 0.28); transition: transform 0.15s, box-shadow 0.15s, filter 0.15s; }
.btn:hover { color: #fff; transform: translateY(-1px); filter: brightness(1.1); }
.btn.secondary { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.secondary:hover { background: var(--surface); }
.btn:disabled { opacity: 0.6; cursor: wait; transform: none; }
.chips { list-style: none; padding: 0; margin: 1.2rem 0 0; display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chips li { font-family: var(--mono); font-size: 0.76rem; padding: 0.22rem 0.65rem; border-radius: 999px; color: #b9c6ff; background: rgba(76, 141, 255, 0.1); border: 1px solid rgba(76, 141, 255, 0.25); }
.card .chips, .rows .chips { margin-top: 0.8rem; }

/* ---------- hero ---------- */
.block-hero { padding-top: clamp(3rem, 8vw, 6rem); }
.hero-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(2rem, 6vw, 4.5rem); align-items: center; }
.hero-grid.no-photo { grid-template-columns: minmax(0, 46rem); }
.hero h1 { font-size: clamp(2.2rem, 5.2vw, 3.9rem); line-height: 1.08; letter-spacing: -0.035em; margin: 0 0 1rem; background: linear-gradient(120deg, #ffffff 30%, #9db8ff 70%, #b7a2ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-name { font-family: var(--mono); font-size: 0.88rem; color: var(--muted); margin-bottom: 1.2rem; }
.lede { font-size: 1.15rem; color: #c3cadb; max-width: 40rem; }
.status-pill { display: inline-block; font-size: 0.85rem; color: var(--ok); border: 1px solid rgba(74, 222, 128, 0.35); background: rgba(74, 222, 128, 0.08); padding: 0.2rem 0.8rem; border-radius: 999px; }
.portrait { margin: 0; position: relative; justify-self: center; width: min(100%, 22rem); }
.portrait::before { content: ''; position: absolute; inset: -2px; border-radius: 24px; background: var(--grad); opacity: 0.7; filter: blur(22px); z-index: -1; }
.portrait img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 22px; border: 1px solid var(--line-2); background: var(--surface); }
.portrait figcaption { margin-top: 0.7rem; font-family: var(--mono); font-size: 0.78rem; color: var(--muted); text-align: center; }

/* ---------- tiles (interests, expertise) ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; }
.tile { display: block; background: linear-gradient(180deg, var(--surface), var(--bg-2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; color: var(--text); text-decoration: none; transition: border-color 0.2s, transform 0.2s; }
a.tile:hover, .tile:hover { border-color: var(--line-2); transform: translateY(-2px); color: var(--text); }
.tile .num { font-family: var(--mono); font-size: 0.78rem; color: var(--violet); }
.tile h3 { font-size: 1.1rem; margin: 0.5rem 0 0.3rem; }
.tile p { color: var(--muted); font-size: 0.95rem; margin: 0.3rem 0 0; }
.tile .tools { font-family: var(--mono); font-size: 0.78rem; color: #b9c6ff; }

/* ---------- project cards ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.4rem; }
.filters button { font: inherit; font-size: 0.85rem; background: var(--surface); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.9rem; cursor: pointer; }
.filters button[aria-pressed='true'] { color: #fff; background: var(--surface-2); border-color: var(--blue); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1.2rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s; }
.card:hover { border-color: var(--line-2); transform: translateY(-3px); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35); }
.card img, .card-art { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-2); }
.card-art { background: linear-gradient(135deg, rgba(47, 107, 255, 0.35), rgba(139, 108, 255, 0.25)), var(--surface-2); }
.card-body { padding: 1.2rem 1.3rem 1.4rem; }
.card h3 { font-size: 1.15rem; margin: 0.1rem 0 0.4rem; }
.card-open, .post-open { all: unset; cursor: pointer; color: var(--text); }
.card-open:hover, .post-open:hover { color: #9dbbff; }
.card-open:focus-visible, .post-open:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 4px; }
.meta { font-family: var(--mono); font-size: 0.76rem; color: var(--muted); margin: 0 0 0.4rem; text-transform: uppercase; letter-spacing: 0.04em; }
.summary { color: #b6bed2; font-size: 0.97rem; margin: 0; }
.more { margin-top: 1.6rem; }

/* ---------- rows (research, certificates, posts) ---------- */
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.rows > li { display: grid; grid-template-columns: 9rem 1fr auto; gap: 1.3rem; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.rows > li.no-thumb { grid-template-columns: 1fr auto; }
.rows h3 { font-size: 1.12rem; margin: 0 0 0.3rem; }
.thumb { all: unset; cursor: pointer; display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-2); }
.thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.links { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.9rem; align-items: flex-end; }
.links a { white-space: nowrap; }

/* ---------- about, prose ---------- */
.prose { max-width: 44rem; }
.prose h2 { font-size: 1.5rem; margin-top: 1.8em; }
.prose h3 { font-size: 1.2rem; margin-top: 1.5em; }
.prose h4 { font-size: 1.05rem; margin-top: 1.3em; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1em; }
.prose li { margin: 0.25em 0; }
.prose blockquote { margin: 1.2em 0; padding: 0.2em 0 0.2em 1.1rem; border-left: 3px solid var(--violet); color: #c3cadb; }
.prose blockquote p { margin: 0; }
.inline-img { margin: 1.4rem 0; }
.inline-img img, .wide-img img { border-radius: var(--radius); border: 1px solid var(--line); width: 100%; }
figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 0.5rem; }
.sub { font-size: 1.05rem; margin: 2.2rem 0 0.8rem; color: var(--muted); font-family: var(--mono); font-weight: 500; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.1em; }
.cv-row { display: grid; grid-template-columns: 11rem 1fr; gap: 1.2rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.cv-row.solo { grid-template-columns: 1fr; }
.cv-row p { margin: 0 0 0.25em; }
.cv-row .when { color: var(--muted); font-size: 0.9rem; font-family: var(--mono); }
.cv-row .chips { margin: 0; }
.detail { color: var(--muted); font-size: 0.95rem; }

/* ---------- call to action, contact ---------- */
.cta-box { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap; padding: clamp(1.6rem, 4vw, 2.6rem); border-radius: 20px; border: 1px solid var(--line-2); background: radial-gradient(120% 140% at 0% 0%, rgba(76, 141, 255, 0.16), transparent 60%), radial-gradient(100% 140% at 100% 100%, rgba(139, 108, 255, 0.16), transparent 60%), var(--surface); }
.cta-box h2 { margin: 0 0 0.3rem; font-size: 1.6rem; }
.cta-box p { margin: 0; color: var(--muted); }
.contact { display: grid; grid-template-columns: 1fr 1.3fr; gap: clamp(1.5rem, 5vw, 3.5rem); align-items: start; }
.contact-info p { color: #c3cadb; }
.contact-info .mail { font-size: 1.1rem; }
.linklist { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 0.35rem; }
.contact-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.35rem; }
input[type='text'], input[type='email'], textarea { width: 100%; font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 0.7rem 0.85rem; }
input:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(76, 141, 255, 0.25); }
textarea { resize: vertical; min-height: 8rem; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.contact-form .actions { margin-top: 0.4rem; }
.status { margin: 0.9rem 0 0; font-size: 0.95rem; min-height: 1.4em; color: var(--muted); }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }

/* ---------- dialog ---------- */
dialog { width: min(100% - 1.5rem, 52rem); max-height: 90vh; padding: 0; border: 1px solid var(--line-2); border-radius: 18px; background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(5, 6, 10, 0.75); backdrop-filter: blur(4px); }
.dlg { padding: clamp(1.4rem, 4vw, 2.4rem); }
.dlg h2 { font-size: 1.7rem; }
.close { position: sticky; top: 0.6rem; float: right; margin: 0.6rem 0.6rem 0 0; z-index: 2; background: var(--surface-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 999px; padding: 0.3rem 0.9rem; font: inherit; font-size: 0.85rem; cursor: pointer; }
.gallery { display: grid; gap: 0.8rem; margin: 1.2rem 0; }
.gallery.multi { grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
.gallery img { border-radius: 10px; border: 1px solid var(--line); width: 100%; }
.out { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 1.4rem; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 3rem; padding: 1.6rem 0; color: var(--muted); font-size: 0.9rem; }
.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.foot p { margin: 0; }
.foot ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 1.2rem; flex-wrap: wrap; }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--text); }

/* ---------- small screens ---------- */
@media (max-width: 52rem) {
  .menu-btn { display: inline-block; }
  nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; background: var(--bg-2); border-bottom: 1px solid var(--line); padding: 0.6rem 1.25rem 1rem; }
  nav.open { display: flex; }
  nav a { padding: 0.7rem 0.9rem; }
  .hero-grid, .contact { grid-template-columns: 1fr; }
  .portrait { order: -1; width: min(70%, 15rem); }
  .rows > li, .rows > li.no-thumb { grid-template-columns: 1fr; }
  .links { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
  .thumb { max-width: 12rem; }
  .cv-row { grid-template-columns: 1fr; gap: 0.2rem; }
}

/* ---------- v1.1 additions ---------- */
.preview-bar { position: sticky; top: 0; z-index: 60; background: linear-gradient(135deg, #3a2a7a, #1f3f8f); color: #fff; font-size: 0.9rem; padding: 0.55rem 1rem; text-align: center; border-bottom: 1px solid var(--line-2); }
.preview-bar a { color: #fff; text-decoration: underline; margin-left: 0.4rem; }
.is-preview .site-header { top: 2.4rem; }
.meta.cred { margin-top: 0.15rem; }
.mono { font-family: var(--mono); }

/* anonymous like button */
.likes { display: flex; align-items: center; gap: .75rem; margin-top: 1.25rem; }
.like-btn { font: inherit; font-weight: 600; padding: .5rem 1rem; border-radius: 999px; border: 1px solid var(--line, #3a4150); background: transparent; color: inherit; cursor: pointer; }
.like-btn:hover:not(:disabled) { border-color: #8fa8ff; }
.like-btn:focus-visible { outline: 3px solid #8fa8ff; outline-offset: 2px; }
.like-btn[aria-pressed="true"] { color: #ff8fb1; border-color: #ff8fb1; cursor: default; }
.like-note { font-size: .9rem; opacity: .85; }
