:root {
  /* 12-col grid: 16" fullscreen proportion – 160px at 1728px, scale with viewport */
  --layout-width: 1728px;
  --layout-margin-h: clamp(24px, 9.26vw, 160px);
  --layout-margin-v: 40px;
  --layout-content-width: 1408px;
  --layout-col-gutter: 12px;
  --layout-col-width: calc(
    (var(--layout-content-width) - 11 * var(--layout-col-gutter)) / 12
  );
  /* Hero message = 5 columns (Figma 279-467): 5 column widths only */
  --hero-msg-width: calc(5 * var(--layout-col-width));
  /* Hero: block = 2 columns, height from 225:110; font from block height (0xmian.com) */
  --hero-color-width: calc(2 * var(--layout-col-width) + var(--layout-col-gutter));
  --hero-color-height: calc(var(--hero-color-width) * 110 / 225);
  --hero-font-size: calc(var(--hero-color-height) * 0.484);
  /* Hero vertical spacing (Figma 279-1002): 122px nav→hero at 1728px, scale with viewport */
  --hero-row-gap: clamp(32px, 7.06vw, 122px);
  --hero-inner-gap: clamp(32px, 7.41vw, 128px);
  /* Card: image gaps and green/white gap – Figma 310-1536 default 8px */
  --card-gap: 8px;
  /* Chronological card: green panel = 464/1408 of content width, min 320px */
  --card-green-w: max(320px, calc((100vw - 2 * var(--layout-margin-h)) * (464 / 1408)));
  /* Project card: scale to always show exactly 5 across content width */
  --card-item-gap: 14px;
  --card-item-width: calc((100vw - 2 * var(--layout-margin-h) - 4 * var(--card-item-gap)) / 5);
  /* Scale factor relative to Figma's 270px baseline */
  --card-scale: calc(var(--card-item-width) / 270);
  --scroll-duration: 50;
  --hero-color: #a5ffde;
  --section-bg: #d1f7f1;
  --project-title-bg: #e8fffb;
  --project-number-bg: #d4f2ed;
  --project-number-color: #56b291;
  --label-border: #a8efe3;
  --label-text: #156347;
  --text-primary: #1a1a1a;
  --text-secondary: #818181;
  --text-muted: #88a4a0;
  --text-dark: #2f3a38;
  --label-bkg-normal: rgba(59, 62, 62, 0.9);
  --label-stroke-normal: #8c9190;
  --label-text-overlay: #d6d6d6;
  --card-number-bg: #f3f3f3;
  --card-title: #f3f3f3;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  min-height: 0;
  height: auto;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: "PT Sans", sans-serif;
  background: white;
  color: var(--text-primary);
  overflow-x: hidden;
}

.portfolio-site {
  background: white;
  width: 100%;
  max-width: var(--layout-width);
  margin: 0 auto;
  padding: 0 var(--layout-margin-h);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* Hero */
.hero-section {
  width: 100%;
}
.hero-inner {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: 0;
  padding-bottom: 0;
  width: 100%;
  max-width: var(--layout-width);
  margin: 0 auto;
  min-height: 100dvh;
}
.hero-content {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  width: 100%;
  max-width: var(--layout-content-width);
  margin: 0 auto;
}
/* Single grid for nav + hero so tabs and hero message always share the same right column */
.hero-top {
  display: grid;
  grid-template-columns: 1fr 12px 1fr;
  grid-template-rows: auto auto;
  gap: 0 0;
  row-gap: var(--hero-row-gap);
  width: 100%;
}

.nav-row {
  display: contents;
}
.nav-hello {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  height: 80px;
  min-height: 80px;
}
.hello-text {
  font-family: "PT Sans", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--text-secondary);
}
.hello-text .name,
.hello-text .role {
  font-weight: 700;
  color: var(--text-primary);
}
.hello-text .slash {
  color: var(--text-secondary);
}

