:root {
  --ink: #151412;
  --paper: #e9e5dc;
  --accent: #e1432f;
  --line: rgba(21, 20, 18, 0.22);
  --muted: rgba(21, 20, 18, 0.57);
  --pointer-x: 0;
  --pointer-y: 0;
  --mx: 50vw;
  --my: 50vh;
  --rx: 50vw;
  --ry: 50vh;
  --dx: 50vw;
  --dy: 50vh;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  background-color: var(--paper);
  background-image: linear-gradient(
    115deg,
    #e9e5dc 0%,
    #ede8de 22%,
    #e4ddcf 46%,
    rgba(225, 67, 47, 0.06) 60%,
    #e8e2d6 78%,
    #e9e5dc 100%
  );
  background-size: 240% 240%;
  background-position: 0% 50%;
  animation: paper-drift 26s ease-in-out infinite alternate;
}

@keyframes paper-drift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 0%;
  }
  100% {
    background-position: 60% 100%;
  }
}

a {
  color: inherit;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.38'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* Cursor-driven ambient light raking across the paper */
.cursor-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    24rem 24rem at var(--mx) var(--my),
    rgba(225, 67, 47, 0.13),
    rgba(225, 67, 47, 0.04) 38%,
    transparent 64%
  );
  mix-blend-mode: multiply;
  transition: opacity 600ms ease;
}

/* Custom "ink" cursor — a trailing ring and a precise dot */
.cursor-ring,
.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  pointer-events: none;
  border-radius: 50%;
  opacity: 0;
  display: none;
}

.cursor-ring {
  width: 2.1rem;
  height: 2.1rem;
  margin: -1.05rem 0 0 -1.05rem;
  border: 1px solid var(--accent);
  transform: translate(var(--rx), var(--ry)) scale(var(--ring-scale, 1));
  transition: opacity 350ms ease, width 250ms ease, height 250ms ease,
    background-color 250ms ease, border-color 250ms ease,
    transform 120ms ease-out;
  will-change: transform;
}

.cursor-dot {
  width: 0.34rem;
  height: 0.34rem;
  margin: -0.17rem 0 0 -0.17rem;
  background: var(--accent);
  transform: translate(var(--dx), var(--dy));
  transition: opacity 350ms ease, transform 60ms linear;
  will-change: transform;
}

/* Only take over the cursor where a real pointer exists */
@media (hover: hover) and (pointer: fine) {
  .js.cursor-ready {
    cursor: none;
  }

  .js.cursor-ready a,
  .js.cursor-ready button {
    cursor: none;
  }

  .js.cursor-ready .cursor-ring,
  .js.cursor-ready .cursor-dot {
    display: block;
  }

  .cursor-ready.cursor-active .cursor-glow,
  .cursor-ready.cursor-active .cursor-ring,
  .cursor-ready.cursor-active .cursor-dot {
    opacity: 1;
  }

  /* Cursor swells and fills over interactive targets */
  .cursor-ready.cursor-hot .cursor-ring {
    --ring-scale: 1.9;
    background: rgba(225, 67, 47, 0.12);
    border-color: var(--accent);
  }

  .cursor-ready.cursor-hot .cursor-dot {
    opacity: 0;
  }

  /* Tactile press: ring contracts briefly on click */
  .cursor-ready.cursor-down .cursor-ring {
    --ring-scale: 0.8;
    background: rgba(225, 67, 47, 0.18);
  }

  .cursor-ready.cursor-down.cursor-hot .cursor-ring {
    --ring-scale: 1.55;
  }
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  width: 58%;
  height: 4.75rem;
  padding: 0 2.25rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(233, 229, 220, 0.82);
  backdrop-filter: blur(14px);
}

.wordmark {
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 0.22rem;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: -0.08em;
  text-decoration: none;
}

.wordmark-dot,
.availability-dot {
  border-radius: 50%;
  background: var(--accent);
}

.wordmark-dot {
  width: 0.38rem;
  height: 0.38rem;
  margin-top: -0.5rem;
}

.availability,
.site-nav,
.section-label,
.eyebrow,
.portrait-wrap figcaption,
.project-meta,
.hero-footer {
  font-family: "DM Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.availability {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.58rem;
}

.availability-dot {
  width: 0.42rem;
  height: 0.42rem;
  animation: pulse 2.4s ease-out infinite;
}

.site-nav {
  justify-self: end;
  display: flex;
  gap: 1.5rem;
  font-size: 0.58rem;
}

