/* ==========================================================================
   DIGITALMATCH — Nicoletta Natali
   Mobile-first stylesheet. Base design width: 360px.
   Typography minimums (mobile): body 18px · nav/controls ≥16px · h1 ≥34px
   h2 ≥28px · card headings 21–24px · buttons ≥17px / ≥52px tall · secondary ≥16px
   ========================================================================== */

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

:root {
  /* Colour */
  --navy-950: #061029;
  --navy-900: #0b1b3f;
  --navy-800: #13285a;
  --blue-500: #1f6bff;
  --blue-600: #1557db;
  --blue-300: #6fb1ff;
  --cyan-400: #2ec8ff;
  --ink: #14203d;
  --ink-muted: #45516e;
  --surface: #ffffff;
  --surface-tint: #f3f6fc;
  --border: #dbe3f1;
  --focus: #6fb1ff;

  /* Type scale (rem relative to 16px root) */
  --fs-body: clamp(1.125rem, 1.07rem + 0.25vw, 1.1875rem);   /* 18 → 19px */
  --fs-lead: clamp(1.1875rem, 1.1rem + 0.4vw, 1.375rem);     /* 19 → 22px */
  --fs-small: 1rem;                                           /* 16px, never lower */
  --fs-nav: 1.0625rem;                                        /* 17px */
  --fs-btn: 1.125rem;                                         /* 18px */
  --fs-h1: clamp(2.125rem, 1.7rem + 2vw, 3.5rem);             /* 34 → 56px */
  --fs-h2: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);            /* 28 → 40px */
  --fs-h3: clamp(1.3125rem, 1.25rem + 0.3vw, 1.5rem);         /* 21 → 24px */

  /* Spacing & shape */
  --gutter: 1.25rem;
  --section-y: clamp(4rem, 3rem + 4vw, 7rem);
  --radius-lg: 1.5rem;
  --radius-md: 1rem;
  --header-h: 4.5rem;
  --shadow: 0 1px 2px rgba(11, 27, 63, 0.06), 0 8px 24px rgba(11, 27, 63, 0.08);
}

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

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

html {
  font-size: 100%; /* respect the user's browser setting (16px default) */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 0.5rem);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface);
  overflow-x: hidden;
  overflow-x: clip; /* clips like hidden but never breaks the sticky header */
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); line-height: 1.12; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: 1.25; letter-spacing: -0.01em; }

p {
  margin: 0;
  max-width: 62ch;
}

p + p {
  margin-top: 1rem;
}

ul[role="list"] {
  list-style: none;
  margin: 0;
  padding: 0;
}

figure {
  margin: 0;
}

a {
  color: var(--blue-600);
  text-underline-offset: 0.2em;
}

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

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -10rem;
  z-index: 100;
  padding: 0.875rem 1.25rem;
  font-size: var(--fs-nav);
  font-weight: 600;
  color: #fff;
  background: var(--blue-500);
  border-radius: 0.75rem;
}

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

.eyebrow {
  margin-bottom: 0.75rem;
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue-600);
}

.eyebrow--light {
  color: var(--blue-300);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  min-height: 3.5rem; /* 56px */
  padding: 0.875rem 1.75rem;
  font: inherit;
  font-size: var(--fs-btn);
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn__icon {
  flex-shrink: 0;
}

.btn--primary {
  color: #fff;
  background: var(--blue-500);
}

.btn--primary:hover {
  background: var(--blue-600);
}

.btn--ghost-light {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
}

.btn--ghost-light:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  min-height: 3rem;
  color: var(--navy-900);
  text-decoration: none;
}

.brand__icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand__name {
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand__sub {
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink-muted);
}

/* The dash only shows when name and subtitle sit on one line (40em and up). */
.brand__sep {
  display: none;
}

/* ---------- Language switch (ES / IT) ---------- */

