/* POP 8 — reference grid layout (yuriroga.com dimensions) */

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

:root {
  --ref-design: 1512;
  --ref-cols: 4;
  --ref-page: calc(100vw * 10 / var(--ref-design));
  --ref-gap: calc(100vw * 10 / var(--ref-design));
  --ref-radius: 28px;
  --ref-col: calc(
    (100vw - (var(--ref-page) * 2) - (var(--ref-gap) * (var(--ref-cols) - 1)))
    / var(--ref-cols)
  );
  --ref-row: calc(var(--ref-col) * 5 / 4 / 2);
  --pop-back-bg: #121212;
  --pop-back-orange: #ff5500;
  --pop-back-watermark: #1a1a1a;
  --pop-yellow: #ffb81f;
  --dark-purple: #110514;
  --purple-rich: #140018;
  --the-purple: #1d0f28;
  --royal-purple: #281734;
  --deep-panel: #120919;
  --cream: #f8f6f6;
  --flip-open-duration: 0.65s;
  --flip-close-duration: 0.58s;
}

/* Typography tokens from Pop_1 artboard (308 × 385px) */
@supports (font-size: 1cqw) {
  .acc-ref-face--back {
    --pop-heading-size: 15.58cqw;   /* 48px */
    --pop-title-size: 5.19cqw;      /* 16px */
    --pop-rule-size: 4.55cqw;       /* 14px */
    --pop-title-gap: 2.6cqw;        /* 8px */
    --pop-rule-gap: 1.95cqw;        /* 6px */
    --pop-back-pad-x: 9.09cqw;      /* 28px */
    --pop-back-pad-bottom: 10.39cqw; /* 32px */
  }
}

@supports not (font-size: 1cqw) {
  .acc-ref-face--back {
    --pop-heading-size: 48px;
    --pop-title-size: 16px;
    --pop-rule-size: 14px;
    --pop-title-gap: 8px;
    --pop-rule-gap: 6px;
    --pop-back-pad-x: 28px;
    --pop-back-pad-bottom: 32px;
  }
}

