/* ============================================================
   brianmaricle.com — shared stylesheet
   One file, every page. This is what keeps the containers and
   nav identical everywhere instead of drifting page to page.
   ============================================================ */

/* --- Reset: the #1 cause of "close but not matching" --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* --- Kills the horizontal "nav jump" between short and long pages.
       Long pages get a scrollbar, short ones don't, which shifts
       centered content sideways. This forces the gutter always. --- */
html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  background-color: #080c14;
  color: #ccf;
  font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 0;
}

a {
  color: #ccf;
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover,
a:focus-visible {
  color: #fff;
}

/* ============================================================
   LAYOUT SHELL — identical on every page
   ============================================================ */
.wrap {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ============================================================
   HEADER / NAV
   ============================================================ */
.site-header {
  background-color: #111827;
  border-bottom: 1px solid #252d3e;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  min-height: 96px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.brand img {
  max-height: 84px;
  width: auto;
}
/* Text fallback if the logo image is ever missing */
.brand-text {
  font-size: 30px;
  font-weight: bold;
  letter-spacing: 0.02em;
  color: #ccf;
}
.brand-text span {
  color: #6b86c0;
  font-weight: normal;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.site-nav a {
  display: inline-block;
  padding: 10px 16px;
  font-size: 21px;
  border-radius: 4px;
  white-space: nowrap;
}
.site-nav a:hover,
.site-nav a:focus-visible {
  background-color: #252d3e;
  color: #fff;
}
.site-nav a[aria-current="page"] {
  color: #fff;
  background-color: #252d3e;
}

/* ============================================================
   SECTIONS
   ============================================================ */
.section {
  background-color: #252d3e;
  padding: 28px 0 34px;
  margin: 22px 0;
  border-radius: 6px;
}

.section-title {
  font-size: 26px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ============================================================
   TILE GRID — the responsive replacement for the fixed tables.
   Portrait tiles (roughly 200x504 source) reflow automatically.
   ============================================================ */
.tile-grid {
  display: grid;
  gap: 0;                                   /* tiles butt together, no spacing */
  grid-template-columns: repeat(6, 1fr);   /* desktop: 6 across */
}

/* Wider tiles for the props/environments/2D row */
.tile-grid--mixed {
  grid-template-columns: repeat(4, 1fr);
}

.tile {
  position: relative;
  display: block;
  overflow: hidden;
  background-color: #1a2130;
  aspect-ratio: 200 / 504;   /* keeps the portrait shape at any width */
}

.tile--wide {
  aspect-ratio: 340 / 299;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s ease, transform 0.35s ease;
}

/* CSS rollover: replaces all the MM_swapImage JavaScript.
   The hover image sits on top and fades in. */
.tile .tile-hover {
  position: absolute;
  inset: 0;
  opacity: 0;
}
.tile:hover .tile-hover,
.tile:focus-visible .tile-hover {
  opacity: 1;
}
.tile:hover img,
.tile:focus-visible img {
  transform: scale(1.04);
}

.tile:focus-visible {
  outline: 2px solid #6b86c0;
  outline-offset: 2px;
}

/* ============================================================
   BIO PAGE
   ============================================================ */
.bio {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.bio-photo {
  position: sticky;
  top: 120px;
}

.bio-photo img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

.bio-text {
  background-color: #111827;
  padding: 30px 34px;
  border-radius: 4px;
}

.bio-text p {
  margin: 0 0 20px 0;
  font-size: 19px;
  line-height: 1.7;
  color: #ccf;
}
.bio-text p:first-child {
  font-size: 21px;
  color: #fff;
}
.bio-text p:last-child { margin-bottom: 0; }

@media (max-width: 860px) {
  .bio {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .bio-photo {
    position: static;
    max-width: 240px;
    margin: 0 auto;
  }
  .bio-text { padding: 22px; }
  .bio-text p { font-size: 17px; }
  .bio-text p:first-child { font-size: 19px; }
}

/* Caption below the grid, like the original */
.grid-caption {
  margin-top: 10px;
  font-size: 22px;
  color: #ccf;
}

/* ============================================================
   PAGE TRANSITIONS (View Transitions API)
   Cross-fade + subtle lift between pages. No JavaScript.
   Browsers without support simply navigate normally.
   ============================================================ */
@view-transition {
  navigation: auto;
}

/* Outgoing page: fade out */
::view-transition-old(root) {
  animation: vt-fade-out 180ms cubic-bezier(0.4, 0, 1, 1) both;
}

/* Incoming page: fade in and lift */
::view-transition-new(root) {
  animation: vt-fade-in 280ms cubic-bezier(0, 0, 0.2, 1) both;
}

@keyframes vt-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes vt-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Keep the header rock-steady during the transition instead of
   fading with the rest of the page. This is what makes it feel
   like an app rather than a page reload. */
.site-header {
  view-transition-name: site-header;
}
::view-transition-old(site-header),
::view-transition-new(site-header) {
  animation: none;
  mix-blend-mode: normal;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
}

/* ============================================================
   PROJECT / GAME PAGES
   ============================================================ */
.project {
  overflow-x: hidden;      /* nothing escapes the panel */
  background-color: #252d3e;
  padding: 26px 26px 34px;
  margin: 22px 0;
  border-radius: 6px;
}

.project-hero {
  margin: 0 0 22px 0;
}
.project-hero img {
  width: 100%;
  height: auto;
  border-radius: 4px;
}

.project-intro {
  margin: 0 0 30px;
  text-align: center;
}
.project-intro p {
  font-size: 19px;
  line-height: 1.7;
  color: #ccf;
  margin-bottom: 14px;
}
.project-intro p:last-child { margin-bottom: 0; }

/* Vertical image stack — the gallery */
.project-gallery {
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.project-gallery img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  background-color: #1a2130;
}

.project-foot {
  margin-top: 26px;
  text-align: center;
}
.backtotop {
  display: inline-block;
  padding: 10px 18px;
  font-size: 18px;
  color: #6b86c0;
  border: 1px solid #3a4560;
  border-radius: 4px;
}
.backtotop:hover {
  color: #fff;
  border-color: #6b86c0;
}

/* Prev / All / Next */
.project-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid #3a4560;
}
.project-nav a {
  display: block;
  padding: 10px 4px;
}
.project-nav-prev { text-align: left; }
.project-nav-next { text-align: right; }
.project-nav-home {
  text-align: center;
  font-size: 17px;
  color: #6b86c0;
  white-space: nowrap;
}
.project-nav-label {
  display: block;
  font-size: 14px;
  color: #6b86c0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.project-nav-title {
  display: block;
  font-size: 20px;
  color: #ccf;
}
.project-nav a:hover .project-nav-title { color: #fff; }

@media (max-width: 760px) {
  .project { padding: 16px 16px 24px; }
  .project-intro p { font-size: 17px; }
  .project-gallery { gap: 16px; }
  .project-nav-title { font-size: 17px; }
  .project-nav { gap: 8px; }
}

/* Shared-element morph: home tile -> project hero.
   The tile is portrait and the hero is landscape, so we let the two
   images cross-fade while the box animates between the two shapes,
   instead of hard-squashing one aspect into the other. */
::view-transition-old(*),
::view-transition-new(*) {
  animation-duration: 420ms;
  animation-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
::view-transition-image-pair(*) {
  isolation: auto;
}
::view-transition-old(*) {
  object-fit: cover;
}
::view-transition-new(*) {
  object-fit: cover;
}

/* ============================================================
   RESUME PAGE
   ============================================================ */
.resume-panel {
  background-color: #111827;
  padding: 44px 40px;
  border-radius: 4px;
  text-align: center;
}
.resume-title {
  font-size: 34px;
  color: #fff;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}
.resume-sub {
  font-size: 19px;
  color: #ccf;
  margin-bottom: 30px;
}
.resume-actions { margin-bottom: 18px; }
.btn {
  display: inline-block;
  padding: 14px 28px;
  font-size: 19px;
  color: #ccf;
  border: 1px solid #6b86c0;
  border-radius: 4px;
}
.btn:hover {
  background-color: #6b86c0;
  color: #0b0f18;
}
.resume-note {
  font-size: 16px;
  color: #6b86c0;
}

/* ============================================================
   CAPTIONED GALLERY (Gobsmax, look-dev walkthroughs)
   ============================================================ */
.figure-stack {
  display: flex;
  flex-direction: column;
  gap: 34px;
  min-width: 0;
  max-width: 100%;
}
.figure-stack figure {
  margin: 0;
  min-width: 0;
  max-width: 100%;
  text-align: center;
}
.figure-stack img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  background-color: #1a2130;
  display: block;
}
.figure-stack video {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  box-sizing: border-box;
  border-radius: 4px;
  background-color: #000;
}
/* Images that shouldn't be blown up to full width (icons, small panels) */
.figure-stack img.natural {
  width: auto;
  max-width: 100%;
  margin: 0 auto;
}
/* images inside a link keep their natural size so the glow hugs them */
.figure-stack a img.natural { margin: 0; }
.figure-stack figcaption {
  margin-top: 10px;
  font-size: 17px;
  line-height: 1.6;
  color: #ccf;
  text-align: center;
}
/* Clickable figures (look-dev walkthroughs): light blue rim highlight on hover,
   matching the roll treatment on the home page tiles. No roll images needed. */
.figure-stack a {
  display: inline-block;   /* hugs the image, doesn't span the container */
  position: relative;
  max-width: 100%;
  border-radius: 4px;
  overflow: hidden;
  line-height: 0;
  vertical-align: top;
}
.figure-stack a img {
  display: block;
  transition: transform .35s ease, filter .25s ease;
}
.figure-stack a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s ease;
  /* inner rim of light blue, brightest at the edges */
  box-shadow:
    inset 0 0 0 1px rgba(180, 210, 255, 0.85),
    inset 0 0 22px 6px rgba(120, 170, 255, 0.55),
    inset 0 0 48px 14px rgba(90, 140, 230, 0.30);
}
.figure-stack a:hover::after,
.figure-stack a:focus-visible::after {
  opacity: 1;
}
.figure-stack a:hover img,
.figure-stack a:focus-visible img {
  transform: scale(1.03);
  filter: brightness(1.06) saturate(1.08);
}
.figure-stack a:focus-visible {
  outline: 2px solid #6b86c0;
  outline-offset: 2px;
}

.divider-rule {
  height: 1px;
  background: #3a4560;
  border: 0;
  margin: 4px 0;
}

.backlink {
  display: inline-block;
  margin-bottom: 18px;
  color: #6b86c0;
  font-size: 17px;
}
.backlink:hover { color: #fff; }

@media (max-width: 760px) {
  .figure-stack { gap: 24px; }
  .figure-stack figcaption { font-size: 15px; }
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  padding: 30px 0 50px;
  text-align: center;
  color: #4a5570;
  font-size: 14px;
}
.site-footer a {
  color: #6b86c0;
}

/* ============================================================
   RESPONSIVE — this is the part the old site could never do
   ============================================================ */
@media (max-width: 1100px) {
  .tile-grid { grid-template-columns: repeat(4, 1fr); }
  .tile-grid--mixed { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .tile-grid { grid-template-columns: repeat(3, 1fr); }
  .site-header .wrap { min-height: 0; }
  .brand img { max-height: 58px; }
  .site-nav a { padding: 8px 12px; font-size: 18px; }
  .section { padding: 20px 0 24px; }
}

@media (max-width: 480px) {
  .tile-grid { grid-template-columns: repeat(2, 1fr); }
  .tile-grid--mixed { grid-template-columns: 1fr; }
  .site-header .wrap { justify-content: center; }
  .section-title { font-size: 21px; }
}

/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .tile:hover img { transform: none; }
}
