:root {
  --page-bg: #d9dadb;
  --panel-bg: #d9d3ce;
  --panel-dark: #121a1f;
  --panel-dark-soft: #1c2d35;
  --text-dark: #191d20;
  --text-soft: rgba(18, 21, 25, 0.72);
  --text-light: rgba(238, 240, 241, 0.94);
  --line: rgba(15, 19, 22, 0.38);
  --dot: rgba(18, 21, 25, 0.9);
  --grid-columns: 12;
  --grid-rows: 8;
  --grid-gap: 20px;
  --grid-color: rgba(255, 0, 0, 0.15);
  --row-color: rgba(0, 100, 255, 0.15);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--page-bg);
  font-family: "Inter", "Segoe UI", sans-serif;
  color: var(--text-dark);
}

body {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

img {
  max-width: 100%;
  display: block;
}

.project-detail-shell {
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  background: #ffffff;
  display: grid;
  grid-template-columns: 1.05fr 0.15fr 0.95fr 1fr;
  gap: 0;
  padding: 0px;
  justify-content: space-between;
  align-items: stretch;
  justify-items: stretch;
  align-content: stretch;
}

.detail-card {
  position: relative;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border-right: 1px solid rgba(18, 21, 25, 0.12);
}

.detail-card:last-child {
  border-right: none;
}

.detail-card--copy {
  background: #d9dadb;
  padding: 18px 28px 26px 26px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 18px;
  border-right: 1px solid rgba(18, 21, 25, 0.12);
}

.detail-card--visual {
  width: 370px;
  background: #ffffff;
  padding: 107px 11px 62px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(18, 21, 25, 0.12);
  justify-content: space-between;
}

.detail-card--dark {
  background: linear-gradient(180deg, #ffffff 0%, #ffffff 100%);
  color: var(--text-dark);
  padding: 107px 113px 43px 10px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  border-right: 1px solid rgba(18, 21, 25, 0.12);
}

.detail-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  color: rgba(18, 21, 25, 0.78);
  z-index: 2;
}

.detail-topline--dark {
  color: rgba(18, 21, 25, 0.8);
}

.detail-index {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.detail-card--copy h1 {
  position: relative;
  z-index: 2;
  margin: 0;
  font-family: "Iowan Old Style", "Georgia", serif;
  font-size: clamp(4.2rem, 4.8vw, 6.4rem);
  line-height: 0.78;
  letter-spacing: -0.08em;
  font-weight: 400;
  color: rgba(17, 21, 25, 0.94);
  margin-top: 2px;
}

.detail-pattern {
  position: absolute;
  left: 24%;
  right: 10%;
  bottom: 50px;
  height: 150px;
  background-image: radial-gradient(var(--dot) 0.8px, transparent 1.1px);
  background-size: 10px 10px;
  border-radius: 50%;
  opacity: 0.6;
  transform: rotate(18deg) scale(1.4);
  filter: contrast(1.2);
}

.detail-caption {
  position: relative;
  z-index: 2;
  margin: 0;
  max-width: 230px;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: rgba(18, 21, 25, 0.8);
}

.detail-body {
  padding: 18px 0px 4px;
}

.detail-body h2,
.dark-content h2 {
  margin: 0 0 10px;
  font-family: "Iowan Old Style", "Georgia", serif;
  font-weight: 400;
  font-size: clamp(2rem, 2.4vw, 3rem);
  line-height: 0.92;
  letter-spacing: -0.06em;
}

/* Clickable headings */
.detail-link {
    font: inherit;
    letter-spacing: inherit;
    color: #962f2f;
    background: none;
  border: 0;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
  display: inline;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-size: 0% 1px;
  background-position: left bottom;
  transition: background-size 420ms cubic-bezier(0.22, 1, 0.36, 1), opacity 300ms ease;
}

.detail-link:hover,
.detail-link:focus-visible {
  opacity: 0.62;
  background-size: 100% 1px;
}

.detail-link:focus-visible {
  outline: 1px solid rgba(18, 21, 25, 0.55);
  outline-offset: 4px;
}

/* Full screen detail overlay */
.detail-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100dvh;
  margin: 0;
  padding: 0;
  z-index: 99999;
  background: #ffffff;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 320ms ease, transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.detail-overlay.is-open {
  opacity: 1;
  transform: translateY(0);
}

.detail-overlay.fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  max-height: none !important;
}

.detail-overlay[hidden] {
  display: none;
}

.detail-overlay-inner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.detail-overlay-bar {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 7.5px clamp(20px, 3.4vw, 48px);
  border-bottom: 1px solid rgba(18, 21, 25, 0.16);
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1), opacity 320ms ease;
  transform: translateY(0);
  opacity: 1;
}

