/* ==========================================================================
   Morgan Johnson Quamina — portfolio
   Instrument Serif display / Karla nav / Inter body
   Each page sets a theme class on <body> and everything follows from it.
   ========================================================================== */

:root {
  --serif: "Instrument Serif", Georgia, serif;
  --karla: "Karla", "Helvetica Neue", Arial, sans-serif;
  --inter: "Inter", "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(1.25rem, 6.5vw, 3.5rem);
  --edge: clamp(1rem, 3.5vw, 2rem);
}

/* ---- themes ---- */

.t-home     { --bg: #fceda2; --ink: #7d5f00; --block: #7d5f00; --block-ink: #fceda2; --hl: #f2d95e; }
.t-digital  { --bg: #bfe3fb; --ink: #3fa2de; --block: #06416c; --block-ink: #ffffff; --hl: #6cc4f5; }
.t-physical { --bg: #ffd9e0; --ink: #e8394f; --block: #5c0812; --block-ink: #ffffff; --hl: #ffa8b6; }
.t-about    { --bg: #ffffff; --ink: #111111; --block: #000000; --block-ink: #25c55e; --hl: #d4d4d4; }
.t-other    { --bg: #cffbdf; --ink: #1e9e5a; --block: #0d5c33; --block-ink: #cffbdf; --hl: #85eab1; }

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--inter);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- the Figma scale: 90% horizontal, 104% vertical ---- */

.scaled {
  display: inline-block;
  transform: scaleX(0.9) scaleY(1.04);
}

/* ---- nav ---- */

.nav {
  display: flex;
  justify-content: flex-end;
  padding: var(--edge) var(--edge) 0;
}

.nav__inner {
  display: flex;
  gap: 0.75em;
  font-family: var(--karla);
  font-size: 20px;
  letter-spacing: -0.045em;
  transform: scaleX(0.9) scaleY(1.04);
  transform-origin: right center;
}

.nav a {
  color: inherit;
  text-decoration: none;
  padding: 0 0.15em;
}

.nav a:hover { text-decoration: underline; }

.nav a[aria-current="page"] { background: var(--hl); }

/* ---- page heading (every page but home) ---- */

.masthead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  padding: var(--edge) var(--edge) 0;
}

.masthead .nav { padding: 0; }

.page-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.25rem, 2.6vw, 1.9rem);
  line-height: 1.2;
  margin: 0;
  padding-left: calc(var(--gutter) - var(--edge));
}

/* ---- home ---- */

.home {
  min-height: 78vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem var(--edge) 6rem;
}

.home__name {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.5rem, 11vw, 116px);
  line-height: 1.05;
  margin: 0 0 1.1rem;
  letter-spacing: 0;
}

.home__lines {
  font-family: var(--inter);
  font-size: 19.8px;
  line-height: 39.6px;
  letter-spacing: -0.045em;
  margin: 0;
}

.home__lines span { display: block; }

/* ---- work grids ---- */

.work {
  padding: clamp(2rem, 5vw, 3.25rem) var(--gutter) clamp(3rem, 8vw, 6rem);
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 4vw, 3.25rem);
}

.work__group { display: flex; flex-direction: column; gap: clamp(0.6rem, 1.5vw, 1rem); }

.work__label {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  line-height: 1.2;
  margin: 0;
}

.row {
  display: grid;
  gap: clamp(1rem, 4vw, 3.5rem);
  grid-template-columns: 1.78fr 1fr;
}

.row--flip { grid-template-columns: 1fr 1.78fr; }

.row--single { grid-template-columns: minmax(0, 1fr); }

