/* ==========================================================================
   Anat Kalinski — Portfolio
   Built from Figma file "Anat Kalinski portfolio"
   ========================================================================== */

:root {
  /* Colors (from Figma) */
  --ink: #222222;
  --paper: #f9f9f9;
  --white: #ffffff;
  --teal: #01ab9d;
  --blue: #007ecc;
  --cyan: #00ffea;
  --rule: #646464;

  /* Card backgrounds */
  --lavender: #e4dfff;
  --cream: #fff4df;
  --mint: #dffff0;
  --sky: #dff5ff;
  --peach: #ffeadf;

  /* Type */
  --serif: "DM Serif Display", Georgia, serif;
  --serif-text: "DM Serif Text", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --caption: "Economica", "Arial Narrow", sans-serif;

  /* Layout */
  --content: 1269px;
  --gutter: 16px;

  --shadow-lg: 0 7px 29px 4px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 5px 7px 0 rgba(0, 0, 0, 0.1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 20px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

body.theme-dark {
  background: var(--ink);
  color: var(--white);
}

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

a {
  color: inherit;
}

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

.container {
  width: min(var(--content), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--cyan);
  color: var(--ink);
  padding: 8px 16px;
  z-index: 100;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ==========================================================================
   Logo (letter tiles)
   ========================================================================== */

.logo {
  display: inline-flex;
  flex-direction: column;
  gap: 0;
  text-decoration: none;
  --tile: 48px;
}

.logo-row {
  display: flex;
  gap: 2px;
  padding: 2px 0;
}

.tile {
  width: var(--tile);
  height: var(--tile);
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: var(--white);
  font-family: var(--sans);
  font-size: calc(var(--tile) * 0.42);
  line-height: 1;
  background: var(--teal);
  transition: transform 0.2s ease;
}

.tile.blue {
  background: var(--blue);
}

.tile img {
  width: 100%;
  height: 100%;
}

.logo:hover .tile {
  transform: translateY(-2px);
}
.logo:hover .tile:nth-child(2) { transition-delay: 0.03s; }
.logo:hover .tile:nth-child(3) { transition-delay: 0.06s; }
.logo:hover .tile:nth-child(4) { transition-delay: 0.09s; }

/* Project page logo: single row with larger letters */
.logo--compact .tile {
  font-size: calc(var(--tile) * 0.66);
}

/* ==========================================================================
   Homepage logo — sliding puzzle
   ========================================================================== */

.puzzle {
  --tile: 48px;
  --gx: 2px;
  --gy: 3px;
  --br: 3; /* blank row */
  --bc: 3; /* blank column */
  position: relative;
  flex-shrink: 0;
  width: calc(4 * var(--tile) + 3 * var(--gx));
  height: calc(4 * var(--tile) + 3 * var(--gy));
  border-radius: 6px;
}

/* The empty slot */
.puzzle::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: var(--tile);
  height: var(--tile);
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: 5px;
  transform: translate(
    calc(var(--bc) * (var(--tile) + var(--gx))),
    calc(var(--br) * (var(--tile) + var(--gy)))
  );
}

.puzzle .tile {
  position: absolute;
  left: 0;
  top: 0;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font-family: var(--sans);
  -webkit-tap-highlight-color: transparent;
  transform: translate(
    calc(var(--c) * (var(--tile) + var(--gx))),
    calc(var(--r) * (var(--tile) + var(--gy)))
  );
  transition: transform 0.22s cubic-bezier(0.3, 0.7, 0.3, 1);
}

.puzzle .tile svg {
  width: 100%;
  height: 100%;
  display: block;
}

.puzzle.is-hinting .tile {
  transition-duration: 0.45s;
}

/* Wrong tile clicked: pulse the tiles that can move */
.puzzle .tile.is-movable {
  animation: tile-movable 0.7s ease-in-out 2;
}

@keyframes tile-movable {
  50% {
    background: var(--cyan);
    color: var(--ink);
    box-shadow: 0 0 0 3px rgba(0, 255, 234, 0.35);
  }
}

/* Solved: a cyan wave across the tiles */
.puzzle.is-solved .tile {
  animation: tile-solved 0.6s ease both;
  animation-delay: calc(var(--i) * 35ms);
}

@keyframes tile-solved {
  40% {
    background: var(--cyan);
    color: var(--ink);
  }
}

@media (prefers-reduced-motion: reduce) {
  .puzzle .tile {
    transition: none;
  }
  .puzzle.is-solved .tile {
    animation: none;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Mobile menu (hamburger)
   ========================================================================== */

.menu-toggle,
.menu-close {
  display: none;
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.nav {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
}

.nav a {
  color: var(--white);
  text-decoration: none;
  font-size: 20px;
  line-height: 1.21;
  position: relative;
  padding: 4px 0;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.nav a:hover::after {
  transform: scaleX(1);
}

.nav a[aria-current="page"] {
  color: var(--cyan);
}

/* Homepage header sits inside the content column */
.home-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding-top: 55px;
}

/* Project pages: full-width dark bar */
.site-header {
  background: var(--ink);
  min-height: 100px;
  padding: 0 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

/* ==========================================================================
   Homepage — hero
   ========================================================================== */

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 40px;
  margin-top: 100px;
}

.hero-text {
  width: 769px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 75px;
  min-width: 0;
}

.hero-intro {
  max-width: 709px;
}

.hero-intro h1 {
  font-weight: 400;
  font-size: 32px;
  line-height: 1.21;
}

.hero-intro p {
  font-size: 24px;
  line-height: 1.21;
  margin-top: 27px;
}

/* Marquee of skills */
.marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.marquee-track {
  display: flex;
  gap: 41px;
  width: max-content;
  animation: marquee 28s linear infinite;
  list-style: none;
  padding: 0;
}

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

.marquee-track li {
  font-weight: 200;
  font-size: 24px;
  line-height: 1.21;
  white-space: nowrap;
}

@keyframes marquee {
  to {
    transform: translateX(calc(-50% - 20.5px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-track {
    animation: none;
    flex-wrap: wrap;
    width: auto;
    row-gap: 12px;
  }
  .marquee-track [aria-hidden="true"] {
    display: none;
  }
  .marquee {
    -webkit-mask-image: none;
    mask-image: none;
  }
}

/* Portrait with offset gradient */
.portrait {
  position: relative;
  width: 362px;
  flex-shrink: 0;
  aspect-ratio: 362 / 472;
}

.portrait::before {
  content: "";
  position: absolute;
  left: 6.9%;
  top: 0;
  width: 93.1%;
  height: 95.1%;
  border-radius: 10px;
  background: linear-gradient(218deg, #00998c 2%, #00ffea 42%, #007ecc 71%);
}

.portrait img {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 93.1%;
  height: 95.1%;
  object-fit: cover;
  border-radius: 10px;
  background: var(--white);
  filter: grayscale(1);
}

/* ==========================================================================
   Homepage — project cards grid
   ========================================================================== */

.projects {
  margin-top: 100px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 615px));
  justify-content: space-between;
  row-gap: 50px;
  column-gap: 39px;
  scroll-margin-top: 40px;
}

.card {
  /* All positions are expressed in Figma pixels (card = 615 × 638) and scaled */
  container-type: inline-size;
  position: relative;
  display: block;
  aspect-ratio: 615 / 638;
  border-radius: 10px;
  overflow: hidden;
  color: var(--ink);
  text-decoration: none;
  background: var(--bg, var(--lavender));
  isolation: isolate;
}

.card-body {
  position: absolute;
  left: calc(37 * 100cqw / 615);
  top: calc(40 * 100cqw / 615);
  width: calc(504 * 100cqw / 615);
  z-index: 1;
}

.card-body--wide {
  left: calc(30 * 100cqw / 615);
  width: calc(577 * 100cqw / 615);
}

.card h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: max(20px, calc(36 * 100cqw / 615));
  line-height: 1.371;
}

.card p {
  margin-top: calc(20 * 100cqw / 615);
  font-size: max(14px, calc(24 * 100cqw / 615));
  line-height: 1.333;
}

.card-shot {
  position: absolute;
  left: calc(var(--x) * 100cqw / 615);
  top: calc(var(--y) * 100cqw / 615);
  width: calc(var(--w) * 100cqw / 615);
  height: calc(var(--h) * 100cqw / 615);
  background: var(--white);
  border-radius: calc(20 * 100cqw / 615);
  box-shadow: var(--shadow-lg);
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.card-shot img {
  position: absolute;
  left: calc(var(--ix, 20) * 100cqw / 615);
  top: calc(var(--iy, 22) * 100cqw / 615);
  width: calc(var(--iw) * 100cqw / 615);
  height: calc(var(--ih) * 100cqw / 615);
  max-width: none;
  object-fit: cover;
  object-position: top left;
}

.card-art {
  position: absolute;
  left: calc(87 * 100cqw / 615);
  top: calc(195 * 100cqw / 615);
  width: calc(435 * 100cqw / 615);
  height: auto;
  max-width: none;
}

a.card:hover .card-shot,
a.card:focus-visible .card-shot {
  transform: translateY(calc(-14 * 100cqw / 615));
}

a.card::after {
  content: "View project →";
  position: absolute;
  right: calc(24 * 100cqw / 615);
  bottom: calc(24 * 100cqw / 615);
  z-index: 2;
  background: var(--ink);
  color: var(--white);
  font-size: 16px;
  line-height: 1;
  padding: 12px 16px;
  border-radius: 999px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

a.card:hover::after,
a.card:focus-visible::after {
  opacity: 1;
  transform: none;
}

/* ==========================================================================
   Project pages
   ========================================================================== */

.project-main {
  display: flex;
  flex-direction: column;
  gap: 100px;
  margin-top: 74px;
}

.project-hero {
  container-type: inline-size;
  position: relative;
  aspect-ratio: 1269 / 638;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg, var(--lavender));
}

.project-hero .frame {
  position: absolute;
  left: calc(88 * 100cqw / 1269);
  top: calc(35 * 100cqw / 1269);
  width: calc(1092 * 100cqw / 1269);
  height: calc(var(--fh, 647) * 100cqw / 1269);
  background: var(--white);
  border-radius: calc(20 * 100cqw / 1269);
  box-shadow: var(--shadow-lg);
}

.project-hero .frame img {
  position: absolute;
  left: calc(var(--ix) * 100cqw / 1269);
  top: calc(var(--iy) * 100cqw / 1269);
  width: calc(var(--iw) * 100cqw / 1269);
  height: calc(var(--ih) * 100cqw / 1269);
  max-width: none;
  object-fit: cover;
  object-position: top center;
}

.project-hero .inner-frame {
  position: absolute;
  left: calc(29 * 100cqw / 1269);
  top: calc(32.5 * 100cqw / 1269);
  width: calc(1036 * 100cqw / 1269);
  height: calc(1000 * 100cqw / 1269);
  background: var(--white);
  border-radius: calc(20 * 100cqw / 1269);
  box-shadow: var(--shadow-lg);
}

.project-intro {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: -50px; /* hero → title gap is 50px in Figma */
}

.project-intro h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 36px;
  line-height: 1.371;
  margin-bottom: 30px;
}

.brief {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brief p {
  line-height: 1.21;
}

.brief p.background {
  line-height: 1.7;
}

.label {
  font-weight: 700;
}

.sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.371;
  text-align: center;
  padding: 20px 0;
  text-wrap: balance;
}

.section h3 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.6;
}

.section ul {
  padding-left: 1.3em;
}

.section li + li {
  margin-top: 4px;
}

.section p + ul {
  margin-top: -20px;
}

.figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 0;
}

.figure img {
  width: 100%;
  height: auto;
}

.figure img.shadow {
  box-shadow: var(--shadow-sm);
}

.figure figcaption {
  font-family: var(--caption);
  font-size: 20px;
  line-height: 1.6;
  text-align: center;
}

.figure figcaption.serif {
  font-family: var(--serif-text);
}

.figure--narrow img {
  max-width: 843px;
}

.figure--crop img {
  aspect-ratio: var(--ratio);
  object-fit: cover;
  object-position: top;
}

.figure-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.figure-row img {
  height: 444px;
  object-fit: cover;
  min-width: 0;
}

.figure-row img:first-child {
  flex: 1 1 auto;
  width: auto;
}

.figure-row img:last-child {
  flex: 0 1 469px;
  width: 469px;
}

/* Next project link */
.next-project {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 32px 0;
  border-top: 1px solid #dcdcdc;
  text-decoration: none;
}

.next-project .eyebrow {
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b6b6b;
}

.next-project strong {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.3;
}

.next-project .arrow {
  font-size: 30px;
  transition: transform 0.25s ease;
}

.next-project:hover .arrow {
  transform: translateX(6px);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  background: var(--ink);
  color: var(--white);
  border-top: 1px solid var(--rule);
  padding: 43px var(--gutter) 50px;
  text-align: center;
  margin-top: 74px;
  scroll-margin-top: 40px;
}

.theme-dark .site-footer {
  margin-top: 150px;
}

.site-footer h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 32px;
  line-height: 1.371;
}

.site-footer p {
  margin-top: 14px;
  font-size: 20px;
  line-height: 1.5;
}

.site-footer p a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.site-footer p a:hover {
  color: var(--cyan);
  border-color: currentColor;
}

.socials {
  display: flex;
  justify-content: center;
  gap: 50px;
  margin-top: 37px;
  list-style: none;
  padding: 0;
}

.socials a {
  display: block;
  color: var(--white);
  transition: color 0.2s ease, transform 0.2s ease;
}

.socials a:hover {
  color: var(--cyan);
  transform: translateY(-2px);
}

.socials svg {
  display: block;
  width: 50px;
  height: 50px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1200px) {
  .portrait {
    width: 300px;
  }
}

@media (max-width: 1024px) {
  .hero {
    flex-direction: column-reverse;
    align-items: flex-start;
    margin-top: 64px;
  }
  .portrait {
    width: min(300px, 70%);
    align-self: center;
  }
  .hero-text {
    gap: 48px;
  }
  .projects {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 24px;
    row-gap: 24px;
  }
  .site-header {
    padding: 0 var(--gutter);
  }
}

@media (max-width: 720px) {
  body {
    font-size: 17px;
  }
  /* Headers */
  .home-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding-top: 12px;
  }
  .home-header .menu-toggle {
    order: -1;
    align-self: flex-end;
  }
  .site-header {
    min-height: 0;
    padding: 12px var(--gutter);
  }
  .logo,
  .puzzle {
    --tile: 38px;
  }
  .portrait {
    width: min(240px, 64%);
  }

  /* Hamburger button */
  .menu-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 44px;
    height: 44px;
    padding: 10px;
    margin-right: -10px;
    background: none;
    border: 0;
    color: var(--white);
    cursor: pointer;
  }
  .menu-toggle span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
  }

  /* Full-screen menu panel */
  .nav {
    position: fixed;
    inset: 0;
    z-index: 50;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    padding: 88px 24px 48px;
    background: var(--ink);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
  }
  .nav.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease;
  }
  .nav a {
    font-family: var(--serif);
    font-size: 40px;
    line-height: 1.3;
  }
  .nav.is-open a {
    animation: nav-in 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
  .nav.is-open a:nth-of-type(2) { animation-delay: 0.05s; }
  .nav.is-open a:nth-of-type(3) { animation-delay: 0.1s; }
  .nav.is-open a:nth-of-type(4) { animation-delay: 0.15s; }

  .menu-close {
    display: block;
    position: absolute;
    top: 12px;
    right: 6px;
    width: 44px;
    height: 44px;
    background: none;
    border: 0;
    color: var(--white);
    cursor: pointer;
  }
  .menu-close::before,
  .menu-close::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    top: 50%;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transform: rotate(45deg);
  }
  .menu-close::after {
    transform: rotate(-45deg);
  }
  body.menu-open {
    overflow: hidden;
  }
  .hero-intro h1 {
    font-size: 26px;
  }
  .hero-intro p,
  .marquee-track li {
    font-size: 20px;
  }
  .projects {
    grid-template-columns: 1fr;
    margin-top: 64px;
  }
  .card p {
    font-size: max(15px, calc(24 * 100cqw / 615));
  }
  .project-main {
    margin-top: 32px;
    gap: 64px;
  }
  .project-intro {
    margin-top: -32px;
  }
  .project-intro h1 {
    font-size: 30px;
    margin-bottom: 8px;
  }
  .section h2 {
    font-size: 25px;
    padding: 12px 0 0;
  }
  .section h3 {
    font-size: 17px;
  }
  .figure figcaption {
    font-size: 18px;
  }
  .figure-row {
    flex-direction: column;
  }
  .figure-row img,
  .figure-row img:first-child,
  .figure-row img:last-child {
    width: 100%;
    height: auto;
    flex: none;
  }
  .next-project strong {
    font-size: 22px;
  }
  .site-footer h2 {
    font-size: 28px;
  }
  .site-footer p {
    font-size: 17px;
  }
  .socials {
    gap: 32px;
  }
  .socials svg {
    width: 40px;
    height: 40px;
  }
}

