/* =====================================================================
   Bruno Puignou — portfolio
   A light, editorial system: warm paper, deep ink, one molten accent.
   Display type = Fraunces (optical, a touch of personality).
   Interface type = Inter.
   ===================================================================== */

/* ----------------------------- Tokens ----------------------------- */
:root {
  /* Light (default) */
  --paper:      #f4f1ea;   /* warm off-white */
  --paper-2:    #ece7dc;   /* slightly deeper card */
  --ink:        #1a1714;   /* near-black, warm */
  --ink-soft:   #5c554c;   /* muted text */
  --line:       #d8d2c5;   /* hairlines */
  --accent:     #e2542b;   /* molten orange */
  --accent-2:   #c9421d;
  --highlight:  #ffffff;

  --maxw: 1240px;
  --gut: clamp(20px, 5vw, 80px);

  --t-fast: 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  --t-med:  0.55s cubic-bezier(0.22, 1, 0.36, 1);
  --t-slow: 0.9s  cubic-bezier(0.22, 1, 0.36, 1);

  --r: 18px;
}

[data-theme="dark"] {
  --paper:      #14110e;
  --paper-2:    #1d1915;
  --ink:        #f3eee4;
  --ink-soft:   #a59c8d;
  --line:       #322c25;
  --accent:     #ff6a3d;
  --accent-2:   #ff855e;
  --highlight:  #1d1915;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--t-med), color var(--t-med);
}

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

h1, h2, h3 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0;
}

em {
  font-style: italic;
  font-optical-sizing: auto;
}

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

/* --------------------------- Utilities ---------------------------- */
.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: var(--paper);
  padding: 12px 18px; z-index: 200; border-radius: 0 0 10px 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Scroll-reveal: elements start lowered + transparent, JS adds .is-in */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity var(--t-slow), transform var(--t-slow);
  will-change: opacity, transform;
}
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ----------------------------- Grain ------------------------------ */
/* A fixed, very faint film grain. Pure SVG noise, no image asset. */
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
[data-theme="dark"] .grain { mix-blend-mode: screen; opacity: 0.05; }