body.acc-lab-page {
  margin: 0;
  min-height: 100vh;
  background: #0a060c;
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

/* Lab page chrome */
.acc-lab-page {
  padding-bottom: 80px;
}

.acc-lab-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: var(--purple-rich);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.acc-lab-header h1 {
  margin: 0;
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.acc-lab-header-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.acc-lab-header-links a {
  color: var(--pop-yellow);
  text-decoration: none;
  font-size: 13px;
}

.acc-lab-header-links a:hover {
  color: #ffffff;
}

.acc-lab-block + .acc-lab-block {
  margin-top: 8px;
}

.acc-lab-meta {
  max-width: calc((var(--ref-col) * var(--ref-cols)) + (var(--ref-gap) * (var(--ref-cols) - 1)) + (var(--ref-page) * 2));
  margin: 0 auto;
  padding: 28px var(--ref-page) 12px;
}

.acc-lab-meta h2 {
  margin: 0 0 4px;
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.acc-lab-meta p {
  margin: 0;
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
}

.acc-lab-meta code {
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 12px;
  color: rgba(255, 184, 31, 0.9);
}

.acc-lab-tag {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.acc-lab-tag--live {
  background: var(--pop-yellow);
  color: var(--dark-purple);
}

.acc-ref {
  width: 100%;
  --acc-nav-color: rgba(255, 255, 255, 0.42);
  --acc-nav-hover: rgba(255, 255, 255, 0.72);
  background: var(--acc-section-bg, var(--dark-purple));
  padding:
    calc(100vw * 48 / var(--ref-design))
    var(--ref-page)
    calc(100vw * 80 / var(--ref-design));
}

.acc-ref--theme-light {
  --acc-nav-color: rgba(17, 5, 20, 0.42);
  --acc-nav-hover: rgba(17, 5, 20, 0.72);
}

.acc-ref--bg-dark-purple { --acc-section-bg: var(--dark-purple); }
.acc-ref--bg-purple-rich { --acc-section-bg: var(--purple-rich); }
.acc-ref--bg-the-purple { --acc-section-bg: var(--the-purple); }
.acc-ref--bg-royal-purple { --acc-section-bg: var(--royal-purple); }
.acc-ref--bg-deep-panel { --acc-section-bg: var(--deep-panel); }
.acc-ref--bg-cream { --acc-section-bg: var(--cream); }
.acc-ref--bg-white { --acc-section-bg: #ffffff; }

.acc-ref-nav {
  display: grid;
  grid-template-columns: repeat(var(--ref-cols), var(--ref-col));
  gap: var(--ref-gap);
  width: calc((var(--ref-col) * var(--ref-cols)) + (var(--ref-gap) * (var(--ref-cols) - 1)));
  max-width: 100%;
  margin: 0 auto calc(100vw * 40 / var(--ref-design));
}

.acc-ref-nav-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--acc-nav-color);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.acc-ref-nav-item:hover {
  color: var(--acc-nav-hover);
}

.acc-ref-nav-work {
  grid-column: 2;
}

.acc-ref-nav-about {
  grid-column: 4;
}

.acc-ref-chevron {
  margin-top: 1px;
  opacity: 0.7;
}

.acc-ref-grid {
  display: grid;
  grid-template-columns: repeat(var(--ref-cols), var(--ref-col));
  grid-auto-rows: var(--ref-row);
  gap: var(--ref-gap);
  width: calc((var(--ref-col) * var(--ref-cols)) + (var(--ref-gap) * (var(--ref-cols) - 1)));
  max-width: 100%;
  margin: 0 auto;
}

/* Flip card */
.acc-ref-tile {
  grid-row: span 2;
  display: block;
  width: 100%;
  height: calc(var(--ref-row) * 2);
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  border-radius: var(--ref-radius);
  cursor: pointer;
  perspective: 1400px;
  -webkit-tap-highlight-color: transparent;
}

.acc-ref-flip-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform var(--flip-open-duration) cubic-bezier(0.4, 0.2, 0.2, 1);
  border-radius: var(--ref-radius);
}

.acc-ref-flip.is-flipped .acc-ref-flip-inner,
.acc-ref-flip.is-opening-right .acc-ref-flip-inner {
  transform: rotateY(180deg);
}

.acc-ref-flip.is-closing-left .acc-ref-flip-inner {
  transform: rotateY(0deg);
  transition-duration: var(--flip-close-duration);
  transition-timing-function: cubic-bezier(0.45, 0, 0.55, 1);
}

.acc-ref-face {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: var(--ref-radius);
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.acc-ref-face--front {
  background: #f0f0f0;
}

.acc-ref-face--front img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.35s ease;
}

.acc-ref-pill {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, calc(-50% + 10px));
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--pop-yellow);
  color: #110514;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(17, 5, 20, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 1;
}

.acc-ref-flip:not(.is-flipped):hover .acc-ref-face--front img,
.acc-ref-flip:not(.is-flipped):focus-visible .acc-ref-face--front img {
  transform: scale(1.03);
}

.acc-ref-flip:not(.is-flipped):hover .acc-ref-pill,
.acc-ref-flip:not(.is-flipped):focus-visible .acc-ref-pill {
  opacity: 1;
  transform: translate(-50%, -50%);
}

/* Back face — Pop_1 design spec (308 × 385) */
.acc-ref-face--back {
  container-type: size;
  container-name: pop-back;
  transform: rotateY(180deg);
  background: var(--pop-back-bg);
  color: #ffffff;
  text-align: left;
}

.acc-ref-watermark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 6%;
  font-family: var(--font-title);
  font-size: 78cqh;
  font-weight: 800;
  line-height: 0.82;
  letter-spacing: -0.06em;
  color: var(--pop-back-watermark);
  pointer-events: none;
  user-select: none;
}

.acc-ref-back-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  padding:
    0
    var(--pop-back-pad-x)
    calc(var(--pop-back-pad-bottom) + var(--pop-rule-size) * 2.8);
}

