/* Kluivert Edegware — portfolio
   Tokens first, components through tokens only. */

:root {
  --bg: #f3f5f2;
  --panel: #ffffff;
  --panel-2: #e9ede8;
  --ink: #0e1512;
  --ink-2: #3d4944;
  --dim: #6b776f;
  --line: #d9dfda;
  --accent: #2451f5;
  --accent-ink: #ffffff;
  --tint: #e4eaff;
  --shadow: 0 18px 48px -24px rgba(14, 21, 18, 0.35);
  --radius: 14px;
  --display: "Syne", "Avenir Next", "Segoe UI", sans-serif;
  --body: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f12;
    --panel: #131a1f;
    --panel-2: #1a232a;
    --ink: #e9eef0;
    --ink-2: #b9c3be;
    --dim: #7f8b85;
    --line: #243038;
    --accent: #7a98ff;
    --accent-ink: #0b0f12;
    --tint: #17223a;
    --shadow: 0 18px 48px -24px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b0f12;
  --panel: #131a1f;
  --panel-2: #1a232a;
  --ink: #e9eef0;
  --ink-2: #b9c3be;
  --dim: #7f8b85;
  --line: #243038;
  --accent: #7a98ff;
  --accent-ink: #0b0f12;
  --tint: #17223a;
  --shadow: 0 18px 48px -24px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

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

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

h1,
h2,
h3 {
  font-family: var(--display);
  margin: 0;
  text-wrap: balance;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

.wrap {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.mono {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.01em;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ---------- header ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.top .wrap {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
}

.brand {
  font-family: var(--display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand .mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-size: 13px;
}

.nav {
  display: flex;
  gap: 22px;
  margin-left: auto;
  font-size: 14px;
  color: var(--ink-2);
}

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

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: 500 14px var(--body);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  border-color: var(--ink-2);
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.btn.icon {
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
}

/* ---------- hero ---------- */

.hero {
  padding: 72px 0 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(44px, 7vw, 84px);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.035em;
  margin: 18px 0 22px;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.lede {
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 34em;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--dim);
}

.facts b {
  color: var(--ink);
  font-weight: 500;
}

.hero-cta {
  display: flex;
  gap: 10px;
  margin-top: 26px;
  flex-wrap: wrap;
}

/* the shelf: real launcher icons of shipped apps */
.shelf {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  padding: 24px;
  max-width: 540px;
  justify-self: end;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.shelf a {
  aspect-ratio: 1;
  border-radius: 22%;
  overflow: hidden;
  background: var(--panel-2);
  transform: translateY(0) rotate(var(--tilt, 0deg));
  transition: transform 0.25s ease;
  animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

.shelf a:hover {
  transform: translateY(-4px) rotate(0deg) scale(1.04);
}

.shelf img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@keyframes rise {
  from {
    transform: translateY(14px) rotate(var(--tilt, 0deg));
  }
  to {
    transform: translateY(0) rotate(var(--tilt, 0deg));
  }
}

/* ---------- sections ---------- */

section {
  padding: 56px 0;
  border-top: 1px solid var(--line);
}

.sec-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 24px;
  align-items: end;
  margin-bottom: 30px;
}

.sec-head h2 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 8px;
}

.sec-head p {
  color: var(--ink-2);
  max-width: 36em;
}

/* app rows */
.apps {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.app {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 20px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.15s ease;
}

.app:hover {
  border-color: var(--ink-2);
}

.app.with-shot {
  grid-template-columns: 76px minmax(0, 1fr) 150px;
}

.app .icon {
  width: 76px;
  height: 76px;
  border-radius: 22%;
  overflow: hidden;
  background: var(--panel-2);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 30px;
  color: var(--accent);
}

.app .icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
}

.app h3 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.client {
  font-size: 13.5px;
  color: var(--dim);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 6px 0 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--dim);
}

.meta .stat {
  color: var(--ink);
}

.app p {
  color: var(--ink-2);
  max-width: 62ch;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--ink-2);
}

.tag.status {
  background: var(--tint);
  color: var(--accent);
}

.links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.store {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 500;
  transition: transform 0.15s ease;
}

.store:hover {
  transform: translateY(-1px);
}

.store svg {
  width: 14px;
  height: 14px;
}

.shot {
  align-self: stretch;
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line);
  max-height: 300px;
}

.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

/* card grids (in production / own products) */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.card {
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card .top-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.card .icon {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 22%;
  overflow: hidden;
  background: var(--panel-2);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  color: var(--accent);
}

.card .icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card h3 {
  font-size: 18px;
  font-weight: 700;
}

.card .client {
  display: block;
  margin-top: 2px;
}

.card p {
  color: var(--ink-2);
  flex: 1;
}

/* open source */
.packages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}

.pkg {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pkg .name {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.pkg .name span {
  color: var(--dim);
  font-weight: 400;
}

.pkg p {
  color: var(--ink-2);
  flex: 1;
}

.pkg .foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--dim);
}

.pkg .foot a {
  color: var(--accent);
}

/* experience: a rail with a dot per role, company first */
.timeline {
  display: grid;
  gap: 0;
}

.job {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 20px;
}

.job .when {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--dim);
  padding-top: 3px;
  text-align: right;
}

.job-body {
  position: relative;
  padding: 0 0 30px 28px;
  border-left: 1px solid var(--line);
}

.job:last-child .job-body {
  padding-bottom: 6px;
  border-left-color: transparent;
}

.job-body::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 7px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dim);
  box-shadow: 0 0 0 4px var(--bg);
}

