/* Dark, text-first theme. Display font for headings, Inter for body. */
:root {
  --bg: #0b1426;
  --bg-elev: #111d33;
  --border: #1f2d4a;
  --fg: #f2f2f2;
  --fg-2: #b7c0d4;
  --muted: #7f8ba6;
  --accent: #2fbf71;
  --accent-bright: #32d57a;
  --display: "Tektur", "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --body: "Inter", -apple-system, system-ui, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

html { color-scheme: dark; background: var(--bg); }
body {
  margin: 0;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--fg);
  font: 400 17px/1.65 var(--body);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-bright); }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 1.5rem; }
.muted { color: var(--muted); }

h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0; }
h2 { font-size: 2rem; margin-bottom: 1.75rem; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); }
.site-header .wrap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 76px; }
.site-header nav { text-align: center; }
.logo {
  justify-self: start; display: inline-flex; align-items: center; gap: .35rem; height: 48px; padding: 0 .8rem;
  background: #050b18; border: 1px solid var(--border); border-radius: 6px; color: #fff;
}
.logo-text { font: italic 500 1.15rem/1 "Ubuntu", "Ubuntu Sans", system-ui, sans-serif; letter-spacing: .02em; }
.logo .tryzub { color: var(--accent-bright); flex: none; }
.logo:hover .tryzub { color: #ffd500; }
.site-header nav a { font-family: var(--display); font-size: .95rem; margin: 0 .9rem; color: var(--fg); }
.lang-switch { justify-self: end; display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; font-size: .8rem; font-weight: 600; letter-spacing: .05em; }
.lang-switch a { padding: .35rem .7rem; color: var(--muted); }
.lang-switch a.active { background: var(--bg-elev); color: var(--fg); }
.lang-switch a:hover { color: var(--accent-bright); }
.ig-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.ig-tile { display: block; text-decoration: none; color: inherit; }
.ig-tile img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }
.ig-caption { display: flex; justify-content: space-between; gap: .5rem; margin-top: .5rem; font-size: .85rem; color: var(--muted); }
.ig-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ig-view { flex: none; }
.ig-tile:hover img { border-color: var(--accent); }
.ig-tile:hover .ig-view { color: var(--accent); }
@media (max-width: 600px) { .ig-grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; } }

.search-form { display: flex; gap: .6rem; max-width: 30rem; margin: -.5rem 0 1.5rem; }
.search-form input { flex: 1; padding: .6rem .9rem; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 6px; color: var(--fg); font: inherit; }
.search-form button { padding: .6rem 1.1rem; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 6px; color: var(--fg); font: inherit; cursor: pointer; }
.search-form button:hover { border-color: var(--accent); color: var(--accent); }
.search-results { font-size: .9rem; margin: -.8rem 0 2rem; }
.search-results a { color: var(--accent); margin-left: .4rem; }
.lang-filter { font-size: .9rem; margin: -.5rem 0 2rem; }
.lang-filter a { color: var(--accent); }
.translation-note { margin: -1.25rem 0 2rem; color: var(--fg-2); }
.translation-note a { color: var(--accent-bright); text-decoration: underline; text-underline-offset: 3px; }
.site-header nav a:hover { color: var(--accent-bright); }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 3rem; align-items: center; padding: 6rem 0 4rem; }
.hero h1 { font-size: clamp(2.2rem, 4.2vw, 3.4rem); max-width: 20ch; }
.bio { color: var(--fg-2); font-size: 1.15rem; max-width: 52ch; margin: 1.75rem 0 .5rem; }
.location { color: var(--muted); margin: 0 0 1.5rem; font-size: .95rem; }
.social { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; }
.social a { display: inline-flex; align-items: center; gap: .45rem; font-weight: 500; color: var(--fg-2); }
.social a:hover { color: var(--accent-bright); }
.social .icon { opacity: .8; }
.hero-art svg { width: 100%; height: auto; max-height: 300px; }

.section { padding: 3rem 0; }

