/* ------------------------------------------------------------------
   sakatadesign.com
   ------------------------------------------------------------------ */

:root {
  --bg: #05080a;
  --fg: #eef8f2;
  --muted: #b4cbc0;
  --muted-dim: #8ea79b;
  --line: rgba(200, 255, 220, 0.14);
  --accent: #5cffb0;
  --max: 1360px;
  --gutter: clamp(20px, 4vw, 48px);
  --font-mono: "Space Grotesk", "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Bricolage Grotesque", "Space Grotesk", -apple-system, sans-serif;
  --mx: 50%;
  --my: 50%;
}

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

html, body {
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  background-color: var(--bg);
  position: relative;
  overflow-x: hidden;
  /* fallback gradient shown before WebGL canvas mounts / if unsupported */
  background-image:
    radial-gradient(1100px 800px at 12% 8%, rgba(20, 140, 90, 0.32) 0%, transparent 55%),
    radial-gradient(900px 700px at 90% 25%, rgba(10, 90, 70, 0.35) 0%, transparent 60%),
    radial-gradient(1200px 900px at 65% 100%, rgba(40, 180, 110, 0.22) 0%, transparent 60%),
    radial-gradient(800px 800px at 8% 88%, rgba(15, 60, 45, 0.4) 0%, transparent 65%),
    linear-gradient(180deg, #04080a 0%, #061410 55%, #030806 100%);
  background-attachment: fixed;
}

/* voronoi shader canvas */
.bg-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  display: block;
  pointer-events: none;
}

/* halftone dots are handled by shader now — hide the CSS noise layer */
.noise { display: none; }

a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a:hover { opacity: 0.55; }

img, video { max-width: 100%; height: auto; display: block; }

/* display type — Bricolage Grotesque with tightened opsz for ink-trap character */
.intro h1,
.about h2,
.project-header h1,
.project-body h3,
.footer-mark,
.next-project a {
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "opsz" 12, "wdth" 100, "wght" 500;
  letter-spacing: -0.03em;
}

/* ---- layout ---- */
.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  position: relative;
  z-index: 2;
}

main { position: relative; z-index: 2; }

/* ---- header / nav ---- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px var(--gutter);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  background: rgba(5, 8, 10, 0.55);
}

.logo {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  gap: 28px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.site-nav a[aria-current="page"] { opacity: 0.4; }

/* ---- hero / intro ---- */
.intro {
  padding: clamp(80px, 14vw, 180px) 0 clamp(80px, 12vw, 140px);
  border-bottom: 1px solid var(--line);
}

.intro h1 {
  font-size: clamp(46px, 7.8vw, 104px);
  line-height: 0.98;
  max-width: 18ch;
  font-variation-settings: "opsz" 12, "wdth" 100, "wght" 500;
}

.intro h1 em {
  font-style: italic;
  color: var(--accent);
  font-variation-settings: "opsz" 12, "wdth" 100, "wght" 400;
}

