/* ==========================================================================
   avvocatosaparamadu.it – site stylesheet
   Visual direction (LAW-16): the old site's colours and fonts, modernised:
   more white space, fewer boxes, one static hero. Mobile first.
   Contrast ratios (WCAG AA, checked in LAW-16) are noted next to the colours.
   ========================================================================== */

/* ---- Fonts (self-hosted, SIL OFL; licences in assets/fonts/) ------------ */
@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/open-sans.woff2") format("woff2");
}
@font-face {
  font-family: "Open Sans";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/open-sans-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/poppins-500.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/poppins-600.woff2") format("woff2");
}

/* ---- Custom properties -------------------------------------------------- */
:root {
  /* Colours */
  --color-navy: #002e5b;        /* on white 13.6:1, on grey-bg 11.8:1 */
  --color-navy-dark: #00203f;   /* hover on navy buttons */
  --color-yellow: #fde428;      /* navy on yellow 10.6:1; never text on white */
  --color-blue: #729ce2;        /* decoration only on white (2.8:1); as text on navy 4.9:1 */
  --color-grey-bg: #eeeff1;     /* section background; body text on it 13.1:1 */
  --color-text: #1d2733;        /* on white 15.1:1 */
  --color-muted: #55606c;       /* on white 6.4:1, on grey-bg 5.6:1 */
  --color-border: #c9ced6;
  --color-white: #ffffff;
  --color-focus: var(--color-navy);
  --color-focus-on-dark: var(--color-yellow);

  /* Typography */
  --font-heading: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 1.25rem + 1vw, 2rem);
  --text-3xl: clamp(1.875rem, 1.4rem + 2vw, 2.75rem);
  --leading: 1.6;
  --leading-tight: 1.25;

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;

  /* Layout */
  --max-width: 72rem;
  --text-width: 42rem;
  --gutter: var(--space-5);
  --radius: 4px;
  --header-height: 4.5rem;
}

/* ---- Base --------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading);
  color: var(--color-text);
  background: var(--color-white);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

[hidden] {
  display: none !important;
}

img,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--color-navy);
  margin: 0 0 var(--space-4);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); font-weight: 500; }

/* Short accent bar under section headings, as on the old site (47 × 3 px). */
.accent::after {
  content: "";
  display: block;
  width: 47px;
  height: 3px;
  margin-top: var(--space-3);
  background: var(--color-yellow);
}

p,
ul,
ol {
  margin: 0 0 var(--space-4);
}

ul,
ol {
  padding-left: var(--space-5);
}

li + li {
  margin-top: var(--space-1);
}

a {
  color: var(--color-navy);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* ---- Utilities ---------------------------------------------------------- */
.container {
  width: 100%;
  max-width: calc(var(--max-width) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.prose {
  max-width: var(--text-width);
}

.prose h2:not(:first-child) {
  margin-top: var(--space-7);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -10rem;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--color-navy);
  color: var(--color-white);
  border-radius: var(--radius);
}

.skip-link:focus {
  top: var(--space-4);
  outline-color: var(--color-focus-on-dark);
}

/* ---- Header and navigation ---------------------------------------------- */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3); /* tight on phones so the logo keeps its size */
  padding-block: var(--space-3);
  padding-inline: max(var(--gutter), (100% - var(--max-width)) / 2);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-white);
}

.brand {
  flex: 1;
  min-width: 0;
}

.brand img {
  width: 12.5rem; /* scales up to 330 px wide on large screens */
}

.lang-switch {
  order: 1;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  text-decoration: none;
}

.lang-switch:hover {
  border-color: var(--color-navy);
}

.menu-toggle {
  order: 2;
  position: relative;
  font: inherit;
  font-weight: 600;
  font-size: var(--text-sm);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  color: var(--color-white);
  background: var(--color-navy);
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}

.menu-toggle::before {
  /* three-line icon drawn with box-shadow */
  content: "";
  width: 1rem;
  height: 2px;
  background: currentColor;
  box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
}

/* Open state: the three lines become a cross (×) */
.menu-toggle[aria-expanded="true"]::before,
.menu-toggle[aria-expanded="true"]::after {
  content: "";
  width: 1rem;
  height: 2px;
  background: currentColor;
  box-shadow: none;
  transform: rotate(45deg);
}

.menu-toggle[aria-expanded="true"]::after {
  position: absolute;
  left: var(--space-3);
  top: calc(50% - 1px);
  transform: rotate(-45deg);
}

.site-nav {
  order: 3;
  flex-basis: 100%;
}

