/* ============================================
   MARVIN STRAUCH — Editorial Portfolio
   Design: Studio Shamshiri-inspired
   ============================================ */

/* ---- Font imports ---- */
@import url('https://api.fontshare.com/v2/css?f[]=switzer@400,500,600,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap');

/* ---- Tokens ---- */
:root {
  --bg: #FFFFFF;
  --text: #1a1a1a;
  --text-muted: #666666;
  --text-faint: #aaaaaa;
  --border: #e8e8e8;
  --overlay-bg: #000000;
  --overlay-text: #FFFFFF;
  --accent: #C46040;
  --detailmeister-gold: #B8985A;
  --rivellus-burgundy: #7A2332;
  --rivellus-blush: #F2DFD8;

  --font-sans: 'Switzer', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;

  --ease: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --max-w: 1440px;
  --pad-x: clamp(1.25rem, 4vw, 3rem);
}

/* ---- Reset ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.55;
  overflow-x: hidden;
  min-height: 100vh;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  background: none;
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* ---- Typography utilities ---- */
.display {
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
}

.eyebrow {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.serif-italic {
  font-family: var(--font-serif);
  font-style: italic;
}

h1.page-title {
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: clamp(2.5rem, 8vw, 6.5rem);
  line-height: 0.95;
}

h2.section-title {
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---- Preloader ---- */
.preloader {
  position: fixed;
  inset: 0;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  pointer-events: none;
  transition: opacity 0.9s var(--ease) 0.2s, visibility 0s linear 1.1s;
}

.preloader.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.preloader__mark {
  width: clamp(80px, 10vw, 140px);
  height: clamp(80px, 10vw, 140px);
  opacity: 0;
  animation: markIn 1.8s var(--ease) forwards;
}

.preloader__mark path,
.preloader__mark line,
.preloader__mark polyline {
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  animation: drawMark 1.8s var(--ease) forwards;
}

@keyframes markIn {
  0% { opacity: 0; transform: scale(0.96); }
  30% { opacity: 1; }
  80% { opacity: 1; transform: scale(1); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes drawMark {
  to { stroke-dashoffset: 0; }
}

/* ---- Header / Nav dot ---- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem var(--pad-x);
  mix-blend-mode: difference;
  color: #fff;
  pointer-events: none;
}

.site-header > * { pointer-events: auto; }

.site-header__logo {
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0.22em;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.nav-toggle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
  position: relative;
}

.nav-toggle:hover {
  background: currentColor;
}

.nav-toggle__lines {
  display: block;
  width: 14px;
  height: 10px;
  position: relative;
}

.nav-toggle__lines::before,
.nav-toggle__lines::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transition: transform 0.35s var(--ease);
}

.nav-toggle__lines::before { top: 2px; }
.nav-toggle__lines::after { bottom: 2px; }

.nav-toggle:hover .nav-toggle__lines::before,
.nav-toggle:hover .nav-toggle__lines::after {
  background: #000;
}

/* ---- Nav overlay ---- */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  color: var(--overlay-text);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s var(--ease), visibility 0s linear 0.6s;
}

.nav-overlay.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s var(--ease), visibility 0s linear 0s;
}

.nav-overlay__close {
  position: absolute;
  top: 1.5rem;
  right: var(--pad-x);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 1rem;
  letter-spacing: 0;
  line-height: 1;
}

.nav-overlay__close:hover {
  background: #fff;
  color: #000;
}

.nav-overlay__brand {
  position: absolute;
  top: 1.5rem;
  left: var(--pad-x);
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0.22em;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.nav-overlay__list {
  list-style: none;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: clamp(0.8rem, 2vw, 1.2rem);
}

.nav-overlay__list a {
  font-family: var(--font-sans);
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: clamp(1.5rem, 4vw, 2.6rem);
  display: inline-block;
  position: relative;
  padding: 0.15em 0.4em;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease), color 0.3s var(--ease);
}

.nav-overlay.is-open .nav-overlay__list a {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger in */
.nav-overlay.is-open .nav-overlay__list li:nth-child(1) a { transition-delay: 0.10s; }
.nav-overlay.is-open .nav-overlay__list li:nth-child(2) a { transition-delay: 0.16s; }
.nav-overlay.is-open .nav-overlay__list li:nth-child(3) a { transition-delay: 0.22s; }
.nav-overlay.is-open .nav-overlay__list li:nth-child(4) a { transition-delay: 0.28s; }
.nav-overlay.is-open .nav-overlay__list li:nth-child(5) a { transition-delay: 0.34s; }
.nav-overlay.is-open .nav-overlay__list li:nth-child(6) a { transition-delay: 0.40s; }
.nav-overlay.is-open .nav-overlay__list li:nth-child(7) a { transition-delay: 0.46s; }

.nav-overlay__list a:hover {
  color: var(--accent);
}

.nav-overlay__list a.is-current {
  color: var(--accent);
}

.nav-overlay__footer {
  position: absolute;
  bottom: 1.5rem;
  left: var(--pad-x);
  right: var(--pad-x);
  display: flex;
  justify-content: space-between;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
}

/* ---- Page shell ---- */
main {
  min-height: 100vh;
}

.page {
  padding: clamp(7rem, 14vh, 10rem) var(--pad-x) clamp(4rem, 10vh, 7rem);
  max-width: var(--max-w);
  margin: 0 auto;
}

.page__header {
  padding-bottom: clamp(3rem, 8vh, 6rem);
  border-bottom: 1px solid var(--border);
  margin-bottom: clamp(3rem, 8vh, 5rem);
}

.page__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.page__lede {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.1rem, 1.8vw, 1.35rem);
  max-width: 55ch;
  color: var(--text-muted);
  margin-top: 2rem;
  line-height: 1.5;
}

/* ---- Landing / Index ---- */
.landing {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 1fr auto;
  position: relative;
}

.landing__hero {
  display: grid;
  place-items: center;
  padding: 7rem var(--pad-x) 3rem;
  position: relative;
}

.landing__portrait {
  position: relative;
  width: clamp(220px, 28vw, 380px);
  aspect-ratio: 3 / 4;
  overflow: hidden;
  margin-bottom: clamp(2rem, 5vh, 3.5rem);
}

.landing__portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(0.1) contrast(0.98);
}

.landing__title {
  font-family: var(--font-sans);
  font-weight: 400;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-size: clamp(1.4rem, 4.2vw, 3.2rem);
  text-align: center;
  line-height: 1;
}

.landing__tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(0.95rem, 1.3vw, 1.15rem);
  color: var(--text-muted);
  margin-top: 1.4rem;
  text-align: center;
  letter-spacing: 0.02em;
}

