/* ==========================================================================
   Variables
   ========================================================================== */
:root {
  /* Page */
  --bg: #EFEFED;
  --bg-soft: #F9F9F7;
  --bg-muted: #F4F4F2;
  --surface: #FFFFFF;
  --placeholder: #D8D8D6;
  --pill: #E8E8E6;

  /* Text */
  --text: #1A1A1A;
  --text-secondary: #666664; /* was #8A8A8A: 3.0:1, below WCAG AA */
  --text-on-dark: #FFFFFF;

  /* Project colors */
  --industrial: #6E1626;
  --imvegan: #0F4D4A;
  --adtech: #1A1A3E;
  --security: #0F0F1A;
  --mapoiltools: #E8E0D0;
  --signal: #183A37;
  --robot: #F0DCC8;

  /* Text that always sits on a light card (sage, sand) */
  --ink: #1A1A1A;
  --text-body: #4A4A4A;

  /* Buttons */
  --btn-primary-bg: #1A1A1A;
  --btn-primary-fg: #FFFFFF;
  --btn-primary-hover: #333333;

  /* Lines and overlays */
  --line: rgba(26, 26, 26, 0.1);
  --lock-overlay: rgba(239, 239, 237, 0.7);
  --card-edge: transparent;
  --error: #B3261E;
  --contact-end: #FFFFFF; /* end color of the Let's work together fade */
  --field-border: #8C8C8A;

  /* Effects */
  --shadow-btn: 0 2px 8px rgba(0, 0, 0, 0.12);
  --shadow-btn-hover: 0 4px 14px rgba(0, 0, 0, 0.14);
  --mock-bg: rgba(255, 255, 255, 0.12);

  color-scheme: light;

  /* Layout */
  --left-width: 320px;
  --gutter: 48px;
  --card-height: 520px;
  --card-radius: 28px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Type scale: every font size on the site comes from here.
     xs   labels, badges, table headers
     sm   captions, card descriptions, buttons, notes
     base body text, intros, card titles
     md   lead paragraphs, sub-headings, point titles
     lg   section headings, name, contact email
     xl   case title, stat numbers
     2xl  page headings (Overview, About, Let's work together) */
  --fs-xs: 12px;
  --fs-sm: 14px;
  --fs-base: 16px;
  --fs-md: 18px;
  --fs-lg: 22px;
  --fs-xl: 28px;
  --fs-2xl: 32px;
}

/* ==========================================================================
   Dark theme
   Follows the system setting unless the visitor picked a theme with the
   toggle (stored as data-theme on <html>).
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141414;
    --bg-soft: #1A1A1A;
    --bg-muted: #1E1E1E;
    --surface: #262626;
    --placeholder: #2E2E2E;
    --pill: #2A2A2A;
    --text: #EDEDEB;
    --text-secondary: #8F8F8C;
    --text-body: #B5B5B2;
    --btn-primary-bg: #EDEDEB;
    --btn-primary-fg: #141414;
    --btn-primary-hover: #FFFFFF;
    --line: rgba(237, 237, 235, 0.1);
    --lock-overlay: rgba(20, 20, 20, 0.7);
    --card-edge: rgba(255, 255, 255, 0.07);
    --error: #FF8A80;
    --contact-end: #1A1A1A;
    --field-border: #6A6A68;
    --shadow-btn: 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-btn-hover: 0 4px 14px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #141414;
  --bg-soft: #1A1A1A;
  --bg-muted: #1E1E1E;
  --surface: #262626;
  --placeholder: #2E2E2E;
  --pill: #2A2A2A;
  --text: #EDEDEB;
  --text-secondary: #8F8F8C;
  --text-body: #B5B5B2;
  --btn-primary-bg: #EDEDEB;
  --btn-primary-fg: #141414;
  --btn-primary-hover: #FFFFFF;
  --line: rgba(237, 237, 235, 0.1);
  --lock-overlay: rgba(20, 20, 20, 0.7);
  --card-edge: rgba(255, 255, 255, 0.07);
  --error: #FF8A80;
  --contact-end: #1A1A1A;
  --field-border: #6A6A68;
  --shadow-btn: 0 2px 8px rgba(0, 0, 0, 0.5);
  --shadow-btn-hover: 0 4px 14px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p {
  margin: 0;
}

h1, h2, h3 {
  font-weight: 500;
  line-height: 1.25;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Hidden visually, still read by screen readers */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ==========================================================================
   Shared: identity block + icon buttons
   ========================================================================== */
.identity__name {
  font-size: var(--fs-lg);
  font-weight: 500;
  line-height: 1.3;
}

.identity__title {
  font-size: var(--fs-lg);
  font-weight: 400;
  line-height: 1.3;
  color: var(--text-secondary);
}

.identity__intro {
  max-width: 260px;
  margin-top: 16px;
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--text-body);
}