/* ------------------------- Custom cursor -------------------------- */
.cursor {
  position: fixed; top: 0; left: 0; z-index: 150;
  width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid var(--accent);
  transform: translate(-50%, -50%) scale(1);
  pointer-events: none;
  transition: transform 0.18s ease, background 0.2s ease, opacity 0.2s;
  opacity: 0;
}
.cursor.is-active { opacity: 1; }
.cursor.is-hover {
  transform: translate(-50%, -50%) scale(1.9);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
/* Hide the bespoke cursor where hover/pointer aren't reliable (touch) */
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

/* ------------------------------ Nav ------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 18px var(--gut);
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.nav.is-scrolled { border-bottom-color: var(--line); }

.nav__brand {
  display: inline-flex; align-items: center; gap: 12px;
  text-decoration: none; font-weight: 500;
}
.nav__mark {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--ink); color: var(--paper);
  font-family: "Fraunces", serif; font-size: 15px;
  letter-spacing: 0; transition: transform var(--t-fast);
}
.nav__brand:hover .nav__mark { transform: rotate(-8deg) scale(1.06); }
.nav__name { font-size: 15.5px; }

.nav__links {
  display: flex; gap: 28px;
  position: absolute; left: 50%; transform: translateX(-50%);
}
.nav__links a {
  text-decoration: none; font-size: 15px; color: var(--ink-soft);
  position: relative; padding: 4px 0;
  transition: color var(--t-fast);
}
.nav__links a::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1px; background: var(--ink);
  transform: scaleX(0); transform-origin: right;
  transition: transform var(--t-fast);
}
.nav__links a:hover { color: var(--ink); }
.nav__links a:hover::after { transform: scaleX(1); transform-origin: left; }

.theme-toggle {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent;
  cursor: pointer; display: grid; place-items: center;
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.theme-toggle:hover { border-color: var(--ink); transform: rotate(20deg); }
.theme-toggle__icon {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--ink);
  box-shadow: inset -5px -5px 0 0 var(--paper);
  transition: all var(--t-fast);
}
[data-theme="dark"] .theme-toggle__icon {
  background: var(--accent); box-shadow: none;
}

@media (max-width: 720px) {
  .nav__links { position: static; transform: none; gap: 18px; }
  .nav__name { display: none; }
}
@media (max-width: 480px) {
  .nav__links a:not([href="#work"]) { display: none; }
}

/* ------------------------------ Hero ------------------------------ */
.hero {
  position: relative; z-index: 2;
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(60px, 12vh, 140px) var(--gut) clamp(40px, 8vh, 90px);
}

.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 14px; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin: 0 0 clamp(24px, 5vh, 48px);
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  70%  { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.hero__title {
  font-size: clamp(2.9rem, 11vw, 8.5rem);
  line-height: 0.94;
  letter-spacing: -0.035em;
  margin: 0 0 clamp(36px, 7vh, 64px);
}
.hero__title .line { display: block; overflow: hidden; }
.hero__title em { color: var(--accent); }

.hero__meta {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(24px, 5vw, 56px);
  align-items: end;
  border-top: 1px solid var(--line);
  padding-top: clamp(24px, 4vh, 40px);
}
.hero__lede {
  font-size: clamp(1.05rem, 1.6vw, 1.32rem);
  line-height: 1.5; color: var(--ink-soft); max-width: 46ch; margin: 0;
}
.hero__lede a {
  color: var(--ink); text-decoration: none;
  border-bottom: 1.5px solid var(--accent);
  transition: color var(--t-fast);
}
.hero__lede a:hover { color: var(--accent); }

.hero__cta { display: flex; gap: 14px; flex-wrap: wrap; }

@media (max-width: 760px) {
  .hero__meta { grid-template-columns: 1fr; gap: 30px; align-items: start; }
}

/* ----------------------------- Buttons ---------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 24px; border-radius: 100px;
  font-size: 15px; font-weight: 500; text-decoration: none;
  border: 1px solid transparent; cursor: pointer;
  transition: transform var(--t-fast), background var(--t-fast),
              color var(--t-fast), border-color var(--t-fast);
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: var(--accent); }
.btn--ghost { border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink); }
.btn__arrow { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--t-fast); }
.btn--primary:hover .btn__arrow { transform: translateX(4px); }

/* ---------------------------- Marquee ----------------------------- */
.marquee {
  position: relative; z-index: 2;
  border-block: 1px solid var(--line);
  padding: 20px 0; margin: clamp(20px, 5vh, 50px) 0;
  overflow: hidden; white-space: nowrap;
}
.marquee__track {
  display: inline-flex; align-items: center; gap: 28px;
  animation: scroll 34s linear infinite;
  font-family: "Fraunces", serif; font-size: clamp(1.4rem, 3vw, 2.2rem);
  font-style: italic; color: var(--ink);
}
.marquee__track .sep { color: var(--accent); font-style: normal; }
@keyframes scroll { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .marquee__track { animation: none; } }

/* ---------------------------- Sections ---------------------------- */
.section {
  position: relative; z-index: 2;
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(60px, 11vh, 140px) var(--gut);
}
.section__head { margin-bottom: clamp(40px, 7vh, 80px); }
.section__index {
  display: inline-block; font-family: "Inter"; font-size: 13px;
  color: var(--accent); letter-spacing: 0.1em; margin-bottom: 16px;
}
.section__title { font-size: clamp(2rem, 6vw, 3.6rem); }
.section__sub { color: var(--ink-soft); margin: 14px 0 0; font-size: 1.05rem; }

/* ----------------------------- Work ------------------------------- */
.projects { list-style: none; margin: 0; padding: 0; }
.project { border-top: 1px solid var(--line); }
.project:last-child { border-bottom: 1px solid var(--line); }

.project__link {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: clamp(24px, 4vw, 60px);
  align-items: center;
  text-decoration: none;
  padding: clamp(28px, 4vh, 48px) 0;
  transition: padding var(--t-med);
}
.project__link:hover { padding-left: clamp(8px, 1.5vw, 20px); }

.project__media {
  aspect-ratio: 4 / 3; border-radius: var(--r);
  overflow: hidden; position: relative;
  background: var(--paper-2);
  border: 1px solid var(--line);
  transition: transform var(--t-med);
}
.project__link:hover .project__media { transform: scale(1.015); }

.project__body { min-width: 0; }
.project__row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 14px;
}
.project__name {
  font-size: clamp(1.8rem, 4vw, 3rem);
  transition: color var(--t-fast);
}
.project__link:hover .project__name { color: var(--accent); }
.project__role {
  font-size: 14px; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: 0.06em;
  white-space: nowrap;
}
.project__desc {
  color: var(--ink-soft); max-width: 60ch; margin: 0 0 20px;
  font-size: 1.02rem;
}
.project__tags { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; }
.project__tags li {
  font-size: 13px; padding: 6px 14px; border-radius: 100px;
  border: 1px solid var(--line); color: var(--ink-soft);
}

@media (max-width: 820px) {
  .project__link { grid-template-columns: 1fr; }
  .project__media { aspect-ratio: 16 / 9; }
}

/* ---- Generated cover art (no image files needed) ---- */
.project__media > * { position: absolute; inset: 0; }

/* Mindko: calm "AI study" motif — a math glyph, a scan line, a check */
.art-mindko {
  background:
    radial-gradient(120% 120% at 80% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 55%),
    linear-gradient(160deg, var(--paper-2), color-mix(in srgb, var(--ink) 6%, var(--paper-2)));
  display: grid; place-items: center;
}
.art-mindko__bubble {
  font-family: "Fraunces", serif; font-size: clamp(60px, 16vw, 120px);
  color: var(--ink); opacity: 0.9;
}
.art-mindko__scan {
  position: absolute; left: 12%; right: 12%; height: 2px;
  top: 50%; background: var(--accent); box-shadow: 0 0 16px var(--accent);
  animation: scanY 3.2s ease-in-out infinite;
}
@keyframes scanY { 0%,100% { top: 24%; opacity: .3 } 50% { top: 74%; opacity: 1 } }
.art-mindko__check {
  position: absolute; right: 16%; bottom: 16%;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 20px;
}
@media (prefers-reduced-motion: reduce){ .art-mindko__scan{ animation:none } }

/* Trex Toolbox: modular grid + a single bright chip */
.art-trex {
  background:
    linear-gradient(150deg, color-mix(in srgb, var(--ink) 8%, var(--paper-2)), var(--paper-2));
}
.art-trex__grid {
  inset: 14% !important;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 18% 22%;
  opacity: 0.9;
}
.art-trex__chip {
  position: absolute; left: 32%; top: 39%;
  width: 18%; height: 22%;
  background: var(--accent); border-radius: 8px;
  display: grid; place-items: center;
  color: #fff; font-family: "Fraunces", serif; font-size: clamp(20px,5vw,34px);
  box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 45%, transparent);
}

