/* =========================================================
   Stefan Doudin — portfolio styles
   ========================================================= */

:root {
  --bg:        #f5f1ea;        /* warm cream */
  --bg-2:      #ede7dc;        /* slightly darker for blocks */
  --ink:       #1a1d24;        /* near-black, slight navy bias */
  --ink-soft:  #4a4f5a;        /* secondary text */
  --ink-mute:  #8a8f99;        /* tertiary */
  --accent:    #2a3a5e;        /* muted navy */
  --accent-2:  #3d5078;        /* lighter navy for hover */
  --line:      rgba(26, 29, 36, 0.12);
  --line-soft: rgba(26, 29, 36, 0.06);

  --serif: "Fraunces", "Times New Roman", serif;
  --sans:  "Inter Tight", -apple-system, BlinkMacSystemFont, sans-serif;

  --max:   1280px;
  --pad:   clamp(20px, 4vw, 56px);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* subtle paper-grain texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.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 0.06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

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

::selection { background: var(--accent); color: var(--bg); }

/* =========================================================
   TOP BAR
   ========================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 241, 234, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}

.topbar__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 18px var(--pad);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 32px;
}

.mark {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-style: italic;
}

.nav {
  display: flex;
  justify-content: center;
  gap: 32px;
  font-size: 14px;
  font-weight: 500;
}

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

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.nav a:hover { color: var(--ink); }
.nav a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.status__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3a8a4f;
  box-shadow: 0 0 0 3px rgba(58, 138, 79, 0.18);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

@media (max-width: 720px) {
  .topbar__inner { grid-template-columns: auto 1fr; gap: 16px; }
  .nav    { display: none; }
  .status { font-size: 12px; }
}

/* =========================================================
   HERO
   ========================================================= */
.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(60px, 12vw, 160px) var(--pad) clamp(80px, 14vw, 180px);
  position: relative;
  z-index: 2;
}

.hero__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(24px, 4vw, 48px);
  max-width: 1100px;
}

.hero__eyebrow {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 14px;
  animation: fade-up 0.8s ease-out 0.1s both;
}

.hero__eyebrow::before {
  content: "";
  width: 40px;
  height: 1px;
  background: var(--accent);
}

.hero__name {
  font-family: var(--serif);
  font-size: clamp(72px, 14vw, 200px);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.04em;
  color: var(--ink);
  animation: fade-up 0.9s ease-out 0.25s both;
}

.hero__name-line {
  display: block;
  position: relative;
}

.hero__letter {
  display: inline-block;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              color 0.4s ease;
  will-change: transform;
  cursor: default;
}

.hero__letter:hover {
  color: var(--accent);
  transform: translateY(-8px) rotate(-2deg) !important;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              color 0.2s ease;
}

.hero__name-italic .hero__letter {
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
}

.hero__name-italic .hero__letter:hover {
  color: var(--ink);
  transform: translateY(-8px) rotate(2deg) !important;
}

.hero__intro {
  font-family: var(--serif);
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.45;
  font-weight: 400;
  color: var(--ink);
  max-width: 720px;
  margin-top: clamp(16px, 3vw, 32px);
  letter-spacing: -0.01em;
  animation: fade-up 0.9s ease-out 0.45s both;
}

.hero__meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: clamp(32px, 5vw, 64px);
  padding-top: clamp(24px, 4vw, 40px);
  border-top: 1px solid var(--line);
  max-width: 720px;
  animation: fade-up 0.9s ease-out 0.65s both;
}

.hero__meta > div { display: flex; flex-direction: column; gap: 4px; }

.hero__meta-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}

.hero__meta-value {
  font-size: 15px;
  color: var(--ink);
  font-weight: 500;
}

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

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

/* =========================================================
   MARQUEE
   ========================================================= */
.marquee {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  padding: 20px 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent 0,
    #000 8%,
    #000 92%,
    transparent 100%
  );
          mask-image: linear-gradient(
    90deg,
    transparent 0,
    #000 8%,
    #000 92%,
    transparent 100%
  );
}

.marquee__track {
  display: inline-flex;
  align-items: center;
  gap: 40px;
  white-space: nowrap;
  animation: marquee-scroll 50s linear infinite;
  will-change: transform;
}

.marquee:hover .marquee__track {
  animation-play-state: paused;
}

.marquee__item {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.marquee__dot {
  font-size: 14px;
  color: var(--accent);
  flex-shrink: 0;
}

@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* =========================================================
   SECTION HEAD
   ========================================================= */
.section-head {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 24px;
  padding-bottom: clamp(40px, 6vw, 72px);
  border-bottom: 1px solid var(--line);
  margin-bottom: clamp(40px, 6vw, 72px);
}

.section-head__num {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}

.section-head__title {
  font-family: var(--serif);
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1;
}

.section-head__note {
  font-size: 14px;
  color: var(--ink-soft);
  text-align: right;
  max-width: 240px;
}

@media (max-width: 720px) {
  .section-head {
    grid-template-columns: auto 1fr;
    gap: 16px;
  }
  .section-head__note { grid-column: 1 / -1; text-align: left; }
}

/* =========================================================
   WORK
   ========================================================= */
.work {
  padding: clamp(60px, 10vw, 120px) 0;
  position: relative;
  z-index: 2;
}

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

.project {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: clamp(24px, 5vw, 80px);
  padding: clamp(32px, 5vw, 56px) 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
  transition: padding-left 0.4s ease;
}

.project:first-child { border-top: none; padding-top: 0; }
.project:hover { padding-left: 16px; }

.project__meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
}