.landing__footer {
  padding: 1.5rem var(--pad-x);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ---- Companies grid ---- */
.companies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.company-cell {
  aspect-ratio: 4 / 3;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  transition: background 0.4s var(--ease);
}

.company-cell:hover {
  background: #fafafa;
}

.company-cell__rank {
  position: absolute;
  top: 0.8rem;
  left: 0.9rem;
  font-family: var(--font-sans);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--text-faint);
}

.company-cell__name {
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: clamp(0.95rem, 1.3vw, 1.15rem);
  text-align: center;
  color: var(--text);
}

.company-cell__sub {
  position: absolute;
  bottom: 0.8rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---- Commercials / Creative list ---- */
.work-list {
  display: flex;
  flex-direction: column;
}

.work-item {
  display: grid;
  grid-template-columns: 6ch 1fr;
  gap: clamp(1rem, 3vw, 2.5rem);
  padding: clamp(2rem, 4vh, 3rem) 0;
  border-bottom: 1px solid var(--border);
}

.work-item__num {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  color: var(--text-faint);
  padding-top: 0.4rem;
}

.work-item__body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 860px) {
  .work-item__body.has-video {
    grid-template-columns: 1.1fr 1fr;
    gap: clamp(2rem, 4vw, 3.5rem);
    align-items: start;
  }
}

.work-item__brand {
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  line-height: 1.05;
}

.work-item__title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.1rem, 1.5vw, 1.3rem);
  color: var(--text);
  margin-top: 0.5rem;
  line-height: 1.35;
}

.work-item__title a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}