/* Lumen: soft duotone orb */
.art-lumen {
  background: radial-gradient(70% 70% at 35% 30%,
      color-mix(in srgb, var(--accent) 55%, var(--paper)) 0%,
      var(--paper-2) 70%);
}
/* Atlas: concentric system rings */
.art-atlas {
  background: var(--paper-2);
  background-image:
    repeating-radial-gradient(circle at 50% 50%,
      transparent 0 16px, var(--line) 16px 17px);
}
/* Field Notes: bold editorial bars */
.art-field {
  background: var(--paper-2);
  background-image: linear-gradient(90deg, var(--accent) 0 6px, transparent 6px);
  background-size: 24px 100%;
  opacity: 1;
}

/* Social App UI Kit: two stacked phone mocks (a nod to the embedded kit) */
.art-social {
  background: linear-gradient(150deg,
      color-mix(in srgb, var(--accent) 16%, var(--paper-2)), var(--paper-2));
  display: grid; place-items: center;
}
.art-social__phone {
  position: absolute; top: 13%; bottom: 13%; width: 36%;
  border-radius: 22px; border: 1px solid var(--line);
  background: var(--highlight);
  box-shadow: 0 20px 44px rgba(0,0,0,0.16);
}
.art-social__phone--back {
  left: 31%; transform: rotate(9deg); opacity: 0.7;
  background: color-mix(in srgb, var(--accent) 30%, var(--highlight));
}
.art-social__phone--front {
  left: 33%; transform: rotate(-5deg);
  display: flex; flex-direction: column; gap: 7%;
  padding: 11% 8%; overflow: hidden;
}
.art-social__bar { height: 9%; border-radius: 5px; background: var(--accent); }
.art-social__avatar {
  width: 26%; aspect-ratio: 1; border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 22%, var(--highlight));
}
.art-social__card {
  height: 15%; border-radius: 9px;
  background: color-mix(in srgb, var(--ink) 9%, var(--highlight));
}

