:root {
  color-scheme: dark;
  --page-gutter: clamp(1rem, 4vw, 5rem);
  --background: #181716;
  --surface: #23211f;
  --text: #f0ece6;
  --muted: #b8b1a8;
  --line: #403a34;
  --accent: #d6bfa6;
  --accent-dark: #e6d2bc;
  --intro-width: 400px;
  --content-width: 680px;
  --column-gap: clamp(96px, 14vw, 360px);
  --reflow-gap: clamp(48px, calc(100vw - 1184px), var(--column-gap));
  --desktop-padding: 64px;
}

* { box-sizing: border-box; }

html { scroll-behavior: auto; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  line-height: 1.65;
}

a { color: inherit; }

.interest-placeholder { display: grid; place-items: center; height: 100%; padding: 24px; color: var(--muted); text-align: center; }

a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 5px;
  border-radius: 2px;
}

.page-content {
  width: 100%;
  max-width: calc(var(--intro-width) + var(--content-width) + var(--reflow-gap) + var(--page-gutter) + var(--page-gutter));
  margin-inline: auto;
  padding-inline: var(--page-gutter);
  display: grid;
  grid-template-columns: minmax(280px, 10fr) minmax(0, 17fr);
  column-gap: var(--reflow-gap);
  justify-content: center;
  align-items: start;
  padding-block: 64px 48px;
}

.intro,
.content-column { min-width: 0; }

.content-column { max-width: var(--content-width); }

.section { scroll-margin-top: 2rem; }

.intro {
  text-align: left;
}

h1, h2, h3, p { margin-top: 0; }

h1, h2, h3 {
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 { margin-bottom: 1.5rem; font-size: 52px; text-wrap: balance; }
h2 { margin-bottom: 0; font-size: 30px; }
h3 { margin-bottom: 1rem; font-size: clamp(1.5rem, 2.4vw, 2rem); }

.intro-copy {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

.section-heading { margin-bottom: 24px; text-align: left; }

#projects,
#interests {
  border-top: 1px solid var(--line);
  padding-top: 40px;
}

#projects { border-top: 0; padding-top: 0; padding-bottom: 40px; }
#interests { padding-bottom: 0; }

.project-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-row {
  /* Keep a readable 260px text column before wrapping below the thumbnail. */
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 24px;
}

.project-copy { flex: 1 1 260px; min-width: 0; text-align: left; }

.project-thumbnail {
  flex: 0 0 180px;
  width: 180px;
  aspect-ratio: 8 / 5;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.project-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 60% 15%;
}

/* Frame the existing session heading and fields without altering the screenshot. */
.project-thumbnail .robotics-thumbnail {
  object-position: center top;
  transform: scale(3);
  transform-origin: center 35%;
}

.project-copy h3 {
  margin-bottom: 0.5rem;
  font-size: 20px;
}

.project-status {
  display: inline-block;
  margin-bottom: 0.65rem;
  padding: 0.1rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  line-height: 1.5;
}

.project-description {
  max-width: 55ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.interest-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.interest-frame img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.interest-frame-background {
  object-fit: cover;
  filter: blur(16px) brightness(0.65);
  transform: scale(1.08);
}

.interest-frame-foreground {
  z-index: 1;
  object-fit: contain;
}

/* Two cards need 544px including their gap; narrower parents get one card. */
.interest-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 24px; }
.interest-card { margin: 0; }
.pc-builds-link { display: block; min-width: 0; text-decoration: none; }
.interest-card figcaption { display: flex; flex-direction: column; gap: 0.15rem; padding-top: 1.25rem; }
.interest-card figcaption strong { font-size: 20px; font-weight: 600; }
.interest-card figcaption span { color: var(--muted); font-size: 17px; }

/* Match the PC Builds page's frame highlight without changing card geometry. */
.page-content :is(.interest-frame, .project-thumbnail) {
  box-shadow: 0 0 0 1px transparent, 0 0 14px 2px transparent;
  transition: border-color 200ms ease-out, box-shadow 200ms ease-out;
}

.interest-card figcaption, .project-copy {
  transition: text-shadow 200ms ease-out;
}

@media (hover: hover) and (pointer: fine) {
  .interest-card:hover .interest-frame,
  .project-row:hover .project-thumbnail {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 0 14px 2px color-mix(in srgb, var(--accent) 18%, transparent);
  }
  .interest-card:hover figcaption,
  .project-row:hover .project-copy {
    text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 65%, transparent);
  }
}

