/* Laia, psicòloga — one stylesheet for the whole site. */

@font-face {
  font-family: "Gloock";
  src: url("../fonts/gloock-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Hanken Grotesk";
  src: url("../fonts/hanken-grotesk-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Palette, named after Barcelona things */
  --calc: #f8f0eb;       /* lime plaster: page background */
  --rosa: #efd8cf;       /* faded Sant Jordi rose: hero panel */
  --rosa-deep: #e8cdc2;  /* tile pattern pressed into the hero panel */
  --wine: #4a2c36;       /* garnatxa: text, buttons, footer */
  --wine-soft: #765960;  /* secondary text */
  --paper: #fffcfa;      /* fields, quiet panels */
  --wine-hover: #5e3c47; /* garnatxa a shade lighter, under the pointer */
  --soft-on-wine: #d9c7c4; /* secondary text on garnet: 7.6:1 */
  --line: rgb(74 44 54 / 0.16);
  --edge: rgb(74 44 54 / 0.4);      /* form field borders */
  --edge-dashed: rgb(74 44 54 / 0.45); /* things still to come */
  --groove: rgb(74 44 54 / 0.09);   /* the panot pressed into a tile */
  --groove-faint: rgb(74 44 54 / 0.05);
  --panel: rgb(255 255 255 / 0.5);  /* quiet panels on a coloured band */
  --tile-on-wine: #553942; /* a tile laid on the garnet band: solid, so the path passes under it */
  --groove-on-wine: rgb(239 216 207 / 0.14); /* the panot pressed into it */
  --sage-deep: #5f6e57;  /* "first steps" band */
  --honey-light: #f0d3a4;/* numbers on the deep sage */
  --error: #a8323a;      /* form errors: 5.9:1 on calç */

  /* Home-page grounds: deep enough to tell apart from the calç */
  --ground-rosa: #ecd1c5;   /* 1.29:1 against calç */
  --soft-on-rosa: #6b4e56;  /* secondary text on it: 5.1:1 */
  /* The Formació cards: each degree in the colour of the section it leads
     to (rose: therapy; garnet: forensic; sage: first steps), a pale tint for
     the card and the full colour for its stone */
  --tint-rose: #f2ddd4;
  --tint-garnet: #ecdee0;
  --tint-sage: #e2e7da;
  --stone-rose: #c98d7e;

  --serif: "Gloock", Georgia, serif;
  --sans: "Hanken Grotesk", system-ui, sans-serif;

  /* Type scale, ratio 1.25 */
  --step-0: 1.125rem;
  --step-1: 1.25rem;
  --step-2: 1.5625rem;
  --step-3: 1.953rem;
  --step-4: clamp(2rem, 1.4rem + 2vw, 2.441rem);
  --step-5: clamp(2.4rem, 1.5rem + 3.4vw, 3.815rem);

  /* Type roles: one size per job, each step clearly apart from the next.
     Serif (Gloock) for headings and titles, sans (Hanken) for everything read
     or pressed. Weight 600 on body size makes an item title (a step, a
     question, a degree) without adding another size. */
  --text-heading: var(--step-4);    /* section headings, h2 */
  --text-title: var(--step-2);      /* sub-headings and tile titles, serif */
  --text-lede: clamp(1.3125rem, 1.15rem + 0.45vw, 1.4375rem); /* the opening paragraph of a section */
  --text-body: var(--step-0);       /* reading text */
  --text-small: 1rem;               /* notes, descriptions, labels, legal */
  --text-action: 1rem;              /* every button and standalone link, at 600 */

  --gutter: clamp(1rem, 4vw, 3rem);
  --wrap: 84rem;
  --section-space: clamp(4rem, 9vw, 7.5rem);

}

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

/* The browser's own surfaces in the site's colours */
::selection {
  background: var(--rosa-deep);
  color: var(--wine);
}

html {
  caret-color: var(--wine);
}

/* Paragraphs avoid a lone last word; headings split evenly */
p,
li,
dd {
  text-wrap: pretty;
}

html {
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  background: var(--calc);
  color: var(--wine);
  font-family: var(--sans);
  font-size: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.15;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: var(--step-5);
  letter-spacing: -0.015em;
  line-height: 1.08;
}

h2 {
  font-size: var(--text-heading);
  letter-spacing: -0.01em;
}

/* Sub-headings: the serif at title size. Smaller item titles (steps,
   questions) use the body face at 600 instead, where Gloock's hairlines
   would thin out. */
h3 {
  font-size: var(--text-title);
  line-height: 1.2;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

.site-footer :focus-visible,
.skip-link:focus-visible {
  outline-color: var(--rosa);
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  background: var(--wine);
  color: var(--calc);
  padding: 0.6rem 1rem;
}

.skip-link:focus {
  top: 1rem;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Buttons ----------
   Three levels, one label size, so the difference is the fill:
   primary   .button          filled garnet pill: the one thing to do here
   secondary .button--quiet   outlined pill: a real alternative
   tertiary  .text-link       underlined words: a quieter way to the same place */

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.75rem 1.5rem;
  border: 1.5px solid var(--wine);
  border-radius: 999px;
  background: var(--wine);
  color: var(--calc);
  font: 600 var(--text-action)/1.2 var(--sans);
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--wine-hover);
}

.button--quiet {
  background: transparent;
  color: var(--wine);
}

/* Under the pointer the outline fills with a wash of garnet: clearly
   pressed-looking, still lighter than the primary */
.button--quiet:hover {
  background: color-mix(in srgb, var(--wine) 10%, transparent);
}

/* The underline is soft at rest and darkens and thickens under the pointer */
.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  font-size: var(--text-action);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration-thickness: 1.5px;
  text-decoration-color: color-mix(in srgb, currentColor 50%, transparent);
  text-underline-offset: 0.25em;
}

.text-link:hover {
  text-decoration-thickness: 2.5px;
  text-decoration-color: currentColor;
}

.button:active {
  transform: translateY(1px);
}

@media (prefers-reduced-motion: no-preference) {
  .button {
    transition: background-color 160ms ease-out, border-color 160ms ease-out;
  }

  .text-link {
    transition: text-decoration-color 160ms ease-out, text-decoration-thickness 160ms ease-out;
  }
}

/* ---------- Header ---------- */

.site-header {
  padding-block: 1.25rem;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.75rem;
  text-decoration: none;
}

/* Language link on the legal pages */
.site-header .wrap > a:not(.brand) {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

.brand-name {
  display: block;
  font-family: var(--serif);
  font-size: 1.75rem;
  line-height: 1;
}

.brand-role {
  display: block;
  font-size: var(--text-small);
  color: var(--wine-soft);
  margin-top: 0.2rem;
}

.nav-toggle {
  display: none;
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2vw, 1.75rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  font-size: var(--text-action);
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
}

.site-nav .lang {
  color: var(--wine-soft);
  padding-left: clamp(1rem, 2vw, 1.75rem);
  border-left: 1px solid var(--line);
}

/* Contacte in the header is the secondary way to the form: outlined, so
   the hero's "Demana la primera trucada" stays the one solid button */
.site-nav .button {
  min-height: 2.5rem;
  padding: 0.5rem 1.15rem;
}

.site-nav .button:hover {
  text-decoration: none;
}

/* The same compact menu as on narrow screens, whenever the links don't fit
   on one line beside the name (large text settings, long translations).
   main.js sets .is-compact after measuring. */
.site-header.is-compact .nav-toggle {
  display: inline-flex;
  min-height: 2.75rem;
  padding: 0.5rem 1.1rem;
}

.site-header.is-compact .wrap {
  flex-wrap: wrap;
}

.site-header.is-compact .site-nav {
  display: none;
  flex-basis: 100%;
}

.site-header.is-compact .site-nav.is-open {
  display: block;
}

.site-header.is-compact .site-nav ul {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  padding-top: 1rem;
}

.site-header.is-compact .site-nav a {
  display: block;
  padding-block: 0.5rem;
  font-size: var(--step-1);
}

.site-header.is-compact .site-nav .lang {
  border-left: 0;
  padding-left: 0;
}

.site-header.is-compact .site-nav .button {
  margin-top: 0.5rem;
  min-height: 2.75rem;
  font-size: var(--text-action);
}

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
}

/* The headline has the tile panel to itself: no photo, the words are the
   picture. Its full stop is the dot the page's path sets off from. */
.hero-visual {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--rosa);
  display: flex;
  align-items: center;
  padding: clamp(3rem, 6vw, 5.5rem) var(--gutter) clamp(3rem, 6vw, 5.5rem) clamp(1.5rem, 5vw, 5rem);
}

