/* ==========================================================================
   Riccardo Mingardi — portfolio
   Black on white, pastel washes, one sans.
   ========================================================================== */

/* Suisse Intl (the Aparelho Studio face) is a licensed font: if you own a
   web licence, drop the .woff2 files in assets/fonts/ and uncomment below.
   Until then the stack falls back to Inter Tight, the closest free match. */
/*
@font-face { font-family: "Suisse Intl"; src: url("../fonts/SuisseIntl-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Suisse Intl"; src: url("../fonts/SuisseIntl-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
*/

:root {
  --white: #ffffff;
  --ink: #111214;
  --ink-2: #4b4f55;
  --grey: #6c7178;          /* AA on white for small text */
  --grey-1: #eef0f2;
  --grey-2: #d5d9dd;
  --line: #e2e5e8;
  --grey-3: #9aa1a8;
  --sky-1: #cfe8fa;
  --sky-2: #93cbf2;
  --sky-3: #4fa8e6;
  --sky-4: #1f7fd0;
  --pastel-grey: #eceef0;
  --pastel-sky: #e2f0fa;
  --blue: #1866b4;          /* links, focus — AA on white */

  --font: "Suisse Intl", "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --gutter: clamp(16px, 3vw, 40px);
  --ease: cubic-bezier(.2, .7, .1, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

.muted { color: var(--grey); }
[hidden] { display: none !important; }

.skip {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--white); padding: 10px 14px;
}
.skip:focus { top: 8px; }

/* Underline-on-hover for text links */
.mail, .bar__mail, .foot a, .side-block a {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .35s var(--ease);
}
.mail:hover, .bar__mail:hover, .foot a:hover, .side-block a:hover { background-size: 100% 1px; }

.mail { color: var(--ink); background-size: 100% 1px; }

.btn {
  display: inline-flex; align-items: center; gap: .5em;
  padding: .7em 1.1em;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: 15px; line-height: 1;
  transition: background-color .2s, color .2s, border-color .2s;
}
.btn:hover { background: var(--ink); color: var(--white); }
.btn--solid { background: var(--ink); color: var(--white); }
.btn--solid:hover { background: var(--blue); border-color: var(--blue); }

/* ==========================================================================
   Home — name and profile on top, Career left, Creatives right.
   Black on white; hovering a side washes the whole page in a pastel.
   ========================================================================== */

.home {
  --bg: var(--white);
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column;
  gap: var(--gutter);
  padding: var(--gutter);
  background: var(--bg);
  transition: background-color .6s var(--ease);
}
.home[data-side="career"]    { --bg: var(--pastel-grey); }
.home[data-side="creatives"] { --bg: var(--pastel-sky); }

.home__top { display: flex; flex-direction: column; gap: .75rem; }
.home__name, .door__title {
  font-size: clamp(1.9rem, 3.6vw, 3.4rem);
  font-weight: 600; line-height: 1; letter-spacing: -0.035em;
}
.door__title { display: block; }
.home__bio { font-size: 15px; line-height: 1.45; max-width: 78ch; }
.home__bio p + p { margin-top: .6em; }

.doors {
  flex: 1;
  padding: 0;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--gutter);
}
.door {
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 44vh;
  padding: clamp(16px, 2vw, 28px);
  border: 1px solid var(--ink);
}
.door__arrow {
  align-self: flex-end;
  font-size: clamp(1.4rem, 2.4vw, 2rem); line-height: 1;
  transition: transform .5s var(--ease);
}
.door:hover .door__arrow, .door:focus-visible .door__arrow { transform: translateX(.4rem); }
.door__sub { display: block; margin-top: .5rem; font-size: 15px; }

.home__foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: .75rem 1.5rem;
  font-size: 15px;
}
.home .mail { color: var(--ink); font-size: clamp(16px, 1.2vw, 18px); background-size: 100% 1px; }

/* Home — phone: stacked */
@media (max-width: 760px) {
  .doors { grid-template-columns: 1fr; }
  .door { min-height: 30svh; }
}

/* ==========================================================================
   Cursor trail (creative previews)
   ========================================================================== */