.job.current .job-body::before {
  background: var(--accent);
  animation: pulse 2.4s ease-out infinite;
}

.job.edu .job-body::before {
  background: transparent;
  border: 2px solid var(--dim);
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 4px var(--bg), 0 0 0 4px color-mix(in srgb, var(--accent) 50%, transparent);
  }
  100% {
    box-shadow: 0 0 0 4px var(--bg), 0 0 0 14px color-mix(in srgb, var(--accent) 0%, transparent);
  }
}

.job h3 {
  font-size: 19px;
  font-weight: 700;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.job h3 .role {
  font-family: var(--body);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: 0;
}

.job h3 .role::before {
  content: "·";
  margin-right: 10px;
  color: var(--dim);
}

.job .client {
  display: block;
  margin: 3px 0 8px;
}

.job p {
  color: var(--ink-2);
  max-width: 62ch;
}

/* contact */
.contact {
  padding: 64px 0 72px;
}

.contact-box {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 32px;
  padding: 36px;
  border-radius: 24px;
  background: var(--ink);
  color: var(--bg);
}

.contact-box h2 {
  font-size: clamp(30px, 4.5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.02;
}

.contact-box p {
  margin-top: 14px;
  opacity: 0.8;
  max-width: 34em;
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
}

.contact-list a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--bg) 22%, transparent);
  font-size: 14px;
  transition: background 0.15s ease;
}

.contact-list a:hover {
  background: color-mix(in srgb, var(--bg) 18%, transparent);
}

.contact-list a span {
  font-family: var(--mono);
  font-size: 12px;
  opacity: 0.7;
}

footer {
  padding: 22px 0 40px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 44px;
  }

  .shelf {
    gap: 12px;
    padding: 16px;
    max-width: none;
    justify-self: start;
  }

  .sec-head {
    grid-template-columns: 1fr;
  }

  .app.with-shot {
    grid-template-columns: 60px minmax(0, 1fr);
  }

  .app {
    grid-template-columns: 60px minmax(0, 1fr);
  }

  .app .icon {
    width: 60px;
    height: 60px;
  }


  .shot {
    grid-column: 1 / -1;
    max-height: 220px;
  }

  .job {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .job .when {
    text-align: left;
    padding-left: 28px;
  }

  .contact-box {
    grid-template-columns: 1fr;
    padding: 26px;
  }

  .nav {
    display: none;
  }
}

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

  .shelf a,
  .btn,
  .store {
    animation: none;
    transition: none;
  }
}

/* =====================================================================
   MOTION — every effect has a job; all of it is off under reduced motion.
   ===================================================================== */

body {
  overflow-x: hidden;
}

/* --- hero intro: lines rise out of a mask, the rest staggers in --- */
.hero {
  position: relative;
  isolation: isolate;
}

.hero h1 .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.06em;
  margin-bottom: -0.06em;
}

.hero h1 .line > span {
  display: block;
  animation: line-up 0.9s cubic-bezier(0.2, 0.9, 0.2, 1) both;
  animation-delay: calc(var(--d, 0) * 110ms);
}

@keyframes line-up {
  from {
    transform: translateY(105%);
  }
  to {
    transform: translateY(0);
  }
}

.reveal {
  animation: reveal 0.9s cubic-bezier(0.2, 0.9, 0.2, 1) both;
  animation-delay: calc(var(--d, 0) * 110ms + 120ms);
}