@keyframes nav-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* ==========================================================================
   Project media: videos, image grids, before/after slider
   ========================================================================== */

.figure video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  background: #ececec;
}

.figure video.shadow,
.figure .shadow {
  box-shadow: var(--shadow-sm);
}

.figure video.transparent {
  background: none;
  border-radius: 0;
}

.figure--medium img,
.figure--medium video {
  max-width: 760px;
}

/* Side-by-side images; column sizes come from --cols */
.figure-grid {
  display: grid;
  grid-template-columns: var(--cols, 1fr 1fr);
  align-items: center;
  gap: 24px;
  width: 100%;
}

.figure-grid img {
  width: 100%;
  height: auto;
}

.figure-grid .grid-caption {
  margin-top: 8px;
  font-family: var(--caption);
  font-size: 20px;
  line-height: 1.6;
  text-align: center;
}

/* Before / after comparison slider */
.compare {
  --pos: 50%;
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
  user-select: none;
  touch-action: pan-y;
}

.compare img {
  width: 100%;
  height: auto;
  pointer-events: none;
}

.compare .compare-before {
  position: absolute;
  inset: 0;
  height: 100%;
  object-fit: cover;
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}

.compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 2px;
  margin-left: -1px;
  background: var(--white);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

.compare-handle::after {
  content: "‹ ›";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  font-size: 20px;
  line-height: 1;
  letter-spacing: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.compare-label {
  position: absolute;
  top: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(34, 34, 34, 0.85);
  color: var(--white);
  font-size: 15px;
  line-height: 1.4;
  pointer-events: none;
}

.compare-label.before { left: 12px; }
.compare-label.after { right: 12px; }

.compare input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
}

