:root {
  --color-bg: #000000;
  --color-surface: #23262e;
  --color-text: #f5f3ed;
  --color-text-soft: #d4d0cc;
  --color-muted: #a8a29e;
  --color-heading: #ffffff;
  --color-accent: #e87555;
  --color-border: #262a35;
  --color-grid: rgba(255, 255, 255, 0.12);
  --color-grid-mark: rgba(255, 255, 255, 0.45);

  --color-shape-blue: #0091FF;
  --color-shape-red: #F5383C;
  --color-shape-yellow: #FFAE00;
  --color-shape-teal: #009D87;

  --color-highlight: var(--color-shape-yellow);

  --font-sans: "Darker Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --measure: 65ch;
  --container-max: 48rem;
  --container-pad: 1.5rem;
}

@media (min-width: 768px) {
  :root { --container-pad: 3rem; }
}

@supports (color: color(display-p3 1 1 1)) {
  :root {
    --color-heading: color(display-p3 1 1 1);
    --color-accent: color(display-p3 0.94 0.48 0.30);

    --color-shape-blue: color(display-p3 0 0.568 1);
    --color-shape-red: color(display-p3 0.93 0.23 0.23);
    --color-shape-yellow: color(display-p3 1 0.68 0);
    --color-shape-teal: color(display-p3 0 0.615 0.528);
  }
}

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

html {
  font-family: var(--font-sans);
  font-optical-sizing: auto;
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-bg);
  background-image:
    linear-gradient(var(--color-grid), var(--color-grid)),
    linear-gradient(var(--color-grid), var(--color-grid));
  background-size: 1px 300vh, 1px 300vh;
  background-repeat: no-repeat;
  background-position:
    max(0px, calc(50% - var(--container-max) / 2)) center,
    min(100%, calc(50% + var(--container-max) / 2)) center;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-weight: 500;
}

main { flex: 1; }

.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* Dotted pattern backdrop, dimmer outside the content column */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background-color: var(--color-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3E%3Cpath fill='%23ffffff' fill-opacity='0.06' d='M1 3h1v1H1V3zm2-2h1v1H3V1z'%3E%3C/path%3E%3C/svg%3E");
  -webkit-mask-image: linear-gradient(
    to right,
    #000 0,
    #000 max(0px, calc(50% - var(--container-max) / 2 - 1px)),
    transparent max(0px, calc(50% - var(--container-max) / 2 - 1px)),
    transparent min(100%, calc(50% + var(--container-max) / 2 + 1px)),
    #000 min(100%, calc(50% + var(--container-max) / 2 + 1px)),
    #000 100%
  );
  mask-image: linear-gradient(
    to right,
    #000 0,
    #000 max(0px, calc(50% - var(--container-max) / 2 - 1px)),
    transparent max(0px, calc(50% - var(--container-max) / 2 - 1px)),
    transparent min(100%, calc(50% + var(--container-max) / 2 + 1px)),
    #000 min(100%, calc(50% + var(--container-max) / 2 + 1px)),
    #000 100%
  );
  -webkit-mask-mode: alpha;
  mask-mode: alpha;
}

main.container { padding-inline: 0; }

main > section,
.site-footer {
  position: relative;
  border-top: 1px solid var(--color-grid);
  padding-inline: var(--container-pad);
}

main > section::before,
main > section::after,
.site-footer::after {
  content: "";
  position: absolute;
  top: -0.5px;
  width: 1.25rem;
  height: 1.25rem;
  background-image:
    linear-gradient(var(--color-grid-mark), var(--color-grid-mark)),
    linear-gradient(var(--color-grid-mark), var(--color-grid-mark));
  background-size: 100% 1px, 1px 100%;
  background-position: center, center;
  background-repeat: no-repeat;
}

main > section,
.site-footer {
  --edge-overflow: min(0.625rem, max(0px, (100vw - var(--container-max)) / 2));
}

main > section::before {
  left: 0;
  transform: translate(-50%, -50%);
}

