/* ═══════════════════════════════════════════════════════════════
   Alberto Redighieri — Portfolio
   style.css
═══════════════════════════════════════════════════════════════ */

/* ── Reset ───────────────────────────────────────────────────── */

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

html {
  scroll-behavior: smooth;
}

ul {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* ── Design tokens ───────────────────────────────────────────── */

:root {
  /* Palette */
  --bg-light:        #F5F5F0;
  --bg-dark:         #1A1A1A;
  --text-on-light:   #1A1A1A;
  --text-on-dark:    #F0F0EB;
  --accent:          #4A5240;

  /* Derived */
  --secondary-light: #6A6A65;
  --muted-light:     #9A9A95;
  --secondary-dark:  #ADADAA;
  --muted-dark:      #707070;

  --border-light:    rgba(26, 26, 26, 0.1);
  --border-dark:     rgba(240, 240, 235, 0.1);

  /* Frame placeholder colours */
  --frame-light:     #CECEC7;
  --frame-dark:      #2A2A26;

  /* Fonts */
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans:  'DM Sans', system-ui, -apple-system, sans-serif;

  /* Layout */
  --nav-h:   5rem;
  --pad-x:   clamp(1.5rem, 5vw, 5rem);
  --pad-y:   clamp(5rem, 9vw, 9rem);
  --col-gap: clamp(3rem, 5vw, 5.5rem);
}

/* ── Base ────────────────────────────────────────────────────── */

body {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.65;
  background-color: var(--bg-light);
  color: var(--text-on-light);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Navigation ──────────────────────────────────────────────── */

#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--pad-x);
  background-color: rgba(245, 245, 240, 0.93);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-on-light);
  transition: background-color 0.35s ease, color 0.35s ease;
}

#nav.nav--dark {
  background-color: rgba(26, 26, 26, 0.93);
  color: var(--text-on-dark);
}

.nav-brand {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.01em;
}

.nav-links {
  display: flex;
  gap: 2.5rem;
}

.nav-links a {
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  padding-bottom: 3px;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background-color: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.22s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  transform: scaleX(1);
}

.nav-links a.active {
  color: var(--accent);
}

#nav.nav--dark .nav-links a::after,
#nav.nav--dark .nav-links a.active::after {
  background-color: var(--text-on-dark);
}

#nav.nav--dark .nav-links a.active {
  color: var(--text-on-dark);
}

/* ── Section shared ──────────────────────────────────────────── */

section {
  padding: var(--pad-y) var(--pad-x);
}

.section-label {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--accent);
}

/* ── Hero ────────────────────────────────────────────────────── */

#hero {
  min-height: 100vh;
  padding-top: 0;
  padding-bottom: 0;
  display: flex;
  align-items: center;
}

.hero-inner {
  padding-top: var(--nav-h);
}

.hero-name {
  font-family: var(--serif);
  font-size: clamp(3rem, 8.5vw, 9rem);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.025em;
  margin-bottom: 2.25rem;
}

.hero-sub {
  font-size: clamp(0.875rem, 1.3vw, 1rem);
  font-weight: 300;
  line-height: 1.75;
  color: var(--secondary-light);
  max-width: 46ch;
}

/* ── Projects (shared) ───────────────────────────────────────── */

.project {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--col-gap);
  align-items: center;
  padding-top: clamp(4rem, 7vw, 7rem);
  padding-bottom: clamp(4rem, 7vw, 7rem);
}

.project + .project {
  border-top: 1px solid var(--border-light);
}

/* Frame placeholders */

.frame-grid {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  overflow: hidden;
}

.frame {
  background-color: var(--frame-light);
  aspect-ratio: 16 / 9;
  width: 100%;
  object-fit: cover;      /* crops <img> frames to fill 16:9 without distortion */
  display: block;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

.frame:hover {
  transform: scale(1.02);
}

.frame-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.375rem;
}

/* Project text */

.project-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem 0.9rem;
  margin-bottom: 1.1rem;
}

.project-client {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--muted-light);
}

.project-tag {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.22em 0.7em;
}

.project-title {
  font-family: var(--serif);
  font-size: clamp(2rem, 3.8vw, 4.5rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
}

.project-body {
  font-size: 0.9rem;
  font-weight: 300;
  line-height: 1.75;
  color: var(--secondary-light);
  max-width: 44ch;
  margin-bottom: 1.75rem;
}

.project-link {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  padding-bottom: 1px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.project-link:hover {
  border-bottom-color: var(--accent);
}

/* ── Documentary (personal films) ───────────────────────────── */

#documentary {
  background-color: var(--bg-light);
}

/* ── Work (commissioned) ─────────────────────────────────────── */

#work {
  background-color: var(--bg-light);
  border-top: 1px solid var(--border-light);
}

/* ── Art (dark) ──────────────────────────────────────────────── */

#art {
  background-color: var(--bg-dark);
  color: var(--text-on-dark);
}

#art .section-label {
  color: rgba(240, 240, 235, 0.45);
  border-bottom-color: rgba(240, 240, 235, 0.45);
}

#art .project + .project {
  border-top-color: var(--border-dark);
}

#art .frame {
  background-color: var(--bg-dark);
  aspect-ratio: auto;
  object-fit: unset;
  height: auto;
}