.detail-overlay.is-scrolled .detail-overlay-bar {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.detail-overlay-kicker {
  display: none;
}

.detail-overlay-breadcrumb {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  color: rgba(18, 21, 25, 0.66);
}

.detail-overlay-close {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid rgba(18, 21, 25, 0.34);
  border-radius: 50%;
  color: rgba(18, 21, 25, 0.86);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  transition: background 240ms ease, color 240ms ease, transform 240ms ease;
}

.detail-overlay-preview {
  display: none;
}

.detail-overlay-close:hover,
.detail-overlay-close:focus-visible {
  background: rgba(18, 21, 25, 0.92);
  color: #fff;
  transform: rotate(90deg);
}

.detail-overlay-scroll {
  --overlay-pad: clamp(20px, 3.4vw, 48px);
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 var(--overlay-pad);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(18, 21, 25, 0.3) transparent;
}

.detail-overlay-scroll::-webkit-scrollbar {
  width: 6px;
}

.detail-overlay-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.detail-overlay-scroll::-webkit-scrollbar-thumb {
  background: rgba(18, 21, 25, 0.25);
  border-radius: 3px;
}

.detail-overlay-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(18, 21, 25, 0.4);
}

.detail-overlay-lede {
  margin-top: clamp(30px, 5vw, 74px);
  margin-bottom: clamp(34px, 4vw, 56px);
}

.detail-overlay-title {
  margin: 0 0 20px;
  font-family: "Iowan Old Style", "Georgia", serif;
  font-weight: 400;
  font-size: clamp(2.6rem, 5.4vw, 5.6rem);
  line-height: 0.88;
  letter-spacing: -0.07em;
  color: rgba(18, 21, 25, 0.95);
}

.detail-overlay-lede {
  margin: 0 0 clamp(34px, 4vw, 56px);
  max-width: 640px;
  font-size: clamp(1.05rem, 1.3vw, 1.45rem);
  line-height: 1.42;
  letter-spacing: -0.03em;
  font-weight: 300;
  color: rgba(18, 21, 25, 0.78);
}

.detail-overlay-rule {
  max-width: 1180px;
  border-top: 1px solid rgba(18, 21, 25, 0.16);
  margin-bottom: clamp(22px, 2.6vw, 36px);
}

.detail-overlay-gallery:empty {
  display: none;
}

/* Full bleed: cancels the scroll container's side padding, so images
   run edge to edge. No gap, so they stack as one continuous column. */
.detail-overlay-gallery {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: auto;
  margin-left: calc(var(--overlay-pad) * -1);
  margin-right: calc(var(--overlay-pad) * -1);
  margin-bottom: 0;
}

.detail-overlay-figure {
  margin: 0;
  background: #ffffff;
}

.detail-overlay-figure img {
  width: 100%;
  height: auto;
  display: block;
}

.detail-overlay-figure figcaption {
  padding: 10px var(--overlay-pad) 0;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  color: rgba(18, 21, 25, 0.6);
}

.detail-overlay-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: clamp(22px, 2.6vw, 42px);
  max-width: 1180px;
}

.detail-overlay-sections:empty {
  display: none;
}
.detail-overlay-block h3 {
  margin: 0 0 10px;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: rgba(18, 21, 25, 0.82);
}

.detail-overlay-block p {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.55;
  font-weight: 300;
  color: rgba(18, 21, 25, 0.74);
}

.detail-body p,
.dark-content p {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--text-soft);
}

.dark-content {
  margin-top: 80px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  flex: 1;
}

.dark-content h2,
.dark-content p {
  color: var(--text-dark);
}

.dark-content p {
  color: rgba(18, 21, 25, 0.72);
  max-width: 260px;
}

@media (max-width: 640px) {
  .detail-card {
    min-height: 320px;
    padding: 24px 16px;
  }

  .detail-overlay-bar {
    height: 60px;
    padding: 0 12px;
  }

  .detail-overlay-bar .brand-mark {
    font-size: 1.1rem;
  }

  .detail-overlay-bar .close-btn {
    width: 32px;
    height: 32px;
  }

  .panel-tabs {
    gap: 8px;
    font-size: 0.8rem;
  }

  .panel-content {
    padding: 16px 12px;
  }

  .project-title {
    font-size: clamp(1.8rem, 9vw, 3rem);
  }

  .project-meta {
    flex-direction: column;
    gap: 8px;
  }
}

/* Grid Overlay System */
.grid-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  display: none;
}

.grid-overlay.active {
  display: block;
}

.grid-overlay-inner {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), 1fr);
  gap: var(--grid-gap);
  width: 100%;
  max-width: 1600px;
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--grid-gap);
}