.pc-builds-link:focus-visible figcaption {
  text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 65%, transparent);
}

.pc-builds-link:focus-visible .interest-frame {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 14px 2px color-mix(in srgb, var(--accent) 18%, transparent);
}

.intro-socials {
  display: flex;
  align-items: center;
  gap: calc(0.25rem + 20px);
  padding: 10px;
  margin-top: 24px;
}

.intro-socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--accent);
  text-decoration: none;
}

.intro-socials svg {
  display: block;
  width: 24px;
  height: 24px;
  fill: currentColor;
  filter: drop-shadow(0 0 3px transparent) drop-shadow(0 0 9px transparent);
}

@media (hover: hover) and (pointer: fine) {
  .intro-socials svg:hover {
    color: var(--accent-dark);
    filter: drop-shadow(0 0 3px color-mix(in srgb, var(--accent-dark) 80%, transparent))
            drop-shadow(0 0 9px color-mix(in srgb, var(--accent) 65%, transparent));
  }
}

.intro-socials a:focus-visible svg {
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--accent-dark) 80%, transparent))
          drop-shadow(0 0 9px color-mix(in srgb, var(--accent) 65%, transparent));
}

@media (prefers-reduced-motion: reduce) {
  .page-content :is(.interest-frame, .project-thumbnail),
  .interest-card figcaption, .project-copy { transition: none; }
}

/* Center fitting content on desktop and portrait displays. Intrinsic height
   keeps taller groups top-aligned and reachable through document scrolling. */
@media (width > 960px) and (orientation: landscape), (orientation: portrait) {
  .page-content {
    min-height: 100svh;
    align-content: center;
    padding-block: var(--desktop-padding);
  }
}

@media (width > 1400px) {
  .page-content {
    width: max-content;
    grid-template-columns: var(--intro-width) var(--content-width);
    column-gap: var(--column-gap);
    padding-inline: 0;
  }
}

/* The intro is about 441px tall at the narrowest two-column width and
   385px on wide desktop. Leave room for social links and sticky spacing.
   Short and stacked layouts keep the introduction in document flow. */
@media (width > 960px) and (orientation: landscape) and (height > 720px), (width > 1000px) and (orientation: portrait) and (height > 720px), (width > 1400px) and (height > 560px) {
  .intro { position: sticky; top: var(--desktop-padding); }
}

@media (width > 1400px) and (height <= 1000px) {
  .section-heading { margin-bottom: 16px; }
  #projects { padding-bottom: 28px; }
  #interests { padding-top: 28px; }
  .interest-frame { height: 180px; aspect-ratio: auto; }
  .interest-card figcaption { padding-top: 0.75rem; }
}

@media (max-width: 960px), (max-width: 1000px) and (orientation: portrait) {
  .page-content { grid-template-columns: minmax(0, 1fr); row-gap: 40px; }
  .intro, .content-column { width: 100%; max-width: var(--content-width); margin-inline: auto; }
  .intro { text-align: center; }
  .intro-copy { max-width: 50ch; margin-inline: auto; text-align: left; }
  .intro-socials { justify-content: center; }
  .section-heading { text-align: center; }
  .project-row, .interest-grid { width: 100%; margin-inline: auto; }
  .project-row { justify-content: center; }
  .project-description, .interest-card figcaption { text-align: left; }
  #projects { border-top: 1px solid var(--line); padding-top: 40px; }
}

@media (max-width: 700px) {
  h1 { font-size: clamp(38px, 9vw, 48px); }
  #projects, #interests { padding-top: 32px; }
  #projects { padding-bottom: 32px; }
  #interests { padding-bottom: 48px; }
}

@media (max-width: 540px) {
  .intro-copy, .project-copy h3, .project-description,
  .project-status, .interest-card figcaption { text-align: center; }
  .project-row { gap: 1.1rem; }
  .project-copy { width: 100%; }
  .project-status { display: table; margin-inline: auto; }
  .project-description { margin-inline: auto; }
}