.compare:has(input:focus-visible) {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

@media (max-width: 720px) {
  .figure-grid {
    grid-template-columns: 1fr;
  }
  .figure-grid .grid-caption {
    font-size: 18px;
  }
  .compare-label {
    font-size: 13px;
  }
  .compare-handle::after {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
}

/* Hero variant for tall (phone) screenshots: a narrow centered frame */
.project-hero .frame.frame--phone {
  left: calc(444.5 * 100cqw / 1269);
  width: calc(380 * 100cqw / 1269);
  height: calc(800 * 100cqw / 1269);
}

/* Link under a figure (e.g. "open full size") */
.figure-link {
  font-size: 17px;
  color: var(--blue);
  text-underline-offset: 3px;
}
.figure-link:hover {
  color: var(--ink);
}

/* ==========================================================================
   About page
   ========================================================================== */

.about-main {
  margin-top: 74px;
}

.about-main > h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 48px;
  line-height: 1.2;
  margin-bottom: 48px;
}

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
  gap: 80px;
  align-items: start;
}

.about-text {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.about-text .lede {
  font-size: 24px;
  line-height: 1.5;
}

.about-text h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.371;
  margin-top: 28px;
}

.about-text ul {
  padding-left: 1.3em;
}

.about-text li + li {
  margin-top: 4px;
}