.work-item__title a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.work-item__meta {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.work-item__meta span strong {
  display: block;
  color: var(--text-faint);
  font-weight: 500;
  margin-bottom: 0.25rem;
  font-size: 0.62rem;
  letter-spacing: 0.24em;
}

.work-item__note {
  font-family: var(--font-serif);
  font-size: 0.98rem;
  color: var(--text-muted);
  margin-top: 1rem;
  max-width: 52ch;
  line-height: 1.5;
}

.work-item__video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

.work-item__video iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.work-item__video--none {
  background: #f5f4f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ---- Detailmeister page ---- */
.centered-brand {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 6rem var(--pad-x);
  text-align: center;
}

.centered-brand__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(2rem, 5vh, 3.5rem);
  max-width: 560px;
}

.centered-brand__logo {
  width: clamp(220px, 34vw, 420px);
}

.centered-brand__label {
  font-family: var(--font-sans);
  font-weight: 300;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  font-size: clamp(0.72rem, 1vw, 0.85rem);
  color: var(--detailmeister-gold);
}

.centered-brand__hr {
  width: 40px;
  height: 1px;
  background: var(--detailmeister-gold);
  border: 0;
  opacity: 0.6;
}

/* ---- Rivellus page ---- */
body.rivellus-page,
html:has(body.rivellus-page) {
  background: var(--rivellus-blush);
}
.rivellus-page {
  background: var(--rivellus-blush);
  min-height: 100vh;
  color: var(--rivellus-burgundy);
}
.rivellus-page main { background: var(--rivellus-blush); }
.rivellus-page .site-footer { border-top-color: rgba(122, 35, 50, 0.18); color: rgba(122, 35, 50, 0.7); }

.rivellus-page .site-header {
  color: var(--rivellus-burgundy);
  mix-blend-mode: normal;
}

.rivellus-page .centered-brand__label {
  color: var(--rivellus-burgundy);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  letter-spacing: 0.14em;
  text-transform: none;
}

.rivellus-page .centered-brand__hr {
  background: var(--rivellus-burgundy);
  opacity: 0.4;
}

.rivellus-page .centered-brand__logo {
  /* PNG already has matching blush bg; no blend needed */
  width: clamp(260px, 40vw, 460px);
}

/* ---- Past page (masonry) ---- */
.past-grid {
  columns: 1;
  column-gap: 1.25rem;
}

@media (min-width: 640px)  { .past-grid { columns: 2; } }
@media (min-width: 960px)  { .past-grid { columns: 3; } }
@media (min-width: 1280px) { .past-grid { columns: 4; } }

.past-cell {
  break-inside: avoid;
  margin-bottom: 1.25rem;
  background: #f7f6f2;
  position: relative;
  overflow: hidden;
}

.past-cell--photo {
  display: block;
  line-height: 0;
}

.past-cell--photo img {
  width: 100%;
  height: auto;
  display: block;
}

.past-cell--text {
  background: #fff;
  border: 1px solid var(--border);
  padding: clamp(2rem, 4vw, 3rem) clamp(1.5rem, 3vw, 2.25rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.past-cell--text h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.35;
  margin-bottom: 1rem;
}

.past-cell--text .past-cell__eyebrow {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
}

.past-cell--text .past-cell__sig {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text-faint);
  font-size: 0.85rem;
  margin-top: 1rem;
}

/* ---- About page ---- */
.about-grid {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .about-grid {
    grid-template-columns: 5fr 7fr;
    align-items: start;
  }
}

.about-portrait {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #f5f4f0;
}

.about-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about-portrait__caption {
  margin-top: 1rem;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: flex;
  justify-content: space-between;
}

.about-bio {
  font-family: var(--font-serif);
  font-size: clamp(1.15rem, 1.5vw, 1.4rem);
  line-height: 1.55;
  color: var(--text);
  max-width: 56ch;
}

.about-bio p + p { margin-top: 1.25rem; }

.about-bio em {
  font-style: italic;
  color: var(--accent);
}

.collab-block {
  margin-top: clamp(3rem, 7vh, 5rem);
  padding-top: clamp(2rem, 5vh, 3rem);
  border-top: 1px solid var(--border);
  display: grid;
  gap: clamp(2rem, 4vw, 3rem);
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .collab-block { grid-template-columns: 180px 1fr; }
}

.collab-block h2 {
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.collab-group {
  margin-bottom: 2rem;
}

.collab-group__label {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 1rem;
}

.collab-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35em 1.5em;
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 1.6vw, 1.35rem);
  line-height: 1.4;
}

.collab-list li {
  position: relative;
  padding-right: 1.5em;
}

.collab-list li:not(:last-child)::after {
  content: '·';
  position: absolute;
  right: 0.25em;
  color: var(--text-faint);
}

.collab-list li em {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.85em;
  margin-left: 0.3em;
}

/* ---- Footer ---- */
.site-footer {
  padding: 3rem var(--pad-x) 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: clamp(4rem, 10vh, 7rem);
}

.site-footer a:hover { color: var(--text); }

/* ---- Utility ---- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- Mobile refinements ---- */
@media (max-width: 640px) {
  body { font-size: 17px; }

  .work-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .work-item__num { padding-top: 0; font-size: 0.65rem; }

  .page__meta { flex-direction: column; gap: 0.5rem; }
}
