/* ---------- Tokens (change colours / fonts here) ---------- */
:root {
  --bg: #111111;
  --panel: #1a1918;
  --ink: #E8E6E1;
  --mute: #8d8a84;
  --sand: #b7ad9b;
  --line: rgba(232, 230, 225, .14);
  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --pad: clamp(1.25rem, 4vw, 3.5rem);
  --ease: cubic-bezier(.22, .61, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 300 1rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

h1, h2, p {
  margin: 0;
}

:focus-visible {
  outline: 1px solid var(--sand);
  outline-offset: 4px;
}

::selection {
  background: var(--sand);
  color: var(--bg);
}


/* ---------- Film grain ---------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}


/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem var(--pad);
  font-size: .72rem;
  letter-spacing: .18em;
  font-weight: 400;
  transition: background .6s var(--ease), padding .6s var(--ease);
}

.nav.scrolled {
  background: rgba(17, 17, 17, .82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding-block: .9rem;
}

.nav nav {
  display: flex;
  gap: clamp(1rem, 3vw, 2.25rem);
}

.nav a {
  color: var(--mute);
  transition: color .5s var(--ease);
}

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

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


/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 7rem var(--pad) clamp(2rem, 5vw, 3.5rem);
}

.status {
  display: flex;
  align-items: center;
  gap: .7rem;
  font-size: .68rem;
  letter-spacing: .22em;
  color: var(--mute);
  margin-bottom: clamp(1rem, 3vw, 2rem);
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sand);
  animation: breathe 5s ease-in-out infinite;
}

.name {
  font: 400 clamp(6.5rem, 27vw, 26rem)/.8 var(--display);
  letter-spacing: -.045em;
  margin-left: -.04em;
  color: var(--ink);
}

.hero-foot {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 1.5rem 3rem;
  align-items: end;
  margin-top: clamp(2rem, 6vw, 4.5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.role {
  font: 400 1.35rem/1.35 var(--display);
}

.role span {
  color: var(--mute);
  font: 300 .85rem/1.9 var(--sans);
  letter-spacing: .04em;
}

.line {
  color: var(--mute);
  max-width: 26ch;
  font-size: .95rem;
}

.cta {
  font-size: .8rem;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--sand);
  padding-bottom: .25rem;
  transition: color .5s var(--ease), border-color .5s var(--ease);
}

.cta:hover {
  color: var(--sand);
}


/* ---------- Page-load sequence ---------- */
.js .r1,
.js .r2,
.js .r3,
.js .r4 {
  opacity: 0;
  animation: settle 2.2s var(--ease) forwards;
}

.js .r1 {
  animation-duration: 2.6s;
  animation-delay: .2s;
}

.js .r2 {
  animation-delay: 1.2s;
  animation-duration: 1.8s;
}

.js .r3 {
  animation-delay: 1.5s;
  animation-duration: 1.8s;
}

.js .r4 {
  animation-delay: 1.8s;
  animation-duration: 1.8s;
}

@keyframes settle {
  from {
    opacity: 0;
    filter: blur(12px);
    transform: translateY(1rem);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: none;
  }
}

@keyframes breathe {
  0%, 100% {
    opacity: .35;
  }

  50% {
    opacity: 1;
  }
}


/* ---------- Work ---------- */
.work {
  padding: clamp(5rem, 12vw, 10rem) var(--pad) clamp(4rem, 9vw, 8rem);
}

.work-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: clamp(2.5rem, 6vw, 5rem);
}

.work-head h2 {
  font: 400 clamp(2rem, 4.5vw, 3.5rem)/1 var(--display);
  letter-spacing: -.02em;
}

.work-head p {
  color: var(--mute);
  font-size: .8rem;
  letter-spacing: .1em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(3rem, 7vw, 7rem) clamp(1rem, 2vw, 2rem);
  align-items: start;
}

.w1 {
  grid-column: 1 / 9;
}

.w2 {
  grid-column: 9 / 13;
  align-self: end;
}

.w3 {
  grid-column: 1 / 5;
  align-self: end;
}

.w4 {
  grid-column: 5 / 13;
}

.w5 {
  grid-column: 2 / 8;
}

.w6 {
  grid-column: 8 / 13;
  margin-top: clamp(4rem, 12vw, 11rem);
}


/* ---------- Image handling ---------- */
/* Images now keep their natural aspect ratios. */
.item {
  position: relative;
  margin: 0;
}

.frame {
  position: relative;
  overflow: hidden;
  background: var(--panel);
}

.frame img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  object-fit: contain;
  transform: scale(1);
  transition: transform 1.6s var(--ease);
}

.frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, .5);
  opacity: 0;
  transition: opacity 1s var(--ease);
  pointer-events: none;
}

.item figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 1.25rem 1.4rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  pointer-events: none;
  opacity: 0;
  transform: translateY(.4rem);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
}

.feature figcaption {
  padding: 1.6rem 1.8rem;
}

.t {
  font: 400 clamp(1.3rem, 2.2vw, 1.9rem)/1.1 var(--display);
}

.c {
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--sand);
  text-align: right;
}

.item:hover img,
.item:focus-visible img {
  transform: scale(1.045);
}