.about-aside {
  position: sticky;
  top: 40px;
  display: flex;
  flex-direction: column;
  gap: 56px;
}

.about-aside .portrait {
  width: min(100%, 340px);
  aspect-ratio: 362 / 400;
}

.skills h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.371;
  margin-bottom: 20px;
}

.skills ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}






@media (max-width: 1024px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: 56px;
  }
  /* Stacked: photo first, then the text, then skills */
  .about-aside {
    display: contents;
  }
  .about-aside .portrait {
    order: -1;
    justify-self: center;
    width: min(280px, 70%);
  }
  .skills {
    order: 1;
  }
}

@media (max-width: 720px) {
  .about-main {
    margin-top: 32px;
  }
  .about-main > h1 {
    font-size: 36px;
    margin-bottom: 28px;
  }
  .about-aside .portrait {
    width: min(240px, 64%);
  }
  .about-text .lede {
    font-size: 20px;
  }
  .about-text h2,
  .skills h2 {
    font-size: 25px;
  }
}

/* ==========================================================================
   Homepage intro links (scroll to projects)
   ========================================================================== */

.intro-link {
  color: var(--cyan);
  text-decoration: none;
  transition: color 0.2s ease;
}

.intro-link:hover {
  color: var(--white);
}

/* Cards targeted from the intro land with breathing room above them */
#dynatrace-projects,
#booking-projects {
  scroll-margin-top: 32px;
}

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