/* Without JS the list stays visible; with JS it is collapsed behind the button. */
.js .site-nav:not(.is-open) {
  display: none;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-5);
}

.js .site-nav ul {
  flex-direction: column;
  gap: 0;
}

.site-nav li + li {
  margin-top: 0;
}

.site-nav a {
  display: block;
  padding: var(--space-2) 0;
  font-family: var(--font-heading);
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--color-yellow);
  text-decoration-thickness: 3px;
  text-underline-offset: 0.4em;
}

@media (min-width: 56em) {
  .site-header {
    column-gap: var(--space-5);
  }

  .brand img {
    width: 16rem;
  }

  .menu-toggle {
    display: none;
  }

  .site-nav,
  .js .site-nav:not(.is-open) {
    display: block;
    order: 1;
    flex-basis: auto;
  }

  .site-nav ul,
  .js .site-nav ul {
    flex-direction: row;
    gap: var(--space-5);
  }

  .lang-switch {
    order: 2;
  }
}

@media (min-width: 72em) {
  .brand img {
    width: 20.625rem; /* 330 px, as on the old site */
  }
}

/* ---- Sections ----------------------------------------------------------- */
.section {
  padding-block: var(--space-7);
}

.section--grey {
  background: var(--color-grey-bg);
}

.section--navy {
  background: var(--color-navy);
  color: var(--color-white);
}

.section--navy h2,
.section--navy h3,
.section--navy a {
  color: var(--color-white);
}

.section--navy :focus-visible {
  outline-color: var(--color-focus-on-dark);
}

@media (min-width: 56em) {
  .section {
    padding-block: var(--space-9);
  }
}

/* Page title area on inner pages */
.page-title {
  padding-block: var(--space-7) var(--space-5);
}

/* The first section after the page title starts right under it. */
.page-title + .section {
  padding-top: 0;
}

/* Landscape photo in a content column (About page) */
.photo {
  width: 100%;
  border-radius: var(--radius);
}

/* On phones the photo comes first; from 56em it moves to the right column. */
.split--reverse > .photo {
  order: -1;
}

@media (min-width: 56em) {
  .split--reverse > .photo {
    order: 0;
  }
}

/* ---- Hero (home) -------------------------------------------------------- */
.hero {
  position: relative;
  display: grid;
  align-items: end;
  min-height: 24rem;
  color: var(--color-white);
  background: var(--color-navy);
  overflow: hidden;
}

.hero > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero::after {
  /* navy gradient keeps the text readable on any photo */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0, 46, 91, 0.92) 0%, rgba(0, 46, 91, 0.55) 60%, rgba(0, 46, 91, 0.25) 100%);
}

.hero__content {
  position: relative;
  z-index: 1;
  padding-block: var(--space-8) var(--space-7);
}

.hero h1 {
  color: var(--color-white);
  max-width: 20ch;
}

.hero p {
  max-width: var(--text-width);
  font-size: var(--text-lg);
}

.hero :focus-visible {
  outline-color: var(--color-focus-on-dark);
}

@media (min-width: 56em) {
  .hero {
    min-height: 32rem;
  }
}

/* ---- Buttons ------------------------------------------------------------ */
.button {
  display: inline-block;
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-heading);
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  color: var(--color-white);
  background: var(--color-navy);
  border: 2px solid var(--color-navy);
  border-radius: var(--radius);
  cursor: pointer;
}

.button:hover {
  background: var(--color-navy-dark);
  border-color: var(--color-navy-dark);
}

/* Yellow button for dark backgrounds (hero, navy sections) */
.button--yellow,
.section--navy .button,
.hero .button {
  color: var(--color-navy);
  background: var(--color-yellow);
  border-color: var(--color-yellow);
}

.button--yellow:hover,
.section--navy .button:hover,
.hero .button:hover {
  background: var(--color-white);
  border-color: var(--color-white);
}

/* ---- Cards (practice-areas summary) ------------------------------------- */
.cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
}

.cards li + li {
  margin-top: 0;
}

/* The whole card is clickable: the card's one link ("Read more") is stretched
   over it with ::after, so keyboard and screen-reader users still get a
   single link per card. */
.card {
  position: relative; /* box for the stretched link */
  isolation: isolate; /* own stacking context, so the image can sit at z-index -1 */
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--color-white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 32, 63, 0.12);
  transition: box-shadow 0.2s, transform 0.2s;
}

.card img {
  position: relative;
  z-index: -1; /* below the text area, so the hover zoom never covers it */
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.3s;
}

.card__body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  flex: 1;
  background: var(--color-white);
}

