/* ------------------------------------------------------------------
   Rihards Zeps — Portfolio
   Aesthetic: Editorial Scandinavian. Refined, warm, considered.
   ------------------------------------------------------------------ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght,SOFT,WONK@9..144,300..900,30..100,0..1&family=Geist:wght@100..900&family=Geist+Mono:wght@300..600&display=swap');

:root {
  /* Palette */
  --paper: #F4EFE5;
  --paper-deep: #ECE5D5;
  --ink: #1C201C;
  --ink-soft: #3D403B;
  --moss: #3A4A3C;
  --terracotta: #5c1fb6;
  --gray: #87847B;
  --rule: #C9C2B2;

  /* Type */
  --display: 'Fraunces', 'Times New Roman', serif;
  --sans: 'Geist', 'Helvetica Neue', sans-serif;
  --mono: 'Geist Mono', 'Courier New', monospace;

  /* Layout */
  --col: 720px;
  --col-wide: 1080px;
  --pad: clamp(1.25rem, 4vw, 3rem);

  /* Motion */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ----- Reset & base ----- */

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: "ss01", "ss02";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* Subtle paper grain via CSS noise */
  background-image:
    radial-gradient(circle at 30% 20%, rgba(180, 160, 120, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 70% 80%, rgba(60, 80, 60, 0.03) 0%, transparent 40%);
  background-attachment: fixed;
}

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

/* ----- Layout shell ----- */

.shell {
  max-width: var(--col-wide);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.col {
  max-width: var(--col);
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* ----- Top bar ----- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem var(--pad) 1rem;
  max-width: var(--col-wide);
  margin: 0 auto;
  border-bottom: 1px solid var(--rule);
  gap: 1rem;
  flex-wrap: wrap;
}

.topbar .mark {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.topbar .mark .mark-logo {
  height: 60px;
  width: auto;
  display: block;
  mix-blend-mode: multiply;
}

.topbar .mark .mark-text {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 11, "SOFT" 50;
  color: var(--ink);
}

.topbar nav {
  display: flex;
  gap: 1.5rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-left: auto;
}

.topbar nav a {
  text-decoration: none;
  color: var(--ink-soft);
  transition: color 0.2s var(--ease);
  position: relative;
}

.topbar nav a:hover { color: var(--terracotta); }

.topbar nav a.current { color: var(--ink); }

.lang-switcher {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  padding-left: 1.25rem;
  border-left: 1px solid var(--rule);
}

.lang-switcher .lang {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray);
  text-decoration: none;
  padding: 0.15rem 0.1rem;
  transition: color 0.2s var(--ease);
  border-bottom: 1px solid transparent;
}

.lang-switcher .lang:hover { color: var(--terracotta); }

.lang-switcher .lang.current {
  color: var(--ink);
  border-bottom-color: var(--ink);
}


@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.75rem;
  }

  .topbar .mark {
    justify-content: center;
    width: 100%;
  }

  .topbar nav {
    width: 100%;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    margin-left: 0;
    text-align: center;
  }

  .lang-switcher {
    width: 100%;
    justify-content: center;
    border-left: none;
    padding-left: 0;
  }
}

/* ----- Hero (homepage) ----- */

.hero {
  max-width: var(--col-wide);
  margin: 0 auto;
  padding: clamp(3.5rem, 12vw, 8rem) var(--pad) clamp(3rem, 8vw, 6rem);
}

.hero .label {
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gray);
  margin: 0 0 1.5rem;
}

.hero h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 2.5rem;
  max-width: 18ch;
  font-variation-settings: "opsz" 96, "SOFT" 30, "WONK" 1;
}

.hero h1 em {
  font-style: italic;
  color: var(--moss);
  font-variation-settings: "opsz" 96, "SOFT" 80;
}

.hero .meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.75rem 2rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  max-width: 40rem;
  margin-top: 2rem;
}

.hero .meta dt {
  color: var(--gray);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  padding-top: 2px;
}

.hero .meta dd {
  margin: 0;
  color: var(--ink);
}