.tabs-row {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  height: 80px;
  min-height: 80px;
}
.tabs {
  display: flex;
  gap: 2px;
  align-items: center;
}
.tab-sep {
  font-family: "PT Serif", serif;
  font-size: 16px;
  line-height: 1.325;
  color: var(--text-secondary);
  padding-bottom: 2px;
}
.tab {
  font-family: "PT Serif", serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.325;
  color: var(--text-secondary);
  padding-bottom: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  box-sizing: border-box;
}
.tab:hover {
  color: var(--text-primary);
}
.tab.active {
  color: var(--text-primary);
  border-bottom-color: #a8efe3;
}

.contact-fullscreen {
  display: flex;
  gap: 26px;
  align-items: center;
}
.contact-link {
  font-family: "PT Serif", serif;
  font-size: 16px;
  line-height: 1.2;
  color: var(--text-primary);
  text-decoration: none;
}
.fullscreen-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.fullscreen-btn__icon {
  display: block;
  width: 24px;
  height: 24px;
}

.hero-msg-section {
  display: contents;
}
.hero-msg-left {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  min-height: 349px;
}
.hero-msg-right {
  grid-column: 3;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding-bottom: 12px;
  min-width: 0;
}
.hero-message {
  font-family: "Public Sans", sans-serif;
  font-size: var(--hero-font-size);
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: -0.07em;
  color: var(--text-primary);
  padding: 12px 0;
  max-width: var(--hero-msg-width);
  width: 100%;
}
.hero-message .curious {
  font-weight: 500;
}
.hero-message .over,
.hero-message .distilling,
.hero-message .and {
  font-weight: 200;
  color: var(--text-secondary);
}
.hero-message .complexity,
.hero-message .simplicity,
.hero-message .elegance {
  font-family: "PT Serif Caption", serif;
  font-style: italic;
  font-weight: 400;
}
.hero-color-area {
  width: var(--hero-color-width);
  height: var(--hero-color-height);
  background: var(--hero-color);
  border-radius: 4px;
  flex-shrink: 0;
}

/* Project carousel */
.project-list-section {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  /* height: badge(scaled) + gap(scaled) + card(scaled) */
  height: calc(var(--card-scale) * 24px + var(--card-scale) * 9px + var(--card-item-width) * (276 / 270));
  overflow: hidden;
  padding: 0;
  margin-bottom: 48px;
}
.project-list-wrapper {
  overflow: hidden;
  width: 100%;
  height: 100%;
}
.project-list {
  display: flex;
  gap: var(--card-item-gap);
  align-items: center;
  width: max-content;
  padding-bottom: 8px;
  animation: project-list-scroll calc(var(--scroll-duration) * 1s) linear
    infinite;
}
.project-list:hover {
  animation-play-state: paused;
}
@keyframes project-list-scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .project-list {
    animation: none;
  }
}

.project-item {
  display: flex;
  flex-direction: column;
  gap: calc(var(--card-scale) * 9px);
  width: var(--card-item-width);
  min-width: var(--card-item-width);
  max-width: var(--card-item-width);
  flex-shrink: 0;
  cursor: pointer;
}
.project-number-badge {
  width: calc(var(--card-scale) * 24px);
  height: calc(var(--card-scale) * 24px);
  background: var(--card-number-bg);
  border-radius: calc(var(--card-scale) * 4px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.project-number-badge span {
  font-family: "Roboto Flex", sans-serif;
  font-size: calc(var(--card-scale) * 14px);
  font-weight: 600;
  color: var(--text-dark);
}
.project-item:hover .project-number-badge {
  background: #e8fffb;
}
.project-item:hover .project-number-badge span {
  color: var(--project-number-color);
}

.project-card-thumb {
  width: 100%;
  height: calc(var(--card-item-width) * (276 / 270));
  border-radius: calc(var(--card-scale) * 8px);
  padding: calc(var(--card-scale) * 14.4px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.project-card-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  filter: grayscale(100%);
}
.project-card-bg--thumb {
  background-image: url("../assets/optimized/project-card-thumb.png");
}
.project-item:hover .project-card-bg {
  filter: none;
}
.project-card-thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.56) 14.456%,
    rgba(0, 0, 0, 0) 46.703%,
    rgba(0, 0, 0, 0.56) 78.949%
  );
  pointer-events: none;
  border-radius: 8px;
}
.project-item:hover .project-card-thumb::before {
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.7) 14.456%,
    rgba(0, 0, 0, 0) 46.703%,
    rgba(0, 0, 0, 0.7) 78.949%
  );
}
/* All card content sits above the bg and gradient overlay */
.project-card-thumb .label,
.project-card-thumb .labels-wrap,
.project-card-thumb .title {
  position: relative;
  z-index: 2;
}

