/* Yeahrs — estils
   Món: negre absolut, os càlid (#F6F5EF), grotesca neutra, el logotip com a única veu display. */

@font-face {
  font-family: "Inter Tight";
  src: url("../fonts/inter-tight-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #000;
  --bone: #f6f5ef;
  --bone-2: rgba(246, 245, 239, 0.72);
  --rule: rgba(246, 245, 239, 0.28);
  --rule-strong: rgba(246, 245, 239, 0.6);
  --error: #ff8a7a;

  --font: "Helvetica Neue", "Inter Tight", Helvetica, Arial, sans-serif;

  --gutter: clamp(16px, 2.2vw, 32px);
  --header-h: 56px;

  --step--1: 0.8125rem;
  --step-0: clamp(0.9375rem, 0.88rem + 0.2vw, 1.0625rem);
  --step-1: clamp(1.125rem, 1rem + 0.45vw, 1.375rem);
  --step-2: clamp(1.625rem, 1.2rem + 1.5vw, 2.5rem);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  background: var(--ink);
  scrollbar-color: var(--rule-strong) var(--ink);
}

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--bone); color: var(--ink); }

img, svg { display: block; max-width: 100%; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: var(--rule-strong);
  transition: text-decoration-color 0.2s ease;
}
a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 1px solid var(--bone);
  outline-offset: 4px;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

h1, h2, h3 { margin: 0; font-weight: 400; text-wrap: balance; }

.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;
}

.skip {
  position: fixed; top: 8px; left: 8px; z-index: 100000;
  padding: 10px 14px; background: var(--bone); color: var(--ink);
  transform: translateY(-200%); text-decoration: none;
}
.skip:focus { transform: none; }

/* ─── Header ─────────────────────────────────────────── */

.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--gutter);
  background: var(--ink);
}

.wordmark {
  font-size: var(--step-1);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-nav ul {
  display: flex; gap: clamp(14px, 1.6vw, 24px);
  margin: 0; padding: 0; list-style: none;
}
.site-nav a {
  font-size: var(--step-0);
  text-decoration: none;
  position: relative;
}
.site-nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: right;
  transition: transform 0.45s var(--ease-out);
}
.site-nav a:hover::after,
.site-nav a[aria-current="true"]::after { transform: scaleX(1); transform-origin: left; }

/* ─── Hero ───────────────────────────────────────────── */

.hero {
  padding: calc(var(--header-h) + clamp(16px, 3vw, 40px)) var(--gutter) clamp(48px, 6vw, 96px);
}

.hero-logo {
  margin: 0;
  color: var(--bone);
}
.hero-logo svg {
  width: 100%; height: auto;
  transform-origin: top center;
  transition: transform 0.8s var(--ease-out);
  will-change: transform;
}
.hero-logo-spacer {
  height: 0;
  transition: height 0.8s var(--ease-out);
}
.hero.is-stretched .hero-logo svg { transform: scaleY(1.6); transition-duration: 0.6s; }
.hero.is-stretched .hero-logo-spacer { transition-duration: 0.6s; }

/* ─── Sections: two-column grid ──────────────────────── */

.block {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  padding: clamp(56px, 8vw, 128px) var(--gutter);
  border-top: 1px solid var(--rule);
}

.label {
  grid-column: 1 / span 5;
  font-size: var(--step-0);
  color: var(--bone);
}

.col-right { grid-column: 7 / -1; }

.intro { border-top: 0; padding-top: 0; }
.intro .statement {
  grid-column: 1 / span 5;
  font-size: var(--step-2);
  line-height: 1.12;
  letter-spacing: -0.02em;
}
.intro .col-right { max-width: 38rem; }

.services .statement {
  font-size: var(--step-2);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: clamp(40px, 5vw, 72px);
}

/* Accordion */
.accordion { border-top: 1px solid var(--rule); }
.accordion details { border-bottom: 1px solid var(--rule); }
.accordion summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 0;
  list-style: none;
  font-size: var(--step-0);
  cursor: pointer;
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion .icon {
  position: relative; flex: none; width: 14px; height: 14px;
}
.accordion .icon::before,
.accordion .icon::after {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px;
  background: currentColor;
  transition: transform 0.4s var(--ease-out);
}
.accordion .icon::after { transform: rotate(90deg); }
.accordion details[open] .icon::after { transform: rotate(0deg); }
.accordion .panel {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 0.5s var(--ease-out);
}
.accordion details[open] .panel { grid-template-rows: 1fr; }
.accordion .panel > div { overflow: hidden; }
.accordion .panel p {
  max-width: 34rem;
  padding: 4px 0 28px;
  font-size: var(--step-1);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* Work */
.work h2 {
  grid-column: 1 / -1;
  font-size: var(--step-2);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: clamp(32px, 4vw, 56px);
}
.projects {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--gutter);
  margin: 0; padding: 0; list-style: none;
}
.project-slides {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #111;
}
.project-slides img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0; z-index: 1;
}
.project-slides img.prev { opacity: 1; z-index: 2; }
.project-slides img.active { opacity: 1; z-index: 3; transition: opacity 0.5s ease; }
.project-label {
  display: flex; flex-direction: column; gap: 2px;
  padding-top: 12px;
  font-size: var(--step-1);
  line-height: 1.25;
}
.project-label .type { color: var(--bone-2); }

/* About */
.about h2 {
  font-size: var(--step-2);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: 0.9em;
}
.about .col-right p { max-width: 36rem; }