.hero-visual h1 {
  font-size: clamp(3rem, 1.3rem + 5.2vw, 6.25rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

/* The full stop: drawn as a filled dot (the start of the path), the real
   character kept for reading and copying */
.cm-full-stop {
  position: relative;
  color: transparent;
}

.cm-start {
  position: absolute;
  left: 50%;
  bottom: 0.21em;
  width: 0.17em;
  height: 0.17em;
  border-radius: 50%;
  background: var(--wine);
  transform: translateX(-50%);
}

.hero-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--rosa-deep);
  /* round: the tiles stretch a little so the panel holds whole ones */
  -webkit-mask: url("../img/panot.svg") 0 0 / 7rem 7rem round;
  mask: url("../img/panot.svg") 0 0 / 7rem 7rem round;
}


.hero-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.5rem;
  padding: clamp(3rem, 6vw, 5.5rem) var(--gutter) clamp(3rem, 6vw, 5.5rem) clamp(2.5rem, 6vw, 6rem);
  max-width: 44rem;
}

.hero-text .lede {
  font-size: var(--text-lede);
  line-height: 1.45;
  max-width: 34ch;
}

/* Who and where, the facts a visitor decides on, as a short list under the
   sentence that introduces them */
.hero-text p:has(+ .hero-facts) {
  margin-bottom: -0.75rem;
}

