/* ============================================================
   aion — portfolio
   Aesthetic: warm paper, ink, a single ring + dot.
   Spare, intentional, timeless.
   ============================================================ */

:root {
  --paper:      #f0ebe0;
  --paper-2:    #e9e2d3;
  --ink:        #1b1814;
  --ink-soft:   rgba(27, 24, 20, 0.60);
  --ink-mute:   rgba(27, 24, 20, 0.40);
  --ink-faint:  rgba(27, 24, 20, 0.10);
  --line:       rgba(27, 24, 20, 0.14);

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  --wrap: 1180px;
  --gutter: clamp(1.4rem, 5vw, 4.5rem);
  --ease: cubic-bezier(.22, 1, .36, 1);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* site-wide caustic wave field — sits above the paper, below all content */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* very subtle paper grain */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--ink); color: var(--paper); }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* keep the fixed nav from covering anchored section headings */
#work, #about { scroll-margin-top: 92px; }

/* small uppercase label */
.kicker {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- the mark (svg ring + dot) ---------- */
.mark { width: 1em; height: 1em; display: inline-block; color: var(--ink); }
.mark circle.ring { fill: none; stroke: currentColor; }

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem var(--gutter);
  transition: padding .5s var(--ease), background .5s var(--ease);
}
.nav.scrolled {
  padding-top: 1rem;
  padding-bottom: 1rem;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.nav__brand .mark { font-size: 1.1rem; }
.nav__brand b { font-weight: 500; }
.nav__links {
  display: flex;
  gap: clamp(1rem, 3vw, 2.4rem);
}
.nav__links a {
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  position: relative;
  padding-bottom: 2px;
  transition: color .35s var(--ease);
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .4s var(--ease);
}
.nav__links a:hover { color: var(--ink); }
.nav__links a:hover::after { transform: scaleX(1); }

/* "roll" hover: the label slides up and a copy rolls in from below.
   Markup is injected by main.js for .nav__links a and .footer__links a. */
.roll {
  position: relative;
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
}
.roll .roll-a,
.roll .roll-b {
  display: block;
  transition: transform .5s var(--ease);
}
.roll .roll-b {
  position: absolute;
  left: 0;
  top: 0;
  transform: translateY(115%);
}
.roll:hover .roll-a,
.roll:focus-visible .roll-a { transform: translateY(-115%); }
.roll:hover .roll-b,
.roll:focus-visible .roll-b { transform: translateY(0); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  min-height: 100svh;
  min-height: 100vh;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
}
/* ---- the hero mark: an SVG circle that draws itself on ---- */
.hero__mark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1;
  pointer-events: none;
  will-change: transform;
}
.hero__mark svg {
  width: min(44vmin, 380px);
  height: auto;
  overflow: visible;
  color: var(--ink);
  display: block;
}
/* so % transform-origin resolves to each circle's own centre, not the viewBox */
.hero__mark svg circle {
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

/* r = 82  ->  circumference ≈ 515.22 */
.hm-ring {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 515.22;
  stroke-dashoffset: 515.22;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  animation: hm-draw 1.7s cubic-bezier(.66, 0, .2, 1) .25s forwards;
}
@keyframes hm-draw { to { stroke-dashoffset: 0; } }

.hm-dot {
  fill: currentColor;
  transform: scale(0);
  transform-origin: 50% 50%;
  animation:
    hm-pop .9s cubic-bezier(.34, 1.56, .5, 1) 1.2s forwards,
    hm-breathe 5.5s ease-in-out 2.3s infinite;
}
@keyframes hm-pop { to { transform: scale(1); } }
@keyframes hm-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }

/* ripples emanating from the centre (the waves) */
.hm-wave {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  opacity: 0;
  transform: scale(.18);
  transform-origin: 50% 50%;
  animation: hm-wave 4.4s ease-out 1.6s infinite;
}
.hm-wave--b { animation-delay: 3.8s; }
@keyframes hm-wave {
  0%   { transform: scale(.18); opacity: 0; }
  14%  { opacity: .4; }
  100% { transform: scale(1.24); opacity: 0; }
}