.hero .meta dd a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 0.2s var(--ease);
}

.hero .meta dd a:hover { text-decoration-color: var(--terracotta); }

/* ----- Section heading ----- */

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding: 0 var(--pad);
  max-width: var(--col-wide);
  margin: 0 auto 2rem;
}

.section-head .num {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--gray);
  letter-spacing: 0.1em;
}

.section-head h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  margin: 0;
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 36;
}

.section-head .rule {
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* ----- Project list (homepage) ----- */

.projects {
  max-width: var(--col-wide);
  margin: 0 auto;
  padding: 1rem var(--pad) clamp(4rem, 8vw, 7rem);
}

.project-item {
  display: grid;
  grid-template-columns: 4rem 1fr auto;
  gap: 2rem;
  align-items: baseline;
  padding: 2.25rem 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
  transition: background 0.3s var(--ease), padding 0.3s var(--ease);
}

.project-item:hover {
  background: var(--paper-deep);
  padding-left: 1rem;
  padding-right: 1rem;
}

.project-item:hover .project-title {
  color: var(--terracotta);
}

.project-item:first-child { border-top: 1px solid var(--rule); }

.project-num {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--gray);
  letter-spacing: 0.1em;
  align-self: start;
  padding-top: 0.4rem;
}

.project-body { display: flex; flex-direction: column; gap: 0.6rem; }

.project-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0;
  font-variation-settings: "opsz" 96, "SOFT" 40;
  transition: color 0.3s var(--ease);
}

.project-title em {
  font-style: italic;
  font-variation-settings: "opsz" 96, "SOFT" 90;
}

.project-desc {
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink-soft);
  margin: 0;
  max-width: 50ch;
  line-height: 1.55;
}

.project-tags {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray);
  margin-top: 0.4rem;
}

.project-arrow {
  font-family: var(--display);
  font-size: 1.5rem;
  color: var(--ink-soft);
  align-self: center;
  font-style: italic;
  transition: transform 0.3s var(--ease), color 0.3s var(--ease);
}

.project-item:hover .project-arrow {
  transform: translateX(8px);
  color: var(--terracotta);
}

@media (max-width: 640px) {
  .project-item { grid-template-columns: 2.5rem 1fr; gap: 1rem; }
  .project-arrow { display: none; }
}

/* ----- About section ----- */

.about {
  max-width: var(--col-wide);
  margin: 0 auto;
  padding: clamp(3rem, 6vw, 5rem) var(--pad);
  border-top: 1px solid var(--rule);
}

.about p {
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  line-height: 1.5;
  letter-spacing: -0.005em;
  margin: 0 0 1.5rem;
  font-variation-settings: "opsz" 24;
}

.about p:last-child { margin-bottom: 0; }

.about p em {
  font-style: italic;
  color: var(--moss);
}

/* ----- Footer ----- */

.footer {
  border-top: 1px solid var(--rule);
  padding: 2rem var(--pad);
  max-width: var(--col-wide);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray);
}

.footer a {
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

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



@media (max-width: 540px) {
  .footer {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.75rem;
  }

  .footer a {
    text-align: center;
  }

  .signature {
    margin: 0 auto;
    display: block;
    max-width: 80px;
  }
}

/* =========================================================
   Case study pages
   ========================================================= */

.case-header {
  max-width: var(--col);
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) var(--pad) clamp(2rem, 4vw, 3rem);
}

.case-header .back {
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 3rem;
  transition: color 0.2s var(--ease);
}

.case-header .back:hover { color: var(--terracotta); }

.case-header .label {
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gray);
  margin: 0 0 1.5rem;
}

.case-header h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2rem, 5.5vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  font-variation-settings: "opsz" 96, "SOFT" 30, "WONK" 1;
}

.case-header h1 em {
  font-style: italic;
  color: var(--moss);
  font-variation-settings: "opsz" 96, "SOFT" 90;
}