.hero-facts {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-weight: 500;
}

.hero-facts li {
  position: relative;
  padding-left: 1.25rem;
}

/* A small tile marks each fact */
.hero-facts li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 2px;
  background: var(--wine);
  opacity: 0.55;
}

.hero-text .credentials {
  font-size: var(--text-small);
  color: var(--wine-soft);
  max-width: 46ch;
}

/* The button with its reassurance right under it; WhatsApp, the quieter
   alternative, beside the button on wide screens and after the note on
   phones (the reading order is button, note, WhatsApp) */
.hero-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.6rem 1.5rem;
  margin-top: 0.5rem;
}

.hero-actions .button {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}

.hero-actions .hero-note {
  grid-column: 1 / -1;
  grid-row: 2;
  margin: 0;
  font-size: 1rem;
  color: var(--wine);
}

.hero-actions .text-link {
  grid-column: 2;
  grid-row: 1;
  justify-self: start;
}

/* ---------- Motion ---------- */
/* Everything here is off when the visitor asks for reduced motion */

@media (prefers-reduced-motion: no-preference) {
  /* No smooth scrolling: the jumps on this page run thousands of pixels,
     and a long animated scroll feels like waiting */

  /* Hero text settles in once on load */
  .hero-text > * {
    animation: rise 800ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .hero-text > :nth-child(2) { animation-delay: 100ms; }
  .hero-text > :nth-child(3) { animation-delay: 180ms; }
  .hero-text > :nth-child(4) { animation-delay: 260ms; }
  .hero-text > :nth-child(5) { animation-delay: 320ms; }

  /* The buttons are there from the start: a fading button reads as disabled */
  .hero-text > .hero-actions {
    animation: none;
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(16px);
    }
  }

  /* Scrolling drifts the tile pattern behind the headline */
  @supports (animation-timeline: scroll()) {
    .hero-visual::before {
      inset: -4rem 0 0;
      animation: drift linear both;
      animation-timeline: scroll(root);
      animation-range: 0 100vh;
    }

    @keyframes drift {
      to { transform: translateY(4rem); }
    }
  }
}

/* Small print under a section */
.note {
  font-size: var(--text-small);
  color: var(--wine-soft);
}

/* ---------- Contact ---------- */

.form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 1.5rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field--wide {
  grid-column: 1 / -1;
}

.field label,
.field legend {
  font-size: var(--text-small);
  font-weight: 600;
}

.field .optional {
  font-weight: 400;
  color: var(--wine-soft);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--edge);
  border-radius: 6px;
  background: var(--paper);
  color: var(--wine);
  font: 400 var(--text-small)/1.5 var(--sans);
}

.field textarea {
  min-height: 9rem;
  resize: vertical;
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  border-color: var(--wine);
  outline-offset: 1px;
}

.field [aria-invalid="true"] {
  border-color: var(--error);
  border-width: 2px;
}

/* Written by main.js under the field it belongs to */
.field-error {
  color: var(--error);
  font-size: var(--text-small);
  font-weight: 500;
}

.form > .field-error {
  grid-column: 1 / -1;
  margin-top: -0.75rem;
}

.button:disabled {
  opacity: 0.75;
  cursor: progress;
}

.consent {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  font-size: var(--text-small);
  color: var(--wine-soft);
}

.consent input {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.15rem;
  accent-color: var(--wine);
  flex: none;
}

/* Basic data-protection notice the law asks for next to the form */
.privacy-note {
  grid-column: 1 / -1;
  max-width: 62ch;
  font-size: var(--text-small);
  color: var(--wine-soft);
}

.form .button {
  justify-self: start;
}

.honeypot {
  display: none;
}

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

.site-footer {
  background: var(--wine);
  color: var(--calc);
}

.footer-note {
  margin-top: 0.75rem;
}