/* a small bead that glides around the ring once it's drawn */
.hm-tracer {
  fill: none;
  stroke: currentColor;
  stroke-width: 3.6;
  stroke-linecap: round;
  stroke-dasharray: 6 509.22;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  opacity: 0;
  animation:
    hm-tracer-in 1s ease 1.9s forwards,
    hm-tracer 7s linear 1.9s infinite;
}
@keyframes hm-tracer-in { to { opacity: .85; } }
@keyframes hm-tracer { to { stroke-dashoffset: -515.22; } }

.hero__caption {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, calc(min(23vmin, 200px) + 2.2rem));
  z-index: 2;
  text-align: center;
  pointer-events: none;
}
.hero__wordmark {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  margin: 0;
  opacity: 0;
  animation: rise 1.1s var(--ease) 0.6s forwards;
}

.hero__foot {
  position: relative;
  z-index: 2;
  padding: 0 var(--gutter) clamp(2rem, 6vh, 4.5rem);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}
.hero__statement {
  max-width: 30ch;
}
.hero__statement .kicker { display: block; margin-bottom: 1rem; opacity: 0; animation: rise .9s var(--ease) .8s forwards; }
.hero__statement h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.9rem, 4.4vw, 3.2rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0;
  opacity: 0;
  animation: rise 1s var(--ease) .95s forwards;
}
/* hero name: per-letter reveal (blur + rise, staggered) */
.hero__statement h1.name-reveal {
  opacity: 1;
  animation: none;
}
.name-word { display: inline-block; white-space: nowrap; }
.name-char {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.5em);
  filter: blur(8px);
  animation: name-in 0.85s var(--ease) both;
  animation-delay: calc(0.45s + var(--i) * 0.05s);
  will-change: transform, opacity, filter;
}
@keyframes name-in {
  to { opacity: 1; transform: none; filter: blur(0); }
}

.hero__scroll {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  opacity: 0;
  animation: rise 1s var(--ease) 1.2s forwards;
}
.hero__scroll .bar {
  width: 46px; height: 1px; background: var(--ink-mute);
  position: relative; overflow: hidden;
}
.hero__scroll .bar::after {
  content: ""; position: absolute; inset: 0;
  background: var(--ink);
  transform: translateX(-100%);
  animation: sweep 2.6s var(--ease) infinite;
}
@keyframes sweep {
  0% { transform: translateX(-100%); }
  55%,100% { transform: translateX(100%); }
}

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

/* ============================================================
   ETHOS
   ============================================================ */
.ethos {
  padding: clamp(6rem, 16vh, 12rem) 0;
}
.ethos p {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.5rem, 3.6vw, 2.6rem);
  line-height: 1.32;
  letter-spacing: -0.015em;
  max-width: 18ch;
  margin: 0;
}
.ethos p em { font-style: italic; }
.ethos .sub {
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 46ch;
  margin-top: 2rem;
  letter-spacing: 0;
}

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.4rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}
.section-head h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.3rem, 2.6vw, 1.9rem);
  letter-spacing: -0.01em;
  margin: 0;
}

/* ============================================================
   WORK
   ============================================================ */
.work { padding-bottom: clamp(4rem, 10vh, 8rem); }

.proj {
  display: grid;
  grid-template-columns: 4rem 1fr minmax(0, 22rem);
  gap: 2rem;
  align-items: start;
  padding: clamp(2rem, 5vw, 3.4rem) 0;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.proj__idx {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
  padding-top: 0.55rem;
  font-variant-numeric: tabular-nums;
}
.proj__title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2rem, 6vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.025em;
  margin: 0 0 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  transition: transform .5s var(--ease), opacity .4s var(--ease);
}
.proj__title .arrow {
  font-size: 0.4em;
  opacity: 0;
  transform: translate(-8px, 0) rotate(-45deg);
  transition: opacity .4s var(--ease), transform .5s var(--ease);
}
a.proj__title:hover { transform: translateX(8px); }
a.proj__title:hover .arrow { opacity: 1; transform: translate(0,0) rotate(-45deg); }