.site-nav a,
.hero-footer a {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3rem;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.hero-footer a:hover,
.hero-footer a:focus-visible {
  color: var(--accent);
}

.hero {
  position: relative;
  min-height: 100svh;
  padding: 4.75rem 42% 0 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) auto;
}

.hero::before {
  content: "001 / PORTFOLIO";
  position: absolute;
  top: 7.2rem;
  left: 2.25rem;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 0.48rem;
  letter-spacing: 0.1em;
  writing-mode: vertical-rl;
}

.hero-copy {
  position: relative;
  z-index: 5;
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  padding: clamp(3.5rem, 10vh, 7rem) 2.25rem 0 clamp(5rem, 8vw, 8.5rem);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 clamp(3rem, 8vh, 6rem);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--muted);
  font-size: 0.58rem;
}

.eyebrow::before {
  content: "";
  width: 2.5rem;
  border-top: 1px solid currentColor;
}

.hero-title {
  width: min-content;
  margin: 0;
  font-size: clamp(6.5rem, 14vw, 14rem);
  line-height: 0.80;
  font-weight: 800;
  letter-spacing: -0.11em;
}

.title-line {
  display: block;
}

.title-line-accent {
  margin-left: clamp(2rem, 8vw, 8rem);
  color: var(--paper);
  -webkit-text-stroke: 1.5px var(--ink);
}

.title-line-accent span {
  color: var(--accent);
  -webkit-text-stroke: 0;
}

/* Cursor "inks in" the headline: accent bleeds into the letters it passes */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .js .title-line {
    background-image: radial-gradient(
      13rem 13rem at var(--tmx, 50%) var(--tmy, -40%),
      var(--accent),
      var(--ink) 56%
    );
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  /* Keep the outlined treatment, but let accent flood the hollow letters */
  .js .title-line-accent {
    background-image: radial-gradient(
      12rem 12rem at var(--tmx, 50%) var(--tmy, -40%),
      var(--accent),
      transparent 52%
    );
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .js .title-line-accent span {
    -webkit-text-fill-color: var(--accent);
  }
}

.hero-intro {
  width: min(27rem, 36vw);
  margin: clamp(3rem, 7vh, 5rem) 0 0;
  padding-top: 1rem;
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 1rem;
  border-top: 1px solid var(--line);
  pointer-events: auto;
}

.intro-index {
  color: var(--accent);
  font-family: "DM Mono", monospace;
  font-size: 0.62rem;
}

.hero-intro p {
  margin: 0;
  font-size: clamp(0.85rem, 1vw, 1rem);
  line-height: 1.6;
  letter-spacing: -0.025em;
}

.portrait-wrap {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  width: 42%;
  min-height: 100svh;
  margin: 0;
  background: #aaa7a2;
}

.portrait-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.portrait-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(21, 20, 18, 0.2), transparent 24%),
    linear-gradient(180deg, transparent 70%, rgba(21, 20, 18, 0.32));
  pointer-events: none;
}

.portrait {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center 34%;
  filter: contrast(1.08);
  transform: scale(1.025) translate(calc(var(--pointer-x) * -0.25px), calc(var(--pointer-y) * -0.25px));
  transition: transform 300ms ease-out;
}

.portrait-wrap figcaption {
  position: absolute;
  right: 2.25rem;
  bottom: 1.5rem;
  left: 2.25rem;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.46rem;
}

.career {
  position: relative;
  z-index: 6;
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  width: min(24rem, calc(100% - 7.25rem));
  margin: 0 0 7rem clamp(5rem, 8vw, 8.5rem);
}

.section-label {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.5rem;
}

.career-list {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  list-style: none;
  border-top: 1px solid var(--line);
}

.career-item {
  padding: 0.8rem 0.5rem 0 0;
  border-right: 1px solid var(--line);
}

.career-item:last-child {
  border-right: 0;
  padding-left: 0.5rem;
}

.career-item:nth-child(2) {
  padding-left: 0.5rem;
}

.career-year,
.career-company,
.career-role {
  display: block;
}

.career-year {
  margin-bottom: 0.7rem;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 0.46rem;
  text-transform: uppercase;
}

.is-current .career-year {
  color: var(--accent);
}

.career-company {
  font-size: 0.72rem;
  font-weight: 700;
}

.career-role {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.48rem;
  line-height: 1.35;
}

.project-card {
  position: absolute;
  right: calc(42% - 4.5rem);
  bottom: 5.25rem;
  z-index: 8;
  width: 15.5rem;
  min-height: 9.2rem;
  padding: 1rem;
  display: grid;
  grid-template-columns: 1fr auto;
  align-content: space-between;
  color: var(--paper);
  background: var(--ink);
  text-decoration: none;
  transform: translate(calc(var(--pointer-x) * 0.18px), calc(var(--pointer-y) * 0.18px)) rotate(-2deg);
  transition: background-color 200ms ease, transform 200ms ease;
}

