/* =============================================
   STUDIO SCALCO — Global Styles
   Gallery minimalism — full monospace, heavy whitespace
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #FAF8F4;
  --text: #1A1A18;
  --body: #591812;
  --accent: #000000;
  --muted: #8A8A86;
  --hairline: #D8D4CC;

  /* tonal placeholder swatches — replace tiles with real <img> when ready */
  --tile-1: #E8E4DC;
  --tile-2: #D9D3C8;
  --tile-3: #C9C1B2;
  --tile-4: #B8AE9A;
  --tile-5: #E2DDD2;
  --tile-6: #D0C8B8;
  --tile-7: #BFB6A4;

  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-sans: Arial, Helvetica, 'Helvetica Neue', sans-serif;
  --pad-x: clamp(20px, 3.5vw, 48px);
  --pad-y: 20px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  font-weight: 400;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Utility class — mono for numbers and counters only */
.mono {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

a { color: inherit; text-decoration: none; transition: opacity .25s ease; }
a:hover { opacity: 0.5; }

/* Keep homepage project hover behaviour independent from the global link fade */
.product:hover { opacity: 1; }

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

/* =============================================
   Top nav — Work (left) / About + Contact (right)
   ============================================= */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--pad-y) var(--pad-x);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  position: relative;
  z-index: 10;
}

.top-nav__group { display: flex; gap: 36px; }

.top-nav a { position: relative; padding-bottom: 2px; }

.top-nav a.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
}

/* =============================================
   Landing / Work — matches the reference exactly
   ============================================= */
.landing {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 var(--pad-x);
  position: relative;
}

/* intentional top whitespace */
.landing__intro {
  margin-top: clamp(80px, 14vh, 180px);
  max-width: 520px;
  opacity: 0;
  animation: fade-in 1.2s ease 0.1s forwards;
}

@keyframes fade-in { to { opacity: 1; } }

.landing__crumb {
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--muted);
}

.landing__crumb .sep { margin: 0 8px; color: var(--muted); }

.landing__copy {
  font-size: clamp(16px, 1.15vw, 19px);
  line-height: 1.75;
  max-width: 42ch;
  text-align: justify;
  color: var(--body);
}

/* Row of 6 identical square thumbnails */
.product-row {
  margin-top: clamp(80px, 12vh, 160px);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(12px, 1.2vw, 20px);
}

.product {
  display: block;
  cursor: pointer;
  position: relative;
  opacity: 1;
  transition: opacity .45s ease;
}

.product__image-link {
  display: block;
}

/* Hover logic: keep the active project clear, soften the other thumbnails */
.product-row:hover .product {
  opacity: .24;
}

.product-row:hover .product:hover {
  opacity: 1;
}

/* Project annotation: appears under the active thumbnail */
.product__annotation {
  position: absolute;
  top: calc(100% + 58px);
  left: 30px;
  width: min(52ch, calc(100vw - 60px));
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;

  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.55;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--body);
  z-index: 5;
}

.product__annotation::before {
  content: '';
  position: absolute;
  left: -18px;
  top: -58px;
  width: 1px;
  height: 106px;
  background: var(--text);
}

.product__annotation h2 {
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.45;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--body);
}

.product__annotation p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.55;
  font-weight: 400;
  letter-spacing: -0.02em;
  text-align: justify;
  color: var(--body);
}

.product:hover .product__annotation {
  opacity: 1;
  pointer-events: auto;
}

.more-link {
  display: inline-block;
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.55;
  letter-spacing: -0.02em;
  color: var(--body);
  text-decoration: none;
  opacity: 0;
  transition: opacity .45s ease .5s;
}

.product:hover .more-link {
  opacity: 1;
}

.more-link:hover {
  opacity: .55;
}

.product__num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 10px;
  color: var(--text);
}

.product__tile {
  aspect-ratio: 1 / 1;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: var(--tile-color, var(--tile-1));
  transition: transform .6s cubic-bezier(.2,.8,.2,1), opacity .4s ease;
}

/* When the tile is an actual <img> */
img.product__tile {
  object-fit: cover;
  display: block;
}

.product__tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.3), transparent 60%),
    radial-gradient(circle at 75% 80%, rgba(0,0,0,.06), transparent 60%);
  z-index: 1;
}

.product__tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .2 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: .4;
  mix-blend-mode: multiply;
  z-index: 2;
}

/* Active tile stays visually clear; inactive tiles are faded via .product-row:hover above */
.product:hover .product__tile { opacity: 1; }

/* =============================================
   Bottom meta bar (landing page)
   ============================================= */