.case-header .lede {
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.5;
  letter-spacing: -0.005em;
  color: var(--ink-soft);
  margin: 1rem 0 0;
  max-width: 38ch;
  font-variation-settings: "opsz" 24;
  font-style: italic;
}

/* ----- Hero placeholder for case study ----- */

.hero-image {
  max-width: var(--col-wide);
  margin: 0 auto clamp(3rem, 6vw, 5rem);
  padding: 0 var(--pad);
}

.hero-image .frame {
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.hero-image .frame::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(45deg, transparent 0 12px, rgba(60, 60, 50, 0.03) 12px 13px);
  pointer-events: none;
}

.hero-image .frame .placeholder {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  text-align: center;
  padding: 1rem;
}

.hero-image .frame .placeholder strong {
  display: block;
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: 1.1rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
  font-variation-settings: "opsz" 36, "SOFT" 70;
}

.hero-image figcaption {
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray);
  margin-top: 0.75rem;
}

/* ----- TL;DR meta block ----- */

.case-meta {
  max-width: var(--col);
  margin: 0 auto clamp(3rem, 6vw, 4.5rem);
  padding: 2rem var(--pad);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.case-meta dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.6rem 2rem;
  margin: 0;
}

.case-meta dt {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gray);
  padding-top: 2px;
}

.case-meta dd {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink);
}

/* ----- Case content ----- */

.case-content {
  max-width: var(--col);
  margin: 0 auto;
  padding: 0 var(--pad) 3rem;
}

.case-content section { margin-bottom: clamp(2.5rem, 5vw, 4rem); }

.case-content h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.4rem, 2.6vw, 1.8rem);
  letter-spacing: -0.01em;
  margin: 0 0 1.25rem;
  font-variation-settings: "opsz" 36, "SOFT" 30;
  position: relative;
  padding-left: 2.5rem;
}

.case-content h2::before {
  content: attr(data-num);
  position: absolute;
  left: 0;
  top: 0.5rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--gray);
  letter-spacing: 0.1em;
}

.case-content h3 {
  font-family: var(--display);
  font-weight: 500;
  font-style: italic;
  font-size: 1.15rem;
  letter-spacing: -0.005em;
  margin: 2rem 0 0.6rem;
  color: var(--moss);
  font-variation-settings: "opsz" 24, "SOFT" 80;
}

.case-content p {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink);
  margin: 0 0 1.1rem;
  max-width: 62ch;
}

.case-content ul {
  font-size: 1rem;
  line-height: 1.65;
  padding-left: 1.2rem;
  margin: 0 0 1.1rem;
  max-width: 62ch;
}

.case-content ul li { margin-bottom: 0.5rem; }

.case-content strong { color: var(--ink); }

/* ----- Pull quote ----- */

.pull {
  border-left: 2px solid var(--terracotta);
  padding: 0.5rem 0 0.5rem 1.5rem;
  margin: 2rem 0;
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  line-height: 1.45;
  color: var(--ink);
  font-variation-settings: "opsz" 36, "SOFT" 80;
  max-width: 50ch;
}

.pull cite {
  display: block;
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray);
}

/* ----- In-case figure placeholder ----- */

figure.placeholder-fig {
  margin: 2rem 0;
  max-width: 100%;
}

figure.placeholder-fig .frame {
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

figure.placeholder-fig .frame::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, transparent 0 12px, rgba(60, 60, 50, 0.03) 12px 13px);
  pointer-events: none;
}

figure.placeholder-fig .frame span {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-align: center;
  padding: 1rem;
}

figure.placeholder-fig figcaption {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray);
  margin-top: 0.6rem;
}

/* ----- Two-column figure grid ----- */

.fig-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 2rem 0;
}

@media (max-width: 600px) {
  .fig-grid { grid-template-columns: 1fr; }
}

/* ----- Outcome callouts ----- */

.outcomes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin: 2rem 0;
}

.outcome {
  border-top: 1px solid var(--rule);
  padding-top: 1rem;
}