.acc-ref-back-top {
  display: flex;
  flex-direction: column;
  gap: var(--pop-title-gap);
}

.acc-ref-back-heading {
  display: block;
  font-family: var(--font-title);
  font-size: var(--pop-heading-size);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.acc-ref-back-label {
  color: #ffffff;
}

.acc-ref-back-num {
  color: var(--pop-back-orange);
}

.acc-ref-back-title {
  display: block;
  font-family: var(--font-body);
  font-size: var(--pop-title-size);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
  color: #ffffff;
}

.acc-ref-back-foot {
  position: absolute;
  left: var(--pop-back-pad-x);
  right: var(--pop-back-pad-x);
  bottom: var(--pop-back-pad-bottom);
  display: flex;
  flex-direction: column;
  gap: var(--pop-rule-gap);
}

.acc-ref-back-rule-label {
  display: block;
  font-family: var(--font-body);
  font-size: var(--pop-rule-size);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--pop-yellow);
}

.acc-ref-back-rule-text {
  display: block;
  font-family: var(--font-body);
  font-size: var(--pop-rule-size);
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0;
  color: #ffffff;
}

.acc-ref-back-rule-text strong {
  font-weight: 700;
  color: #ffffff;
}

.acc-ref-flip:focus-visible {
  outline: 2px solid var(--pop-yellow);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .acc-ref-flip-inner,
  .acc-ref-face--front img,
  .acc-ref-pill {
    transition: none;
  }

  .acc-ref-flip.is-closing-left .acc-ref-flip-inner {
    transform: rotateY(0deg);
  }

  .acc-ref-flip:not(.is-flipped):hover .acc-ref-face--front img,
  .acc-ref-flip:not(.is-flipped):focus-visible .acc-ref-face--front img {
    transform: none;
    filter: none;
  }
}

@media (max-width: 840px) {
  :root {
    --ref-cols: 2;
  }

  .acc-ref-nav {
    grid-template-columns: repeat(2, var(--ref-col));
    margin-bottom: calc(100vw * 48 / var(--ref-design));
  }

  .acc-ref-nav-work,
  .acc-ref-nav-about {
    grid-column: auto;
  }

  .acc-ref-nav-about {
    grid-column: 2;
  }
}

/* POP grid — fade overlay (production hero, variant B: auto cycle) */
.acc-ref-pop {
  position: relative;
  overflow: hidden;
  border-radius: var(--ref-radius);
  -webkit-tap-highlight-color: transparent;
}

.acc-ref-pop-media,
.acc-ref-pop-overlay {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.acc-ref-pop-media {
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
}

.acc-ref-pop-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transition: transform 0.45s ease, opacity 0.45s ease;
}

.acc-ref-pop-overlay {
  z-index: 1;
  container-type: size;
  container-name: pop-back;
  display: block;
  background: var(--pop-back-bg);
  color: #ffffff;
  text-align: left;
  opacity: 0;
  transition: opacity 0.38s ease;
}

.acc-ref-pop.is-active .acc-ref-pop-overlay {
  opacity: 1;
}

[data-pop-grid] .acc-ref-pop:not(.is-active) .acc-ref-pop-media img {
  opacity: 1;
  transform: none;
}

[data-pop-grid] .acc-ref-pop.is-active .acc-ref-pop-media img {
  opacity: 0.55;
  transform: scale(1.02);
}

@supports (font-size: 1cqw) {
  .acc-ref-pop-overlay {
    --pop-heading-size: 15.58cqw;
    --pop-title-size: 5.19cqw;
    --pop-rule-size: 4.55cqw;
    --pop-title-gap: 2.6cqw;
    --pop-rule-gap: 1.95cqw;
    --pop-back-pad-x: 9.09cqw;
    --pop-back-pad-bottom: 10.39cqw;
  }
}

@media (prefers-reduced-motion: reduce) {
  .acc-ref-pop-media img,
  .acc-ref-pop-overlay {
    transition: none;
  }
}
