/* espierto.com – main stylesheet (no framework).
   Progressive enhancement: html.js shows one "page" at a time; without JS everything stacks. */

/* Google Sans (variable 400–700), self-hosted: no request to Google's servers (GDPR-friendly, faster). */
@font-face {
  font-family: "Google Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/google-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Google Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/google-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --navy: #242876;
  --blue: #15b0ed;
  --blue-2: #0899d1;
  --ink: #1d2433;
  --muted: #5b6475;
  --bg: #fff;
  --surface: #f5f7fb;
  --radius: 10px;
  --header-h: 4.5rem;
  --font: "Google Sans", "Helvetica Neue", Helvetica, Arial, system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow: 0 6px 24px rgb(16 24 64 / .12);
  --focus: 3px solid #ffbf47;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: clamp(1rem, .95rem + .25vw, 1.125rem);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--navy); transition: color .2s ease; }
a:hover { color: var(--blue-2); }
:root { interpolate-size: allow-keywords; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
:focus-visible { outline: var(--focus); outline-offset: 2px; }
/* Headings/main receive focus programmatically after navigation (for screen readers) – no ring needed. */
[tabindex="-1"]:focus { outline: none; }
h1, h2, h3, h4, h5, h6, strong, b, th, dt, summary, label, button { font-weight: 400; }
h1, h2, h3 { line-height: 1.2; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: #fff; color: var(--navy); padding: .6rem 1rem; border-radius: var(--radius);
}
.skip-link:focus { top: 1rem; }

.container { width: min(1100px, 100% - 2.5rem); margin-inline: auto; }

.site-header, .site-footer {
  background: linear-gradient(-45deg, var(--navy), var(--blue-2), var(--navy), var(--blue-2));
  background-size: 400% 400%;
  animation: gradient 30s ease infinite;
}
@keyframes gradient { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20; color: #fff;
  view-transition-name: site-header;
  transition: background-color .3s ease, box-shadow .3s ease;
}
.site-header.is-scrolled { box-shadow: 0 4px 18px rgb(16 24 64 / .25); }
.site-header__inner {
  width: min(1100px, 100% - 2rem); margin-inline: auto;
  min-height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.site-nav { align-self: stretch; display: flex; margin-left: auto; order: 2; }
.menu-toggle { order: 4; }
.brand img { height: 3rem; width: auto; animation: spin-in 2s .5s 1 reverse; }
@keyframes spin-in { from { transform: rotate(0); } to { transform: rotate(180deg); } }

.site-nav ul { list-style: none; display: flex; align-items: stretch; margin: 0; padding: 0; }
/* Each menu item is a full-height square block that lights up as a whole. */
.site-nav a {
  display: flex; align-items: center; height: 100%; min-height: var(--header-h);
  padding: 0 1.25rem; border-radius: 0;
  color: var(--blue); text-decoration: none; font-size: 1.35rem; font-weight: 400;
  transition: background-color .2s, color .2s;
}
.site-nav a:hover, .site-nav a:focus-visible { background: var(--blue); color: #fff; }
.site-nav a:focus-visible { outline-offset: -3px; }
.site-nav a[aria-current="page"] { color: #fff; background: rgb(255 255 255 / .14); }
.site-nav a[aria-current="page"]:hover { background: var(--blue); }

/* One-time language suggestion (bottom, non-blocking) */
.lang-suggest {
  position: fixed; z-index: 40; left: 50%; bottom: 1rem; transform: translateX(-50%);
  width: min(560px, calc(100% - 2rem)); display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  background: #fff; color: var(--ink); border: 1px solid #dfe5ef; box-shadow: var(--shadow); padding: .8rem 1rem;
}
.lang-suggest p { margin: 0; flex: 1 1 220px; font-size: .95rem; }
.lang-suggest__yes { background: var(--navy); color: #fff; padding: .45rem .9rem; text-decoration: none; font-weight: 400; }
.lang-suggest__yes:hover { background: var(--blue-2); color: #fff; }
.lang-suggest__no { background: none; border: 0; font: inherit; color: var(--muted); cursor: pointer; text-decoration: underline; padding: .45rem .25rem; }
@media (prefers-reduced-motion: no-preference) { .lang-suggest { animation: fade-in .3s ease; } }

.menu-toggle {
  display: none; background: transparent; border: 1px solid rgb(255 255 255 / .5);
  border-radius: 6px; padding: .6rem .55rem; cursor: pointer;
}
.menu-toggle__bar { display: block; width: 24px; height: 2px; background: #fff; border-radius: 2px; }
.menu-toggle__bar + .menu-toggle__bar { margin-top: 5px; }

@media (max-width: 767px) {
  .js .menu-toggle { display: block; }
  .js .site-nav {
    position: absolute; inset: var(--header-h) 0 auto 0;
    background: linear-gradient(to bottom right, var(--navy), #1587ed);
    display: none; padding: 0;
    opacity: 0; transform: translateY(-8px);
    transition: opacity .22s ease, transform .22s ease, display .22s allow-discrete;
  }
  .js .site-nav.is-open { display: block; opacity: 1; transform: none; }
  @starting-style { .js .site-nav.is-open { opacity: 0; transform: translateY(-8px); } }
  .menu-toggle__bar { transition: transform .22s ease, opacity .22s ease; }
  .menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(2) { transform: translateY(7px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(3) { opacity: 0; }
  .menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(4) { transform: translateY(-7px) rotate(-45deg); }
  .site-nav ul { flex-direction: column; flex-wrap: wrap; }
  .no-js .site-nav ul { flex-direction: row; }
  .site-nav a { font-size: 1.25rem; min-height: 3.25rem; height: auto; padding: 0 1.5rem; width: 100%; }
  .site-nav li + li a { border-top: 1px solid rgb(255 255 255 / .12); }
}

/* ---------- Pages ---------- */
main { flex: 1; outline: none; }
.page { padding-block: 2.5rem 3.5rem; scroll-margin-top: var(--header-h); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.page__title {
  text-align: center;
  font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.4rem); margin: 0 0 2rem;
  color: var(--blue-2);
}
.prose { max-width: 75ch; }
.prose h3, .prose__h { color: var(--navy); margin-top: 1.75rem; font-size: 1.35rem; }

/* ---------- Home ---------- */
.page--home { padding: 0; position: relative; }
.tiles {
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr);
  height: calc(100dvh - var(--header-h));
  min-height: 420px;
}
.tile { background: center / cover no-repeat; }
.tile--1 { background-image: url("../images/1.jpg"); background-image: image-set(url("../images/1.webp") type("image/webp"), url("../images/1.jpg") type("image/jpeg")); }
.tile--2 { background-image: url("../images/2.jpg"); background-image: image-set(url("../images/2.webp") type("image/webp"), url("../images/2.jpg") type("image/jpeg")); }
.tile--3 { background-image: url("../images/3.jpg"); background-image: image-set(url("../images/3.webp") type("image/webp"), url("../images/3.jpg") type("image/jpeg")); }
.tile--4 { background-image: url("../images/6.jpg"); background-image: image-set(url("../images/6.webp") type("image/webp"), url("../images/6.jpg") type("image/jpeg")); }
.tile--5 { background-image: url("../images/4.jpg"); background-image: image-set(url("../images/4.webp") type("image/webp"), url("../images/4.jpg") type("image/jpeg")); }
.tile--6 { background-image: url("../images/5.jpg"); background-image: image-set(url("../images/5.webp") type("image/webp"), url("../images/5.jpg") type("image/jpeg")); }
.hero {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgb(0 0 0 / .45); text-decoration: none;
}
.hero__name {
  margin: 0; padding: 0 1rem; text-align: center;
  font-size: clamp(2.4rem, 1.5rem + 5vw, 5rem); font-weight: 400; color: #fff;
  text-shadow: 3px 3px 3px #000; min-height: 1.2em;
  /* Transform-only entrance: text is painted at once, so it does not delay LCP. */
  animation: rise-in .9s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes rise-in { from { transform: translateY(.4em) scale(.98); } to { transform: none; } }
.hero:hover .hero__name, .hero:focus-visible .hero__name { color: #e6f6fd; }

/* Home: header over the tiles, slim footer */
body.on-home .site-header { background: rgb(0 0 0 / .35); animation: none; position: fixed; inset: 0 0 auto 0; }
body.on-home .tiles { height: 100dvh; }
body.on-home .site-footer { background: rgb(0 0 0 / .55); animation: none; position: fixed; inset: auto 0 0 0; padding-block: .5rem; }
body.on-home .site-footer__title { display: none; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: minmax(220px, 1fr) 2fr; gap: 2.5rem; align-items: start; }
.about__photo { margin: 0; position: sticky; top: calc(var(--header-h) + 1rem); }
.about__photo img {
  border-radius: 50%; aspect-ratio: 1; object-fit: cover; padding: 12px; width: 100%;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  box-shadow: var(--shadow);
}
.about__text p { text-align: justify; hyphens: auto; }
.about__text h3, .cv-title { color: var(--navy); font-size: 1.5rem; margin: 2rem 0 1rem; }

/* Experience timeline */
.timeline { list-style: none; margin: 0 0 1rem; padding: 0 0 0 1.5rem; border-left: 3px solid var(--blue); }
.timeline__item { position: relative; padding: 0 0 1.5rem .5rem; }
.timeline__item::before {
  content: ""; position: absolute; left: calc(-1.5rem - 9px); top: .35rem;
  width: 15px; height: 15px; border-radius: 50%; background: #fff; border: 3px solid var(--navy);
}
.timeline__when { margin: 0; font-size: .9rem; color: var(--muted); }
.timeline__role { margin: .1rem 0 0; font-size: 1.15rem; font-weight: 400; color: var(--ink); }
.timeline__org { margin: 0 0 .4rem; color: var(--navy); }
.timeline ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.about__text .timeline p { text-align: left; }

/* Education links + certifications */
.timeline__org a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
/* "At a glance" summary on About */
.glance { margin: 1.75rem 0 .5rem; padding: 1.1rem 1.25rem; border: 1px solid #dfe5ef; border-left: 3px solid var(--navy); background: var(--surface); }
.glance__title { margin: 0 0 .6rem; font-size: 1.1rem; color: var(--navy); }
.glance dl { margin: 0; display: grid; gap: .45rem; }
.glance dl > div { display: grid; grid-template-columns: 9.5rem 1fr; gap: 1rem; }
.glance dt { color: var(--muted); font-size: .92rem; }
.glance dd { margin: 0; }
@media (max-width: 520px) { .glance dl > div { grid-template-columns: 1fr; gap: 0; } }

/* Collapsible CV items (experience, education, certifications) */
.cv-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.cv-head h3, .cv-head .cv-title { margin-bottom: 1rem; }
.cv-toggle {
  font: inherit; font-size: .875rem; color: var(--navy); background: none; cursor: pointer;
  border: 1px solid #c9d2e3; border-radius: 999px; padding: .3rem .85rem; min-height: 32px;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
@media (hover: hover) { .cv-toggle:hover { background: var(--navy); color: #fff; border-color: var(--navy); } }
.cv-toggle:active { background: #e8ecf5; }
.cv-hint { margin: -.5rem 0 1rem; font-size: .9rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.cv-hint::before {
  content: ""; flex: none; width: 1em; height: 1em; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M12 11v6M12 7.5v.01'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M12 11v6M12 7.5v.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.cv-item {
  background: #fff; border: 1px solid #dfe5ef; border-radius: 12px;
  box-shadow: 0 1px 2px rgb(16 24 64 / .05);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.cv-item[open] { border-color: var(--blue); box-shadow: 0 6px 20px rgb(16 24 64 / .1); }
.cv-item > summary {
  list-style: none; cursor: pointer; display: grid; gap: .15rem;
  padding: .85rem 7.5rem .85rem 1rem; border-radius: 12px; position: relative;
  transition: background-color .2s ease;
}
.cv-item > summary::-webkit-details-marker { display: none; }
@media (hover: hover) {
  .cv-item:hover { border-color: #9fb6d9; box-shadow: 0 4px 14px rgb(16 24 64 / .08); }
  .cv-item > summary:hover .cv-more { background: var(--navy); color: #fff; }
}
.cv-item > summary:focus-visible { outline: var(--focus); outline-offset: 2px; }
/* The visible "Details" / "Hide" pill (with chevron) makes it obvious each item opens */
.cv-more {
  position: absolute; right: .85rem; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .8rem; font-weight: 400; color: var(--navy);
  background: #eef3fb; border-radius: 999px; padding: .3rem .7rem;
  transition: background-color .2s ease, color .2s ease;
}
.cv-more::after {
  content: ""; width: .45rem; height: .45rem;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-25%) rotate(45deg); transition: transform .25s ease;
}
.cv-item[open] .cv-more::after { transform: translateY(20%) rotate(-135deg); }
.cv-more__hide, .cv-item[open] .cv-more__show { display: none; }
.cv-item[open] .cv-more__hide { display: inline; }
/* One-line teaser of the first highlight while closed */
.cv-preview {
  margin-top: .35rem; color: var(--muted); font-size: .92rem;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.cv-item[open] .cv-preview { display: none; }
@media (max-width: 520px) {
  .cv-item > summary { padding-right: 1rem; padding-bottom: 2.9rem; }
  .cv-more { top: auto; bottom: .7rem; right: auto; left: 1rem; transform: none; }
}
.cv-item::details-content {
  block-size: 0; overflow: clip;
  transition: block-size .3s ease, content-visibility .3s allow-discrete;
}
.cv-item[open]::details-content { block-size: auto; }
.cv-item__body { padding: 0 1rem 1rem; }
.cv-item__body ul { margin: 0; padding-left: 1.1rem; }
.cv-item__body p { margin: .25rem 0; text-align: left; color: var(--muted); }
.timeline__item .timeline__when, .timeline__item .timeline__role, .timeline__item .timeline__org { display: block; margin: 0; }
.timeline__item { padding-bottom: .9rem; }
.timeline__item::before { top: 1.1rem; }
.certs { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .6rem; }
.cv-item--cert > summary { padding-left: 2.4rem; }
.cv-item--cert > summary::before { content: ""; position: absolute; left: 1.15rem; top: 1.05rem; width: .35rem; height: .7rem; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg); }
.cv-item--cert .cv-item__body { padding-left: 2.4rem; }
@media (max-width: 520px) { .cv-item--cert .cv-more { left: 2.4rem; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; border: 0; border-radius: 6px; cursor: pointer;
  padding: .7rem 1.4rem; font: inherit; font-weight: 400; text-decoration: none;
  background: var(--navy); color: #fff; transition: background-color .2s, transform .1s;
}
.btn:hover { background: var(--blue-2); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .65; cursor: progress; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }

/* ---------- Projects ---------- */
.cards {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.5rem;
}
.card { background: #fff; border-radius: var(--radius); box-shadow: 0 1px 3px rgb(0 0 0 / .12); transition: box-shadow .2s, transform .2s; }
.card:hover, .card:focus-within { box-shadow: var(--shadow); transform: translateY(-3px); }
.card__link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.card__link { overflow: hidden; border-radius: var(--radius); }
.card__img { width: 100%; aspect-ratio: 486 / 300; object-fit: cover; border-radius: var(--radius) var(--radius) 0 0; background: var(--surface); transition: transform .4s ease; }
.card:hover .card__img, .card:focus-within .card__img { transform: scale(1.03); }
.card__body { padding: 1rem 1.1rem 1.25rem; text-align: center; }
.card__title { display: block; font-size: 1.25rem; color: var(--ink); margin-bottom: .35rem; }
.card__desc { color: var(--muted); font-size: .95rem; }

/* ---------- Contact / forms ---------- */
.contact { max-width: 640px; margin-inline: auto; }
.contact__links { list-style: none; padding: 0; margin: 2rem 0; display: flex; justify-content: center; gap: 1.25rem; }
.contact__links img { width: 4rem; height: 4rem; transition: transform .2s; }
.contact__links a:hover img { transform: scale(1.1); }
.form__group { display: grid; gap: .35rem; margin-bottom: 1.1rem; }
.form label { font-weight: 400; }
.form input, .form textarea {
  font: inherit; width: 100%; padding: .65rem .8rem; color: var(--ink);
  border: 1px solid #b9c0cc; border-radius: 6px; background: #fff;
}
.form input:focus, .form textarea:focus { border-color: var(--blue-2); outline: var(--focus); outline-offset: 0; }
.form [aria-invalid="true"] { border-color: #c62828; }
.form small { color: var(--muted); }
.form__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form__status { min-height: 1.6em; margin-top: 1rem; }
.form__status.is-error { color: #b71c1c; }
.form__status.is-ok { color: #1b5e20; }

/* ---------- Thank-you overlay ---------- */
.thanks {
  transition: opacity .4s ease;
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 2rem;
  background: rgb(255 255 255 / .96);
}
.thanks[hidden] { display: none; }
.thanks__box { text-align: center; padding: 2.5rem; border-radius: var(--radius); background: rgb(0 0 0 / .35); color: #fff; animation: fade-in .6s; }
.thanks__box h2 { font-size: clamp(1.5rem, 1rem + 2vw, 2.2rem); margin: 0 0 .75rem; text-shadow: 2px 2px 3px #000; }
.thanks__box p { font-size: 1.25rem; margin: 0; text-shadow: 2px 2px 3px #000; }
.thanks.is-leaving { opacity: 0; transition: opacity .7s; }
@starting-style { .thanks:not([hidden]) { opacity: 0; } }

/* ---------- Footer ---------- */
.site-footer { color: #fff; padding-block: 1.5rem; text-align: center; z-index: 10; }
.site-footer a, .site-footer .link-button { color: #fff; }
.site-footer__title { margin: 0 0 .5rem; font-weight: 400; }
.social { list-style: none; padding: 0; margin: .25rem 0 .75rem; display: flex; justify-content: center; gap: clamp(1rem, 4vw, 3rem); }
.social img { width: 2.5rem; height: 2.5rem; transition: transform .2s; }
.social a:hover img, .social a:focus-visible img { transform: scale(1.35); }
.site-footer__meta { margin: .25rem 0; font-size: .875rem; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .25rem 1rem; }
/* Comfortable 24px+ tap targets for the small footer links */
.site-footer__meta a, .site-footer__meta .link-button { display: inline-block; padding: .35rem .25rem; min-height: 24px; }
/* Language list: the current language is plain text-like, the others are links */
.lang-list { display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 .5rem; }
.site-footer .lang-list a[aria-current] { text-decoration: none; opacity: .7; }
/* Small screens: keep the five names on one line; the label stays available to screen readers */
@media (max-width: 480px) {
  .lang-list { gap: 0 .2rem; }
  .lang-list__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* ---------- Responsive ---------- */
@media (max-width: 800px) {
  .about { grid-template-columns: 1fr; }
  .about__photo { position: static; max-width: 320px; margin-inline: auto; }
}

/* ---------- Motion / print ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .site-header, .site-footer, .tiles, .hero, .form, .thanks, .cv-toggle { display: none !important; }
  .cv-item::details-content { block-size: auto !important; content-visibility: visible !important; }
}
.cv-item--cert .timeline__role { font-size: 1rem; }
