/* ============================================================
   TOKENS
============================================================ */
:root {
  --bg:          #ffffff;
  --bg-card:     #EDEAE4;
  --projects-tag: #f7f7f7;
  --text:        #1A1817;
  --text-2:      #919191;
  --text-3:      #AAA49C;
  --accent:      #C4593A;
  --border:      #DDD8CF;

  --ff-body:    'DM Sans', sans-serif;
  --ff-label:   'IBM Plex Sans Condensed', sans-serif;

  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);

  --nav-h: 56px;
}

/* ============================================================
   RESET
============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--ff-body);
  font-optical-sizing: auto;
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ============================================================
   UTILITIES
============================================================ */
.section-header-label {
  font-size: 1rem;
  font-weight: 400;
  text-transform: uppercase;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}
.section-header-label svg {
  flex-shrink: 0;
  display: block;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

/* ============================================================
   REVEAL ANIMATIONS
============================================================ */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.fade-in.visible {
  opacity: 1;
  transform: none;
}

.grid-row-section .grid-wrap.fade-in {
  transform: none;
  transition: opacity 0.3s var(--ease);
}

/* stagger project cards */
.project-card:nth-child(1).fade-in { transition-delay: 0s; }
.project-card:nth-child(2).fade-in { transition-delay: 0.08s; }
.project-card:nth-child(3).fade-in { transition-delay: 0.16s; }
.project-card:nth-child(4).fade-in { transition-delay: 0.24s; }

/* ============================================================
   NAV
============================================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: var(--nav-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 max(1.5rem, calc((100% - 1296px) / 2));
  background: rgba(249, 249, 249, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform 0.3s var(--ease);
}
.nav--hidden {
  transform: translateY(-100%);
}

.nav-logo {
  font-size: 0.8rem;
  font-weight: 450;
  transition: color 0.2s;
  justify-self: start;
}
.nav-logo:hover { color: var(--accent); }

.nav-center {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav-center a {
  font-size: 0.8rem;
  font-weight: 400;
  text-transform: uppercase;
  color: var(--text-2);
  transition: color 0.2s;
}
.nav-center a:hover,
.nav-center a.active { color: var(--text); }

.nav-icons {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  justify-self: end;
}
.nav-icons a {
  display: flex;
  align-items: center;
  color: var(--text-3);
  transition: color 0.2s, transform 0.2s;
}
.nav-icons a:hover {
  color: var(--text);
}

.nav-menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.nav-menu-btn span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--text);
  transition: transform 0.3s, opacity 0.3s;
}

/* ============================================================
   HERO
============================================================ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4rem;
  padding: calc(var(--nav-h) + 5rem) max(3rem, calc((100% - 1296px) / 2)) calc(5rem + 3 * 104px);
  position: relative;
}

.hero-bg-circle {
  position: absolute;
  top: 8%;
  right: -8%;
  width: 55vw;
  height: 55vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(196, 89, 58, 0.07) 0%, transparent 65%);
  pointer-events: none;
}

.hero-right {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

/* ── Grid interaction component ── */
.grid-wrap {
  position: relative;
  display: inline-block;
}

.grid {
  display: grid;
  grid-template-columns: repeat(9, 104px);
  grid-template-rows: repeat(5, 104px);
  position: relative;
  border-left: 1px solid rgba(0,0,0,0.12);
  border-top: 1px solid rgba(0,0,0,0.12);
}

.cell {
  position: relative;
  width: 104px;
  height: 104px;
  border-right: 1px solid rgba(0,0,0,0.12);
  border-bottom: 1px solid rgba(0,0,0,0.12);
  cursor: default;
}

.cell-num {
  position: absolute;
  top: 5px;
  left: 7px;
  font-size: 9px;
  color: rgba(0,0,0,0.2);
  font-family: var(--ff-label);
  pointer-events: none;
  z-index: 3;
}

.cell.black { cursor: pointer; }

.cell-fill {
  position: absolute;
  inset: 0;
  background: #1c1c1c;
  border-radius: 8px;
  z-index: 3;
}
.cell-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 3px 3px 8px rgba(121, 121, 121, 0.45),
    inset -2px -2px 6px rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

.cell.open .cell-fill {
  animation: doorOpen 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  transform-origin: left center;
  transform-style: preserve-3d;
}
.cell.closing .cell-fill {
  animation: doorClose 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  transform-origin: left center;
  transform-style: preserve-3d;
}

@keyframes doorOpen {
  0%   { transform: perspective(300px) rotateY(0deg); }
  100% { transform: perspective(300px) rotateY(-82deg); }
}
@keyframes doorClose {
  0%   { transform: perspective(300px) rotateY(-82deg); }
  100% { transform: perspective(300px) rotateY(0deg); }
}

.cell-img {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 0;
}
.cell-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 10px;
}