.project-card:hover,
.project-card:focus-visible {
  background: var(--accent);
  transform: rotate(0);
}

.project-meta {
  grid-column: 1 / -1;
  font-size: 0.42rem;
  opacity: 0.58;
}

.project-name {
  align-self: end;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.085em;
}

.project-arrow {
  align-self: end;
  font-size: 1.1rem;
}

.project-description {
  grid-column: 1 / -1;
  max-width: 12rem;
  margin-top: 0.45rem;
  font-size: 0.52rem;
  opacity: 0.62;
}

.hero-footer {
  position: relative;
  z-index: 9;
  grid-column: 1;
  grid-row: 2;
  padding: 1rem 2.25rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.46rem;
}

.hero-footer p {
  margin: 0;
}

.hero-footer p:nth-child(2) {
  text-align: center;
}

.hero-footer a {
  justify-self: end;
  color: var(--ink);
}

.hero-footer a span {
  color: var(--accent);
}

.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 650ms ease, transform 650ms cubic-bezier(0.22, 1, 0.36, 1);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.js .project-card.reveal {
  transform: translateY(18px) rotate(-2deg);
}

.js .project-card.reveal.is-visible {
  transform: rotate(-2deg);
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 0.38rem rgba(225, 67, 47, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(225, 67, 47, 0);
  }
}

@media (max-width: 1100px) {
  .site-header {
    width: 55%;
  }

  .hero {
    padding-right: 45%;
  }

  .portrait-wrap {
    width: 45%;
  }

  .hero-title {
    font-size: clamp(6rem, 15vw, 10rem);
  }

  .career {
    display: none;
  }

  .project-card {
    right: calc(45% - 5rem);
  }
}

@media (max-width: 760px) {
  .site-header {
    right: 0;
    width: 100%;
    height: 4rem;
    padding: 0 1rem;
    grid-template-columns: 1fr auto;
  }

  .availability {
    display: none;
  }

  .site-nav {
    gap: 0.85rem;
  }

  .site-nav a:nth-child(2) {
    display: none;
  }

  .hero {
    min-height: auto;
    padding: 4rem 0 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .hero::before {
    display: none;
  }

  .hero-copy {
    order: 1;
    padding: 3rem 1rem 2.5rem;
  }

  .eyebrow {
    margin-bottom: 3rem;
  }

  .hero-title {
    font-size: clamp(4.8rem, 24vw, 7rem);
    line-height: 0.74;
  }

  .title-line-accent {
    margin-left: 0.55rem;
    color: transparent;
  }

  .hero-intro {
    width: calc(100% - 2rem);
    margin: 3rem 0 0 auto;
  }

  .portrait-wrap {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    order: 2;
    width: calc(100% - 2rem);
    min-height: 35rem;
    margin: 0 0 0 1rem;
  }

  .portrait-wrap figcaption {
    right: 0.75rem;
    bottom: 0.75rem;
    left: 0.75rem;
  }

  .career {
    order: 3;
    width: calc(100% - 2rem);
    margin: 2.5rem 1rem 0;
    display: block;
  }

  .career-list {
    grid-template-columns: 1fr;
  }

  .career-item,
  .career-item:nth-child(2),
  .career-item:last-child {
    padding: 0.85rem 0;
    display: grid;
    grid-template-columns: 4rem 1fr;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .career-year {
    grid-row: span 2;
  }

  .project-card {
    position: relative;
    right: auto;
    bottom: auto;
    order: 4;
    width: calc(100% - 4rem);
    min-height: 11rem;
    margin: 2.5rem 1rem 2.5rem auto;
  }

  .hero-footer {
    order: 5;
    width: calc(100% - 2rem);
    margin: 0 1rem;
    padding: 1rem 0;
    grid-template-columns: 1fr 1fr;
  }

  .hero-footer p:first-child {
    display: none;
  }

  .hero-footer p:nth-child(2) {
    text-align: left;
  }
}

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

  .availability-dot {
    animation: none;
  }

  .portrait,
  .project-card,
  .reveal {
    transform: none !important;
    transition: none !important;
  }

  .cursor-glow,
  .cursor-ring,
  .cursor-dot {
    display: none !important;
    opacity: 0 !important;
  }

  body {
    animation: none !important;
    background-position: 0% 50% !important;
  }
}