#art .project-client {
  color: var(--muted-dark);
}

#art .project-tag {
  color: rgba(240, 240, 235, 0.65);
  border-color: rgba(240, 240, 235, 0.25);
}

#art .project-body {
  color: var(--secondary-dark);
}

#art .project-link {
  color: rgba(240, 240, 235, 0.75);
  border-bottom-color: transparent;
}

#art .project-link:hover {
  border-bottom-color: rgba(240, 240, 235, 0.75);
}

/* ── About ───────────────────────────────────────────────────── */

#about {
  background-color: var(--bg-light);
}

.about-body {
  max-width: 62ch;
}

.about-text {
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  font-weight: 300;
  line-height: 1.8;
  color: var(--text-on-light);
}

.about-text + .about-text {
  margin-top: 1.6em;
}

/* ── Contact ─────────────────────────────────────────────────── */

#contact {
  background-color: var(--bg-light);
  border-top: 1px solid var(--border-light);
}

.contact-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.contact-icons {
  display: flex;
  align-items: center;
  gap: 2.25rem;
}

.contact-icon {
  display: flex;
  align-items: center;
  color: var(--text-on-light);
  transition: color 0.2s ease;
}

.contact-icon:hover {
  color: var(--accent);
}

.contact-icon svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
  display: block;
}

/* ── Footer ──────────────────────────────────────────────────── */

#footer {
  padding: 1.75rem var(--pad-x);
  border-top: 1px solid var(--border-light);
  background-color: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-copy {
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--muted-light);
}

.footer-icons {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.footer-icon {
  display: flex;
  align-items: center;
  color: var(--muted-light);
  transition: color 0.2s ease;
}

.footer-icon:hover {
  color: var(--accent);
}

.footer-icon svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  display: block;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 768px) {
  :root {
    --pad-x: 1.25rem;
    --pad-y: 4rem;
    --col-gap: 2.5rem;
  }

  .nav-links {
    gap: 1.5rem;
  }

  .project {
    grid-template-columns: 1fr;
  }

  /* Always show media above text on mobile, regardless of DOM order */
  .project-media { order: 1; }
  .project-text  { order: 2; }

  .project-title {
    font-size: clamp(1.8rem, 7vw, 2.8rem);
  }

  .hero-name {
    font-size: clamp(2.8rem, 13vw, 4.5rem);
  }

  .about-body {
    max-width: 100%;
  }
}

@media (max-width: 520px) {
  .nav-brand {
    font-size: 0.85rem;
  }

  .nav-links {
    gap: 0.75rem;
  }

  .nav-links a {
    font-size: 0.68rem;
    letter-spacing: 0;
  }

  .contact-icons {
    gap: 1.75rem;
  }

  .contact-icon svg {
    width: 28px;
    height: 28px;
  }
}

/* Clickable cursor on embeddable frames */
article[data-embed] .frame {
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════
   Institutional page  (/institutional.html)
═══════════════════════════════════════════════════════════════ */

.inst-header {
  padding: 1.75rem var(--pad-x);
  border-bottom: 1px solid var(--border-light);
  background-color: var(--bg-light);
}

.inst-back {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.015em;
  color: var(--text-on-light);
  transition: color 0.2s ease;
}

.inst-back:hover {
  color: var(--accent);
}

.inst-main {
  max-width: 860px;
  margin: 0 auto;
  padding: var(--pad-y) var(--pad-x);
}

.inst-intro {
  margin-bottom: 5rem;
  padding-bottom: 4rem;
  border-bottom: 1px solid var(--border-light);
}

.inst-title {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 400;
  font-style: italic;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--text-on-light);
  margin-bottom: 0.4rem;
}

.inst-subtitle {
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2rem;
}

.inst-note {
  font-size: 0.875rem;
  font-weight: 300;
  line-height: 1.7;
  color: var(--secondary-light);
  max-width: 52ch;
}

.inst-note a {
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.inst-note a:hover {
  border-bottom-color: var(--accent);
}

.inst-list {
  list-style: none;
  counter-reset: inst-counter;
}

.inst-item {
  counter-increment: inst-counter;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem 3rem;
  align-items: start;
  padding-block: 2.5rem;
  border-bottom: 1px solid var(--border-light);
}

.inst-item:first-child {
  border-top: 1px solid var(--border-light);
}

.inst-item-num {
  display: none; /* counter visible via pseudo */
}

.inst-item-body {
  position: relative;
  padding-left: 3rem;
}

.inst-item-body::before {
  content: counter(inst-counter, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.1em;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--muted-light);
}

.inst-item-title {
  font-family: var(--serif);
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 0.35rem;
  color: var(--text-on-light);
}

.inst-item-client {
  font-size: 0.78rem;
  font-weight: 300;
  color: var(--muted-light);
  margin-bottom: 0.5rem;
}

.inst-item-note {
  font-size: 0.83rem;
  font-weight: 300;
  line-height: 1.65;
  color: var(--secondary-light);
  max-width: 52ch;
}

.inst-item-links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  padding-top: 0.15rem;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .inst-item {
    grid-template-columns: 1fr;
  }

  .inst-item-links {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
  }
}