.icon-buttons {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-btn);
  color: var(--text);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-btn-hover);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* Theme toggle: show the moon in light mode, the sun in dark mode */
.theme-toggle {
  border: 0;
  padding: 0;
  cursor: pointer;
}

.theme-toggle .icon-sun { display: none; }

:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* Smooth color change only while switching themes */
.theme-switching,
.theme-switching * {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
}

/* ==========================================================================
   Hero: two-column split
   ========================================================================== */
/* The whole page scrolls (so keyboard, focus and trackpad all work);
   the left column stays put while the cards pass by. */
@media (min-width: 768px) {
  /* "proximity" settles on a card when you stop near one, but never pulls
     the page away from something the keyboard just moved focus to */
  html {
    scroll-snap-type: y proximity;
  }

  .about,
  .contact {
    scroll-snap-align: start;
  }
}

.hero {
  display: flex;
  align-items: flex-start;
}

.hero__left {
  position: sticky;
  top: 0;
  flex: 0 0 var(--left-width);
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  padding: var(--gutter);
}

.hero__right {
  flex: 1;
  min-width: 0;
  /* Room above the first and below the last card so they can sit centered */
  --edge: max(24px, calc(50vh - (var(--card-height) / 2) - 20px));
  padding: var(--edge) calc(var(--gutter) + 24px) var(--edge) 6px;
}

/* ==========================================================================
   Project cards
   ========================================================================== */
.project {
  display: block;
  text-decoration: none;
  scroll-snap-align: center;
  margin-bottom: 64px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.project:last-child {
  margin-bottom: 0;
}

.project.is-visible,
.short-work.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Without JS, show cards right away */
.no-js .project,
.no-js .short-work {
  opacity: 1;
  transform: none;
}

.project__card {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--card-height);
  border-radius: var(--card-radius);
  position: relative;
  box-shadow: inset 0 0 0 1px var(--card-edge);
  overflow: hidden;
}

/* Real image or video filling the card */
.project__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (hover: hover) {
  .project:hover .project__media,
  .short-card:hover .project__media {
    transform: scale(1.03);
  }
}

@media (prefers-reduced-motion: reduce) {
  .project__media { transition: none; }
  .project:hover .project__media,
  .short-card:hover .project__media { transform: none; }
}

/* Screen recording floating in the card, on the card's own background */
/* Video already composed on its own dark stage: show it whole, the card
   background matches the stage so the edges disappear */
.project__media--contain {
  object-fit: contain;
}

/* Transparent composition: shown whole, the card gradient shows through */
.project__media--float {
  inset: 6% 5%;
  width: 90%;
  height: 88%;
  object-fit: contain;
}

.project__media--framed {
  position: relative;
  inset: auto;
  width: min(84%, calc(var(--card-height) * 0.78 * 16 / 9));
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 28px 64px rgba(0, 0, 0, 0.4);
}