.block {
  background: var(--block);
  color: var(--block-ink);
  min-height: clamp(200px, 30vw, 360px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
  font-size: clamp(1.5rem, 4.2vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.block a { color: inherit; text-decoration: none; }
.block a:hover { text-decoration: underline; }

/* ---- about ---- */

.about {
  padding: clamp(2rem, 5vw, 3.25rem) var(--gutter) clamp(3rem, 8vw, 6rem);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 6vw, 5.5rem);
}

.about .block {
  aspect-ratio: 1 / 1.06;
  min-height: 0;
  font-size: 14px;
  letter-spacing: -0.02em;
}

/* ---- other ---- */

.other {
  padding: clamp(2rem, 5vw, 3.25rem) var(--gutter) 6rem;
  min-height: 60vh;
}

/* ---- small screens ---- */

@media (max-width: 44rem) {
  .row, .row--flip, .about { grid-template-columns: minmax(0, 1fr); }
  .masthead { flex-direction: column-reverse; align-items: stretch; gap: 1.25rem; }
  .masthead .nav { justify-content: flex-end; }
  .nav__inner { font-size: 16px; }
  .about .block { aspect-ratio: 1 / 0.8; }
}

:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* ---- project tiles on the physical / digital pages ---- */

.tiles {
  padding: clamp(2rem, 5vw, 3.25rem) var(--gutter) clamp(3rem, 8vw, 6rem);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.25rem, 3vw, 2.25rem);
}

.tile {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--block);
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 600ms cubic-bezier(0, 0, 0.2, 1);
}

.tile:hover img { transform: scale(1.04); }

/* the name sits over the image and only appears on hover */
.tile__name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2.5rem 1.1rem 0.9rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1rem, 1.8vw, 1.4rem);
  line-height: 1.2;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
  opacity: 0;
  transition: opacity 320ms ease;
}

.tile:hover .tile__name,
.tile:focus-visible .tile__name { opacity: 1; }

/* no hover on touch screens, so always show it there */
@media (hover: none) {
  .tile__name { opacity: 1; }
}

/* a tile with no photograph yet: the name is the whole tile */
.tile--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
}

.tile--empty .tile__name {
  position: static;
  opacity: 1;
  padding: 0;
  background: none;
  color: var(--block-ink);
  font-size: clamp(1.1rem, 2.4vw, 1.75rem);
}

@media (max-width: 44rem) {
  .tiles { grid-template-columns: minmax(0, 1fr); }
}

/* ---- project pages: gallery + write-up ---- */

.project-page {
  padding: clamp(2rem, 5vw, 3.25rem) var(--gutter) clamp(3rem, 8vw, 6rem);
}