/* ==========================================================================
   Projects drawer
   ========================================================================== */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
}

.drawer[hidden] {
  display: none;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--ink);
  color: var(--white);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.35);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.drawer-panel:focus {
  outline: none;
}

.drawer.is-open .drawer-backdrop {
  opacity: 1;
}

.drawer.is-open .drawer-panel {
  transform: none;
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 28px 8px;
}

.drawer-head h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 32px;
  line-height: 1.2;
}

.drawer-close {
  position: relative;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  background: none;
  border: 0;
  color: var(--white);
  cursor: pointer;
}

.drawer-close::before,
.drawer-close::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  top: 50%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(45deg);
}

.drawer-close::after {
  transform: rotate(-45deg);
}

.drawer-body {
  padding: 8px 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  flex: 1;
}

.drawer-group h3 {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9a9a9a;
  margin-bottom: 8px;
}

.drawer-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.drawer-group a {
  display: block;
  padding: 10px 0;
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.3;
  color: var(--white);
  text-decoration: none;
  transition: color 0.2s ease, transform 0.2s ease;
}

.drawer-group a:hover {
  color: var(--cyan);
  transform: translateX(4px);
}

.drawer-group a[aria-current="page"] {
  color: var(--cyan);
}


.drawer-all {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid #3a3a3a;
  color: #cfcfcf;
  font-size: 16px;
  text-decoration: none;
}