/* Contact */
.contact-form { display: grid; gap: 22px; max-width: 40rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; }
.field { display: grid; gap: 8px; }
.field label, legend { font-size: var(--step-0); }
.req { color: var(--bone-2); margin-left: 0.35em; font-size: var(--step--1); }

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form input[type="url"],
.contact-form textarea {
  width: 100%;
  appearance: none;
  background: transparent;
  color: var(--bone);
  font: inherit;
  border: 1px solid var(--rule-strong);
  border-radius: 0;
  padding: 11px 12px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.contact-form textarea { min-height: 9rem; resize: vertical; }
.contact-form input::placeholder,
.contact-form textarea::placeholder { color: rgba(246, 245, 239, 0.5); }
.contact-form input:hover,
.contact-form textarea:hover { border-color: var(--bone); }
.contact-form input:focus,
.contact-form textarea:focus { outline: none; border-color: var(--bone); background: rgba(246, 245, 239, 0.05); }
.contact-form [aria-invalid="true"] { border-color: var(--error); }
.contact-form input { caret-color: var(--bone); }

.check {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  font-size: var(--step-0);
}
.check input {
  appearance: none; margin: 0; flex: none;
  width: 16px; height: 16px; border: 1px solid var(--rule-strong); border-radius: 0;
  display: grid; place-content: center;
}
.check input::before {
  content: ""; width: 8px; height: 8px; background: var(--bone);
  transform: scale(0); transition: transform 0.2s var(--ease-out);
}
.check input:checked::before { transform: scale(1); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.btn {
  justify-self: start;
  appearance: none;
  background: transparent; color: var(--bone);
  font: inherit;
  border: 1px solid var(--bone);
  border-radius: 999px;
  padding: 12px 28px;
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease, opacity 0.2s ease;
}
.btn:hover { background: var(--bone); color: var(--ink); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

.form-status { min-height: 1.45em; margin: 0; font-size: var(--step-0); }
.form-status[data-state="error"] { color: var(--error); }
.field-error { color: var(--error); font-size: var(--step--1); }
.field-error:empty { display: none; }

.form-done { font-size: var(--step-2); line-height: 1.12; letter-spacing: -0.02em; max-width: 30rem; }

/* ─── Footer ─────────────────────────────────────────── */

.site-footer {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  align-items: end;
  padding: clamp(40px, 5vw, 72px) var(--gutter) clamp(28px, 3vw, 40px);
  border-top: 1px solid var(--rule);
  font-size: var(--step--1);
  line-height: 1.5;
}
.footer-logo { grid-column: 1 / span 4; max-width: 200px; color: var(--bone); text-decoration: none; }
.footer-logo svg {
  width: 100%; height: auto;
  transform-origin: left bottom;
  transition: transform 0.5s var(--ease-out);
}
.footer-logo:hover svg { transform: scaleY(1.4); }
.site-footer address { grid-column: 7 / span 3; font-style: normal; }
.footer-contact { grid-column: 10 / -1; }
.footer-contact a { display: block; width: fit-content; }

/* ─── Language switcher ──────────────────────────────── */

.lang {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
  display: flex; gap: 8px;
  margin: 0; padding: 0; list-style: none;
}
.lang a {
  display: block;
  padding: 6px 14px;
  border: 1px solid var(--bone);
  background: var(--ink);
  font-size: 12px; letter-spacing: 0.08em;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.lang a:hover,
.lang a[aria-current="page"] { background: var(--bone); color: var(--ink); }

/* ─── Custom cursor (precise pointers only) ──────────── */

.cursor { display: none; }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  html.has-cursor, html.has-cursor * { cursor: none; }
  html.has-cursor input[type="text"],
  html.has-cursor input[type="email"],
  html.has-cursor input[type="url"],
  html.has-cursor textarea { cursor: text; }
  .cursor {
    display: block;
    position: fixed; left: 0; top: 0; z-index: 99999;
    width: 16px; height: 16px; margin: -8px 0 0 -8px;
    border-radius: 50%;
    background: var(--bone);
    pointer-events: none;
    opacity: 0;
    mix-blend-mode: difference;
    transition: width 0.25s var(--ease-out), height 0.25s var(--ease-out), margin 0.25s var(--ease-out), opacity 0.2s ease;
  }
  .cursor.is-visible { opacity: 1; }
  .cursor.is-hover { width: 40px; height: 40px; margin: -20px 0 0 -20px; opacity: 0.4; mix-blend-mode: normal; }
  .cursor.is-text { opacity: 0; }
}

/* ─── 404 ────────────────────────────────────────────── */

.notfound {
  min-height: 100svh;
  display: grid; align-content: center; gap: 32px;
  padding: calc(var(--header-h) + 24px) var(--gutter) 96px;
}
.notfound p { font-size: var(--step-2); line-height: 1.12; letter-spacing: -0.02em; max-width: 24ch; }

/* ─── Responsive ─────────────────────────────────────── */

@media (max-width: 767px) {
  :root { --header-h: 52px; }
  .site-nav ul { gap: 14px; }
  .site-nav a { font-size: var(--step--1); }

  .block { row-gap: 28px; }
  .label, .col-right, .intro .statement { grid-column: 1 / -1; }
  .intro .statement { margin-bottom: 4px; }

  .projects { grid-template-columns: 1fr; row-gap: 40px; }
  .field-row { grid-template-columns: 1fr; }

  .site-footer { row-gap: 24px; padding-bottom: 8px; }
  .footer-logo { grid-column: 1 / -1; max-width: 160px; }
  .site-footer address,
  .footer-contact { grid-column: 1 / -1; }

  /* Al mòbil el selector d'idioma no flota sobre el contingut: tanca la pàgina. */
  .lang { position: static; padding: 16px var(--gutter) 32px; }
  .lang a { padding: 10px 16px; }
}