/* logo-themed link mark: a tiny ring + dot that draws on hover */
.linkmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.62em;
  height: 0.62em;
  margin-left: 0.22em;
  flex: none;
  opacity: 0;
  transform: scale(.4);
  transition: opacity .4s var(--ease), transform .55s var(--ease);
}
.linkmark svg { width: 100%; height: 100%; display: block; overflow: visible; color: currentColor; }
.linkmark .lm-ring {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-dasharray: 59.7;          /* 2π·9.5 */
  stroke-dashoffset: 59.7;
  transform: rotate(-90deg);
  transform-box: fill-box;
  transform-origin: 50% 50%;
  transition: stroke-dashoffset .6s var(--ease);
}
.linkmark .lm-dot {
  fill: currentColor;
  transform: scale(0);
  transform-box: fill-box;
  transform-origin: 50% 50%;
  transition: transform .4s var(--ease) .16s;
}
a.proj__title:hover .linkmark,
.contact-row:hover .linkmark { opacity: 1; transform: scale(1); }
a.proj__title:hover .lm-ring,
.contact-row:hover .lm-ring { stroke-dashoffset: 0; }
a.proj__title:hover .lm-dot,
.contact-row:hover .lm-dot { transform: scale(1); }

.proj__desc {
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 42ch;
  margin: 0;
}
.proj__meta {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  padding-top: 0.4rem;
}
.proj__tags {
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  line-height: 1.9;
}
.proj__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
}
.proj__links a, .proj__links span.muted {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.proj__links a {
  position: relative;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--ink-faint);
  transition: border-color .35s var(--ease);
}
.proj__links a::before { content: "↗"; margin-right: 0.35em; font-size: 0.85em; opacity: .55; }
.proj__links a:hover { border-color: var(--ink); }
.proj__links span.muted { color: var(--ink-mute); letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.7rem; }

/* ============================================================
   ABOUT
   ============================================================ */
.about { padding: clamp(5rem, 13vh, 10rem) 0; }
.about__grid {
  display: grid;
  grid-template-columns: 4rem 1fr minmax(0, 22rem);
  gap: 2rem;
}
.about__body { max-width: 40ch; }
.about__body p {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  line-height: 1.42;
  letter-spacing: -0.01em;
  margin: 0 0 1.4rem;
}
.about__body p.small {
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  letter-spacing: 0;
  color: var(--ink-soft);
}
.about__contact { display: flex; flex-direction: column; gap: 1rem; padding-top: 0.3rem; }
.btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  align-self: flex-start;
  padding: 0.85rem 1.4rem;
  border: 1px solid var(--ink);
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color .45s var(--ease), transform .45s var(--ease);
}
/* ink sweeps in from the left */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .5s var(--ease);
}
.btn:hover { color: var(--paper); transform: translateY(-2px); }
.btn:hover::before { transform: scaleX(1); }
.btn__arrow { transition: transform .45s var(--ease); }
.btn:hover .btn__arrow { transform: translateX(5px); }
.about__contact .link {
  font-size: 0.82rem;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}
.about__contact .link a { border-bottom: 1px solid var(--ink-faint); padding-bottom: 1px; transition: border-color .3s var(--ease); }
.about__contact .link a:hover { border-color: var(--ink); }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  border-top: 1px solid var(--line);
  padding: clamp(2.5rem, 6vh, 4rem) 0 2.5rem;
}
.footer__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.4rem;
}
.footer__brand { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--serif); font-weight: 300; font-size: 1.4rem; letter-spacing: 0.3em; text-indent: 0.3em; }
.footer__brand .mark { font-size: 1.1rem; }
.footer__links { display: flex; gap: clamp(1rem, 3vw, 2rem); }
.footer__links a {
  font-size: 0.74rem; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-soft); transition: color .3s var(--ease);
}
.footer__links a:hover { color: var(--ink); }
.footer__base {
  margin-top: 2.5rem;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
}