main > section::after {
  right: 0;
  transform: translate(var(--edge-overflow), -50%);
}

.site-footer::after {
  right: 0;
  transform: translate(var(--edge-overflow), -50%);
}

main > section:nth-child(even)::before { display: none; }
main > section:nth-child(odd)::after { display: none; }

main > section:nth-child(even) :is(h1, h2, .section-heading, .hero-tagline) {
  text-align: right;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 2rem;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-heading);
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.logo-mark { width: 1.5rem; height: 1.5rem; }
.logo-slash { color: var(--color-accent); }

/* Footer */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 2rem;
  margin-top: 4rem;
  width: 100%;
}
.site-footer p {
  color: var(--color-shape-blue);
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
}
.footer-mark { width: 2rem; height: 2rem; }

/* Typography */
h1, h2, h3, h4 {
  line-height: 1.2;
  color: var(--color-heading);
  font-weight: 700;
  margin-block: 1.5em 0.5em;
}
h1 { font-size: 1.25rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }

p, ul, ol {
  max-width: var(--measure);
  margin-block: 0.75rem;
}

a {
  color: var(--color-text);
  transition: color 0.2s ease-in-out;
}
.hl { color: var(--color-highlight); }
html :is(a, .hl):hover,
html :is(a, .hl):focus { color: var(--color-highlight); }
:nth-child(4n+1 of a, .hl) { --color-highlight: var(--color-shape-blue); }
:nth-child(4n+2 of a, .hl) { --color-highlight: var(--color-shape-red); }
:nth-child(4n+3 of a, .hl) { --color-highlight: var(--color-shape-yellow); }
:nth-child(4n of a, .hl)   { --color-highlight: var(--color-shape-teal); }

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 0.1em 0.3em;
  background: var(--color-surface);
  border-radius: 0.25rem;
}
pre {
  padding: 1rem;
  background: var(--color-surface);
  border-radius: 0.5rem;
  overflow-x: auto;
}
pre code { padding: 0; background: transparent; }

hr { border: none; border-top: 1px solid var(--color-border); margin-block: 2rem; }

img { max-width: 100%; height: auto; }

ul li::marker { font-size: 0.6em; }

/* Hero */
.hero {
  padding-block: 1.2rem;
}
.hero h1 {
  font-size: 2rem;
  margin: 0;
  color: var(--color-heading);
}
.hero-tagline {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-muted);
  margin: 0;
}

/* Social link row */
.social-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.7rem;
  padding-top: 1.5rem;
}
.social-links a {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  gap: 0.45rem;
  color: var(--color-heading);
  font-size: 1.25rem;
  font-weight: 600;
  text-decoration: none;
}
.social-links a svg {
  width: 0.81em;
  height: 0.81em;
  flex-shrink: 0;
  display: block;
  transform: translateY(0.08em);
}

/* Sections */
.section {
  margin-block: 1.5rem;
  padding-block: 1.2rem;
}
.section-heading {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-heading);
  padding-bottom: 1rem;
  margin: 0;
}

/* Project card */
.project {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}
.project-media {
  border-radius: 1rem;
  overflow: hidden;
}
.project-media video {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.project-title.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  color: var(--color-heading);
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  margin: 0;
}
.project-dates {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-muted);
  white-space: nowrap;
}
.project-description {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--color-muted);
  margin: 1.5rem 0 1rem;
  max-width: none;
}
.project-tech-heading {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-muted);
  margin: 0;
}
.project-tech {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--color-muted);
  list-style: disc;
  padding-left: 1.25rem;
  max-width: none;
}

