/* ----------------------------------------
   Oliver Whyte — quiet index
   ---------------------------------------- */

:root {
  --bg: #ffffff;
  --ink: #111111;
  --text: #777777;
  --text-soft: #a0a0a0;
  --rule: #ececec;
  --easing: cubic-bezier(0.22, 1, 0.36, 1);

  --fs: 15px;        /* one type size */
  --lh: 1.5;         /* tighter rhythm */
  --col: 36rem;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-feature-settings: 'ss01', 'cv11';
  font-size: var(--fs);
  font-weight: 400;
  line-height: var(--lh);
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

@supports (font-variation-settings: normal) {
  html, body { font-family: 'Inter var', 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif; }
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.4s var(--easing), transform 0.45s var(--easing);
}

a:hover {
  color: var(--ink);
}

button {
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

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

p { margin: 0 0 var(--lh) 0; }
p:last-child { margin-bottom: 0; }

/* ----------------------------------------
   Header
   ---------------------------------------- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2rem 2rem;
  z-index: 10;
  background: var(--bg);
}

.wordmark {
  font-size: var(--fs);
  font-weight: 400;
  color: var(--text);
  transition: color 0.4s var(--easing);
}

.wordmark:hover { color: var(--ink); }

.toggle {
  width: 1rem;
  height: 1rem;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: color 0.4s var(--easing), transform 0.5s var(--easing);
}

.toggle:hover { color: var(--ink); }

.toggle-icon,
.toggle-icon::before {
  content: '';
  position: absolute;
  background: currentColor;
}

.toggle-icon {
  width: 0.75rem;
  height: 1px;
}

.toggle-icon::before {
  width: 1px;
  height: 0.75rem;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

body.about-open .toggle { transform: rotate(45deg); color: var(--ink); }

/* ----------------------------------------
   Home — the index
   ---------------------------------------- */

.home {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8rem 2rem;
}

.index {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: var(--col);
}

.index li {
  margin: 0;
}

.index a {
  display: block;
  padding: 0.32rem 0;        /* tighter line spacing */
  color: var(--text);
  position: relative;
  will-change: transform;
}

.index a:hover {
  color: var(--ink);
  transform: translateX(0.4rem);
}

/* gentle stagger on first paint */
.index li {
  opacity: 0;
  transform: translateY(4px);
  animation: rise 0.9s var(--easing) forwards;
}
.index li:nth-child(1)  { animation-delay: 0.05s; }
.index li:nth-child(2)  { animation-delay: 0.09s; }
.index li:nth-child(3)  { animation-delay: 0.13s; }
.index li:nth-child(4)  { animation-delay: 0.17s; }
.index li:nth-child(5)  { animation-delay: 0.21s; }
.index li:nth-child(6)  { animation-delay: 0.25s; }
.index li:nth-child(7)  { animation-delay: 0.29s; }
.index li:nth-child(8)  { animation-delay: 0.33s; }
.index li:nth-child(9)  { animation-delay: 0.37s; }
.index li:nth-child(10) { animation-delay: 0.41s; }
.index li:nth-child(11) { animation-delay: 0.45s; }
.index li:nth-child(12) { animation-delay: 0.49s; }
.index li:nth-child(13) { animation-delay: 0.53s; }

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------
   Footer
   ---------------------------------------- */

.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 2rem;
  pointer-events: none;
}

.site-footer p {
  margin: 0;
  font-size: var(--fs);
  line-height: 1.5;
  color: var(--text-soft);
}

/* ----------------------------------------
   About overlay
   ---------------------------------------- */

.about {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 5;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s var(--easing), visibility 0.5s var(--easing);
  overflow-y: auto;
}

.about[hidden] { display: block; }

body.about-open .about {
  opacity: 1;
  visibility: visible;
}

.about-inner {
  max-width: var(--col);
  padding: 8rem 2rem 4rem;
}

.about-title {
  font-size: var(--fs);
  font-weight: 400;
  color: var(--text-soft);
  margin: 0 0 1rem;
  letter-spacing: -0.005em;
}

.about-text {
  font-size: var(--fs);
  line-height: var(--lh);
  color: var(--text);
  margin: 0 0 2.5rem;
}

.about-meta {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.about-meta > div {
  display: grid;
  grid-template-columns: 8rem 1fr;
  align-items: baseline;
  font-size: var(--fs);
}

.about-meta dt {
  color: var(--text-soft);
  font-weight: 400;
  margin: 0;
}

.about-meta dd {
  margin: 0;
  color: var(--text);
}

.about-meta dd a {
  transition: color 0.4s var(--easing);
}

.about-meta dd a:hover {
  color: var(--ink);
}

body.about-open .about-inner > * {
  animation: rise 0.7s var(--easing) backwards;
}
body.about-open .about-title { animation-delay: 0.1s; }
body.about-open .about-text  { animation-delay: 0.18s; }
body.about-open .about-meta  { animation-delay: 0.26s; }

/* ----------------------------------------
   Project pages
   ---------------------------------------- */

.project {
  padding: 8rem 0 6rem;       /* no horizontal padding — children control it */
}

.project-text {
  max-width: var(--col);
  margin: 0 auto 5rem;        /* centered horizontally */
  padding: 0 2rem;            /* keeps text from touching edges */
}

.project-title {
  font-size: var(--fs);
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.005em;
  line-height: var(--lh);
  margin: 0 0 1rem;
}

.project-description {
  font-size: var(--fs);
  line-height: var(--lh);
  color: var(--text);
  margin: 0 0 2.5rem;
}

.project-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0;
}

.project-meta > div {
  display: grid;
  grid-template-columns: 6rem 1fr;
  align-items: baseline;
  font-size: var(--fs);
}

.project-meta dt {
  color: var(--text-soft);
  font-weight: 400;
  margin: 0;
}

.project-meta dd {
  margin: 0;
  color: var(--text);
}

/* full-bleed image stack */
.project-images {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 0 0 5rem;
  width: 100%;                /* full page width */
}

.project-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #f6f6f6 0%, #ececec 100%);
  display: block;
}