.drawer-all:hover {
  color: var(--cyan);
}

body.drawer-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .drawer-panel,
  .drawer-backdrop {
    transition: none;
  }
}

/* ==========================================================================
   Lightbox (project pages)
   ========================================================================== */

.zoomable {
  cursor: zoom-in;
}

.zoomable:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}

.lightbox {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--white);
  overflow: hidden;
}

.lightbox::backdrop {
  background: rgba(17, 17, 17, 0.94);
}

.lightbox[open] {
  display: grid;
  grid-template-rows: 1fr auto;
  animation: lightbox-in 0.25s ease;
}

@keyframes lightbox-in {
  from {
    opacity: 0;
  }
}

.lightbox-stage {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 64px 72px 12px;
  cursor: zoom-out;
}

.lightbox-stage img,
.lightbox-stage video {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 150px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  background: var(--white);
  cursor: default;
}

.lightbox-stage video.transparent {
  background: none;
}

.lightbox-caption {
  padding: 8px 24px 28px;
  text-align: center;
  font-family: var(--caption);
  font-size: 22px;
  line-height: 1.4;
}

.lightbox-count {
  position: absolute;
  top: 22px;
  left: 24px;
  margin: 0;
  font-size: 15px;
  color: #b5b5b5;
}

.lightbox button {
  position: absolute;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.lightbox button:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.lightbox-close {
  top: 12px;
  right: 16px;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }

.lightbox-prev[hidden],
.lightbox-next[hidden],
.lightbox-count[hidden] {
  display: none;
}

body.lightbox-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  .lightbox-stage {
    padding: 64px 12px 8px;
  }
  .lightbox-prev,
  .lightbox-next {
    top: auto;
    bottom: 16px;
    transform: none;
    width: 44px;
    height: 44px;
  }
  .lightbox-caption {
    font-size: 18px;
    padding: 8px 64px 24px;
  }
  /* Homepage: center the puzzle logo; hamburger stays top-right */
  .home-header .puzzle {
    align-self: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox[open] {
    animation: none;
  }
}

/* Slider hint: --pos is registered so it can be animated; the divider glides
   right, left and back, while the knob pulses */
@property --pos {
  syntax: "<percentage>";
  inherits: true;
  initial-value: 50%;
}

.compare.is-hinting {
  animation: compare-hint 1.95s ease-in-out;
}

@keyframes compare-hint {
  0%   { --pos: 50%; }
  33%  { --pos: 66%; }
  67%  { --pos: 34%; }
  100% { --pos: 50%; }
}

.compare.is-hinting .compare-handle::after {
  animation: compare-knob 0.65s ease-in-out 3;
}

@keyframes compare-knob {
  50% {
    transform: translate(-50%, -50%) scale(1.12);
    box-shadow: 0 0 0 6px rgba(0, 255, 234, 0.35), 0 2px 8px rgba(0, 0, 0, 0.3);
  }
}

/* ==========================================================================
   Project pages: company · dates label, and "At a glance" summary
   ========================================================================== */

.project-meta {
  font-size: 15px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6b6b6b;
  margin-bottom: -12px;
}

.glance {
  margin-top: -40px; /* sit closer to the brief above */
  background: var(--white);
  border-radius: 10px;
  padding: 36px 40px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 28px rgba(0, 0, 0, 0.05);
}

.glance-label {
  font-size: 15px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 20px;
}

.glance-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1.25fr;
  gap: 40px;
}