.item:hover .frame::after,
.item:focus-visible .frame::after {
  opacity: 1;
}

.item:hover figcaption,
.item:focus-visible figcaption {
  opacity: 1;
  transform: none;
}


/* ---------- Touch screens ---------- */
@media (hover: none), (max-width: 760px) {
  .item figcaption,
  .feature figcaption {
    position: static;
    opacity: 1;
    transform: none;
    padding: .7rem 0 0;
  }

  .frame::after {
    display: none;
  }

  .item:hover img {
    transform: none;
  }
}


/* ---------- Scroll reveal ---------- */
.js .reveal {
  opacity: 0;
  filter: blur(8px);
  transition: opacity 1.8s var(--ease), filter 1.8s var(--ease);
}

.js .reveal.in {
  opacity: 1;
  filter: blur(0);
}


/* ---------- About ---------- */
.about {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2rem clamp(1rem, 2vw, 2rem);
  padding: clamp(4rem, 9vw, 8rem) var(--pad);
  border-top: 1px solid var(--line);
}

.label {
  grid-column: 1 / 4;
  font: 400 .72rem/1.8 var(--sans);
  letter-spacing: .22em;
  color: var(--mute);
}

.about-body {
  grid-column: 4 / 12;
}

.bio {
  font: 400 clamp(1.6rem, 3.2vw, 2.7rem)/1.25 var(--display);
  letter-spacing: -.01em;
  max-width: 30em;
}

.skills {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 2.2rem;
  margin-top: clamp(2rem, 5vw, 3.5rem);
  font-size: .72rem;
  letter-spacing: .2em;
  color: var(--mute);
}


/* ---------- Contact ---------- */
.contact {
  padding: clamp(6rem, 14vw, 12rem) var(--pad) clamp(5rem, 10vw, 8rem);
  border-top: 1px solid var(--line);
}

.contact h2 {
  font: 400 clamp(2.8rem, 9vw, 8.5rem)/.98 var(--display);
  letter-spacing: -.035em;
}

.contact h2 em {
  color: var(--sand);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 3rem;
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
}

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

.links a,
.links button {
  font-size: 1.05rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--line);
  transition: border-color .6s var(--ease), color .6s var(--ease);
}

.links a:hover,
.links button:hover {
  border-color: var(--sand);
  color: var(--sand);
}


/* ---------- Footer ---------- */
.foot {
  display: flex;
  justify-content: space-between;
  padding: 1.5rem var(--pad) 2rem;
  border-top: 1px solid var(--line);
  font-size: .75rem;
  color: var(--mute);
}

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


/* ---------- Discord window ---------- */
[hidden] {
  display: none !important;
}

body:has(dialog[open]) {
  overflow: hidden;
}

.dlg {
  width: min(92vw, 26rem);
  padding: clamp(1.5rem, 5vw, 2.25rem);
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
}

.dlg::backdrop {
  background: rgba(10, 10, 10, .75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.dlg[open] {
  animation: settle .7s var(--ease);
}

.dlg-label {
  font-size: .7rem;
  letter-spacing: .22em;
  color: var(--mute);
}

.dlg-name {
  font: 400 clamp(2rem, 8vw, 2.8rem)/1.1 var(--display);
  margin: .6rem 0 1.6rem;
  word-break: break-all;
  user-select: all;
  -webkit-user-select: all;
}

.dlg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .9rem 2rem;
}

.dlg-actions button,
.dlg-actions a {
  font: 300 .95rem/1.4 var(--sans);
  color: var(--ink);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--sand);
  padding: 0 0 .25rem;
  cursor: pointer;
  transition: color .5s var(--ease);
}

.dlg-actions button:hover,
.dlg-actions a:hover {
  color: var(--sand);
}

.dlg-x {
  position: absolute;
  top: .9rem;
  right: 1rem;
  background: none;
  border: 0;
  padding: .25rem;
  color: var(--mute);
  font: 300 .68rem var(--sans);
  letter-spacing: .16em;
  cursor: pointer;
}

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


/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .nav {
    font-size: .66rem;
    letter-spacing: .14em;
  }

  .hero-foot {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .cta {
    justify-self: start;
  }

  .grid {
    gap: 2.25rem 1rem;
  }

  .w1,
  .w4 {
    grid-column: 1 / -1;
  }

  .w2 {
    grid-column: 6 / 13;
    align-self: start;
  }

  .w3 {
    grid-column: 1 / 8;
    align-self: start;
  }

  .w5 {
    grid-column: 1 / 10;
  }

  .w6 {
    grid-column: 4 / 13;
    margin-top: 0;
  }

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

  .label,
  .about-body {
    grid-column: 1 / -1;
  }

  .item figcaption,
  .feature figcaption {
    flex-direction: column;
    gap: .15rem;
  }

  .c {
    text-align: left;
  }

  .links {
    gap: 1rem 2rem;
  }
}


/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: .01ms !important;
  }

  .js .r1,
  .js .r2,
  .js .r3,
  .js .r4,
  .js .reveal {
    opacity: 1;
    filter: none;
    transform: none;
  }

  .item:hover img {
    transform: none;
  }
}