.project-image.tall { aspect-ratio: 3 / 4; }
.project-image.wide { aspect-ratio: 16 / 9; }

/* image / video tag fallback (when real media replaces placeholder divs) */
.project-images img,
.project-images video {
  width: 100%;
  height: auto;
  display: block;
}

/* two-up row: two images side-by-side */
.project-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  width: 100%;
}

.project-row > * {
  width: 100%;
  display: block;
}

/* centered media block (e.g. a video shown at intrinsic-ish size) */
.project-media-centered {
  width: 100%;
  max-width: 720px;
  margin: 0 auto 5rem;
  display: block;
}

.project-media-centered video,
.project-media-centered img {
  width: 100%;
  height: auto;
  display: block;
}

/* prev / next navigation */
.project-nav {
  max-width: var(--col);
  margin: 0 auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: baseline;
  gap: 1rem;
  font-size: var(--fs);
}

.project-nav a {
  color: var(--text);
  transition: color 0.4s var(--easing), transform 0.4s var(--easing);
}

.project-nav a:hover { color: var(--ink); }

.project-nav .prev { justify-self: start; }
.project-nav .next { justify-self: end; }

.project-nav .prev:hover { transform: translateX(-0.4rem); }
.project-nav .next:hover { transform: translateX(0.4rem); }

/* hide a missing prev/next placeholder but keep the grid balanced */
.project-nav .empty { visibility: hidden; }

/* ----------------------------------------
   Responsive
   ---------------------------------------- */

@media (max-width: 640px) {
  :root { --fs: 14px; }
  .site-header { padding: 1.5rem 1.5rem; }
  .home { padding: 6rem 1.5rem; }
  .index a:hover { transform: none; }
  .site-footer { padding: 1.5rem 1.5rem; position: static; margin-top: 4rem; }
  .about-inner { padding: 6rem 1.5rem 3rem; }
  .about-meta > div,
  .project-meta > div {
    grid-template-columns: 1fr;
    row-gap: 0;
  }
  .project { padding: 6rem 0 4rem; }
  .project-text { padding: 0 1.5rem; margin-bottom: 3rem; }
  .project-images { gap: 1rem; margin-bottom: 3rem; }
  .project-row { grid-template-columns: 1fr; gap: 1rem; }
  .project-media-centered { margin-bottom: 3rem; padding: 0 1.5rem; }
  .project-nav { padding: 0 1.5rem; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .index a:hover { transform: none; }
}