.site-footer .band {
  height: 4rem;
  background: var(--rosa);
  opacity: 0.35;
  -webkit-mask: url("../img/panot.svg") 0 0 / 4rem 4rem repeat-x;
  mask: url("../img/panot.svg") 0 0 / 4rem 4rem repeat-x;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
  padding-block: 3rem 3.5rem;
}

.site-footer .brand-name {
  font-size: 2rem;
}

.site-footer p,
.site-footer li {
  font-size: var(--text-small);
  letter-spacing: 0.012em; /* light on garnet reads thinner */
  line-height: 1.68;
}

.site-footer .muted {
  opacity: 0.75;
}

.site-footer ul {
  list-style: none;
  margin: -0.625rem 0; /* the links' tap padding shouldn't push them off the row */
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* Comfortable tap height for the stacked footer links */
.site-footer li a {
  display: inline-block;
  padding-block: 0.625rem;
}

/* ---------- Thank-you page ---------- */

.thanks {
  min-height: 60vh;
  display: grid;
  align-content: center;
  gap: 1.25rem;
  padding-block: var(--section-space);
}

.thanks p {
  max-width: 44ch;
  font-size: var(--text-lede);
}

/* ---------- Legal pages ---------- */

.legal {
  max-width: 48rem;
  padding-block: clamp(2rem, 5vw, 4rem) var(--section-space);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.legal h1 {
  font-size: var(--text-heading);
  margin-bottom: 0.5rem;
}

.legal h2 {
  font-size: var(--text-title);
  margin-top: 1.5rem;
}

.legal ul {
  margin: 0;
  padding-left: 1.25rem;
}

.legal .draft {
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--wine);
  background: var(--paper);
}

/* ---------- Responsive ---------- */

@media (max-width: 64rem) {
  .nav-toggle {
    display: inline-flex;
    min-height: 2.75rem;
    padding: 0.5rem 1.1rem;
  }

  .site-header .wrap {
    flex-wrap: wrap;
  }

  .site-nav {
    display: none;
    flex-basis: 100%;
  }

  .site-nav.is-open {
    display: block;
  }

  .site-nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding-top: 1rem;
  }

  .site-nav a {
    display: block;
    padding-block: 0.5rem;
    font-size: var(--step-1);
  }

  .site-nav .lang {
    border-left: 0;
    padding-left: 0;
  }

  .site-nav .button {
    margin-top: 0.5rem;
    min-height: 2.75rem;
    font-size: var(--text-action);
  }

  /* Drawings are composed to the frame, so they keep it whole instead of being cropped */
}

@media (max-width: 52rem) {
  .hero {
    grid-template-columns: 1fr;
  }

  /* On phones the headline panel comes first, then the text */
  .hero-visual {
    padding: 1.5rem var(--gutter) 1.5rem;
  }

  /* Sized to the screen so "Hagamos camino," keeps one line (it is 8em
     wide) and the button stays on the first screen */
  .hero-visual h1 {
    font-size: min(3rem, 11vw);
  }

  /* The registration number follows the buttons on a phone, still in view
     as reassurance, so the call to action comes sooner */
  .hero-text .credentials {
    order: 5;
  }

  /* In line with the text of every section below: the lane on the left is
     where the path runs down from the headline's full stop */
  .hero-text {
    padding: 1.25rem var(--gutter) 3rem calc(var(--gutter) + 3.25rem);
  }

  .hero-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-actions .text-link {
    grid-column: 1;
    grid-row: 3;
  }
}

@media (max-width: 36rem) {
  .list,
  .form {
    grid-template-columns: 1fr;
  }

  /* Full name and Menú share one row */
  .site-header .brand-name {
    font-size: 1.375rem;
  }
}

/* Social profiles: the logo with its name, so it reads at a glance.
   In the footer the logo stands alone, next to the legal links */
.social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  font-weight: 600;
  color: var(--wine);
  text-decoration-thickness: 1.5px;
}

/* Two classes so the drawing rule (.cm-art svg) doesn't stretch it */
.social-link .social-icon {
  flex: none;
  width: 1.25em;
  height: 1.25em;
  margin: 0;
  fill: currentColor;
}

.social-link--icon {
  justify-content: center;
  min-width: 2.75rem;
  margin-inline-start: -0.625rem;
  color: inherit;
}

.social-link--icon .social-icon {
  width: 1.5rem;
  height: 1.5rem;
}

/* In the opening: the registration number and, beside it, where to look her up */
.hero-text .credentials {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.5rem;
}

/* Here it's a credential, not a call to action: the soft colour and normal
   weight of the line it sits on, so it doesn't rival the WhatsApp link */
.hero-text .credentials .social-link {
  font-size: var(--text-small);
  font-weight: 400;
  color: inherit;
  text-decoration-thickness: 1px;
}