/* ============================================================
   REVEAL
   ============================================================ */
/* only hide for the reveal animation when JS is running to un-hide it;
   without JS (or if it fails) everything stays visible */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
}
[data-reveal].in { opacity: 1; transform: none; }

/* ============================================================
   PROSE (privacy / terms)
   ============================================================ */
.doc { padding-top: clamp(7rem, 18vh, 11rem); padding-bottom: clamp(5rem, 12vh, 9rem); }
.doc__head { max-width: 60ch; margin-bottom: clamp(3rem, 7vh, 5rem); }
.doc__head .mark { font-size: 2.2rem; margin-bottom: 2rem; display: block; }
.doc__head h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 0 0 1rem;
}
.doc__head .meta { font-size: 0.82rem; letter-spacing: 0.04em; color: var(--ink-mute); }
.prose { max-width: 64ch; }
.prose h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.2rem, 2.6vw, 1.55rem);
  letter-spacing: -0.01em;
  margin: 2.8rem 0 0.9rem;
}
.prose p, .prose li {
  font-size: 1rem;
  line-height: 1.72;
  color: var(--ink-soft);
}
.prose p { margin: 0 0 1.1rem; }
.prose strong { color: var(--ink); font-weight: 500; }
.prose ul { padding-left: 1.1rem; margin: 0 0 1.1rem; }
.prose li { margin-bottom: 0.55rem; }
.prose a { color: var(--ink); border-bottom: 1px solid var(--ink-faint); padding-bottom: 1px; transition: border-color .3s var(--ease); }
.prose a:hover { border-color: var(--ink); }
.prose .lede { font-family: var(--serif); font-weight: 300; font-size: clamp(1.3rem, 3vw, 1.7rem); line-height: 1.45; color: var(--ink); letter-spacing: -0.01em; margin-bottom: 2rem; }
/* contact list */
.contact-list {
  max-width: 62ch;
  margin-top: 1rem;
  border-top: 1px solid var(--line);
}
.contact-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.7rem 0;
  border-bottom: 1px solid var(--line);
}
.contact-row__label {
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  flex: none;
}
.contact-row__value {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.3rem, 3.6vw, 2.1rem);
  letter-spacing: -0.015em;
  text-align: right;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  transition: transform .5s var(--ease);
}
.contact-row__value .arrow {
  font-size: 0.55em;
  opacity: 0;
  transform: translate(-6px, 0);
  transition: opacity .4s var(--ease), transform .5s var(--ease);
}
.contact-row:hover .contact-row__value { transform: translateX(8px); }
.contact-row:hover .contact-row__value .arrow { opacity: .6; transform: translate(0, 0); }

@media (max-width: 560px) {
  .contact-row { flex-direction: column; gap: 0.4rem; }
  .contact-row__value { text-align: left; }
}

.back {
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin-top: 3.5rem;
  font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft);
}
.back::before { content: "←"; }
.back:hover { color: var(--ink); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 820px) {
  .nav__links { gap: 1.1rem; }
  .hero__foot {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 1.3rem;
  }
  .proj, .about__grid {
    grid-template-columns: 1fr;
    gap: 1.4rem;
  }
  .proj__idx { padding-top: 0; }
  .proj__meta { padding-top: 0; }
  .hero__caption { transform: translate(-50%, calc(min(30vmin, 170px) + 1.6rem)); }
}
@media (max-width: 520px) {
  .nav__brand b { display: none; }
  .proj__title { font-size: clamp(2.2rem, 13vw, 3rem); }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  [data-reveal] { opacity: 1; transform: none; }
  .hero__wordmark, .hero__statement .kicker, .hero__statement h1, .hero__scroll { opacity: 1; animation: none; }
}