.outcome .num {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: 2rem;
  color: var(--moss);
  margin-bottom: 0.3rem;
  font-variation-settings: "opsz" 96, "SOFT" 90;
  line-height: 1;
}

.outcome .label {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray);
}

@media (max-width: 600px) {
  .outcomes { grid-template-columns: 1fr; gap: 1rem; }
}

/* ----- Bottom navigation between case studies ----- */

.case-nav {
  border-top: 1px solid var(--rule);
  padding: 2.5rem var(--pad);
  max-width: var(--col-wide);
  margin: 3rem auto 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 2rem;
}

.case-nav a {
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: color 0.2s var(--ease);
}

.case-nav a:hover { color: var(--terracotta); }

.case-nav .label {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray);
}

.case-nav .title {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.2rem;
  font-variation-settings: "opsz" 36, "SOFT" 50;
}

.case-nav .next { text-align: right; align-items: flex-end; }

@media (max-width: 540px) {
  .case-nav { flex-direction: column; gap: 1.5rem; }
  .case-nav .next { text-align: left; align-items: flex-start; }
}

/* ----- Page intro animation ----- */

@keyframes rise {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero h1, .case-header h1 { animation: rise 0.9s var(--ease) both; }
.hero .label, .case-header .label { animation: rise 0.7s var(--ease) 0.1s both; }
.hero .meta, .case-header .lede { animation: rise 0.8s var(--ease) 0.2s both; }
.project-item { animation: rise 0.6s var(--ease) both; }
.project-item:nth-child(1) { animation-delay: 0.1s; }
.project-item:nth-child(2) { animation-delay: 0.2s; }
.project-item:nth-child(3) { animation-delay: 0.3s; }

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

/* ---- Image rendering inside frames ----
   Frames with real images flow at the image's natural aspect ratio.
   Placeholders keep their forced ratios so empty slots still look intentional. */

.hero-image .frame:has(img),
figure.placeholder-fig .frame:has(img) {
  aspect-ratio: auto;
  height: auto;
  display: block;
  background: var(--paper-deep);
}

/* Hide the diagonal stripe pattern when a real image fills the frame */
.hero-image .frame:has(img)::before,
figure.placeholder-fig .frame:has(img)::before {
  display: none;
}

.hero-image .frame img,
figure.placeholder-fig .frame img {
  width: 100%;
  height: auto;
  display: block;
  position: relative;
  z-index: 1;
}

/* Optional matting around full-bleed posters / artefacts */
figure.placeholder-fig.contain .frame img {
  padding: 1.25rem;
  background: var(--paper);
  box-sizing: border-box;
}

/* Side-by-side image comparison */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 2rem 0;
}
.compare-grid figure { margin: 0; }
.compare-grid .frame {
  aspect-ratio: 4 / 3;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.compare-grid img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 1rem;
  background: var(--paper);
}
.compare-grid figcaption {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray);
  margin-top: 0.6rem;
}
@media (max-width: 600px) {
  .compare-grid { grid-template-columns: 1fr; }
}

/* ----- About section with portrait + signature ----- */

.about-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

.about-portrait {
  position: relative;
}

.about-portrait img {
  width: 100%;
  height: auto;
  display: block;
  filter: grayscale(0.05) contrast(1.02);
  border: 1px solid var(--rule);
  background: var(--paper-deep);
}

.about-portrait .caption {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gray);
  margin-top: 0.75rem;
  display: block;
}

.about-prose {
  /* prose paragraphs use existing .about p styling */
}

.about-prose p:first-child {
  margin-top: 0;
}

.signature {
  margin-top: 1.25rem;
  max-width: 60px;
  height: auto;
  display: block;
  opacity: 0.95;
  mix-blend-mode: multiply;
}

@media (max-width: 720px) {
  .about-layout {
    grid-template-columns: 1fr;
  }
  .about-portrait {
    max-width: 240px;
  }
}

/* Language note shown under translated project tiles */
.project-body .lang-note {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray);
  margin: 0.4rem 0 0;
}