/* Hide inline SVG filter defs */
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Tech pills — specular highlight via SVG filter */
.tech-pills {
  list-style: none;
  padding: 0;
  margin-block: 1rem;
  max-width: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.pill {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.875rem 0.55rem;
  border-radius: 1.05rem;
  corner-shape: squircle;
  -webkit-corner-shape: squircle;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  color: var(--color-text);
  background: transparent;
}
@supports (text-box: trim-both cap alphabetic) {
  .pill {
    padding: 0.4rem 0.875rem 0.6rem;
    text-box: trim-both cap alphabetic;
  }
}
.pill::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  corner-shape: inherit;
  -webkit-corner-shape: inherit;
  background: #ffffff;
  filter: url(#glass-spec-tech);
  pointer-events: none;
  z-index: -1;
}
.pill::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  corner-shape: inherit;
  -webkit-corner-shape: inherit;
  background: rgba(255, 255, 255, 0.05);
  pointer-events: none;
  z-index: -2;
  transition: background 0.2s ease-in-out;
}
.pill:hover::after,
.pill:focus-visible::after {
  background: color-mix(in srgb, var(--color-highlight) 10%, transparent);
}
.pill:active::after {
  background: color-mix(in srgb, var(--color-highlight) 20%, transparent);
}

/* About portrait */
.about-portrait {
  display: flex;
  justify-content: center;
}
.about-portrait img {
  width: 100%;
  max-width: 32rem;
  border-radius: 1.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}
.bio {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--color-muted);
}
.bio strong {
  font-weight: 700;
  color: var(--color-heading);
}

/* DVD-bouncing backdrop shapes */
.shapes-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: clip;
}
.shape {
  position: absolute;
  top: var(--offset-y, 0);
  left: var(--offset-x, 10vw);
  width: var(--shape-size);
  height: var(--shape-size);
  will-change: transform;
  animation: shape-bounce-x var(--dur-x) linear infinite alternate;
  animation-delay: var(--delay-x);
}
.shape-inner {
  position: relative;
  width: 100%;
  height: 100%;
  opacity: 0.135;
  filter: blur(calc(var(--shape-size) / 6));
  background: var(--shape-color);
  will-change: transform;
  animation: shape-bounce-y var(--dur-y) linear infinite alternate;
  animation-delay: var(--delay-y);
}
@keyframes shape-bounce-x {
  from { transform: translateX(0); }
  to   { transform: translateX(max(0px, calc(80svw - var(--shape-size)))); }
}
@keyframes shape-bounce-y {
  from { transform: translateY(0); }
  to   { transform: translateY(max(0px, calc(100svh - var(--shape-size)))); }
}
.shape-circle   { --shape-size: min(672px, 96vmin);  --offset-y: -13lvh; --dur-x: 52s; --dur-y: 44s; --delay-x: -32s; --delay-y: -6s;  }
.shape-triangle { --shape-size: min(720px, 102vmin); --offset-y: 10lvh;  --dur-x: 68s; --dur-y: 75s; --delay-x: -12s; --delay-y: -28s; }
.shape-square-a { --shape-size: min(576px, 83vmin);  --offset-y: 29lvh;  --dur-x: 91s; --dur-y: 52s; --delay-x: -79s; --delay-y: -33s; }
.shape-square-b {
  --shape-size: min(624px, 90vmin);
  --offset-y: calc(50lvh - var(--shape-size) / 2);
  --offset-x: calc(50vw - var(--shape-size) / 2);
  animation: none;
}
.shape-square-b .shape-inner { animation: none; }
.shape-circle   .shape-inner { --shape-color: var(--color-shape-blue); border-radius: 50%; }
.shape-triangle .shape-inner { background: transparent; }
.shape-triangle .shape-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-shape-red);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}
.shape-square-a .shape-inner { --shape-color: var(--color-shape-yellow); }
.shape-square-b .shape-inner { --shape-color: var(--color-shape-teal); }
@media (prefers-reduced-motion: reduce) {
  .shape, .shape-inner { animation: none; }
}

/* Post list (writing page) */
.post-list { list-style: none; padding: 0; }
.post-list li {
  padding-block: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}
.post-list a {
  text-decoration: none;
  color: inherit;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.post-list time {
  color: var(--color-muted);
  font-size: 0.875rem;
}