.grid-column {
  background: var(--grid-color);
  border-left: 1px solid rgba(255, 0, 0, 0.3);
  border-right: 1px solid rgba(255, 0, 0, 0.3);
  position: relative;
}

.grid-column::before {
  content: attr(data-col);
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255, 0, 0, 0.8);
  background: rgba(255, 255, 255, 0.9);
  padding: 2px 6px;
  border-radius: 3px;
}

/* Row Overlay System */
.row-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  display: none;
}

.row-overlay.active {
  display: block;
}

.row-overlay-inner {
  display: grid;
  grid-template-rows: repeat(var(--grid-rows), 1fr);
  gap: var(--grid-gap);
  width: 100%;
  height: 100vh;
  padding: var(--grid-gap) 0;
}

.grid-row-line {
  background: var(--row-color);
  border-top: 1px solid rgba(0, 100, 255, 0.3);
  border-bottom: 1px solid rgba(0, 100, 255, 0.3);
  position: relative;
}

.grid-row-line::before {
  content: attr(data-row);
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(0, 100, 255, 0.8);
  background: rgba(255, 255, 255, 0.9);
  padding: 2px 6px;
  border-radius: 3px;
}

.grid-toggle-btn,
.row-toggle-btn {
  position: fixed;
  bottom: 30px;
  z-index: 10000;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.9);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: "Inter", "Segoe UI", sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.grid-toggle-btn {
  right: 30px;
  background: rgba(255, 0, 0, 0.9);
}

.row-toggle-btn {
  right: 100px;
  background: rgba(0, 100, 255, 0.9);
}

.grid-toggle-btn:hover,
.row-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.grid-toggle-btn.active {
  background: rgba(0, 255, 0, 0.9);
}

.row-toggle-btn.active {
  background: rgba(0, 255, 100, 0.9);
}

.mobile-preview-overlay[hidden] {
  display: none !important;
}

body.mobile-preview-open {
  overflow: hidden;
}

.mobile-preview-launch {
  display: none;
}

@media (min-width: 641px) {
  .detail-overlay-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(18, 21, 25, 0.34);
    border-radius: 18px;
    background: transparent;
    color: rgba(18, 21, 25, 0.86);
    font: 500 0.68rem/1 "Inter", "Segoe UI", sans-serif;
    cursor: pointer;
  }

  .detail-overlay-preview:hover,
  .detail-overlay-preview:focus-visible {
    background: rgba(18, 21, 25, 0.92);
    color: #fff;
  }

  .mobile-preview-launch {
    position: fixed;
    left: 16px;
    bottom: 18px;
    z-index: 10001;
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 22px;
    background: #121519;
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
    font: 600 0.72rem/1 "Inter", "Segoe UI", sans-serif;
    letter-spacing: 0.04em;
    cursor: pointer;
  }

  .mobile-preview-overlay:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(5, 9, 12, 0.72);
    backdrop-filter: blur(5px);
  }

  .mobile-preview-window {
    display: grid;
    grid-template-rows: 44px minmax(0, 1fr);
    width: min(392px, calc(100vw - 40px));
    height: min(860px, calc(100dvh - 40px));
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 20px;
    background: var(--page-bg);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  }

  .mobile-preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 14px;
    background: var(--panel-dark);
    color: var(--text-light);
    font: 500 0.72rem/1 "Inter", "Segoe UI", sans-serif;
    letter-spacing: 0.04em;
  }

  .mobile-preview-close {
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 14px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
  }

  .mobile-preview-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: var(--page-bg);
  }
}