.card__body h3 {
  font-size: var(--text-lg);
}

.card__body a:last-child {
  margin-top: auto;
  font-weight: 600;
}

.card__body a:last-child::after {
  content: "";
  position: absolute;
  inset: 0;
}

.card:hover {
  box-shadow: 0 6px 18px rgba(0, 32, 63, 0.18);
  transform: translateY(-2px);
}

.card:hover img {
  transform: scale(1.04);
}

.card:hover .card__body a:last-child {
  text-decoration-thickness: 2px;
}

/* Keyboard focus: outline the whole card instead of the link text. */
.card:has(a:focus-visible) {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

@supports selector(:has(*)) {
  .card__body a:last-child:focus-visible {
    outline: none;
  }
}

/* ---- Two columns (profile, contact) ------------------------------------- */
.split {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: minmax(0, 1fr); /* lets columns shrink below image width */
  align-items: start;
}

@media (min-width: 56em) {
  .split {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    gap: var(--space-8);
  }

  .split--reverse {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }
}

.portrait {
  max-width: min(100%, 24rem);
  margin-inline: auto;
}

/* ---- Practice areas: collapsible sections ------------------------------- */
.areas {
  border-top: 1px solid var(--color-border);
}

.area {
  border-bottom: 1px solid var(--color-border);
  scroll-margin-top: var(--space-4);
}

.area > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-5);
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 500;
  color: var(--color-navy);
  cursor: pointer;
  list-style: none;
}

.area > summary::-webkit-details-marker {
  display: none;
}

.area > summary::after {
  /* chevron */
  content: "";
  flex: none;
  width: 0.6em;
  height: 0.6em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-25%);
  transition: transform 0.15s;
}

.area[open] > summary::after {
  transform: rotate(-135deg);
}

.area__body {
  padding-bottom: var(--space-6);
  max-width: var(--text-width);
}

/* ---- Contact details ---------------------------------------------------- */
.contact-list {
  list-style: none;
  padding: 0;
}

.contact-list li + li {
  margin-top: var(--space-3);
}

.label {
  font-weight: 600;
}

/* Navy card with all contact details (Contact page) */
.contact-card {
  padding: var(--space-6) var(--space-5);
  color: var(--color-white);
  background: var(--color-navy);
  border-radius: var(--radius);
  overflow-wrap: anywhere; /* long e-mail addresses on narrow screens */
}

.contact-card a {
  color: var(--color-white);
}

.contact-card :focus-visible {
  outline-color: var(--color-focus-on-dark);
}

.contact-card__name {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-5);
}

.contact-details {
  margin: 0;
}

.contact-details dt {
  font-weight: 600;
  color: var(--color-yellow); /* yellow on navy 10.6:1 */
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.contact-details dd {
  margin: 0 0 var(--space-4);
}

.contact-details dd:last-child {
  margin-bottom: 0;
}

/* ---- Call-to-action band ------------------------------------------------ */
.cta {
  background: var(--color-yellow);
  color: var(--color-navy);
  padding-block: var(--space-7);
}

.cta .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4) var(--space-6);
}

.cta p {
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 600;
}

/* ---- Forms -------------------------------------------------------------- */
.form {
  display: grid;
  gap: var(--space-4);
  max-width: var(--text-width);
}

.field label {
  display: block;
  margin-bottom: var(--space-1);
  font-weight: 600;
}

.field input,
.field textarea {
  width: 100%;
  padding: var(--space-3);
  font: inherit;
  color: var(--color-text);
  background: var(--color-white);
  border: 1px solid var(--color-muted); /* 6.4:1, above the 3:1 needed for UI parts */
  border-radius: var(--radius);
}

.field textarea {
  min-height: 9rem;
  resize: vertical;
}

.field--checkbox {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.field--checkbox input {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.2rem;
  accent-color: var(--color-navy);
}

.field--checkbox label {
  font-weight: 400;
}

.form-note {
  font-size: var(--text-sm);
  color: var(--color-muted);
}

/* Honeypot against spam bots: off screen for people, still a normal field to bots */
.form-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- Footer ------------------------------------------------------------- */
.site-footer {
  padding-block: var(--space-7);
  padding-inline: max(var(--gutter), (100% - var(--max-width)) / 2);
  font-size: var(--text-sm);
  color: var(--color-white);
  background: var(--color-navy);
}

.site-footer p {
  margin-bottom: var(--space-2);
}

.site-footer a {
  color: var(--color-white);
}

.site-footer :focus-visible {
  outline-color: var(--color-focus-on-dark);
}

/* ---- Motion ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