.project__mock {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 400px;
  max-width: calc(100% - 48px);
  height: 280px;
  padding: 16px;
  border-radius: 12px;
  background: var(--mock-bg);
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (hover: hover) {
  .project:hover .project__mock {
    transform: translateY(-4px);
  }
}

/* ==========================================================================
   Cursor card: a box with the case title and description that follows the
   mouse over a project card. Colors come from the case (data-tone).
   ========================================================================== */
/* Outer element only moves (set by JS); the inner box does the growing */
.cursor-card {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  width: 300px;
  pointer-events: none;
  will-change: transform;
}

.cursor-card__box {
  padding: 18px 20px 20px;
  background: var(--cc-bg, #3A3A3A);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: scale(0.35);
  transform-origin: top left;
  transition:
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.3s ease,
    border-radius 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    background-color 0.35s ease;
  border-radius: 28px;
}

/* Grow from the corner nearest the cursor */
.cursor-card[data-flip-x] .cursor-card__box { transform-origin: top right; }
.cursor-card[data-flip-y] .cursor-card__box { transform-origin: bottom left; }
.cursor-card[data-flip-x][data-flip-y] .cursor-card__box { transform-origin: bottom right; }

.cursor-card.is-visible .cursor-card__box {
  opacity: 1;
  transform: scale(1);
  border-radius: 18px;
}

/* Text fades and rises in just after the box opens */
.cursor-card__title,
.cursor-card__desc {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.cursor-card.is-visible .cursor-card__title,
.cursor-card.is-visible .cursor-card__desc {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.45s ease 0.12s, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.12s;
}

.cursor-card.is-visible .cursor-card__desc {
  transition-delay: 0.18s;
}

.cursor-card__title {
  font-size: var(--fs-sm);
  line-height: 1.3;
  color: var(--cc-title, #9A9A9A);
}

.cursor-card__desc {
  margin-top: 10px;
  font-size: var(--fs-base);
  line-height: 1.4;
  color: var(--cc-text, #F2F2F2);
}

@media (prefers-reduced-motion: reduce) {
  .cursor-card__box,
  .cursor-card__title,
  .cursor-card__desc {
    transform: none !important;
  }
}

.cursor-card[data-tone="industrial"]       { --cc-bg: #8A2236; --cc-title: #F6C9D1; --cc-text: #FDF2F4; }
.cursor-card[data-tone="imvegan"]     { --cc-bg: #1F6B66; --cc-title: #BFE8E2; --cc-text: #F1FBF9; }
.cursor-card[data-tone="adtech"]      { --cc-bg: #2F2F66; --cc-title: #9C9CDA; --cc-text: #F0F0FF; }
.cursor-card[data-tone="security"]     { --cc-bg: #262640; --cc-title: #AEAED2; --cc-text: #EEEEF6; }
.cursor-card[data-tone="signal"]      { --cc-bg: #2C5A55; --cc-title: #C4E3DD; --cc-text: #F2FAF8; }
.cursor-card[data-tone="robot"]       { --cc-bg: #7E5F45; --cc-title: #F6E3D0; --cc-text: #FFF8F1; }
.cursor-card[data-tone="mapoiltools"] { --cc-bg: #6B5D45; --cc-title: #EFE5D2; --cc-text: #FAF6EE; }

@media (hover: none), (pointer: coarse) {
  .cursor-card { display: none; }
}

.project__mock-label {
  font-size: var(--fs-sm);
  color: var(--text-on-dark);
  opacity: 0.8;
}

/* Light cards need dark placeholder text */
.project__card--light .project__mock {
  background: rgba(255, 255, 255, 0.45);
}

.project__card--light .project__mock-label {
  color: var(--ink);
}

.project__label {
  margin-top: 16px;
  font-size: var(--fs-base);
  font-weight: 400;
  line-height: 1.6;
  color: var(--text);
}

/* Description: shown by the hover box on desktop, under the card on touch screens */
.project__desc {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (hover: none), (pointer: coarse) {
  .project__desc {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    margin-top: 4px;
    font-size: var(--fs-sm);
    line-height: 1.5;
    color: var(--text-secondary);
  }
}

.bg-industrial {
  background:
    radial-gradient(120% 90% at 50% 0%, #A8283F 0%, rgba(168, 40, 63, 0) 60%),
    linear-gradient(160deg, #6E1626 0%, #3A0B14 100%);
}
.bg-imvegan {
  background:
    radial-gradient(120% 90% at 50% 0%, #1E8279 0%, rgba(30, 130, 121, 0) 60%),
    linear-gradient(160deg, #11524E 0%, #0A3332 100%);
}
.bg-adtech {
  background:
    radial-gradient(120% 90% at 50% 0%, #3A3A86 0%, rgba(58, 58, 134, 0) 60%),
    linear-gradient(160deg, #22224F 0%, #101026 100%);
}
.bg-security { background: var(--security); }
.bg-mapoiltools { background: var(--mapoiltools); }
.bg-signal { background: var(--signal); }
.bg-robot { background: var(--robot); }

/* ==========================================================================
   "More work": short project cards, two per row, not clickable.
   Each row snaps into place like the big cards.
   ========================================================================== */
.short-work {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.short-work__title {
  margin: 0 0 28px;
  font-size: var(--fs-md);
  font-weight: 500;
}

.short-work__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 96px 64px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Short cards reuse the big-card design (.project__card, .project__mock,
   .project__label); only the size differs */
.short-card {
  min-width: 0;
  scroll-snap-align: center;
  border-radius: var(--card-radius);
}

.short-card:focus-visible {
  outline: none;
}

.short-card:focus-visible .project__card {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.project__card--small {
  height: auto;
  aspect-ratio: 1 / 1;
}

.project__card--small .project__mock {
  width: 74%;
  max-width: none;
  height: 54%;
}

@media (hover: hover) {
  .short-card:hover .project__mock {
    transform: translateY(-4px);
  }
}

/* ==========================================================================
   Scroll indicator dots
   ========================================================================== */
.scroll-dots {
  position: fixed;
  top: 50%;
  right: 11px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
  transition: opacity 0.3s ease;
}

.scroll-dots.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

/* Buttons are 24px tap targets (WCAG 2.5.8); the visible dot is drawn inside */
.scroll-dots button {
  position: relative;
  width: 24px;
  height: 24px;
  margin: -9px 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.scroll-dots button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: var(--text);
  opacity: 0.25;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.scroll-dots button:hover::after {
  opacity: 0.5;
}

.scroll-dots button[aria-current="true"]::after {
  opacity: 0.8;
  transform: scale(1.3);
}

/* ==========================================================================
   About
   ========================================================================== */
.about {
  background: var(--bg);
  padding: 120px var(--gutter);
}

.about__inner {
  display: flex;
  gap: 64px;
  align-items: center;
  max-width: 960px;
  margin: 0 auto;
}

.about__photo {
  flex: 0 0 280px;
  height: 360px;
  border-radius: 20px;
  background: var(--placeholder);
  object-fit: cover;
  object-position: center 30%;
}

.eyebrow {
  font-size: var(--fs-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.about__name {
  margin-top: 12px;
  font-size: var(--fs-2xl);
}

.about__bio {
  margin-top: 20px;
  max-width: 560px;
}

.about__facts {
  margin-top: 20px;
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--text);
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.pills li {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--pill);
  color: var(--text);
  font-size: var(--fs-xs);
  line-height: 1.4;
}

/* ==========================================================================
   Contact
   ========================================================================== */
.contact {
  /* Fades in from the page color instead of starting at a hard edge */
  background: linear-gradient(180deg, var(--bg) 0%, var(--contact-end) 60%, var(--contact-end) 100%);
  padding: 140px var(--gutter);
  text-align: center;
}

.contact h2 {
  font-size: var(--fs-2xl);
}

.contact__email {
  display: inline-block;
  margin-top: 24px;
  font-size: var(--fs-lg);
  color: var(--text);
  text-decoration: none;
}

.contact__email:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.contact__links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 20px;
  font-size: var(--fs-base);
}

.contact__links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.contact__links a:hover {
  color: var(--text);
}

/* ==========================================================================
   Short screens in the two-column layout (landscape phones, small laptops)
   ========================================================================== */
@media (min-width: 768px) and (max-height: 680px) {
  :root {
    --card-height: max(260px, calc(100vh - 150px));
  }

  .project__mock {
    height: 55%;
  }

}

/* ==========================================================================
   Mobile (below 768px)
   ========================================================================== */
@media (max-width: 767px) {
  :root {
    --gutter: 16px;
    --card-height: 380px;
    --card-radius: 22px;

    /* Larger steps shrink on phones; small text stays readable */
    --fs-md: 17px;
    --fs-lg: 20px;
    --fs-xl: 24px;
    --fs-2xl: 26px;
  }

  .hero {
    display: block;
    height: auto;
  }

  .hero__left {
    position: static;
    height: auto;
    padding: 48px var(--gutter) 32px;
  }

  .hero__right {
    padding: 0 var(--gutter) 48px;
  }

  .project {
    margin-bottom: 40px;
  }

  .short-work__grid {
    grid-template-columns: 1fr;
  }

  .short-work__grid {
    gap: 56px;
  }

  .project__mock {
    height: 200px;
  }

  .scroll-dots {
    display: none;
  }

  .about {
    padding: 80px var(--gutter);
  }

  .about__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 32px;
  }

  .about__photo {
    flex: none;
    width: 100%;
    max-width: 280px;
  }

  .contact {
    padding: 96px var(--gutter);
  }

  .contact__email {
    word-break: break-all;
  }
}

/* ==========================================================================
   Skip link: hidden until a keyboard user tabs to it
   ========================================================================== */
.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  font-size: var(--fs-sm);
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}
