/* Shared colors and sizing tokens for the editorial visual system. */
:root {
  color-scheme: light;
  --ink: #12263a;
  --paper: #eff7ff;
  --accent: #6e7dab;
  --muted: #807182;
  --line: color-mix(in srgb, var(--accent) 30%, var(--paper));
  --max-width: 1180px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #eff7ff;
  --paper: #12263a;
  --accent: #b2bce0;
  --muted: #bfb1c1;
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.theme-toggle {
  flex-shrink: 0;
  padding: 8px;
  background: transparent;
  cursor: pointer;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

/* Desktop layout: fixed sidebar beside the only scrolling content column. */
.site-shell {
  width: 100%;
}

/* Leave the fixed sidebar untouched while this column provides page scrolling. */
main {
  width: min(calc(100% - 368px), 1100px);
  margin-left: 320px;
}

.wordmark {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.wordmark span,
.eyebrow,
.text-link {
  color: var(--accent);
}

/* The sidebar stays the full height of the viewport while main content scrolls. */
.sidebar {
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 10;
  width: 260px;
  height: 100vh;
  top: 0;
  display: flex;
  flex-direction: column;
  padding: 28px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.profile-block {
  margin: 36px 0 28px;
}

/* Frame the circular portrait on the subject rather than the photo center. */
.portrait-sidebar {
    display: block;
    width: 200px;
    height: 200px;
    max-width: none;
    margin-bottom: 20px;
    border-radius: 50%;
    object-fit: cover;
    object-position: 72% 72%;
}

.profile-name {
  margin-bottom: 4px;
  font-size: 1.25rem;
}

.profile-role {
  margin-bottom: 0;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  line-height: 1.6;
  text-transform: uppercase;
}

.profile-description {
  max-width: 180px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.25;
}

.sidebar-label {
  margin: 0 0 18px;
  color: var(--accent);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Sidebar navigation is stacked vertically for quick scanning. */
nav {
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

nav a {
  display: flex;
  gap: 16px;
  align-items: baseline;
  margin-left: -10px;
  padding: 8px 10px;
  border-radius: 12px;
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}

nav a span {
  color: var(--accent);
  font-size: 0.55rem;
}

nav a:hover,
nav a:focus-visible,
nav a[aria-current] {
  background: #773344;
  color: #eff7ff;
}

nav a:hover span,
nav a:focus-visible span,
nav a[aria-current] span {
  color: #eff7ff;
}

.sidebar-secondary {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.sidebar nav {
  gap: 8px;
}

.sidebar nav a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.sidebar-footer {
  padding-top: 24px;
}

.reel-intro {
  max-width: 650px;
  margin: 0 0 28px;
  font-size: clamp(1.1rem, 1.8vw, 1.4rem);
  line-height: 1.5;
}

.text-link {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

.text-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.repo-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  margin-top: 16px;
  padding: 14px 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #773344;
  color: #eff7ff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.repo-button i {
  font-size: 1.25rem;
}

.repo-button:hover,
.repo-button:focus-visible {
  background: #914357;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgb(18 38 58 / 18%);
}

.repo-button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .repo-button {
    transition: none;
  }

  .repo-button:hover,
  .repo-button:focus-visible {
    transform: none;
  }
}

.sidebar-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sidebar-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sidebar-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
  text-transform: none;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.sidebar-icon i {
  line-height: 1;
}

.sidebar-icon:hover {
  border-color: var(--accent);
  background: #773344;
  color: #eff7ff;
}

.sidebar-copyright {
  white-space: nowrap;
}

main > section {
  width: 100%;
}

.eyebrow {
  margin: 0 0 24px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

p {
  margin-top: 0;
}

h2 {
  margin: 0;
  font-size: clamp(3rem, 7vw, 6rem);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 0.98;
}

h2 em {
  color: var(--accent);
  font-style: italic;
}

.reel-section,
.about-section {
  padding: 56px 0 96px;
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 40px;
}

.section-heading .eyebrow {
  margin-bottom: 0;
}

/* Responsive Vimeo frame keeps the reel at its original 16:9 ratio. */
.reel-video {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--ink);
}

.reel-video iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* Reel notes use native disclosure controls, so they work without JavaScript. */
.reel-breakdown {
  margin-top: 56px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 14%, var(--paper));
  box-shadow: 0 3px 8px rgb(18 38 58 / 15%);
}

.reel-breakdown[open] {
  border-bottom: 6px solid var(--line);
}

.reel-breakdown > details {
  margin: 0 clamp(14px, 3vw, 28px);
}

.reel-breakdown > .breakdown-toggle + details {
  border-top: 0;
}

.breakdown-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.breakdown-heading .eyebrow {
  margin-bottom: 0;
}

.breakdown-intro {
  max-width: 300px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.reel-breakdown details {
  border-top: 1px solid var(--line);
}

.reel-breakdown details:last-child {
  border-bottom: 0;
  margin-bottom: 12px;
}

.reel-breakdown summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0;
  cursor: pointer;
  list-style: none;
  font-size: 1.25rem;
}

.reel-breakdown > details > summary {
  padding-right: 12px;
  padding-left: 12px;
  border-radius: 8px;
  transition: background-color 180ms ease, color 180ms ease;
}

.reel-breakdown > details > summary:hover,
.reel-breakdown > details > summary:focus-visible {
  background: var(--muted);
  color: var(--paper);
}

.reel-breakdown > details > summary:hover span,
.reel-breakdown > details > summary:focus-visible span,
.reel-breakdown > details > summary:hover::after,
.reel-breakdown > details > summary:focus-visible::after {
  color: inherit;
}

.reel-breakdown > details > summary:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.reel-breakdown summary::-webkit-details-marker {
  display: none;
}

.reel-breakdown summary::after {
  color: var(--accent);
  content: "+";
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.1rem;
}

.reel-breakdown details[open] > summary::after {
  content: "-";
}

.reel-breakdown > .breakdown-toggle {
  width: 100%;
  min-height: 56px;
  align-items: center;
  padding: 18px 20px;
  border: 0;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 14%, var(--paper));
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.reel-breakdown > .breakdown-toggle:hover,
.reel-breakdown > .breakdown-toggle:focus-visible {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.reel-breakdown > .breakdown-toggle::after {
  content: "";
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  margin: -5px 3px 0 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  color: inherit;
  transform: rotate(45deg);
}

.reel-breakdown[open] > .breakdown-toggle::after {
  margin-top: 5px;
  transform: rotate(225deg);
}

.reel-breakdown > .breakdown-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.reel-breakdown[open] > .breakdown-toggle {
  margin-bottom: 0;
  border-radius: 10px 10px 0 0;
}

.reel-breakdown summary span {
  margin-right: 18px;
  color: var(--accent);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
}

.reel-breakdown details > p {
  max-width: 560px;
  margin: -2px 48px 22px 38px;
  color: var(--muted);
  font-size: 1rem;
}

.reel-breakdown .breakdown-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin-top: 14px;
  padding: 9px 12px;
  border-radius: 8px;
  background: #773344;
  color: #eff7ff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  transition: background-color 180ms ease;
}

.reel-breakdown .breakdown-link:hover,
.reel-breakdown .breakdown-link:focus-visible {
  background: #914357;
}

.reel-breakdown .breakdown-link:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* Project cards form a scannable grid below the reel breakdown. */
.projects-section {
  padding: 0 0 96px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.project-card {
  position: relative;
  display: flex;
  min-height: 220px;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 14%, var(--paper));
  text-decoration: none;
  transition: background-color 180ms ease, color 180ms ease;
}

.project-thumbnail {
  display: block;
  width: calc(100% + 40px);
  max-width: none;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  margin: -20px -20px 16px;
}

.project-thumbnail-logo {
  object-fit: cover;
  object-position: center;
  background: #fff;
}

.project-thumbnail ~ h3 {
  padding-top: 16px;
}

.project-card:hover,
.project-card:focus-visible {
  background: var(--ink);
  color: var(--paper);
  outline: none;
}

.project-number,
.project-meta {
  color: var(--accent);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-card h3 {
  max-width: 220px;
  margin: auto 0 12px;
  font-size: clamp(1.35rem, 2vw, 2rem);
  font-weight: 400;
  line-height: 1;
}

.project-preview {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  padding: 14px;
  transform: translateY(120%);
  background: #773344;
  color: #eff7ff;
  font-size: 0.9rem;
  line-height: 1.25;
  transition: transform 180ms ease;
}

.project-card:hover .project-preview,
.project-card:focus-visible .project-preview {
  transform: translateY(0);
}

/* Compact post cards keep dates beside the title and excerpt. */
.blog-preview-section {
  padding: 0 0 96px;
}

.blog-preview-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.blog-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 4px 18px;
  align-items: start;
  padding: 14px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 14%, var(--paper));
  text-decoration: none;
  transition: background-color 180ms ease, border-color 180ms ease;
}

.blog-card:hover,
.blog-card:focus-visible {
  background: #773344;
  border-color: var(--accent);
  color: #eff7ff;
}

.blog-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.blog-card:hover .blog-date,
.blog-card:hover p,
.blog-card:focus-visible .blog-date,
.blog-card:focus-visible p {
  color: #eff7ff;
}

.blog-card .blog-date {
  grid-row: span 2;
  padding-top: 4px;
}

.blog-date {
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.blog-card h3 {
  margin: 0;
  font-size: clamp(1.15rem, 1.6vw, 1.5rem);
  font-weight: 400;
  line-height: 1.2;
}

.blog-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

.blog-cta-wrap {
  margin-top: 24px;
}

.blog-page-section {
  padding: 56px 0 96px;
}

.blog-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.blog-list-item {
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.blog-list-item h3 {
  margin: 10px 0 8px;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  font-weight: 400;
  line-height: 1.1;
}

.blog-list-item h3 a {
  color: inherit;
  text-decoration: none;
}

.blog-list-item p {
  margin: 0;
  max-width: 660px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: start;
}

.about-copy {
  max-width: 520px;
  padding-top: 20px;
}

.large-copy {
  margin-bottom: 28px;
  font-size: clamp(1.8rem, 3.2vw, 3rem);
  line-height: 1.08;
}

.about-copy > p {
  max-width: 400px;
  margin-bottom: 36px;
  color: var(--muted);
  font-size: 1.08rem;
}

/* Detail pages keep the same sidebar while presenting one project clearly. */
.project-detail {
  min-height: 100vh;
  padding: 48px 0 120px;
}

.back-link {
  display: inline-block;
  margin-bottom: 96px;
  color: var(--accent);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.back-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.project-detail h1 {
  max-width: 760px;
  margin: 0 0 20px;
  font-size: clamp(3rem, 7vw, 7rem);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 0.95;
}

/* Project films sit directly below the title at a responsive 16:9 ratio. */
.project-video {
  width: 100%;
  max-width: 900px;
  aspect-ratio: 16 / 9;
  margin: 40px 0 28px;
  overflow: hidden;
  background: var(--ink);
}

.project-video iframe,
.project-video video {
  width: 100%;
  height: 100%;
  border: 0;
}

.steam-embed {
  max-width: 646px;
  margin: 40px 0 28px;
}

.steam-embed iframe {
  display: block;
  width: 100%;
  height: 190px;
  margin-bottom: 16px;
  border: 0;
}

.steam-embed .text-link {
  white-space: normal;
}

.project-detail-meta {
  color: var(--accent);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.project-detail-copy {
  max-width: 640px;
  margin-top: 88px;
  font-size: clamp(1.1rem, 1.8vw, 1.35rem);
}

.project-detail-copy p {
  margin-bottom: 28px;
}

.project-detail-image {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 28px;
}

.project-hero-image {
  max-width: 900px;
  margin-top: 40px;
}

.london-photo {
  max-width: 90px;
}

.project-detail-copy h2 {
  margin: 72px 0 24px;
  font-size: clamp(2rem, 4vw, 3.5rem);
}

.project-detail-copy ul {
  margin: 0 0 28px;
  padding-left: 1.25rem;
}

.project-detail-copy li {
  margin-bottom: 10px;
}

/* Footer metadata is quiet and secondary to the portfolio content. */
.site-footer {
  width: min(calc(100% - 368px), 1100px);
  margin: 0 48px 0 320px;
  display: flex;
  justify-content: space-between;
  padding: 20px 0 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 700px) {
  /* Collapse the desktop sidebar into a compact mobile layout. */
  .site-shell,
  .site-footer {
    width: min(calc(100% - 32px), var(--max-width));
  }

  .site-footer {
    margin: 0 auto;
  }

  .site-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    left: auto;
    bottom: auto;
    width: auto;
    height: auto;
    z-index: auto;
    min-height: 0;
    padding: 20px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }

  main {
    width: 100%;
    margin-left: 0;
  }

  .profile-block {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 20px 0;
  }

  .portrait-sidebar {
    width: 68px;
    margin: 0;
  }

  .profile-description,
  .sidebar-label {
    display: none;
  }

  .profile-name {
    margin-bottom: 2px;
    font-size: 1rem;
  }

  .sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 0.62rem;
  }

  .sidebar nav a {
    margin-left: 0;
  }

  .sidebar-footer {
    margin-top: 20px;
  }

  .sidebar-copyright {
    display: none;
  }

  .section-heading,
  .breakdown-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .reel-section,
  .about-section,
  .projects-section,
  .blog-preview-section {
    padding: 72px 0;
  }

  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .blog-card {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .blog-card .blog-date {
    grid-row: auto;
    padding-top: 0;
  }

  .breakdown-heading {
    gap: 8px;
  }

  .reel-breakdown summary {
    font-size: 1.05rem;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .project-detail {
    min-height: 0;
    padding: 48px 0 80px;
  }

  .back-link {
    margin-bottom: 64px;
  }

  .project-detail-copy {
    margin-top: 56px;
  }
}

@media (max-width: 460px) {
  .project-grid {
    grid-template-columns: 1fr;
  }
}