.bubble {
  position: absolute;
  left: 96px;
  top: 50%;
  margin-top: -18px;
  background: #ffffff80;
  backdrop-filter: blur(24px) saturate(180%) brightness(1.2);
  -webkit-backdrop-filter: blur(32px) saturate(180%) brightness(1.08);
  border-radius: 99px;
  padding: 8px 12px;
  font-family: var(--ff-body);
  font-size: 11px;
  line-height: 1.5;
  color: rgba(0, 0, 0, 0.9);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.88) translateY(3px);
  transition: opacity 0.22s 0.46s, transform 0.22s 0.46s;
  z-index: 4;
  box-shadow:
    0 6px 40px rgba(0,0,0,0.05),
    0 2px 8px rgba(0,0,0,0.02);
}
.cell.open .bubble {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.grid-col-ext {
  position: absolute;
  top: calc(5 * 104px + 1px);
  left: calc(4 * 104px);
  display: grid;
  grid-template-columns: 104px;
  grid-template-rows: repeat(3, 104px);
  border-left: 1px solid rgba(0,0,0,0.12);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.grid-col-ext--top {
  top: calc(-2 * 104px);
  grid-template-rows: repeat(2, 104px);
  opacity: 1;
  border-top: 1px solid rgba(0,0,0,0.12);
}

.grid-col-ext-cell {
  border-right: 1px solid rgba(0,0,0,0.12);
  border-bottom: 1px solid rgba(0,0,0,0.12);
}

/* ── Shared char base ── */
.grid-col-ext-char {
  position: absolute;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}

/* ── Grid1 bottom char ── */
.grid-col-ext--bottom .grid-col-ext-char {
  bottom: 0;
  left: 85px;
}

.grid-col-ext--bottom .grid-col-ext-img {
  height: 180px;
  width: auto;
  max-width: none;
  display: block;
  z-index: -1;
}

.grid-col-ext--bottom .grid-col-ext-bubble {
  width: 18rem;
  margin-top: 0;
}

/* ── Grid2 top char ── */
.grid-col-ext--top .grid-col-ext-char {
  bottom: 155px;
  left: -35px;
}

.grid-col-ext--top .grid-col-ext-img {
  height: 145px;
  width: auto;
  max-width: none;
  display: block;
  z-index: 1;
}

.grid-col-ext--top .grid-col-ext-bubble {
  width: 15rem;
  margin-top: 20px;
  margin-left: -350px;
  opacity: 1;
  transform: none;
  transition: none;
}

/* ── Shared bubble base ── */
.grid-col-ext-bubble {
  background: #ffffff80;
  backdrop-filter: blur(24px) saturate(180%) brightness(1.2);
  -webkit-backdrop-filter: blur(32px) saturate(180%) brightness(1.08);
  border-radius: 16px;
  padding: 10px 14px;
  font-family: var(--ff-body);
  font-size: 12px;
  line-height: 1.5;
  color: rgba(0, 0, 0, 0.9);
  white-space: normal;
  box-shadow: 0 6px 40px rgba(0,0,0,0.05), 0 2px 8px rgba(0,0,0,0.02);
  opacity: 0;
  transform: scale(0.88) translateY(3px);
  transition: opacity 0.4s ease 0.2s, transform 0.4s ease 0.2s;
}

.grid-col-ext.active .grid-col-ext-bubble {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.grid-row-section {
  display: flex;
  justify-content: center;
  padding: calc(4rem + 2 * 104px) max(3rem, calc((100% - 936px) / 2)) 4rem;
}

.grid--row {
  grid-template-columns: repeat(9, 104px) !important;
  grid-template-rows: repeat(1, 104px) !important;
}

.grid-hint {
  font-size: 0.7rem;
  font-family: var(--ff-label);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(0,0,0,0.35);
}

/* ============================================================
   WORK
============================================================ */
.scroll-arrow {
  display: flex;
  justify-content: center;
  color: rgba(0,0,0,0.25);
}
.scroll-arrow svg {
  width: 24px;
  height: 24px;
}

.work {
  padding: 6rem max(3rem, calc((100% - 936px) / 2));
}

.projects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 4rem;
}

/* Image placeholders */
.img-brix { background: linear-gradient(135deg, #1E293B 0%, #334155 50%, #475569 100%); }
.img-opus { background: linear-gradient(135deg, #0F172A 0%, #4C1D95 60%, #6D28D9 100%); }
.img-moka { background: linear-gradient(135deg, #7C2D12 0%, #9A3412 60%, #C2410C 100%); }

.project-card {
  background: var(--bg);
  display: block;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: background 0.35s var(--ease);
}

.project-inner {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  min-height: 420px;
  position: relative;
}

.project-visual {
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  background: #000;
}
.project-visual--no-video {
  background: transparent;
}
.project-visual--no-video .project-img {
  opacity: 1 !important;
  transform: none !important;
}
.project-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0px 8px 12px rgba(255,255,255,0.4),
    inset 6px 0px 12px rgba(255,255,255,0.3),
    inset 0 0px 6px rgba(164, 126, 0, 0.12);
  pointer-events: none;
  z-index: 2;
}
.project-img {
  width: 100%;
  height: 100%;
  transition: transform 0.55s var(--ease);
}
.project-card:hover .project-img { transform: scale(1.04); }

.project-hover-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity 0.35s var(--ease);
  pointer-events: none;
  border-radius: inherit;
  transform: scale(1.01);
}
.project-card:hover .project-hover-video { opacity: 1; }
.project-card:hover .project-img { opacity: 0; }

.project-bottom {
  display: flex;
  flex-direction: column;
  gap: 4rem;
}
.project-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.project-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.project-name-tags {
  display: flex;
  padding-top: 0.2rem;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.project-name-tags span {
  font-size: 0.8rem;
  color: var(--text-3);
  background-color: var(--projects-tag);
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  font-weight: 400;
}

.project-name {
  font-size: 1.2rem;
  font-weight: 350;
}
.project-desc {
  font-size: 1rem;
  color: var(--text-2);
  font-weight: 350;
  line-height: 1.4;
}

/* ============================================================
   FOOT
============================================================ */
.foot {
  display: flex;
  justify-content: center;
  height: var(--nav-h);
  margin-top: 4rem;
  padding-bottom: 2rem;
}

.foot-center {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.foot-center a {
  font-size: 0.8rem;
  font-weight: 400;
  text-transform: uppercase;
  color: var(--text-2);
  transition: color 0.2s;
}
.foot-center a:hover,
.foot-center a.active { color: var(--text); }

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 768px) {
  :root { --nav-h: 48px; }

  .nav { padding: 0 1.5rem; grid-template-columns: 1fr auto; }
  .nav-center { display: none; }
  .nav-icons { display: none; }
  .nav-menu-btn { display: flex; justify-self: end; }

  .hero { padding: calc(var(--nav-h) + 3rem) 1.5rem calc(4rem + 3 * 64px); flex-direction: column; align-items: center; gap: 3rem; }
  .hero-right { display: flex; }
  .grid { grid-template-columns: repeat(5, 64px); grid-template-rows: repeat(9, 64px); }
  .grid--row { grid-template-columns: repeat(5, 64px) !important; grid-template-rows: repeat(1, 64px) !important; }
  .cell { width: 64px; height: 64px; }
  .grid-col-ext { grid-template-columns: 64px; grid-template-rows: repeat(3, 64px); top: calc(9 * 64px + 1px); left: calc(2 * 64px); }
  .grid-col-ext--top { top: calc(-2 * 64px); left: calc(2 * 64px); grid-template-rows: repeat(2, 64px); }
  .grid-col-ext-cell { width: 64px; height: 64px; }
  .grid-col-ext--bottom .grid-col-ext-char { height: 111px; left: 52px; bottom: 0; }
  .grid-col-ext--bottom .grid-col-ext-img { height: 111px; }
  .grid-col-ext--bottom .grid-col-ext-bubble { width: 10.5rem; margin-left: -2rem; margin-top: -3.4rem;}
  .grid-col-ext--top .grid-col-ext-char { height: 111px; left: -26px; bottom: 80px; }
  .grid-col-ext--top .grid-col-ext-img { height: 100px; }
  .grid-col-ext--top .grid-col-ext-bubble { width: 8rem; max-width: 8rem; margin-left: -14rem; margin-top: -2rem; }
  .cell-fill { border-radius: 5px; }
  .cell-img img { border-radius: 6px; }
  .bubble { left: 58px; font-size: 10px; padding: 6px 10px; }

  .grid-row-section { padding: calc(4rem + 2 * 64px) 1.5rem 4rem; }
  .work { padding-left: 1.5rem; padding-right: 1.5rem; }

  .projects { grid-template-columns: 1fr; }
  .project-inner { min-height: auto; }
}