@media (max-width: 820px) {
  .project-detail-shell {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .detail-card {
    width: 100%;
    height: auto;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid rgba(18, 21, 25, 0.12);
  }

  .detail-card--copy {
    min-height: 330px;
    padding: 22px 20px 28px;
    justify-content: space-between;
  }

  .detail-card--copy h1 {
    font-size: clamp(2.4rem, 11vw, 5.2rem);
  }

  .detail-pattern {
    left: 18%;
    right: 8%;
    bottom: 28px;
    height: 110px;
  }

  .detail-caption {
    max-width: 240px;
  }

  .detail-card--visual,
  .detail-card--dark {
    min-height: 260px;
    padding: 24px 20px 32px;
  }

  .detail-card--visual {
    width: 100%;
  }

  .detail-body {
    padding: 30px 0 0;
  }

  .detail-body h2,
  .dark-content h2 {
    font-size: clamp(2rem, 9vw, 2.7rem);
  }

  .detail-body p,
  .dark-content p {
    max-width: 70%;
    font-size: 0.95rem;
  }

  .dark-content {
    flex: 0 1 auto;
    margin-top: 54px;
  }

  .grid-toggle-btn,
  .row-toggle-btn,
  .grid-overlay,
  .row-overlay {
    display: none !important;
  }

  .detail-overlay-scroll {
    --overlay-pad: 16px;
  }
}

@media (max-width: 640px) {
  .mobile-preview-launch {
    display: none !important;
  }

  .detail-card {
    height: 100vh;
    height: 100svh;
    min-height: 100vh;
    min-height: 100svh;
    flex: 0 0 100vh;
    flex-basis: 100svh;
  }
}

.mobile-desktop-notice[hidden] {
  display: none !important;
}

@media (max-width: 640px) {
  .mobile-desktop-notice:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(12, 19, 25, 0.72);
  }

  .mobile-desktop-notice__dialog {
    width: min(100%, 340px);
    padding: 26px 22px 22px;
    border: 1px solid rgba(18, 21, 25, 0.24);
    border-radius: 8px;
    background: #d9dadb;
    color: #191d20;
    text-align: center;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
  }

  .mobile-desktop-notice__dialog p {
    margin: 0 0 22px;
    font-size: 1rem;
    line-height: 1.4;
  }

  .mobile-desktop-notice__button {
    min-width: 112px;
    min-height: 44px;
    padding: 10px 24px;
    border: 1px solid #191d20;
    border-radius: 3px;
    background: #191d20;
    color: #ffffff;
    font: inherit;
    cursor: pointer;
  }

  .mobile-desktop-notice__button:focus-visible {
    outline: 2px solid #191d20;
    outline-offset: 4px;
  }

  body.mobile-desktop-notice-open {
    overflow: hidden;
  }
}

@media (max-width: 640px) {
  .project-detail-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 40% repeat(3, 20%);
    width: 100%;
    height: 100vh;
    height: 100svh;
    min-height: 0;
    overflow: hidden;
  }

  .detail-card {
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
    flex: none;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 0;
  }

  .detail-card--visual,
  .detail-card--dark {
    border-top: 1px solid rgba(18, 21, 25, 0.16);
  }

  .detail-card--visual .detail-topline,
  .detail-card--dark .detail-topline {
    display: none;
  }

  .detail-card--copy {
    gap: 8px;
    justify-content: space-between;
  }

  .detail-topline {
    gap: 4px;
    font-size: 0.52rem;
    letter-spacing: 0.06em;
  }

  .detail-index {
    font-size: 0.55rem;
  }

  .detail-card--copy h1 {
    font-size: clamp(2rem, 13vw, 3.2rem);
    line-height: 0.86;
    overflow-wrap: anywhere;
  }

  .detail-pattern {
    left: 10%;
    right: 4%;
    bottom: 12px;
    height: 56px;
    transform: rotate(18deg) scale(1.1);
  }

  .detail-caption {
    max-width: 100%;
    font-size: 0.62rem;
    line-height: 1.25;
  }

  .detail-card--visual,
  .detail-card--dark {
    justify-content: space-between;
  }

  .detail-body,
  .dark-content {
    margin-top: initial;
    padding: 0;
  }

  .detail-body h2,
  .dark-content h2 {
    margin-bottom: 4px;
    font-size: clamp(0.95rem, 5vw, 1.25rem);
    line-height: 0.98;
    letter-spacing: -0.05em;
    overflow-wrap: anywhere;
  }

  .detail-body p,
  .dark-content p {
    max-width: 70%;
    font-size: 0.95rem;
  }
}

@media (max-width: 640px) and (max-height: 700px) {
  .detail-body p,
  .dark-content p {
    font-size: clamp(0.56rem, 2.4vw, 0.68rem);
    line-height: 1.15;
    margin-top: 8px;
  }
}

@media (min-width: 821px) {
  body[data-project="verdanza"] .detail-card--visual,
  body[data-project="verdanza"] .detail-card--dark {
    border-right: 0;
  }

  body[data-project="verdanza"] .detail-card--visual + .detail-card--dark,
  body[data-project="verdanza"] .detail-card--dark + .detail-card--dark {
    border-left: 1px solid rgba(18, 21, 25, 0.16);
  }
}

@media (min-width: 821px) {
  body[data-project="aadhya"] .detail-body,
  body[data-project="aadhya"] .dark-content {
    position: absolute;
    top: 35%;
    left: 10px;
    right: 113px;
    margin: 0;
    padding: 0;
    flex: none;
  }

  body[data-project="aadhya"] .detail-card--visual .detail-body {
    left: 11px;
    right: 11px;
  }
}

@media (min-width: 1400px) {
  body[data-project="aadhya"] .detail-body,
  body[data-project="aadhya"] .dark-content {
    top: 75%;
  }
}

@media (min-width: 1200px) and (max-width: 1399px) {
  body[data-project="aadhya"] .detail-body,
  body[data-project="aadhya"] .dark-content {
    top: 64%;
  }
}