.meta-bar {
  margin-top: auto;
  padding: clamp(60px, 10vh, 100px) var(--pad-x) var(--pad-y);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.meta-bar__left { display: flex; gap: 10px; flex-wrap: wrap; }
.meta-bar__left .sep { color: var(--hairline); }

.meta-bar__right {
  color: var(--text);
}

/* =============================================
   Project detail page
   ============================================= */
.project-detail {
  flex: 1;
  padding: clamp(40px, 8vh, 80px) var(--pad-x) 0;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: clamp(40px, 6vw, 100px);
  align-items: start;
  max-width: 1680px;
  margin: 0 auto;
  width: 100%;
}

.project-detail__meta {
  position: sticky;
  top: clamp(40px, 8vh, 80px);
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.project-detail__crumb {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.project-detail__crumb a { color: var(--text); }
.project-detail__crumb .sep { margin: 0 6px; color: var(--hairline); }

.project-detail__title-block { margin-top: 20px; }

.project-detail__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.project-detail__title {
  font-family: var(--font-sans);
  font-size: clamp(24px, 2.4vw, 32px);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.project-detail__spec { display: grid; gap: 18px; margin-top: 12px; }

.project-detail__spec dt {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.project-detail__spec dd { font-size: 14px; }

.project-detail__nav {
  margin-top: 20px;
  display: flex;
  gap: 20px;
  font-size: 13px;
}

.project-detail__nav a {
  padding-bottom: 2px;
  border-bottom: 1px solid currentColor;
}

/* project right column — images + text */
.project-detail__body {
  display: flex;
  flex-direction: column;
  gap: clamp(40px, 6vh, 80px);
  padding-bottom: clamp(60px, 10vh, 120px);
}

.project-detail__hero {
  width: 100%;
  position: relative;
  overflow: hidden;
  background: var(--tile-color, var(--tile-1));
}

/* Placeholder div fallback (no img child) — keeps the 4:5 block */
.project-detail__hero:not(img) {
  aspect-ratio: 4 / 5;
}

img.project-detail__hero {
  display: block;
  height: auto;
}

/* Full-width single image (used for diptych spreads, etc.) */
.project-detail__wide {
  width: 100%;
  height: auto;
  display: block;
}

/* Decorative overlays — only for placeholder hero (no img child) */
.project-detail__hero:not(img)::before,
.project-detail__hero:not(img)::after {
  content: '';
  position: absolute;
  inset: 0;
}

.project-detail__hero:not(img)::before {
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.3), transparent 60%),
    radial-gradient(circle at 75% 80%, rgba(0,0,0,.06), transparent 60%);
  z-index: 1;
}

.project-detail__hero:not(img)::after {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .2 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: .4;
  mix-blend-mode: multiply;
  z-index: 2;
}

.project-detail__text {
  max-width: 58ch;
  font-size: 13px;
  line-height: 1.7;
  text-align: justify;
  color: var(--body);
}

.project-detail__text p { margin-bottom: 1.2em; }
.project-detail__text p:last-child { margin-bottom: 0; }

.project-detail__gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.project-detail__gallery .tile {
  aspect-ratio: 4 / 5;
  position: relative;
  overflow: hidden;
  background: var(--tile-color, var(--tile-2));
}

.project-detail__gallery .tile::before,
.project-detail__gallery .tile::after {
  content: '';
  position: absolute;
  inset: 0;
}

.project-detail__gallery .tile::before {
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.3), transparent 60%),
    radial-gradient(circle at 75% 80%, rgba(0,0,0,.06), transparent 60%);
  z-index: 1;
}

.project-detail__gallery .tile::after {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .2 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: .4;
  mix-blend-mode: multiply;
  z-index: 2;
}

/* =============================================
   About & Contact pages
   ============================================= */
.text-page {
  flex: 1;
  padding: clamp(40px, 8vh, 80px) var(--pad-x) clamp(60px, 10vh, 120px);
  max-width: 1680px;
  margin: 0 auto;
  width: 100%;
}

.text-page__crumb {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: clamp(60px, 12vh, 140px);
  opacity: 0;
  animation: fade-in 1s ease .1s forwards;
}

.text-page__crumb .sep { margin: 0 6px; color: var(--hairline); }

.text-page__body {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: clamp(40px, 6vw, 100px);
  align-items: start;
}

.text-page__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.text-page__content {
  max-width: 62ch;
  font-size: 13px;
  line-height: 1.7;
  text-align: justify;
  color: var(--body);
}

.text-page__content p { margin-bottom: 1.4em; }
.text-page__content p:last-child { margin-bottom: 0; }

.text-page__section {
  padding-top: 40px;
  margin-top: 40px;
  border-top: 1px solid var(--hairline);
}

.text-page__section:first-child {
  padding-top: 0;
  margin-top: 0;
  border-top: none;
}

.text-page__section h3 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
  margin-bottom: 24px;
}

.text-page__list { list-style: none; }

.text-page__list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

.text-page__list li span { color: var(--muted); font-size: 13px; }

