/* ==========================================================================
   Tokens — measured from the reference build (1440 desktop / 390 phone)
   ========================================================================== */
:root {
  --brand: #59199d;
  --brand-soft: #ac8cce;
  --white: #ffffff;
  --ink-70: rgba(0, 0, 0, 0.7);
  --line: rgba(0, 0, 0, 0.18);
  --gutter: 24px;
  --gap: 12px;
  --mono: "Roboto Mono", ui-monospace, monospace;
  --sans: "Inter", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --h1: 70px;
  --h2: 18px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--white); }
body {
  background: var(--white);
  color: var(--brand);
  font: 500 12px/1.2 var(--mono);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; background: none; border: 0; outline: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (pointer: fine) {
  html.has-cursor, html.has-cursor * { cursor: none !important; }
}

/* ==========================================================================
   Header
   ========================================================================== */
.header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: 58px; padding: 16px var(--gutter);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  pointer-events: none;
}
.header > * { pointer-events: auto; }
.clock { font: 600 14px/1 var(--mono); letter-spacing: -0.04em; white-space: nowrap; justify-self: start; }
.clock .city { letter-spacing: -0.01em; margin-left: 4px; }
.logo { display: none; font: 900 14px/1 var(--sans); letter-spacing: -0.01em; }

.nav {
  display: flex; align-items: center; gap: 10px;
  background: var(--brand); padding: 4px; height: 26px;
}
.nav a {
  position: relative; height: 18px; padding: 0 4px;
  display: flex; align-items: center;
  color: var(--white); font: 500 12px/1.2 var(--mono);
  transition: color 0.2s var(--ease-out);
}
.nav a::before {
  content: ""; position: absolute; inset: 0; background: var(--white);
  transform: scaleY(0); transform-origin: bottom; transition: transform 0.25s var(--ease-out);
  z-index: 0;
}
.nav a span { position: relative; z-index: 1; }
.nav a:hover::before, .nav a.is-active::before { transform: scaleY(1); }
.nav a:hover, .nav a.is-active { color: var(--brand); }

.nav-wrap { justify-self: center; }
.header-email { justify-self: end; }
.menu-btn { display: none; }