.writeup {
  max-width: 34em;
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.02em;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

.writeup p { margin: 0 0 1rem; }
.writeup p:last-child { margin-bottom: 0; }

.writeup__lede {
  font-size: clamp(1.125rem, 1rem + 0.6vw, 1.4rem);
  line-height: 1.35;
  margin-bottom: 1.5rem;
}

.writeup__facts {
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
  font-size: 14px;
}

.writeup__facts li {
  display: flex;
  gap: 1rem;
  padding: 0.55rem 0;
  border-top: 1px solid currentColor;
}

.writeup__facts .k { flex: 0 0 8rem; opacity: 0.7; }

.gallery {
  display: grid;
  gap: clamp(1rem, 3vw, 2.25rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
}

.gallery figure { margin: 0; }

.gallery img {
  width: 100%;
  height: auto;
  display: block;
  background: var(--block);
}

.gallery figcaption {
  font-size: 13px;
  opacity: 0.75;
  margin-top: 0.6rem;
  letter-spacing: -0.02em;
}

/* a figure that should run the full width of the gallery */
.gallery .wide { grid-column: 1 / -1; }

/* a link that reads as an action rather than body text */
.linkout {
  display: inline-block;
  font-family: var(--karla);
  font-size: 15px;
  letter-spacing: -0.045em;
  color: inherit;
  text-decoration: none;
  border-bottom: 2px solid currentColor;
  padding-bottom: 0.1rem;
}

.linkout:hover { opacity: 0.6; }

.gallery a { display: block; }

.gallery video {
  width: 100%;
  height: auto;
  display: block;
  background: #fff;
}


/* ---- sketch & video pages ---- */

.sketch {
  padding: clamp(2rem, 5vw, 3.25rem) var(--gutter) clamp(3rem, 8vw, 6rem);
  display: grid;
  gap: clamp(1.5rem, 4vw, 3.25rem);
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 56rem) {
  .sketch { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start; }
  /* for tall, phone-shaped canvases the media column is the narrow one */
  .sketch--narrow { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
}

#holder canvas { max-width: 100%; height: auto; display: block; }

.sketch__text {
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.02em;
  max-width: 34em;
}

.sketch__text h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.5rem;
  margin: 0 0 0.75rem;
}

.sketch__text p { margin: 0 0 1rem; }
.sketch__text p:last-child { margin-bottom: 0; }

.sketch__meta, .sketch__hint { font-size: 13px; opacity: 0.75; }

/* video */

.player { background: var(--block); padding: clamp(0.75rem, 2vw, 1.25rem); }

.player video { display: block; width: 100%; height: auto; background: #000; }

.player__fallback {
  color: var(--block-ink);
  font-size: 14px;
  padding: 2rem 1rem;
  text-align: center;
}

.player__fallback a { color: inherit; }

.caption { font-size: 13px; opacity: 0.75; margin-top: 0.65rem; letter-spacing: -0.02em; }

.stills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.stills img { width: 100%; height: auto; display: block; }


/* ==========================================================================
   Page transitions
   Cross-document View Transitions: the browser snapshots the outgoing page,
   snapshots the incoming one, and animates between them. No JavaScript.
   Unsupported browsers simply navigate instantly — nothing breaks.
   ========================================================================== */

@view-transition { navigation: auto; }

/* Elements given a name are tracked across pages instead of fading with
   everything else, so the nav stays put while the page changes underneath it.
   A name must be unique on the page. */
.nav__inner { view-transition-name: nav; }
.page-title { view-transition-name: title; }

@media (prefers-reduced-motion: no-preference) {

  ::view-transition-old(root) {
    animation: vt-out 220ms cubic-bezier(0.4, 0, 1, 1) both;
  }

  ::view-transition-new(root) {
    animation: vt-in 340ms cubic-bezier(0, 0, 0.2, 1) both;
  }

  /* the nav crossfades quickly so it reads as continuous */
  ::view-transition-old(nav),
  ::view-transition-new(nav) {
    animation-duration: 180ms;
  }

  ::view-transition-old(title) {
    animation: vt-title-out 200ms ease both;
  }

  ::view-transition-new(title) {
    animation: vt-title-in 340ms cubic-bezier(0, 0, 0.2, 1) both;
  }
}

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

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

@keyframes vt-title-out {
  to { opacity: 0; transform: translateY(-6px); }
}

@keyframes vt-title-in {
  from { opacity: 0; transform: translateY(8px); }
}

/* Fallback for browsers without View Transitions (Firefox, older Safari):
   animate the content in on load so navigation still feels deliberate. */
@supports not (view-transition-name: none) {
  @media (prefers-reduced-motion: no-preference) {
    main { animation: page-in 340ms cubic-bezier(0, 0, 0.2, 1) both; }
  }
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(10px); }
}

/* ==========================================================================
   Scroll reveal
   reveal.js adds .reveal-ready to <html> and [data-reveal] to its targets.
   Without the script nothing is hidden, so the page degrades to plain.
   ========================================================================== */

[data-reveal] {
  transition: opacity 800ms cubic-bezier(0, 0, 0.2, 1),
              transform 800ms cubic-bezier(0, 0, 0.2, 1);
}

.reveal-ready [data-reveal] {
  opacity: 0;
  transform: translateY(22px);
}

.reveal-ready [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal-ready [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---- about ---- */

.about-grid {
  padding: clamp(2rem, 5vw, 3.25rem) var(--gutter) clamp(3rem, 8vw, 6rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.75rem, 5vw, 4rem);
  align-items: start;
}

@media (min-width: 56rem) {
  .about-grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
}

.about-grid img { width: 100%; height: auto; display: block; }

/* ---- experience list (the other page) ---- */

.experience {
  padding: clamp(2rem, 5vw, 3.25rem) var(--gutter) clamp(3rem, 8vw, 6rem);
  max-width: 46em;
}

.role { padding-block: clamp(1.5rem, 3vw, 2.25rem); border-top: 1px solid currentColor; }

.role:first-child { border-top: 0; padding-top: 0; }

.role__org {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  line-height: 1.15;
  margin: 0 0 0.2rem;
}

.role__meta {
  font-family: var(--karla);
  font-size: 14px;
  letter-spacing: -0.045em;
  opacity: 0.75;
  margin: 0 0 1rem;
}

.role ul { margin: 0; padding-left: 1.1em; font-size: 16px; line-height: 1.55; letter-spacing: -0.02em; }

.role li { margin-bottom: 0.5rem; }

.role li:last-child { margin-bottom: 0; }

.role__todo { opacity: 0.55; font-style: italic; }