.glance h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 24px;
  line-height: 1.3;
  margin-bottom: 10px;
}

.glance p,
.glance li {
  font-size: 17px;
  line-height: 1.55;
}

.glance ul {
  margin: 0;
  padding-left: 1.1em;
}

.glance li + li {
  margin-top: 6px;
}

.glance-outcome {
  border-left: 3px solid var(--teal);
  padding-left: 24px;
}

@media (max-width: 1024px) {
  .glance-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .glance-outcome {
    border-left: 0;
    border-top: 3px solid var(--teal);
    padding: 20px 0 0;
  }
}

@media (max-width: 720px) {
  .glance {
    margin-top: -24px;
    padding: 24px 20px;
  }
  .glance h3 {
    font-size: 21px;
  }
  .glance p,
  .glance li {
    font-size: 16px;
  }
  .project-meta {
    font-size: 13px;
    margin-bottom: -4px;
  }
}

/* ==========================================================================
   About page: grouped skills and CV button
   ========================================================================== */

.skill-groups {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.skill-group h3 {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6b6b6b;
  margin-bottom: 10px;
}

.skills .chips,
.chips {
  flex-direction: row;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips li {
  font-size: 15px;
  line-height: 1.3;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid #dedede;
}

.cv-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  font-size: 17px;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.cv-button:hover {
  background: var(--blue);
  transform: translateY(-1px);
}

.cv-button svg {
  width: 18px;
  height: 18px;
}

/* Key decisions (project pages) */
.decisions {
  margin-top: -60px;
}

.decision-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  counter-reset: decision;
}

.decision-list li {
  counter-increment: decision;
  position: relative;
  padding: 24px 24px 24px 64px;
  border-radius: 10px;
  background: var(--white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 28px rgba(0, 0, 0, 0.05);
}

.decision-list li::before {
  content: counter(decision);
  position: absolute;
  left: 22px;
  top: 22px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--teal);
  color: var(--white);
  font-size: 15px;
  line-height: 1;
}

.decision-list li:nth-child(3n)::before {
  background: var(--blue);
}

.decision-list h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 21px;
  line-height: 1.3;
  margin-bottom: 8px;
}