.project__year {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--accent);
}

.project__tags {
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}

.project__body { max-width: 640px; }

.project__title {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 16px;
  transition: color 0.3s ease;
}

.project:hover .project__title { color: var(--accent); }

.project__desc {
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin-bottom: 24px;
}

.project__links {
  display: flex;
  gap: 24px;
}

.link-arrow {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--ink);
  transition: gap 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.link-arrow span {
  font-family: var(--serif);
  font-style: italic;
  transition: transform 0.3s ease;
}

.link-arrow:hover {
  gap: 14px;
  color: var(--accent);
  border-color: var(--accent);
}

.link-arrow:hover span { transform: translateX(2px); }

@media (max-width: 720px) {
  .project { grid-template-columns: 1fr; gap: 16px; }
  .project__meta { flex-direction: row; gap: 14px; align-items: baseline; padding-top: 0; }
}

/* =========================================================
   FLOATING PROJECT PREVIEW
   ========================================================= */
.preview {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s ease;
  width: clamp(280px, 32vw, 420px);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
    0 30px 60px -20px rgba(26, 29, 36, 0.35),
    0 12px 24px -12px rgba(26, 29, 36, 0.2);
  will-change: transform, opacity;
}
.preview.is-active {
  opacity: 1;
}
.preview__img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top center;
  background: var(--bg-2);
}
.preview__label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
  padding: 10px 14px;
  text-align: center;
  background: var(--bg);
  border-top: 1px solid var(--line-soft);
}
.preview__label:empty { display: none; }

/* hide on touch / coarse pointer */
@media (hover: none), (pointer: coarse), (max-width: 820px) {
  .preview { display: none; }
}

/* =========================================================
   ABOUT
   ========================================================= */
.about {
  padding: clamp(60px, 10vw, 120px) 0;
  background: var(--bg-2);
  position: relative;
  z-index: 2;
}

.about__grid {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: clamp(40px, 6vw, 80px);
}

.about__main p {
  font-size: clamp(17px, 1.6vw, 19px);
  line-height: 1.7;
  color: var(--ink-soft);
  margin-bottom: 20px;
  max-width: 580px;
}

.about__lead {
  font-family: var(--serif) !important;
  font-size: clamp(24px, 2.6vw, 32px) !important;
  line-height: 1.35 !important;
  color: var(--ink) !important;
  margin-bottom: 32px !important;
  letter-spacing: -0.01em;
}

.about__side {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding-top: 8px;
}

.about__block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.about__label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.about__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.about__list li {
  font-size: 15px;
  color: var(--ink);
  font-weight: 400;
}

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

/* =========================================================
   CONTACT
   ========================================================= */
.contact {
  padding: clamp(60px, 10vw, 120px) 0 clamp(80px, 12vw, 140px);
  position: relative;
  z-index: 2;
}

.contact__grid {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: clamp(40px, 6vw, 80px);
  align-items: start;
}

.contact__big {
  font-family: var(--serif);
  font-size: clamp(40px, 6vw, 72px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.contact__big-italic {
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
}

.contact__sub {
  margin-top: 24px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 460px;
}

.contact__methods {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.contact__row {
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: center;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
  transition: padding 0.3s ease;
  position: relative;
}

.contact__row:hover { padding-left: 12px; }

.contact__row-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}

.contact__row-value {
  font-family: var(--serif);
  font-size: clamp(20px, 2.2vw, 26px);
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: color 0.3s ease;
}

.contact__row:hover .contact__row-value { color: var(--accent); }

.contact__arrow {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--ink-mute);
  transition: transform 0.3s ease, color 0.3s ease;
}

.contact__row:hover .contact__arrow {
  transform: translateX(6px);
  color: var(--accent);
}

@media (max-width: 820px) {
  .contact__grid { grid-template-columns: 1fr; }
  .contact__row-value { font-size: 18px; }
}

/* =========================================================
   FOOTER
   ========================================================= */
.footer {
  border-top: 1px solid var(--line);
  padding: 32px 0;
  position: relative;
  z-index: 2;
}

.footer__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}

.footer__center { text-align: center; }
.footer__inner > span:last-child { text-align: right; }

@media (max-width: 600px) {
  .footer__inner { grid-template-columns: 1fr; gap: 8px; text-align: center; }
  .footer__center, .footer__inner > span:last-child { text-align: center; }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