.trail { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.trail img {
  position: absolute; left: 0; top: 0;
  width: clamp(120px, 12vw, 190px);
  aspect-ratio: 594 / 841;       /* A1, portrait */
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 6px 24px rgba(17, 18, 20, .12);
  animation: trail-in .3s var(--ease) both;
}
.trail img.is-out { animation: trail-out .5s ease forwards; }
@keyframes trail-in  { from { opacity: 0; scale: .85; } to { opacity: 1; scale: 1; } }
@keyframes trail-out { to { opacity: 0; scale: .92; } }

/* ==========================================================================
   Inner pages — bar and two-column split
   ========================================================================== */

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.inner { font-size: 14px; line-height: 1.45; }

.bar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 1rem;
  padding: 16px var(--gutter);
  background: var(--white);
  font-size: 14px;
}
.bar__name { font-weight: 600; justify-self: start; }
.bar__nav { display: flex; gap: 1.25rem; }
.bar__nav a { font-weight: 600; color: var(--grey); transition: color .2s; }
.bar__nav a:hover, .bar__nav a[aria-current="page"] { color: var(--ink); }
.bar__mail { justify-self: end; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  gap: 20px;
  padding: clamp(1.5rem, 5vh, 3rem) var(--gutter) 4rem;
}
.split__side { grid-column: 1; grid-row: 1; align-self: start; position: sticky; top: 64px; }
.split__main { grid-column: 2; grid-row: 1; max-width: 860px; }

.label {
  font-size: 12px; font-weight: 400; letter-spacing: .06em; text-transform: uppercase;
  color: var(--grey);
  margin-bottom: .6rem;
}

@media (max-width: 860px) {
  .bar { grid-template-columns: 1fr auto; }
  .bar__mail { display: none; }
  .split { grid-template-columns: 1fr; gap: 2.5rem; }
  .split__side, .split__main { grid-column: 1; grid-row: auto; position: static; }
}

/* ==========================================================================
   Career — role first, activities condensed underneath
   ========================================================================== */

.cv-section + .cv-section { margin-top: 2.5rem; }

.entry + .entry { margin-top: 1.5rem; }
.entry__head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.entry__role { font-size: 17px; font-weight: 400; line-height: 1.25; letter-spacing: -0.01em; }
.entry__date { flex: none; font-size: 13px; color: var(--grey); font-variant-numeric: tabular-nums; }
.entry__org { color: var(--grey); margin-top: .1rem; }
.entry__list { margin-top: .45rem; max-width: 72ch; }
.entry__list li { position: relative; padding-left: .9rem; line-height: 1.38; }
.entry__list li + li { margin-top: .15rem; }
.entry__list li::before { content: "–"; position: absolute; left: 0; color: var(--grey); }
.entry__note { margin-top: .3rem; }

/* three columns: basics left, experience + education centre, projects right */
.cv3 { grid-template-columns: minmax(0, 3fr) minmax(0, 6fr) minmax(0, 3fr); column-gap: 40px; }
.cv3 .split__main { max-width: none; }
.cv3 .split__main .entry + .entry { margin-top: 2rem; }
.cv3 .split__main .entry__role { font-size: 22px; line-height: 1.2; letter-spacing: -0.02em; }
.cv3 .split__main .entry__org { font-size: 15px; margin-top: .2rem; }
.cv-projects { grid-column: 3; grid-row: 1; align-self: start; position: sticky; top: 64px; font-size: 13px; }
.cv-projects .entry + .entry { margin-top: 1.5rem; }
.cv-projects .entry__head { flex-direction: column; gap: 0; }
.cv-projects .entry__role { font-size: 15px; }
.split__side { font-size: 13px; }

/* hovering one entry brings it forward and quiets the rest */
@media (hover: hover) {
  .cv3 .entry { transition: opacity .3s; }
  .cv3 .split__main:hover .entry, .cv-projects:hover .entry { opacity: .3; }
  .cv3 .split__main .entry:hover, .cv-projects .entry:hover { opacity: 1; }
}

@media (max-width: 1080px) and (min-width: 861px) {
  .cv3 { grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); }
  .cv-projects { grid-column: 2; grid-row: 2; position: static; margin-top: 1rem; }
}
@media (max-width: 860px) {
  .cv3 { grid-template-columns: 1fr; }
  .cv-projects { grid-column: 1; grid-row: auto; position: static; }
}

/* bold: section titles, roles, companies */
.inner--career .label { font-weight: 600; color: var(--ink); }
.entry__role { font-weight: 600; }
.entry__org strong { font-weight: 600; color: var(--ink); }

.side-actions { margin-bottom: 1.75rem; }
.side-block + .side-block { margin-top: 1.5rem; }
.side-block li + li { margin-top: .1rem; }