.decision-list p {
  font-size: 16px;
  line-height: 1.55;
}

@media (max-width: 720px) {
  .decisions {
    margin-top: -40px;
  }
}

/* ==========================================================================
   Password gate (protected case studies)
   ========================================================================== */

.gate {
  min-height: 56vh;
  display: grid;
  place-items: center;
  padding: 40px 0 20px;
}

.gate-checking .gate {
  visibility: hidden; /* trying a remembered password; avoids a flash of the form */
}

.gate-card {
  width: min(520px, 100%);
  padding: 44px 40px 36px;
  border-radius: 12px;
  background: var(--white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 12px 40px rgba(0, 0, 0, 0.07);
  text-align: center;
}

.gate-icon {
  display: grid;
  grid-template-columns: repeat(2, 22px);
  gap: 3px;
  justify-content: center;
  margin-bottom: 22px;
}

.gate-icon span {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--teal);
}

.gate-icon span:nth-child(3) {
  background: var(--blue);
}

.gate-icon span:nth-child(4) {
  background: none;
  border: 1.5px dashed #b5b5b5;
}

.gate-card .project-meta {
  margin: 0 0 6px;
}

.gate-card h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 32px;
  line-height: 1.25;
}

.gate-card .gate-text {
  margin-top: 12px;
  font-size: 17px;
  line-height: 1.55;
  color: #555;
}

.gate-form {
  display: flex;
  gap: 8px;
  margin-top: 26px;
}

.gate-form input {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  font: inherit;
  font-size: 17px;
  border: 1px solid #cfcfcf;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
}

.gate-form input:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.gate-form button {
  padding: 12px 20px;
  font: inherit;
  font-size: 17px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease;
}

.gate-form button:hover:not(:disabled) {
  background: var(--blue);
}

.gate-form button:disabled {
  opacity: 0.7;
  cursor: progress;
}

.gate-error {
  min-height: 1.5em;
  margin-top: 12px;
  font-size: 15px;
  color: #c0392b;
}

.gate-help {
  font-size: 15px;
  color: #6b6b6b;
}

.gate-help a {
  color: var(--blue);
}

@media (max-width: 720px) {
  .gate-card {
    padding: 32px 20px 28px;
  }
  .gate-card h1 {
    font-size: 26px;
  }
  .gate-form {
    flex-direction: column;
  }
}