@keyframes reveal {
  from {
    opacity: 0.001;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --- drifting colour behind the shelf --- */
.hero-bg {
  position: absolute;
  inset: -20% -10%;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  filter: blur(70px);
  opacity: 0.55;
}

.hero-bg i {
  position: absolute;
  width: 46vmin;
  height: 46vmin;
  border-radius: 50%;
  background: var(--accent);
  animation: drift 16s ease-in-out infinite alternate;
}

.hero-bg i:nth-child(1) {
  right: 4%;
  top: 6%;
  opacity: 0.45;
}

.hero-bg i:nth-child(2) {
  right: 22%;
  bottom: 0;
  background: #2ec4a5;
  opacity: 0.35;
  animation-duration: 21s;
  animation-delay: -6s;
}

.hero-bg i:nth-child(3) {
  left: 30%;
  top: 40%;
  width: 30vmin;
  height: 30vmin;
  background: #ff8a4c;
  opacity: 0.25;
  animation-duration: 25s;
  animation-delay: -12s;
}

@keyframes drift {
  from {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-8%, 10%) scale(1.15);
  }
  to {
    transform: translate(6%, -8%) scale(0.95);
  }
}

/* --- shelf: 3D tilt toward the cursor, dock magnification, ambient float --- */
.shelf-wrap {
  perspective: 1100px;
  justify-self: end;
  width: 100%;
  max-width: 540px;
  animation: reveal 1s cubic-bezier(0.2, 0.9, 0.2, 1) both;
  animation-delay: 260ms;
}

.shelf {
  justify-self: stretch;
  max-width: none;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.2, 1);
  will-change: transform;
}

.shelf a {
  transform: translateY(0) rotate(var(--tilt, 0deg)) scale(var(--s, 1));
  transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.2, 1);
  animation: none;
}

.shelf a:hover {
  transform: translateY(-4px) rotate(0deg) scale(var(--s, 1.08));
  z-index: 2;
}

.shelf img {
  animation: float 6s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * -0.7s);
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

/* --- ticker --- */
.ticker {
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
  margin: 0 -20px;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.ticker-track {
  display: flex;
  width: max-content;
  gap: 38px;
  padding-left: 38px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--dim);
  animation: ticker 42s linear infinite;
}

.ticker:hover .ticker-track {
  animation-play-state: paused;
}

.ticker-track span:nth-child(3n + 2) {
  color: var(--ink);
}

.ticker-track span:nth-child(6n + 4) {
  color: var(--accent);
}

@keyframes ticker {
  to {
    transform: translateX(-50%);
  }
}

/* --- scroll-driven entrances (no JS; browsers without support show static) --- */
@supports (animation-timeline: view()) {
  .app,
  .card,
  .pkg,
  .job,
  .sec-head {
    animation: enter linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 38%;
  }
}

@keyframes enter {
  from {
    opacity: 0.15;
    transform: translateY(28px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --- cursor spotlight on app rows --- */
.app {
  position: relative;
  overflow: hidden;
}

.app::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%),
      color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.app:hover::before {
  opacity: 1;
}

.app > * {
  position: relative;
}

.shot img {
  transition: transform 0.7s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.app:hover .shot img {
  transform: translateY(-18px);
}

.app .icon,
.card .icon {
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.app:hover .icon,
.card:hover .icon {
  transform: rotate(-6deg) scale(1.06);
}

/* --- magnetic buttons --- */
.magnetic {
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.2, 1), border-color 0.15s ease;
  will-change: transform;
}

/* --- nav pill that slides to the active section --- */
.nav {
  position: relative;
  align-items: center;
}

.nav a {
  position: relative;
  z-index: 1;
  padding: 6px 10px;
  border-radius: 999px;
}

.nav .pill {
  position: absolute;
  top: 0;
  left: var(--px, 0px);
  width: var(--pw, 0px);
  height: 100%;
  border-radius: 999px;
  background: var(--tint);
  opacity: var(--po, 0);
  transition: left 0.35s cubic-bezier(0.2, 0.9, 0.2, 1), width 0.35s cubic-bezier(0.2, 0.9, 0.2, 1), opacity 0.2s;
}

.nav a.active {
  color: var(--accent);
}

/* --- header shrinks once you scroll --- */
.top .wrap {
  transition: height 0.25s ease;
}

.top.scrolled .wrap {
  height: 52px;
}

/* --- theme switch: circular wipe (View Transitions) --- */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-old(root) {
  z-index: 1;
}

::view-transition-new(root) {
  z-index: 2;
}

/* --- reduced motion: everything static --- */
@media (prefers-reduced-motion: reduce) {
  .hero h1 .line > span,
  .reveal,
  .shelf-wrap,
  .hero-bg i,
  .shelf img,
  .ticker-track,
  .app,
  .card,
  .pkg,
  .job,
  .sec-head,
  .job.current .job-body::before {
    animation: none !important;
  }

  .shelf,
  .shelf a,
  .magnetic,
  .shot img,
  .app .icon,
  .card .icon,
  .nav .pill {
    transition: none !important;
    transform: none !important;
  }
}

.store.apple {
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line);
}