@media (max-width: 560px) {
  .entry__head { flex-direction: column; gap: .1rem; }
}

/* ==========================================================================
   Creatives — project list, recap rectangles, project detail
   ========================================================================== */

.works-nav__list { font-size: 17px; line-height: 1.3; }
.works-nav__list li + li { margin-top: .35rem; }
.works-nav__list a { transition: color .2s; }
.works-nav__list a .muted { font-size: 13px; margin-left: .35rem; }
.works-nav__list a:hover, .works-nav__list a[aria-current="true"] { color: var(--ink); }
.is-detail .works-nav__list a { color: var(--grey); }
.is-detail .works-nav__list a[aria-current="true"], .is-detail .works-nav__list a:hover { color: var(--ink); }
.works-nav__mail { display: inline-block; margin-top: 2rem; }

/* Recap: one A-format rectangle per project */
.recap {
  --h: clamp(200px, 34vh, 320px);
  display: flex; flex-wrap: wrap;
  gap: 2rem 20px;
  align-items: start;
}
.card { display: block; width: min-content; }
.card__frame {
  display: block; overflow: hidden;
  height: var(--h);
  border-radius: 6px;
  background: var(--pastel-grey);
}
.card__frame--portrait  { aspect-ratio: 594 / 841; }
.card__frame--landscape { aspect-ratio: 841 / 594; }
.card__frame img { width: 100%; height: 100%; object-fit: cover; transition: opacity .3s; }
.card:hover .card__frame img { opacity: .85; }
.card__title { display: block; margin-top: .6rem; font-size: 15px; }
.card__meta { display: block; color: var(--grey); }

/* Detail */
.project__back { display: inline-block; margin-bottom: 1.5rem; color: var(--grey); }
.project__back:hover { color: var(--ink); }
.project__title { font-size: 26px; font-weight: 400; line-height: 1.15; letter-spacing: -0.02em; }
.project__meta { margin-top: .3rem; color: var(--grey); }
.project__text { margin-top: 1.25rem; max-width: 68ch; }
.project__text p + p { margin-top: .7em; }
.project__sub { margin-top: 2rem; }

.gallery { display: grid; gap: 1.25rem 20px; margin-top: 2rem; align-items: start; }
.gallery--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gallery--feature { grid-template-columns: 1fr 1fr; }
.gallery--feature li:first-child { grid-column: 1 / -1; }
.gallery button { display: block; width: 100%; border-radius: 6px; overflow: hidden; }
.gallery img { width: 100%; }
.gallery__cap { display: block; margin-top: .4rem; color: var(--grey); }

@media (max-width: 860px) {
  .works-nav__mail { display: none; }
}
@media (max-width: 560px) {
  .recap { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem 12px; }
  .card { width: auto; }
  .card__frame { height: auto; }
  .gallery--3 { grid-template-columns: 1fr 1fr; gap: 1.25rem 12px; }
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.lightbox {
  width: 100vw; height: 100vh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: var(--white);
}
.lightbox::backdrop { background: rgba(255, 255, 255, .6); }
.lightbox[open] { display: grid; place-items: center; }
.lightbox__fig { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 64px 72px; max-width: 100%; max-height: 100%; }
.lightbox__img { max-width: 100%; max-height: calc(100vh - 160px); width: auto; object-fit: contain; border-radius: 6px; }
.lightbox__cap { font-size: 13px; color: var(--grey); }
.lightbox__btn {
  position: absolute;
  min-width: 44px; height: 44px; padding: 0 14px;
  font-size: 14px;
}
.lightbox__btn:hover { text-decoration: underline; }
.lightbox__close { top: 12px; right: 12px; }
.lightbox__prev { left: 12px; top: 50%; translate: 0 -50%; }
.lightbox__next { right: 12px; top: 50%; translate: 0 -50%; }
@media (max-width: 760px) {
  .lightbox__fig { padding: 64px 12px 80px; }
  .lightbox__prev, .lightbox__next { top: auto; bottom: 16px; translate: none; }
}

/* ==========================================================================
   Page entrance (home only)
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
  .home__top, .door, .home__foot { animation: rise .8s var(--ease) both; }
  .door--career { animation-delay: .1s; }
  .door--creatives { animation-delay: .18s; }
  .home__foot { animation-delay: .26s; }
  @keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
}