/* --- Label --- */
.project-card-thumb .label {
  background: rgba(59, 62, 62, 0.9);
  border: 1px solid #8b9190;
  border-radius: 100px;
  padding: calc(var(--card-scale) * 4.2px) calc(var(--card-scale) * 9.6px);
  display: inline-flex;
  align-items: center;
  width: fit-content;
}
.project-item:hover .project-card-thumb .label {
  background: rgba(47, 58, 56, 0.9);
  border-color: #658580;
}
.project-card-thumb .label span {
  font-family: "Roboto Condensed", sans-serif;
  font-size: calc(var(--card-scale) * 14px);
  color: #d6d6d6;
  letter-spacing: calc(var(--card-scale) * 0.056em);
}
.project-item:hover .project-card-thumb .label span {
  color: #c6f2eb;
}
.project-card-thumb .labels-wrap {
  display: flex;
  gap: calc(var(--card-scale) * 6px);
  flex-wrap: wrap;
}

/* --- Title (bottom) --- */
.project-card-thumb .title {
  font-family: "Roboto Flex", sans-serif;
  font-size: calc(var(--card-scale) * 21px);
  font-weight: 500;
  color: #f3f3f3;
  padding-bottom: calc(var(--card-scale) * 9.6px);
  padding-left: calc(var(--card-scale) * 7.2px);
}
.project-item:hover .project-card-thumb .title {
  color: #a8efe3;
}

/* --- Desc panel (hover only, sits between label and title) --- */
.project-card-thumb .desc {
  display: none;
  position: absolute;
  /* top: after label+padding, bottom: above title+padding */
  top: calc(var(--card-scale) * (14.4 + 24.4 + 24));
  left: calc(var(--card-scale) * 14.4px);
  right: calc(var(--card-scale) * 14.4px);
  bottom: calc(var(--card-scale) * (14.4 + 34.6 + 24));
  z-index: 2;
  align-items: flex-start;
  justify-content: flex-start;
  background: rgba(28, 34, 31, 0.87);
  padding: 0 calc(var(--card-scale) * 16px);
  border-radius: calc(var(--card-scale) * 8px) calc(var(--card-scale) * 8px) calc(var(--card-scale) * 8px) 0;
  overflow: hidden;
}
.project-item:hover .project-card-thumb .desc {
  display: flex;
  align-items: center;
}
.project-card-thumb .desc span {
  font-family: "Tomorrow", sans-serif;
  font-size: calc(var(--card-scale) * 16px);
  color: #00f8a5;
  text-align: left;
  line-height: 1.3;
}

/* Chronological projects section */
.chronological-bleed {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex-shrink: 0;
}
.chronological-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0 36px;
  width: 100%;
  background: linear-gradient(to bottom, #ffffff 0%, var(--section-bg) 100%);
}
.chronological-text {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  max-width: var(--layout-content-width);
  margin: 0 auto;
  padding: 0 var(--layout-margin-h);
  color: #88a4a0;
}
.chronological-line {
  flex: 1;
  height: 1px;
  background: currentColor;
  opacity: 0.4;
}
.chronological-text span {
  font-family: "Public Sans", sans-serif;
  font-size: 16px;
  letter-spacing: -0.32px;
}