/* Contribution graph */
/* minmax(0, 1fr): a plain 1fr column grows to the grid's full width on phones instead of letting .contrib-scroll scroll. */
.contrib { display: grid; grid-template-columns: minmax(0, 1fr); }
.contrib-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; padding: 1.5rem 2rem 1.75rem; }
.contrib-viewport { position: relative; }
.contrib-scroll { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent; -webkit-overflow-scrolling: touch; }
/* Edge fades hint that the strip continues; the script drops them at either end. */
.contrib-viewport::before, .contrib-viewport::after { content: ""; position: absolute; top: 0; bottom: 0; width: 2.5rem; pointer-events: none; opacity: 0; transition: opacity .2s; }
.contrib-viewport::before { left: 0; background: linear-gradient(to right, var(--bg-elev), transparent); }
.contrib-viewport::after { right: 0; background: linear-gradient(to left, var(--bg-elev), transparent); }
.contrib-viewport.more-before::before, .contrib-viewport.more-after::after { opacity: 1; }
.contrib-months, .contrib-grid { --cell: 16px; --gap: 4px; display: grid; grid-auto-columns: var(--cell); column-gap: var(--gap); }
.contrib-months { grid-template-rows: 1fr; grid-auto-flow: column; height: 1.6rem; font-size: .85rem; white-space: nowrap; }
.contrib-grid { grid-template-rows: repeat(7, var(--cell)); grid-auto-flow: column; row-gap: var(--gap); }
.contrib-grid i, .legend i { display: block; width: var(--cell, 16px); height: var(--cell, 16px); border-radius: 3px; background: #0d1a2e; }
.l1 { background: #0e4429 !important; }
.l2 { background: #006d32 !important; }
.l3 { background: #26a641 !important; }
.l4 { background: #39d353 !important; }
.contrib-foot { display: flex; justify-content: space-between; margin-top: 1rem; font-size: .95rem; }
.legend { display: inline-flex; align-items: center; gap: 4px; }
.legend i { --cell: 14px; display: inline-block; }

/* Work experience */
.jobs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3rem 4rem; }
.job { display: grid; grid-template-columns: 96px 1fr; gap: 1.5rem; position: relative; }
.job-logo {
  position: relative; z-index: 1; width: 96px; height: 96px; display: grid; place-items: center;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px;
}
.job-logo img { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; }
.job-logo span { font-family: var(--display); font-size: 2rem; color: var(--accent); }
.job::after { content: ""; position: absolute; left: 47px; top: 96px; bottom: -3rem; width: 1px; background: var(--border); }
.job:nth-last-child(-n+2)::after { display: none; }
.job h3 { font-size: 1.25rem; padding-top: .35rem; }
.job-role { margin: .15rem 0 .35rem; font-size: 1.05rem; }
.job-dates { margin: 0 0 1rem; color: var(--muted); font-size: .9rem; letter-spacing: .12em; text-transform: uppercase; }
.job-dates .present { color: var(--accent-bright); }
.job-desc { margin: 0; color: var(--fg-2); }
.job-more { margin-top: .75rem; }
.job-more summary { cursor: pointer; color: var(--accent); font-size: .9rem; letter-spacing: .08em; text-transform: uppercase; }
.job-more summary:hover { color: var(--accent-bright); }
.job-more ul { margin: .75rem 0 0; padding-left: 1.1rem; color: var(--fg-2); font-size: .97rem; }
.job-more li { margin-bottom: .5rem; }

.skills { color: var(--fg-2); }
.skills strong { color: var(--fg); margin-right: .5rem; }
.chip { display: inline-block; padding: .1rem .6rem; margin: .15rem .3rem .15rem 0; border: 1px solid var(--border); border-radius: 999px; font-size: .9rem; }

/* Post lists */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { padding: .5rem 0; border-bottom: 1px solid var(--border); }
.post-list time { display: inline-block; width: 8rem; color: var(--muted); font-size: .9rem; }
.post-list a { font-weight: 500; }
/* Home "Recent writing": a small square cover at the end of the row. */
.post-list li.has-thumb { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.post-list-thumb { flex: none; }
.post-list-thumb img { display: block; width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.more { color: var(--accent); }

.page-title { font-size: 2.4rem; margin: 3rem 0 2rem; }

/* "Start here": up to three pinned posts as cards, above the chronological list. */
.featured { margin-bottom: 3rem; }
.featured-title { font-size: 1.1rem; margin-bottom: 1rem; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.featured-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
.featured-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; padding: 1.25rem 1.5rem; }
.featured-card .post-meta { margin: 0 0 .5rem; font-size: .9rem; }
.featured-card h3 { font-size: 1.2rem; }
.featured-card h3 a { color: var(--fg); }
.featured-card h3 a:hover { color: var(--accent-bright); }
.featured-summary { color: var(--fg-2); margin: .5rem 0 0; font-size: .97rem; }
.post-summary { max-width: 46rem; margin-bottom: 2.5rem; }
.post-summary.has-thumb { display: grid; grid-template-columns: 1fr 200px; gap: 1.5rem; align-items: start; }
.post-thumb img { display: block; width: 200px; height: 134px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.post-summary .post-meta { margin: 0; }
.post-summary h2 { font-size: 1.5rem; margin: .3rem 0 .5rem; }
.post-summary p { color: var(--fg-2); margin: 0 0 .5rem; }
.tags a { color: var(--muted); margin-right: .5rem; font-size: .9rem; }
.tags a:hover { color: var(--accent-bright); }
.pagination { display: flex; justify-content: space-between; max-width: 46rem; margin: 2rem 0; }
.back { display: inline-block; margin: 1rem 0 3rem; color: var(--muted); }

/* Single post */
.post { max-width: 46rem; margin: 3rem 0 0; }
/* Cover: landscape fills the column; square/portrait keeps its shape, capped in height and centred. */
.post-cover { margin: 0 0 1.5rem; }
.post-cover img { display: block; width: 100%; height: auto; max-height: 480px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); }
.post-cover--tall img { width: auto; max-width: 100%; max-height: 420px; margin: 0 auto; }
.post h1 { font-size: 2.4rem; margin-bottom: .5rem; }
.post-meta { color: var(--muted); font-size: .85rem; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 2rem; }
.post-meta .sep { margin: 0 .3rem; }
.read-time { margin-left: .75rem; font-size: .85rem; }
.post-body { font-size: 1.1rem; color: #e4e4e6; }
.post-body h2, .post-body h3 { margin: 2rem 0 .75rem; }
.post-body h2 { font-size: 1.5rem; }
.post-body a { color: var(--accent-bright); text-decoration: underline; text-underline-offset: 3px; }
.post-body img { max-width: 100%; height: auto; border-radius: 8px; }
/* Figures from Markdown (blog/markdown.py): full width by default, or {: .left } / .right / .half / .small. */
.post-body .figure { margin: 1.5rem 0; }
.post-body .figure img { display: block; margin: 0 auto; }
.post-body .figure.left img, .post-body .figure.right img, .post-body .figure.half img, .post-body .figure.small img { width: 100%; }
.post-body figcaption { margin-top: .5rem; color: var(--muted); font-size: .9rem; text-align: center; }
.post-body .figure.left, .post-body .figure.right { width: 40%; margin-top: .3rem; }
.post-body .figure.left { float: left; margin-right: 1.5rem; }
.post-body .figure.right { float: right; margin-left: 1.5rem; }
.post-body .figure.half { width: 50%; margin-left: auto; margin-right: auto; }
.post-body .figure.small { width: 33%; margin-left: auto; margin-right: auto; }
.post-body h2, .post-body h3, .post-body .video, .post-body pre { clear: both; }
.post-body .video { aspect-ratio: 16 / 9; margin: 1.5rem 0; }
.post-body .video iframe { display: block; width: 100%; height: 100%; border: 0; border-radius: 8px; background: #081020; }
.post-body pre { background: #081020; border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.25rem; overflow-x: auto; font: .9rem/1.5 var(--mono); }
.post-body code { font-family: var(--mono); font-size: .92em; background: #081020; padding: .1rem .35rem; border-radius: 4px; }
.post-body pre code { background: none; padding: 0; }
.post-body blockquote { border-left: 3px solid var(--accent); margin: 1.5rem 0; padding-left: 1rem; color: var(--fg-2); }
.post-body table { border-collapse: collapse; }
.post-body td, .post-body th { border: 1px solid var(--border); padding: .35rem .7rem; }
.notice { background: #2a2416; border: 1px solid #4a3f1e; color: #f1d789; padding: .6rem .9rem; border-radius: 6px; font-size: .95rem; }

/* Locked post */
.locked { text-align: left; }
.unlock-form { display: flex; gap: .6rem; margin-top: 1.5rem; max-width: 26rem; }
.unlock-form input { flex: 1; padding: .7rem .9rem; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 6px; color: var(--fg); font: inherit; }
.unlock-form button { padding: .7rem 1.2rem; background: var(--accent-bright); border: 0; border-radius: 6px; color: #0b2a19; font: 600 1rem var(--body); cursor: pointer; }
.errorlist { list-style: none; padding: 0; margin: 0 0 .5rem; color: #f28b82; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 4rem; padding: 3rem 0; }
.site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.site-footer p { margin: 0; }
.site-footer a { font-weight: 500; }
.site-footer .sep { color: var(--muted); margin: 0 .4rem; }

/* Pygments (codehilite) */
.highlight .k, .highlight .kn, .highlight .kd { color: #c792ea; }
.highlight .s, .highlight .s1, .highlight .s2 { color: #c3e88d; }
.highlight .nf, .highlight .fm { color: #82aaff; }
.highlight .c, .highlight .c1 { color: #6b6b73; font-style: italic; }
.highlight .mi, .highlight .mf { color: #f78c6c; }

/* Brands: copy on the left, a ruled grid of wordmarks on the right. */
.brands { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); gap: 3rem; align-items: start; }
.brands h2 { font-size: clamp(2rem, 3.4vw, 2.6rem); margin-bottom: 1.5rem; }
.brands h2 em { font-style: normal; color: var(--accent-bright); }
.eyebrow { display: flex; align-items: center; gap: .7rem; margin: 0 0 1.25rem; font: 500 .8rem var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.brands-text > .eyebrow::before { content: ""; width: 10px; height: 10px; background: var(--accent-bright); }
.brands-intro { color: var(--fg-2); margin: 0 0 2rem; max-width: 44ch; }
.brands-agencies { border-top: 1px solid var(--border); padding-top: 1.5rem; }
.brands-agencies .eyebrow { margin-bottom: .6rem; }
.brands-agencies p:last-child { margin: 0; font: .95rem/1.7 var(--mono); color: var(--fg-2); }
.brand-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.brand-grid li { display: grid; place-items: center; min-height: 150px; padding: 1.25rem; text-align: center; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); transition: background .2s; }
.brand-grid li:hover { background: var(--bg-elev); }
.brand-grid span { font: 700 clamp(1.15rem, 2vw, 1.6rem)/1.1 var(--display); color: var(--fg); opacity: .85; letter-spacing: .01em; }
.brand-grid li:hover span { opacity: 1; }
/* Logos are stored in their own colours; flatten them to white to match the wordmarks. */
.brand-grid img { width: auto; max-width: 62%; height: 48px; object-fit: contain; filter: brightness(0) invert(1); opacity: .85; transition: opacity .2s; }
.brand-grid li:hover img { opacity: 1; }
.brand-grid img.brand-logo--lg { height: 72px; max-width: 80%; }

@media (max-width: 900px) {
  .brands { grid-template-columns: 1fr; gap: 2rem; }
  .hero { grid-template-columns: 1fr; padding-top: 3.5rem; }
  .featured-list { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .jobs { grid-template-columns: 1fr; gap: 2.5rem; }
  .job:nth-last-child(-n+2)::after { display: block; }
  .job:last-child::after { display: none; }
}
@media (max-width: 760px) {
  /* Logo and language switcher on the first row, nav wraps beneath. */
  .site-header .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; height: auto; padding-top: .75rem; padding-bottom: .75rem; gap: .5rem 1rem; }
  .site-header nav { order: 3; width: 100%; text-align: left; }
  .site-header nav a { margin: 0 1.1rem 0 0; }
}
@media (max-width: 600px) {
  .brand-grid li { min-height: 96px; padding: .75rem; }
  .brand-grid span { font-size: 1rem; }
  .brand-grid img { height: 32px; max-width: 75%; }
  .brand-grid img.brand-logo--lg { height: 48px; }
  .job { grid-template-columns: 64px 1fr; gap: 1rem; }
  .job-logo { width: 64px; height: 64px; }
  .job::after { left: 31px; top: 64px; }
  .post-list time { display: block; width: auto; }
  /* Blog index: small square thumbnail beside the text. */
  .post-summary.has-thumb { grid-template-columns: 1fr 88px; gap: 1rem; }
  .post-thumb img { width: 88px; height: 88px; }
  /* Floated and reduced figures go full width on a phone. */
  .post-body .figure.left, .post-body .figure.right, .post-body .figure.half, .post-body .figure.small { float: none; width: 100%; margin-left: 0; margin-right: 0; }
  /* Contribution graph: tighter cells (~6 months per screen), stacked footer. */
  .contrib-card { padding: 1rem 1.1rem 1.25rem; }
  .contrib-months, .contrib-grid { --cell: 11px; --gap: 3px; }
  .contrib-months { font-size: .75rem; height: 1.3rem; }
  .contrib-foot { flex-direction: column; gap: .5rem; font-size: .9rem; }
}

/* Cookie-consent banner (only rendered when GA is configured) */
.consent { position: fixed; right: 1rem; bottom: 1rem; left: 1rem; max-width: 30rem; margin-left: auto; padding: 1rem 1.25rem; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); z-index: 50; }
.consent p { margin: 0 0 .75rem; color: var(--fg-2); font-size: .95rem; }
.consent-actions { display: flex; gap: .6rem; }
.consent button { padding: .55rem 1.1rem; background: var(--accent-bright); border: 0; border-radius: 6px; color: #0b2a19; font: 600 .9rem var(--body); cursor: pointer; }
.consent button.secondary { background: transparent; border: 1px solid var(--border); color: var(--fg-2); }
.consent button.secondary:hover { color: var(--fg); border-color: var(--fg-2); }