.lang-switch {
  display: inline-flex;
  flex-shrink: 0;
  padding: 0.1875rem;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.lang-switch__btn {
  min-width: 3rem;
  min-height: 2.5rem;
  padding: 0 0.75rem;
  font: inherit;
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.lang-switch__btn:hover {
  color: var(--navy-900);
}

.lang-switch__btn[aria-pressed="true"] {
  color: #fff;
  background: var(--navy-900);
}

/* The switch needs JavaScript, so it is hidden without it. */
html:not(.js) .lang-switch {
  display: none;
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.5rem 0.875rem;
  font: inherit;
  font-size: var(--fs-nav);
  font-weight: 600;
  color: var(--navy-900);
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.menu-toggle__icon,
.menu-toggle__icon::before,
.menu-toggle__icon::after {
  display: block;
  width: 1.125rem;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.menu-toggle__icon {
  position: relative;
}

.menu-toggle__icon::before,
.menu-toggle__icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.menu-toggle__icon::before { top: -6px; }
.menu-toggle__icon::after { top: 6px; }

.menu-toggle[aria-expanded="true"] .menu-toggle__icon {
  background: transparent;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__icon::before {
  top: 0;
  transform: rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle__icon::after {
  top: 0;
  transform: rotate(-45deg);
}

/* Without JavaScript the toggle is hidden and the links are always visible. */
html:not(.js) .menu-toggle {
  display: none;
}

html:not(.js) .site-header__inner {
  flex-wrap: wrap;
  padding-block: 0.5rem;
}

.site-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: flex;
  align-items: center;
  min-height: 3.25rem;
  font-size: var(--fs-nav);
  font-weight: 600;
  color: var(--navy-900);
  text-decoration: none;
}

/* Mobile drop-down panel */
.js .site-nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 16px 32px rgba(11, 27, 63, 0.12);
}

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

.js .site-nav__list {
  padding: 0.5rem var(--gutter) 1.25rem;
}

.js .site-nav__list li + li {
  border-top: 1px solid var(--border);
}

.js .site-nav a {
  min-height: 3.5rem;
  font-size: 1.1875rem; /* 19px: comfortable tap targets on phones */
}

html:not(.js) .site-nav {
  width: 100%;
}

html:not(.js) .site-nav__list {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1.25rem;
}

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

.hero {
  color: #fff;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(31, 107, 255, 0.28) 0%, rgba(31, 107, 255, 0) 60%),
    var(--navy-900);
}

.hero__inner {
  display: grid;
  gap: 2.75rem;
  padding-block: 3rem 3.5rem;
}

.hero__content h1 {
  max-width: 18ch;
}

.hero__lead {
  margin-top: 1.25rem;
  font-size: var(--fs-lead);
  line-height: 1.6;
  color: #dbe4f7;
  max-width: 40ch;
}

.hero__actions {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  margin-top: 2rem;
}

.hero__actions .btn {
  width: 100%;
}

.hero__media {
  width: 100%;
  max-width: 26rem;
  justify-self: center;
}

.hero__media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center 55%;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.35);
}

/* ---------- Sections ---------- */

.section {
  padding-block: var(--section-y);
}

.section--tint {
  background: var(--surface-tint);
}

.section__header {
  margin-bottom: 2.25rem;
}

.section__header h2 {
  max-width: 22ch;
}

/* ---------- Service cards ---------- */

.cards {
  display: grid;
  grid-template-columns: 1fr; /* one column on phones and tablets */
  gap: 1.25rem;
}

.card {
  padding: 1.75rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.card__icon {
  display: inline-grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 1.25rem;
  color: var(--blue-500);
  background: #e6efff;
  border-radius: var(--radius-md);
}

.card__title {
  margin-bottom: 0.75rem;
  color: var(--navy-900);
}

.card p {
  color: var(--ink-muted);
}

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

.about {
  display: grid;
  gap: 2.5rem;
}

.about__content h2 {
  margin-bottom: 1.5rem;
  max-width: 20ch;
}

.about__media img {
  width: 100%;
  aspect-ratio: 6 / 5;
  object-fit: cover;
  object-position: 60% 30%;
  border-radius: var(--radius-lg);
}

/* ---------- Projects ---------- */

.projects {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.project {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.project__media {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.project__media img {
  width: 100%;
  height: 100%;
}

/* Website screenshots: always shown whole, at their natural proportions. */
.project__media--screenshot {
  aspect-ratio: auto;
}

.project__media--screenshot img {
  height: auto;
  object-fit: contain;
}

.project__media--contain {
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: #fbf7f0;
}

.project__media--contain img {
  object-fit: contain;
}

.project__body {
  padding: 1.5rem 1.5rem 1.75rem;
}

.project__tag {
  margin-bottom: 0.5rem;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--blue-600);
}

.project__body p:not(.project__tag) {
  color: var(--ink-muted);
}

.btn--outline {
  color: var(--navy-900);
  border-color: var(--navy-900);
}

.btn--outline:hover {
  color: #fff;
  background: var(--navy-900);
}

.project__link {
  width: 100%;
  margin-top: 1.5rem;
}

.project__link[hidden] {
  display: none;
}

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

.contact {
  padding-block: var(--section-y);
  color: #fff;
  background:
    radial-gradient(90% 70% at 0% 100%, rgba(46, 200, 255, 0.18) 0%, rgba(46, 200, 255, 0) 60%),
    var(--navy-900);
}

.contact__inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.contact__lead {
  margin: 1.25rem 0 2rem;
  font-size: var(--fs-lead);
  color: #dbe4f7;
  max-width: 40ch;
}

.btn--wide {
  width: 100%;
}

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

.site-footer {
  padding-block: 2.5rem;
  font-size: var(--fs-small);
  color: #c4cfe6;
  background: var(--navy-950);
}

.site-footer__inner {
  display: grid;
  gap: 0.75rem;
}

.site-footer p + p {
  margin-top: 0;
}

.site-footer__brand {
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: #fff;
  overflow-wrap: anywhere;
}

/* ==========================================================================
   Phones only — below 40em (640px)
   ========================================================================== */

@media (max-width: 39.9375em) {
  /* Header: ES / IT on a slim top row, then logo (left) and Menú (right). */
  .js {
    --header-h: 7.25rem;
  }

  .js .site-header__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "lang  lang"
      "brand toggle";
    align-items: center;
    row-gap: 0.25rem;
    padding-block: 0.375rem 0.5rem;
  }

  .js .lang-switch {
    grid-area: lang;
    justify-self: end;
  }

  .js .brand {
    grid-area: brand;
  }

  .js .menu-toggle {
    grid-area: toggle;
  }

  /* Hero: brand image first, centred and shown whole. */
  .hero__inner {
    gap: 2.25rem;
    padding-block: 2.25rem 3.5rem;
  }

  .hero__media {
    order: -1;
    max-width: 16rem;
  }

  .hero__media img {
    aspect-ratio: auto;
    object-fit: contain;
  }
}

/* ==========================================================================
   Tablet — 40em (640px) and up
   ========================================================================== */

@media (min-width: 40em) {
  :root {
    --gutter: 2rem;
  }

  .hero__actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .hero__actions .btn,
  .btn--wide,
  .project__link {
    width: auto;
  }

  .lang-switch {
    margin-left: auto;
  }

  .card {
    padding: 2rem;
  }

  .about__media {
    max-width: 36rem;
  }
}

/* Brand name and subtitle on one line from 40em (640px) */
@media (min-width: 40em) {
  .brand__text {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 0.375rem;
  }

  .brand__sep {
    display: inline;
  }
}

/* Two project cards side by side from 48em (768px) */
@media (min-width: 48em) {
  .projects {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ==========================================================================
   Desktop — 60em (960px) and up
   ========================================================================== */

@media (min-width: 60em) {
  :root {
    --header-h: 5rem;
  }

  /* Inline navigation, then the ES / IT switch on the far right */
  .menu-toggle {
    display: none;
  }

  .site-nav {
    margin-left: auto;
  }

  .lang-switch {
    order: 1;
    margin-left: 0.75rem;
  }

  .js .site-nav,
  .site-nav {
    display: block;
    position: static;
    width: auto;
    background: none;
    border: 0;
    box-shadow: none;
  }

  .js .site-nav__list,
  .site-nav__list {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
  }

  .js .site-nav__list li + li {
    border: 0;
  }

  .js .site-nav a,
  .site-nav a {
    min-height: 3rem;
    padding: 0 1rem;
    white-space: nowrap;
    font-size: var(--fs-nav);
    border-radius: 999px;
  }

  .site-nav a:hover {
    color: var(--blue-600);
    background: var(--surface-tint);
  }

  .js .site-nav .site-nav__cta,
  .site-nav .site-nav__cta {
    margin-left: 0.5rem;
    padding: 0 1.5rem;
    color: #fff;
    background: var(--navy-900);
  }

  .site-nav .site-nav__cta:hover {
    color: #fff;
    background: var(--blue-600);
  }

  .hero__inner {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    align-items: center;
    gap: 4rem;
    padding-block: 5.5rem 6rem;
  }

  .hero__media {
    justify-self: end;
  }

  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
  }

  .about {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 4rem;
  }

  .about__media {
    order: -1;
    max-width: none;
  }

  .contact__inner {
    align-items: center;
    text-align: center;
  }

  .contact__inner h2,
  .contact__lead {
    margin-inline: auto;
  }

  .site-footer__inner {
    grid-template-columns: 1fr auto;
    align-items: center;
    column-gap: 2rem;
  }

  .site-footer__copy {
    grid-column: 1 / -1;
  }
}

/* Narrow desktops (960–1023px): stack the brand again so the nav and ES / IT fit on one row */
@media (min-width: 60em) and (max-width: 63.9375em) {
  .brand__text {
    flex-direction: column;
    align-items: flex-start;
  }

  .brand__sep {
    display: none;
  }
}