/* roll-over text (two stacked copies) */
.roll { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.roll-text { position: relative; overflow: hidden; display: inline-block; height: 1.2em; }
.roll-text span { display: block; transition: transform 0.45s var(--ease-out); }
.roll-text span + span { position: absolute; left: 0; top: 100%; }
.roll:hover .roll-text span { transform: translateY(-100%); }
.roll-icon { position: relative; width: 14px; height: 14px; overflow: hidden; flex: none; }
.roll-icon svg { position: absolute; inset: 0; width: 14px; height: 14px; transition: transform 0.45s var(--ease-out); }
.roll-icon svg + svg { transform: translate(-100%, 100%); }
.roll:hover .roll-icon svg:first-child { transform: translate(100%, -100%); }
.roll:hover .roll-icon svg + svg { transform: translate(0, 0); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 12px;
  background: var(--brand); color: var(--white);
  font: 700 12px/1.2 var(--mono);
}
.btn[disabled] { background: var(--brand-soft); pointer-events: none; }

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
  position: absolute; left: 0; right: 0; bottom: 0; height: 30px;
  padding: 0 var(--gutter);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  z-index: 5;
}
.footer > :last-child { justify-self: end; }
.available { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; }
.pulse { position: relative; width: 12px; height: 12px; border: 1.5px solid var(--brand); flex: none; }
.pulse::after { content: ""; position: absolute; inset: 2px; background: var(--brand); animation: blink 1.2s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.page { position: relative; min-height: 100vh; padding-bottom: 30px; }
.page:has(> .hero) { padding-bottom: 0; }

/* ==========================================================================
   Home hero
   ========================================================================== */
.hero {
  position: relative; height: 100vh; min-height: 640px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.hero-side {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 343px;
}
.hero-side.left { left: var(--gutter); }
.hero-side.left p { width: 200px; }
.hero-side.right { right: var(--gutter); display: flex; justify-content: flex-end; }
.hero-side ul { list-style: none; display: grid; gap: 3.4px; }
.hero-center { display: flex; flex-direction: column; align-items: center; text-align: center; width: 686px; }
.avatar { position: relative; width: 200px; height: 200px; margin-bottom: 24px; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.avatar img:not(.is-on) { visibility: hidden; }
.h-display { font: 700 var(--h1)/1 var(--mono); }
.hero .role { font-weight: 700; margin-top: 16px; }

.trail { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.trail img {
  position: absolute; left: 0; top: 0; width: 250px; height: 167px; object-fit: contain;
  will-change: transform, opacity, filter;
}
.hero > :not(.trail) { position: relative; z-index: 2; }
.hero > .hero-side { position: absolute; }

/* ==========================================================================
   Generic sections
   ========================================================================== */
.intro { padding: 96px var(--gutter) 0; text-align: center; display: flex; flex-direction: column; align-items: center; }
.intro .lead { width: 420px; max-width: 100%; color: var(--ink-70); margin-top: 16px; }
.section { padding: 64px var(--gutter); }
.h-section { font: 700 var(--h2)/1.2 var(--mono); text-align: center; text-transform: uppercase; }
.section-head { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-bottom: 48px; }
.muted { color: var(--ink-70); }

/* ==========================================================================
   Work grid + project card
   ========================================================================== */
.tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 48px 0; }
.tab {
  height: 22px; padding: 0 8px; display: inline-flex; align-items: center;
  font: 700 12px/1.2 var(--mono); color: var(--brand);
  transition: background 0.25s var(--ease-out), color 0.25s var(--ease-out);
}
.tab.is-active { background: var(--brand); color: var(--white); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); padding: 0 var(--gutter); align-items: start; }
.card { display: block; position: relative; }
.card-media { position: relative; overflow: hidden; aspect-ratio: 3 / 4; background: #eee; }
.card.is-wide .card-media { aspect-ratio: 4 / 3; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s cubic-bezier(0.34, 1.3, 0.64, 1); }
.card:hover .card-media img { transform: scale(1.04); }
.badge {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  height: 22px; padding: 0 8px; display: inline-flex; align-items: center;
  background: var(--brand); color: var(--white); font-weight: 700;
}
.card-body { background: var(--brand); color: var(--white); padding: 8px 8px 10px; }
.card-title { font: 700 16px/1.4 var(--mono); }
.card-desc {
  margin-top: 10px; font: 500 12px/1.2 var(--mono);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card.is-hidden { display: none; }
.card.is-entering { animation: cardIn 0.6s var(--ease-out) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(24px) scale(0.98); } }

/* ==========================================================================
   Contact CTA (shared)
   ========================================================================== */
.cta { padding: 64px var(--gutter) 64px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.cta .lead { width: 420px; max-width: 100%; color: var(--ink-70); margin: 16px 0; }
.cta-img { width: 200px; height: 200px; margin-top: 48px; object-fit: contain; }

/* sticker outline drawn in the brand colour, so any uploaded cut-out matches the theme */
.sticker {
  filter: drop-shadow(2px 0 0 var(--brand)) drop-shadow(-2px 0 0 var(--brand))
          drop-shadow(0 2px 0 var(--brand)) drop-shadow(0 -2px 0 var(--brand));
}

/* ==========================================================================
   About
   ========================================================================== */
.socials { display: flex; gap: 24px; margin-top: 32px; }
.socials a { font-weight: 700; color: var(--ink-70); transition: color 0.2s; }
.socials a:hover { color: var(--brand); }
.loop { position: relative; width: 300px; height: 400px; margin-top: 48px; }
.loop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.loop img:not(.is-on) { visibility: hidden; }
.softwares { padding-top: 48px; }
.tools { display: flex; justify-content: center; gap: 14px; }
.tools svg, .tools img { width: 42px; height: 42px; display: block; object-fit: contain; border-radius: 9px; }

.rows { border-top: 0; }
.row {
  display: grid; grid-template-columns: repeat(3, 1fr); align-items: center;
  height: 62px; border-bottom: 1px solid var(--line); color: var(--ink-70);
}
.row > :nth-child(2) { text-align: center; }
.row > :last-child { text-align: right; }
.row.two { grid-template-columns: 1fr 1fr; }

.cards4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.service { background: var(--brand); color: var(--white); padding: 24px; min-height: 170px; }
.service .num { font: 600 24px/1.2 var(--mono); }
.service h3 { font: 700 16px/1.4 var(--mono); margin-top: 12px; text-transform: uppercase; }
.service p { margin-top: 12px; font-weight: 700; }
.client {
  background: var(--brand); color: var(--white); height: 180px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  font: 700 14px/1.2 var(--mono);
}
.client svg { width: 44px; height: 44px; transition: transform 0.5s var(--ease-out); }
.client:hover svg { transform: rotate(-12deg) scale(1.1); }

/* ==========================================================================
   Contact page
   ========================================================================== */
.contact-main { min-height: 900px; padding: 196px var(--gutter) 0; display: flex; flex-direction: column; align-items: center; }
.form { width: 388px; max-width: 100%; margin-top: 64px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; row-gap: 20px; }
.field { display: flex; flex-direction: column; gap: 10px; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 500; }
.field input, .field select, .field textarea {
  height: 40px; padding: 0 12px; color: #000; font: 400 14px/1.2 var(--mono); letter-spacing: 0.04em;
  border-bottom: 1px solid #000; border-radius: 0; transition: border-color 0.2s;
  -webkit-appearance: none; appearance: none;
}
.field textarea { height: 96px; padding-top: 12px; resize: none; }
.field select { color: rgba(0, 0, 0, 0.7); background: transparent; }
.field select.has-value { color: #000; }
.field :is(input, select, textarea):focus { border-color: var(--brand); }
.field ::placeholder { color: rgba(0, 0, 0, 0.6); }
.select-wrap { position: relative; }
.select-wrap select { width: 100%; }
.select-wrap svg { position: absolute; right: 8px; top: 13px; width: 14px; height: 14px; pointer-events: none; color: #000; }
.form .btn { grid-column: 1 / -1; justify-content: center; height: 30px; margin-top: 0; }
.form-note { grid-column: 1 / -1; text-align: center; font-weight: 700; min-height: 14px; }

/* ==========================================================================
   Case study
   ========================================================================== */
.case { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; padding: 96px var(--gutter) 64px; }
.case-info { position: relative; }
.case-sticky { position: sticky; top: 96px; }
.case-info .lead { width: 420px; max-width: 100%; color: var(--ink-70); margin-top: 24px; }
.meta { list-style: none; margin-top: 24px; display: grid; gap: 10px; color: var(--ink-70); }
.meta li { display: flex; align-items: center; gap: 8px; padding-left: 0; }
.meta li::before { content: ""; width: 8px; height: 8px; background: var(--brand); margin-right: 0; }
.meta b { font-weight: 700; }
.case-images { display: grid; gap: var(--gap); }
.case-images img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: #eee; }

.more { padding: 64px 0; }
.marquee { overflow: hidden; margin-top: 48px; }
.marquee-track { display: flex; align-items: flex-start; gap: var(--gap); width: max-content; will-change: transform; }
.marquee .card { width: 400px; flex: none; }
.more .center { display: flex; justify-content: center; margin-top: 48px; }

/* ==========================================================================
   Cursor
   ========================================================================== */
.cursor {
  position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none;
  width: 12px; height: 12px; margin: -6px 0 0 -6px;
  display: none;
}
.has-cursor .cursor { display: block; }
.cursor-box {
  width: 100%; height: 100%; background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1), outline-color 0.2s;
  outline: 1px solid transparent;
}
.cursor-box svg { width: 14px; height: 14px; color: var(--white); opacity: 0; transform: scale(0.4); transition: opacity 0.2s, transform 0.35s var(--ease-out); }
.cursor.is-link .cursor-box { transform: scale(1.83); outline-color: var(--white); }
.cursor.is-link .cursor-box svg { opacity: 1; transform: scale(0.55); }
.cursor.is-hidden { opacity: 0; }

/* ==========================================================================
   Reveal + pixel transition
   ========================================================================== */
[data-reveal] { opacity: 0.001; transform: translateY(50px); }
[data-reveal].is-in { opacity: 1; transform: none; transition: opacity 0.7s var(--ease-out), transform 0.9s var(--ease-out); transition-delay: var(--d, 0s); }

.pixel-veil { position: fixed; inset: 0; z-index: 900; pointer-events: none; background: var(--brand); }
.pixel-veil.is-canvas { background: transparent; }
.pixel-veil canvas { width: 100%; height: 100%; display: block; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; }
  .pixel-veil { display: none; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ==========================================================================
   Tablet 810–1199
   ========================================================================== */
@media (max-width: 1199.98px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .cards4 { grid-template-columns: repeat(2, 1fr); }
  .hero-side { width: 220px; }
}

/* ==========================================================================
   Phone < 810
   ========================================================================== */
@media (max-width: 809.98px) {
  :root { --h1: 32px; --h2: 14px; }
  .header { height: 62px; grid-template-columns: 1fr auto; }
  .clock, .header-email { display: none; }
  .logo { display: block; justify-self: start; }
  .nav-wrap { display: flex; align-items: center; justify-self: end; background: var(--brand); height: 30px; padding: 4px; }
  /* closed menu: links also leave the tab order (visibility flips after the collapse finishes) */
  .nav-wrap .nav {
    height: 22px; padding: 0; gap: 10px; max-width: 0; overflow: hidden; visibility: hidden;
    transition: max-width 0.55s var(--ease-out), padding 0.55s var(--ease-out), visibility 0s linear 0.55s;
  }
  .nav-wrap.is-open .nav { max-width: 260px; padding-right: 10px; visibility: visible; transition-delay: 0s; }
  .menu-btn {
    display: flex; position: relative; width: 22px; height: 22px; flex: none;
    align-items: center; justify-content: center; color: var(--white);
  }
  .menu-btn i { position: absolute; left: 2px; right: 2px; height: 4px; background: #f8f8f8; transition: transform 0.4s var(--ease-out), opacity 0.2s; }
  .menu-btn i:nth-child(1) { top: 5px; }
  .menu-btn i:nth-child(2) { top: 13px; }
  .menu-btn svg { width: 14px; height: 14px; opacity: 0; transform: scale(0.5); transition: opacity 0.25s, transform 0.4s var(--ease-out); }
  .nav-wrap.is-open .menu-btn { outline: 1px solid var(--white); outline-offset: -1px; }
  .nav-wrap.is-open .menu-btn i { opacity: 0; transform: scaleX(0); }
  .nav-wrap.is-open .menu-btn svg { opacity: 1; transform: none; }

  /* very narrow phones: keep the open menu clear of the logo */
  @media (max-width: 359.98px) {
    .nav-wrap .nav { gap: 4px; }
    .nav-wrap.is-open .nav { padding-right: 6px; }
  }

  .hero { align-items: stretch; }
  .hero-side.left { top: 72px; transform: none; width: auto; }
  .hero-side.right { top: auto; bottom: 73px; transform: none; width: auto; }
  .hero-center { width: 100%; padding: 0 var(--gutter); justify-content: center; }
  .avatar { width: 150px; height: 150px; }

  .intro { padding-top: 72px; }
  .intro .lead { width: 274px; }
  .tabs { margin: 32px 10px; }
  .grid { grid-template-columns: 1fr; }
  .card-title { font-size: 12px; }
  .cta .lead { width: 300px; }
  .loop { width: 225px; height: 300px; }
  /* phone: company over role on the left, years on the right */
  .row { grid-template-columns: 1fr auto; column-gap: 16px; row-gap: 4px; height: auto; min-height: 60px; padding: 12px 0; }
  .row > :first-child { grid-column: 1; grid-row: 1; font-weight: 700; }
  .row > :nth-child(2) { grid-column: 1; grid-row: 2; text-align: left; }
  .row > :last-child { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .cards4.services { grid-template-columns: 1fr; }
  .contact-main { padding-top: 72px; min-height: 0; padding-bottom: 64px; }
  .form { margin-top: 32px; width: 100%; grid-template-columns: 1fr; }
  .case { grid-template-columns: minmax(0, 1fr); padding-top: 72px; gap: 32px; }
  .case > * { min-width: 0; }
  .footer { grid-template-columns: 1fr auto; }
  .footer > :first-child { display: none; }
  .case-sticky { position: static; }
  .marquee .card { width: 260px; }
  .cta-img { width: 150px; height: 150px; }
}

/* ==========================================================================
   Touch: bigger invisible hit areas, same visuals
   ========================================================================== */
@media (pointer: coarse) {
  .btn, .socials a, .logo, .menu-btn, .tab { position: relative; }
  .btn::after, .socials a::after, .logo::after, .menu-btn::after { content: ""; position: absolute; inset: -11px -6px; }
  .tab::after { content: ""; position: absolute; inset: -6px -4px; }
}