/* Contact page email */
.contact-email {
  font-family: var(--font-sans);
  font-size: clamp(20px, 2.2vw, 28px);
  letter-spacing: -0.005em;
  display: inline-block;
  padding-bottom: 4px;
  border-bottom: 1px solid currentColor;
  margin-bottom: 32px;
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 900px) {
  .product-row {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
  .product:nth-child(n+5) { margin-top: 24px; }

  .project-detail,
  .text-page__body {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .project-detail__meta { position: static; }
}

@media (max-width: 560px) {
  .product-row { grid-template-columns: repeat(2, 1fr); }
  .project-detail__gallery { grid-template-columns: 1fr; }
  .top-nav { flex-direction: row; flex-wrap: wrap; gap: 16px; }
  .top-nav__group { gap: 20px; }
  .meta-bar { flex-direction: column; gap: 12px; align-items: flex-start; }
  .meta-bar__left { flex-direction: column; gap: 4px; }
  .meta-bar__left .sep { display: none; }
}

/* =============================================
   Safe project additions — DDW + Project 04
   These are appended to the original stylesheet only.
   ============================================= */

/* Two-column text used on DDW and other project pages */
.project-detail__text--two-column {
  width: 100%;
  max-width: none;
  column-count: 2;
  column-gap: 60px;
}

.project-detail__text--two-column p {
  break-inside: avoid;
}

/* DDW selected articles */
.selected-articles {
  margin-top: 60px;
}

.selected-articles__heading {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
  margin-bottom: 30px;
}

.selected-articles__item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: baseline;
  padding: 18px 0;
  border-bottom: 1px solid var(--hairline);
  text-decoration: none;
}

.selected-articles__item:first-of-type {
  border-top: 1px solid var(--hairline);
}

.selected-articles__title {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.7;
  font-weight: 400;
  color: var(--body);
  text-transform: none;
}

.selected-articles__meta {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
  white-space: nowrap;
}

.selected-articles__item:hover {
  opacity: 0.6;
}

/* Project 04 intro: image + single-column text */
.project-detail__intro {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

.project-detail__intro-image {
  width: 100%;
  height: auto;
  display: block;
}

.project-detail__intro-text {
  font-size: 13px;
  line-height: 1.7;
  text-align: justify;
  color: var(--body);
  max-width: 42ch;
}

.project-detail__intro-text p {
  margin-bottom: 1.2em;
}

/* Project 04 image grid */
.project-detail__masonry {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
}

.project-detail__masonry img,
.project-image--wide,
.project-image--portrait {
  width: 100%;
  height: auto;
  display: block;
}

.project-image--wide {
  grid-column: 1 / -1;
}

.project-image--portrait {
  grid-column: span 1;
}

/* Typewriter links */
.typewriter-link,
.substack-link {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--text);
}

.typewriter-link a,
.substack-link a {
  border-bottom: 1px solid currentColor;
}

/* Responsive additions */
@media (max-width: 900px) {
  .project-detail__text--two-column {
    column-count: 1;
  }

  .selected-articles__item {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .selected-articles__meta {
    white-space: normal;
  }

  .project-detail__intro {
    grid-template-columns: 1fr;
  }

  .project-detail__intro-text {
    max-width: none;
  }

  .project-detail__masonry {
    grid-template-columns: 1fr;
  }

  .project-image--wide,
  .project-image--portrait {
    grid-column: 1 / -1;
  }
}

/* =============================================
   Homepage refinements — hover + intro + footer
   ============================================= */

.landing__copy {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  max-width: 48ch;
  text-align: left;
  color: var(--body);
}

.product-row:hover .product {
  opacity: .24;
}

.product-row:hover .product:hover {
  opacity: 1 !important;
}

.product-row:hover .product:hover .product__tile {
  opacity: 1 !important;
  filter: none !important;
}

.product.product--annotation-left .product__annotation {
  left: auto;
  right: 30px;
  text-align: left;
}

.product.product--annotation-left .product__annotation::before {
  left: auto;
  right: -18px;
}

/* =============================================
   FINAL HOMEPAGE HOVER FIX
   ============================================= */

/* Fade non-hovered thumbnails only when hovering the row */
.product-row:hover .product {
  opacity: 0.24;
}

/* The hovered project wrapper must remain fully opaque */
.product-row:hover .product:hover,
.product-row:hover .product:focus-within {
  opacity: 1 !important;
}

/* The hovered thumbnail image must stay full-colour */
.product-row:hover .product:hover .product__tile,
.product-row:hover .product:focus-within .product__tile {
  opacity: 1 !important;
  filter: none !important;
  mix-blend-mode: normal !important;
}

/* Prevent decorative pseudo-overlays from washing out actual image thumbnails */
img.product__tile::before,
img.product__tile::after {
  content: none !important;
  display: none !important;
}

/* Keep annotations readable even when the row is faded */
.product-row:hover .product:hover .product__annotation,
.product-row:hover .product:focus-within .product__annotation {
  opacity: 1 !important;
}

/* Flip Project 06 annotation to the left so it doesn't hit the browser edge */
.product.product--annotation-left .product__annotation {
  left: auto !important;
  right: 30px !important;
}

.product.product--annotation-left .product__annotation::before {
  left: auto !important;
  right: -18px !important;
}