.projects-chronological {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 24px;
  background: var(--section-bg);
  padding: 0 var(--layout-margin-h);
  align-items: stretch;
}
.project-section {
  overflow: visible;
  position: relative;
  scroll-margin-top: 64px;
  display: flex;
  justify-content: center;
}
/* Card: VERTICAL flex, no gap — preview flush on top, info flush below.
   border-radius shapes the hover shadow; per-corner radii on children handle visual clipping. */
.project-card {
  position: relative;
  width: 100%;
  max-width: var(--layout-content-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  transition: box-shadow 0.25s ease;
}
.project-card:hover {
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.04);
}
/* Preview: 3 equal images with 8px gap. Height = 268/1408 of card width.
   Figma: Preview TL=16 TR=16 BR=0 BL=0 */
.project-card-preview {
  display: flex;
  flex-direction: row;
  gap: var(--card-gap);
  background: white;
  flex-shrink: 0;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  /* Height proportional: 268px at 1408px content width */
  height: calc((100vw - 2 * var(--layout-margin-h)) * (268 / 1408));
}
.project-card-preview .thumb-left,
.project-card-preview .thumb-mid,
.project-card-preview .thumb-right {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-width: 0;
}
.project-card-preview .thumb-left {
  background: var(--section-bg);
}
.project-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.project-card-preview .thumb-mid img,
.project-card-preview .thumb-right img {
  filter: grayscale(100%);
  transition:
    filter 0.35s ease,
    transform 0.4s ease;
}
.project-card:hover .project-card-preview .thumb-mid img,
.project-card:hover .project-card-preview .thumb-right img {
  filter: none;
}
.project-card-preview .thumb-left:hover img {
  transform: scale(1.03);
}
.thumb-overflow {
  overflow: hidden;
}
.thumb-overflow img {
  object-fit: cover;
  min-width: 100%;
  min-height: 100%;
}
.thumb-agent-ball img {
  object-fit: contain;
  object-position: center;
}

/* Info: green panel left (fixed 464/1408 of content width) + white desc right.
   Figma: green panel BL=16, white panel BR=16 */