/* ---- Live Figma embed showcase ---- */
.kit-showcase {
  margin-top: clamp(44px, 7vh, 84px);
  border-top: 1px solid var(--line);
  padding-top: clamp(32px, 5vh, 56px);
}
.kit-showcase__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap; margin-bottom: 28px;
}
.kit-showcase__title { font-size: clamp(1.6rem, 4vw, 2.6rem); margin: 10px 0 8px; }
.kit-showcase__sub { color: var(--ink-soft); margin: 0; max-width: 52ch; }

.kit-embed {
  position: relative; width: 100%; aspect-ratio: 16 / 10;
  border-radius: var(--r); overflow: hidden;
  border: 1px solid var(--line); background: var(--paper-2);
}
.kit-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@media (max-width: 700px) { .kit-embed { aspect-ratio: 3 / 4; } }

/* ----------------------------- About ------------------------------ */
.about__grid {
  display: grid; grid-template-columns: 1.4fr 0.6fr;
  gap: clamp(30px, 6vw, 80px);
}
.about__bio p {
  font-size: clamp(1.2rem, 2.4vw, 1.7rem);
  line-height: 1.45; color: var(--ink); margin: 0 0 1.2em;
  font-family: "Fraunces", serif; font-weight: 300;
}
.about__bio a { color: var(--accent); text-decoration: none; border-bottom: 1px solid currentColor; }
.about__bio em { color: var(--accent); }

.about__side { display: grid; gap: 28px; align-content: start; }
.capability h3 {
  font-family: "Inter"; font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-soft); margin: 0 0 14px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.capability ul { list-style: none; margin: 0; padding: 0; }
.capability li { padding: 7px 0; font-size: 1.02rem; }

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

/* ---------------------------- Contact ----------------------------- */
.contact { text-align: center; }
.contact__inner { max-width: 820px; margin: 0 auto; }
.contact__title {
  font-size: clamp(2.4rem, 8vw, 5.5rem);
  margin: 18px 0 24px;
}
.contact__lede {
  color: var(--ink-soft); font-size: 1.15rem;
  max-width: 48ch; margin: 0 auto 40px;
}
.contact__mail {
  display: inline-block; text-decoration: none;
  font-family: "Fraunces", serif; font-style: italic;
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  color: var(--ink); border-bottom: 2px solid var(--accent);
  padding-bottom: 4px; transition: color var(--t-fast);
}
.contact__mail:hover { color: var(--accent); }

.contact__links {
  display: flex; gap: 28px; justify-content: center;
  margin-top: 44px; flex-wrap: wrap;
}
.contact__links a {
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--ink-soft); font-size: 15px;
  text-transform: uppercase; letter-spacing: 0.06em;
  transition: color var(--t-fast);
}
.contact__links a svg {
  width: 16px; height: 16px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  transition: transform var(--t-fast);
}
.contact__links a:hover { color: var(--accent); }
.contact__links a:hover svg { transform: translate(3px, -3px); }

/* ----------------------------- Footer ----------------------------- */
.footer {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  max-width: var(--maxw); margin: 0 auto;
  padding: 40px var(--gut) 56px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft); font-size: 14px;
}
.footer__name { font-family: "Fraunces", serif; color: var(--ink); font-size: 16px; }
.footer__top { text-decoration: none; transition: color var(--t-fast); }
.footer__top:hover { color: var(--accent); }