.intro-meta {
  margin-top: 44px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---- work index ---- */
.work-heading {
  padding: 60px 0 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.work-list {
  list-style: none;
  border-top: 1px solid var(--line);
}

.work-list li {
  border-bottom: 1px solid var(--line);
}

.work-list a {
  display: grid;
  grid-template-columns: 60px 1fr auto auto;
  gap: 24px;
  align-items: center;
  padding: 28px 0;
  font-family: var(--font-display);
  font-size: clamp(26px, 3.2vw, 44px);
  font-variation-settings: "opsz" 14, "wdth" 100, "wght" 500;
  letter-spacing: -0.025em;
  transition: padding 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), color 0.2s;
}

.work-list a:hover {
  padding-left: 16px;
  opacity: 1;
  color: var(--accent);
}

.work-list .num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.work-list .tags {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.work-list .year {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.work-list a:hover .num,
.work-list a:hover .tags,
.work-list a:hover .year {
  color: var(--accent);
  opacity: 0.7;
}

/* ---- footer ---- */
.site-footer {
  margin-top: 120px;
  padding: 40px var(--gutter);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 32px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  position: relative;
  z-index: 2;
}

.footer-links {
  display: flex;
  gap: 22px;
}

.footer-mark {
  font-size: 48px;
  color: var(--fg);
  letter-spacing: -0.04em;
  font-variation-settings: "opsz" 14, "wdth" 100, "wght" 500;
}

/* ---- about page ---- */
.about {
  padding: clamp(60px, 10vw, 140px) 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 56px;
  max-width: 820px;
}

.about h2 {
  font-size: clamp(32px, 4.2vw, 56px);
  line-height: 1.05;
  margin-bottom: 28px;
  font-variation-settings: "opsz" 14, "wdth" 100, "wght" 500;
}

.about p {
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.7;
  color: #e0efe6;
  margin-bottom: 18px;
}

.about .label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  margin-bottom: 16px;
  display: block;
}

.about-block { border-top: 1px solid var(--line); padding-top: 40px; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 36px 32px;
}

.info-grid dt {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  margin-bottom: 8px;
}

.info-grid dd {
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ---- project (case study) ---- */
.project-header {
  padding: clamp(60px, 10vw, 140px) 0 60px;
  border-bottom: 1px solid var(--line);
}

.project-header .eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 26px;
}

.project-header h1 {
  font-size: clamp(44px, 7.4vw, 96px);
  line-height: 0.98;
  max-width: 18ch;
  font-variation-settings: "opsz" 12, "wdth" 100, "wght" 500;
}

.project-meta {
  margin-top: 44px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.project-meta dt {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 8px;
  font-size: 10px;
}

.project-body {
  padding: 80px 0;
  max-width: 720px;
  margin: 0 auto;
}

.project-body p {
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.75;
  color: #e6f2ea;
  margin-bottom: 22px;
}

.project-body h3 {
  font-size: 32px;
  margin-top: 52px;
  margin-bottom: 16px;
  font-variation-settings: "opsz" 14, "wdth" 100, "wght" 500;
}

.project-media {
  padding: 40px 0;
  display: grid;
  gap: 24px;
}

.project-media .full { grid-column: 1 / -1; }
.project-media img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #0e1a14;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.next-project {
  border-top: 1px solid var(--line);
  padding: 44px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: clamp(22px, 2.6vw, 36px);
  font-variation-settings: "opsz" 14, "wdth" 100, "wght" 500;
}

.next-project > span:first-child {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.next-project a:hover { color: var(--accent); }
.next-project .arrow { color: var(--muted); font-size: 18px; margin-left: 6px; }

/* ---- responsive ---- */
@media (max-width: 640px) {
  .work-list a {
    grid-template-columns: 32px 1fr;
    gap: 16px;
    padding: 22px 0;
  }
  .work-list .tags, .work-list .year { display: none; }
  .project-meta { grid-template-columns: repeat(2, 1fr); }
  .pair { grid-template-columns: 1fr; }
  .site-nav { gap: 18px; }
  .info-grid { grid-template-columns: 1fr; }
  .site-header { padding: 18px var(--gutter); }
}

/* accessibility — respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .bg-canvas { display: none; }
  .work-list a { transition: none; }
  .image-cell img { transition: none; }
  /* skip the scroll-driven fade so nothing distracts */
  .js-fade-active .grid-cell,
  .js-fade-active .intro-cell {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ------------------------------------------------------------------
   Scroll-driven fade (fade.js sets .in-view when tile is mid-viewport)
   ------------------------------------------------------------------ */
.js-fade-active .grid-cell,
.js-fade-active .intro-cell {
  opacity: 0.18;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
              transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: opacity, transform;
}
.js-fade-active .grid-cell.in-view,
.js-fade-active .intro-cell.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ------------------------------------------------------------------
   Project gallery (per-project page)
   ------------------------------------------------------------------ */

.project-gallery {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  padding: 40px 0 40px;
}

.gallery-item {
  position: relative;
  grid-column: span 6;
  overflow: hidden;
  background: rgba(6, 14, 10, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 2px;
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
}

/* When there are 2+ images, alternate sizes for rhythm */
.project-gallery .gallery-item:nth-of-type(n+2) { grid-column: span 3; }
.project-gallery .gallery-item:nth-of-type(3n+2) { grid-column: span 3; }
.project-gallery .gallery-item:nth-of-type(3n+4) { grid-column: span 4; }
.project-gallery .gallery-item:nth-of-type(3n+5) { grid-column: span 2; }

/* The first image always goes full width as a hero */
.project-gallery .gallery-item:first-child { grid-column: 1 / -1; }

@media (max-width: 700px) {
  .project-gallery { grid-template-columns: 1fr; }
  .project-gallery .gallery-item,
  .project-gallery .gallery-item:first-child,
  .project-gallery .gallery-item:nth-of-type(n+2),
  .project-gallery .gallery-item:nth-of-type(3n+2),
  .project-gallery .gallery-item:nth-of-type(3n+4),
  .project-gallery .gallery-item:nth-of-type(3n+5) { grid-column: 1; }
}

/* ------------------------------------------------------------------
   Portfolio masonry grid (homepage)
   ------------------------------------------------------------------ */

/* full-width intro block above the grid */
.intro-block {
  padding: 20px 20px 0;
  margin-bottom: clamp(48px, 6vw, 96px);
  position: relative;
  z-index: 2;
}

.portfolio-grid {
  columns: 4;
  column-gap: 20px;
  padding: 20px;
  position: relative;
  z-index: 2;
}

.grid-cell {
  position: relative;
  overflow: hidden;
  background: rgba(6, 14, 10, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  display: block;
  color: inherit;
  text-decoration: none;
  transition: opacity 0.25s ease;
  /* keep each tile as one piece in the column flow */
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  margin: 0 0 20px;
  width: 100%;
}

.grid-cell:hover { opacity: 1; }

/* legacy classes — kept as no-ops so old markup doesn't break */
.grid-cell.tall,
.grid-cell.wide,
.grid-cell.big,
.grid-cell.full {}

/* image cells — image dictates the cell's height (natural aspect ratio) */
.image-cell {
  min-height: 200px; /* baseline presence even for very short/wide images */
}
.image-cell img {
  width: 100%;
  height: auto;
  min-height: 200px;    /* short images stretch up to this; cover crops as needed */
  max-height: 720px;    /* clamp very tall images so nothing runs away */
  object-fit: cover;
  object-position: center top;
  display: block;
  transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.4s;
  filter: saturate(0.85) contrast(1.02);
}
.image-cell:hover img {
  transform: scale(1.03);
  filter: saturate(1) contrast(1.05);
}

.caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 18px 20px 16px;
  background: linear-gradient(to top,
    rgba(2, 6, 4, 0.92) 0%,
    rgba(2, 6, 4, 0.55) 55%,
    rgba(2, 6, 4, 0) 100%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  color: #f2fff5;
  pointer-events: none;
}
.image-cell:hover .caption {
  opacity: 1;
  transform: translateY(0);
}
.caption .num {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
}
.caption .title {
  font-family: var(--font-display);
  font-size: clamp(20px, 1.7vw, 28px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 14, "wdth" 100, "wght" 500;
}
.caption .tags {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* intro / text cells */
.intro-cell {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(40px, 5vw, 72px) clamp(28px, 3.5vw, 48px);
  background: rgba(10, 22, 16, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  min-height: 340px;
}
.intro-cell p {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.4vw, 76px);
  line-height: 1.0;
  letter-spacing: -0.035em;
  font-variation-settings: "opsz" 14, "wdth" 100, "wght" 500;
  color: var(--fg);
  max-width: 24ch;
}
.intro-cell em {
  color: var(--accent);
  font-style: italic;
  font-variation-settings: "opsz" 14, "wdth" 100, "wght" 400;
}
.intro-meta-line {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-top: 32px;
  display: block;
}

.text-cell {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(20px, 2.4vw, 32px);
  background: rgba(8, 18, 12, 0.55);
  transition: background 0.25s ease, opacity 0.25s ease;
  min-height: 220px;
}
.text-cell:hover {
  background: rgba(14, 32, 22, 0.75);
  opacity: 1;
}
.text-cell .cell-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.text-cell .cell-headline {
  font-family: var(--font-display);
  font-size: clamp(20px, 1.8vw, 28px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 14, "wdth" 100, "wght" 500;
  color: var(--fg);
}
.text-cell:hover .cell-headline { color: var(--accent); }

/* responsive column counts */
@media (max-width: 1200px) { .portfolio-grid { columns: 3; } }
@media (max-width: 800px)  { .portfolio-grid { columns: 2; } }
@media (max-width: 500px)  {
  .portfolio-grid { columns: 1; }
  .caption { opacity: 1; transform: none; } /* always show caption on mobile */
}