.project-card-info {
  display: flex;
  flex-direction: row;
  align-items: stretch;
}
.project-card-title-block {
  /* 464/1408 of content width, min 320px — matches left image above */
  flex: 0 0 var(--card-green-w);
  width: var(--card-green-w);
  background: var(--project-title-bg);
  padding: 18px 18px 24px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-radius: 0 0 0 16px;
  overflow: hidden;
}
.project-card-title-inner {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  width: 100%;
  flex: 1;
  min-height: 0;
}
.project-card-title-left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  min-width: 0;
  height: 100%;
}
.project-card-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-shrink: 0;
}
.project-card-name-wrap {
  padding-left: 4px;
  flex-shrink: 0;
}
.project-card-labels {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.project-card-label {
  background: var(--section-bg);
  border: 0.896px solid var(--label-border);
  border-radius: 89.626px;
  padding: 4.2px 9.6px;
  font-family: "Roboto Condensed", sans-serif;
  font-size: 14px;
  color: var(--label-text);
  letter-spacing: 0.56px;
}
.project-card-date-role {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 4px;
}
.project-card-date {
  font-family: "Roboto Flex", sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
}
.project-card-role {
  font-family: "Roboto Flex", sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}
.project-card-name {
  font-family: "Roboto Flex", sans-serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.48px;
}
.project-card-badge {
  flex-shrink: 0;
  width: 24.4px;
  height: 24.4px;
  background: var(--project-number-bg);
  border-radius: 2.033px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Roboto Flex", sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--project-number-color);
}
.project-card-desc {
  flex: 1;
  min-width: 0;
  background: white;
  padding: 24px 16px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 48px;
  border-radius: 0 0 16px 0;
}
.project-card-desc-title {
  font-family: "Public Sans", sans-serif;
  font-size: 32px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: -2.24px;
  color: var(--text-primary);
  min-height: 93px;
}
.project-card-redirect {
  display: flex;
  flex-wrap: wrap;
  gap: 48px;
  align-items: center;
}
.project-card-redirect-item {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  opacity: 0.45;
  transition: opacity 0.2s ease;
}
.project-card-redirect-item:hover {
  opacity: 1;
}
.project-card-redirect-item[data-coming-soon] {
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}
.project-card-redirect-item .redirect-icon {
  flex-shrink: 0;
  display: block;
  width: auto;
  height: 30px;
}

/* Footer */
.footer {
  width: 100%;
  background: var(--section-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0;
  flex-shrink: 0;
}
.footer-inner {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  font-family: "Public Sans", sans-serif;
  font-size: 12px;
  color: #88a4a0;
  letter-spacing: -0.6px;
  line-height: 1.5;
}
.footer-text {
  font-weight: 500;
}
.footer-copy {
  font-weight: 400;
}

/* Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}
.overlay.active {
  display: flex;
}
.overlay-frame {
  width: 90%;
  height: 90%;
  max-width: 1728px;
  background: white;
  border-radius: 24px;
  overflow: hidden;
}
.overlay-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

@media (max-width: 1728px) {
  .portfolio-site {
    padding: 0 var(--layout-margin-h);
  }
  .projects-chronological {
    padding: 0 var(--layout-margin-h);
  }
  .chronological-text {
    padding: 0 var(--layout-margin-h);
  }
}


/* At full content width (1408px), cap preview height at exact Figma value */
@media (min-width: 1728px) {
  .project-card-preview {
    height: 268px;
  }
}

/* xl: large desktop – wider horizontal padding */
@media (min-width: 1280px) {
  .portfolio-site {
    padding-left: var(--layout-margin-h);
    padding-right: var(--layout-margin-h);
  }
}

/* lg: desktop navigation and subtle enhancements */
@media (min-width: 1024px) {
  .nav-hello,
  .tabs-row {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.9);
  }

  .contact-fullscreen {
    gap: 26px;
  }

  /* Animated underline for tabs on hover */
  .tab {
    position: relative;
  }

  .tab::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    height: 2px;
    width: 0;
    background: #b0b8b6;
    transition: width 0.2s ease;
  }

  .tab:hover::after {
    width: 100%;
  }

  .tab.active::after {
    display: none;
  }

  .hero-message {
    max-width: var(--hero-msg-width);
  }

  /* Project cards – subtle lift on hover */
  .project-card {
    transition:
      box-shadow 0.25s ease,
      transform 0.2s ease;
  }

  .project-card:hover {
    transform: translateY(-2px);
  }

  /* Footer: keep text + © centered together on desktop */
  .footer-inner {
    width: 100%;
    max-width: 1280px;
    padding: 0 40px;
    justify-content: center;
  }
}

/* md+: hero right column content can grow */
@media (min-width: 768px) {
  :root {
    --hero-font-size: 36px;
  }

  .hero-msg-right {
    min-height: 349px;
  }

  .hero-message {
    width: 100%;
  }
}

/* Card spacing: 6px between 600px–1024px, 4px below 600px */
@media (max-width: 1024px) {
  :root {
    --card-gap: 6px;
  }
}

/* Smallest screens: tighter card gap + smaller, centered hero message */
@media (max-width: 599px) {
  :root {
    --card-gap: 4px;
    /* Shrink hero color block on mobile; font-size scales from block height */
    --hero-color-width: 180px;
    --hero-color-height: calc(var(--hero-color-width) * 110 / 225);
  }

  .hero-msg-right {
    align-items: center;
  }

  .hero-message {
    text-align: center;
  }
}

/* Small screens: allow project list to scroll horizontally; cards keep green+white on one row */
@media (max-width: 767px) {
  .project-list {
    animation: none;
  }

  .project-list-wrapper {
    overflow-x: auto;
  }

  :root {
    --card-item-width: 220px;
    --card-scale: calc(220 / 270);
  }

  .project-list-section {
    height: calc(var(--card-scale) * 24px + var(--card-scale) * 9px + var(--card-item-width) * (276 / 270));
  }
}
