/* ============================================================
   LUCAS IEZZI PORTFOLIO  —  style.css
   Mobile-first, CSS custom properties, no framework
   ============================================================ */

/* ── Google Fonts (Inter) are loaded via <link> in head.ejs ── */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

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

button, input, textarea, select {
  font: inherit;
}

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

/* ── Custom properties ──────────────────────────────────────── */
:root {
  /* Palette */
  --color-bg:        #ffffff;
  --color-text:      #1a1b1f;
  --color-muted:     #5c5c5c;
  --color-subtle:    #999999;
  --color-border:    #e0e0e0;
  --color-hover-bg:  #f5f5f5;
  --color-placeholder: #e8e8e8;

  /* Type */
  --font:            'Montserrat', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --font-weight-light:  300;
  --font-weight-reg:    400;
  --font-weight-med:    500;
  --font-weight-semi:   600;
  --font-weight-bold:   700;

  /* Layout */
  --nav-height:      100px;
  --container-max:   1400px;
  --content-max:     960px;
  --gap-sm:          16px;
  --gap-md:          24px;
  --gap-lg:          48px;
  --gap-xl:          80px;

  /* Responsive padding (clamp: 24px mobile → 96px desktop) */
  --side-pad:        clamp(24px, 6vw, 96px);

  /* Transitions */
  --ease:            0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:        0.3s cubic-bezier(0, 0, 0.2, 1);

  /* ── Design tokens ──────────────────────────────────────── */
  --d-name-size:          40px;
  --d-name-weight:        500;
  --d-name-lh:            1;
  --d-name-gap:           16px;
  --d-bio-size:           24px;
  --d-bio-weight:         400;
  --d-bio-lh:             1.333;
  --d-card-size:          19.2px;
  --d-proj-title-size:    32px;
  --d-proj-title-weight:  700;
  --d-sect-head-size:     22px;
  --d-sect-head-weight:   700;
  --d-body-size:          16px;
  --d-hero-top:           44px;
  --d-hero-bot:           40px;
  --d-proj-top:           40px;
  --d-proj-header-mb:     0px;
  --d-section-gap:        48px;
}

/* ── Base ───────────────────────────────────────────────────── */
body {
  font-family: var(--font);
  font-weight: var(--font-weight-reg);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

/* ── Focus styles (accessibility) ──────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── Container ──────────────────────────────────────────────── */
.container {
  width: 100%;
  padding-inline: 7%;
}

@media (max-width: 640px) {
  .container { padding-inline: 15px; }
}

/* ── Navigation ─────────────────────────────────────────────── */
.site-nav {
  background: var(--color-bg);
}

.nav-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--nav-height);
}

/* Left: small logo slot */
.nav-logo-small {
  display: flex;
  align-items: center;
}
.nav-logo-small a { display: flex; align-items: center; text-decoration: none; margin-top: 22px; }
.nav-logo-small img { height: var(--logo-nav-size, 52px); width: auto; max-width: 200px; object-fit: contain; display: block; }

/* Center: logomark slot */
.nav-logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-logo-mark a { display: flex; align-items: center; text-decoration: none; margin-top: 22px; }
.nav-logo-mark img { height: var(--logo-nav-size, 52px); width: auto; max-width: 400px; object-fit: contain; display: block; }

/* Right: links + hamburger */
.nav-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* Hero logo slots — hidden by default; enable via UI Sandbox (logo.showMark / logo.showSmall) */
.hero-logo-small,
.hero-logo-mark {
  display: none;
  margin-bottom: 1rem;
}
.hero-logo-small { align-items: flex-start; }
.hero-logo-mark  { align-items: center; justify-content: center; }
.hero-logo-small img { height: 48px; width: auto; max-width: 120px; object-fit: contain; }
.hero-logo-mark  img { height: 52px; width: auto; max-width: 240px; object-fit: contain; }

@media (max-width: 768px) {
  .nav-inner { grid-template-columns: auto 1fr auto; }
  .nav-logo-mark { display: none !important; }
}

/* Desktop nav links */
.nav-links-desktop {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links-desktop a {
  font-size: 12px;
  font-weight: var(--font-weight-med);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  text-decoration: none;
  transition: color var(--ease);
}
.nav-links-desktop a:hover { color: var(--color-text); }

/* Hamburger button — hidden on desktop */
.nav-hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-right: -8px;
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  position: relative;
  z-index: 301;
}

@media (max-width: 768px) {
  .nav-hamburger { display: flex; }
  .nav-links-desktop { display: none; }
  .nav-right { gap: 0; }
}

.nav-hamburger span {
  display: block;
  height: 1.5px;
  width: 22px;
  background: var(--color-text);
  border-radius: 1px;
  transition:
    transform var(--ease-out),
    opacity var(--ease-out);
  transform-origin: center;
}

/* Hamburger → X animation */
.nav-hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.nav-hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.nav-hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* Full-screen nav menu (mobile overlay + desktop drawer) */
.nav-menu {
  position: fixed;
  inset: 0;
  top: var(--nav-height);
  background: var(--color-bg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;

  /* Hidden by default */
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition:
    opacity var(--ease-out),
    visibility var(--ease-out);
}

.nav-menu.is-open {
  opacity: 1;
  pointer-events: all;
  visibility: visible;
}

.nav-menu a {
  display: block;
  font-size: clamp(20px, 4vw, 28px);
  font-weight: var(--font-weight-light);
  letter-spacing: -0.02em;
  color: var(--color-text);
  padding: 12px 24px;
  text-decoration: none;
  transition: opacity var(--ease);
}
.nav-menu a:hover { opacity: 0.5; }

/* ── Homepage hero ──────────────────────────────────────────── */
.hero {
  padding-top: var(--d-hero-top);
  padding-bottom: var(--d-hero-bot);
}

.site-name {
  font-size: var(--d-name-size);
  font-weight: var(--d-name-weight);
  line-height: var(--d-name-lh);
  margin-bottom: var(--d-name-gap);
  color: #4b4e58;
  width: 50%;
}

.hero-text {
  font-size: var(--d-bio-size);
  font-weight: var(--d-bio-weight);
  line-height: var(--d-bio-lh);
  color: var(--color-text);
}

/* The word "crafting" is bold italic */
.hero-text .highlight {
  font-weight: var(--font-weight-bold);
  font-style: italic;
}

/* ── Project grid (homepage) ────────────────────────────────── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem 1rem;
  padding-bottom: 40px;
}

@media (max-width: 960px) {
  .project-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .project-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

/* Project card */
.project-card {
  display: block;
  text-decoration: none;
  color: inherit;
}

.project-card-image {
  aspect-ratio: 3 / 2;
  background: var(--color-placeholder);
  overflow: hidden;
  margin-bottom: 12px;
  position: relative;
}

.project-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.5s var(--ease-out);
  will-change: transform;
}

.project-card:hover .project-card-image img {
  transform: scale(1.04);
}

/* Placeholder when no thumbnail exists */
.project-card-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-subtle);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.project-card-title {
  font-size: var(--d-card-size);
  font-weight: 300;
  line-height: 1.5rem;
  color: #212327;
  text-align: center;
  margin-top: 5px;
  transition: opacity var(--ease);
}

.project-card:hover .project-card-title {
  opacity: 0.55;
}

/* ── Project page ───────────────────────────────────────────── */

/* Project header */
.project-header {
  margin-top: var(--d-hero-top);
  margin-bottom: var(--d-proj-header-mb);
}

.project-title {
  font-size: 2.2rem;
  font-weight: 600;
  line-height: 2.5rem;
  margin-bottom: 10px;
}

.project-subtitle {
  opacity: 0.6;
  color: #2c2e36;
  font-size: 1rem;
  line-height: 2rem;
}

/* Hero image — full-bleed (outside container) */
.project-hero-image {
  width: 100%;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.project-hero-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* Project sections */
.project-section {
  margin-bottom: var(--d-section-gap);
}

.project-section__heading {
  font-size: 2rem;
  font-weight: 500;
  line-height: 2rem;
  margin-bottom: 10px;
  padding-top: 42px;
}

.project-section__body {
  color: #2c2e36;
  font-size: 1.5rem;
  line-height: 2rem;
}

/* Section images — inside container, same width as text */
.project-section-images {
  margin-top: 22px;
  display: flex;
  gap: 0;
}

/* Multi-image rows: JS sets flex proportional to each image's natural aspect ratio
   so all images in a row share the same height and together fill the full width.
   These are fallback values before JS runs. */
.project-section-images img {
  flex: 1 1 0%;
  min-width: 0;
  width: 0;
  height: auto;
  display: block;
}

/* Single image: natural proportions, full width */
.project-section-images:has(img:only-child) img {
  flex: none;
  width: 100%;
}

/* Consecutive rows in a multi-row section: flush together */
.project-section-images + .project-section-images {
  margin-top: 0;
}

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 28px 0;
  text-align: center;
  color: var(--color-subtle);
  font-size: 12px;
  letter-spacing: 0.01em;
}

.site-footer__link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: color var(--ease);
}
.site-footer__link:hover { color: var(--color-text); text-decoration: underline; text-underline-offset: 2px; }
.site-footer__sep { margin: 0 8px; }

/* ── Cookie banner (slim bar above the nav) ─────────────────── */
/* display:flex below would otherwise override the hidden attribute */
.cookie-banner[hidden],
.privacy-modal[hidden] { display: none; }

.cookie-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px var(--side-pad);
  background: #f5f5f5;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.4;
}

.cookie-banner__text {
  margin: 0;
  text-align: center;
}

.cookie-banner__link {
  background: none;
  border: none;
  padding: 0;
  margin-left: 4px;
  font: inherit;
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.cookie-banner__ack {
  flex: none;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-bg);
  font: inherit;
  line-height: 1;
  color: var(--color-text);
  cursor: pointer;
  padding: 4px 10px;
  transition: border-color var(--ease);
}
.cookie-banner__ack:hover { border-color: var(--color-subtle); }

/* ── Privacy notice modal ──────────────────────────────────── */
.privacy-modal {
  position: fixed;
  inset: 0;
  z-index: 410;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.privacy-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.privacy-modal__panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--color-bg);
  color: var(--color-text);
  border-radius: 6px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
}

.privacy-modal__header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.privacy-modal__header h2 {
  font-size: 15px;
  font-weight: var(--font-weight-semi);
}

.privacy-modal__close {
  border: none;
  background: none;
  font-size: 18px;
  line-height: 1;
  color: var(--color-muted);
  cursor: pointer;
  padding: 4px;
}
.privacy-modal__close:hover { color: var(--color-text); }

.privacy-modal__body {
  padding: 12px 16px 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-muted);
}

.privacy-modal__body p { margin: 0 0 10px; }
.privacy-modal__body p:last-child { margin-bottom: 0; }
.privacy-modal__body ul { margin: 0 0 10px; padding-left: 18px; }
.privacy-modal__body li { margin-bottom: 6px; }
.privacy-modal__body strong { color: var(--color-text); }
.privacy-modal__body a { color: var(--color-text); text-decoration: underline; text-underline-offset: 2px; }
.privacy-modal__body h3 {
  margin: 14px 0 4px;
  font-size: 13px;
  font-weight: var(--font-weight-semi);
  color: var(--color-text);
}
.privacy-modal__meta { margin-top: 16px; font-size: 12px; color: var(--color-subtle); }

/* ── Error / 404 pages ──────────────────────────────────────── */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 60dvh;
  gap: 16px;
  padding: var(--gap-xl) var(--side-pad);
}

.error-page__code {
  font-size: clamp(56px, 12vw, 100px);
  font-weight: var(--font-weight-semi);
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--color-border);
}

.error-page__title {
  font-size: clamp(18px, 3vw, 24px);
  font-weight: var(--font-weight-med);
  letter-spacing: -0.02em;
}

.error-page__body {
  font-size: 15px;
  color: var(--color-muted);
}

.error-page a {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 14px;
  transition: opacity var(--ease);
}
.error-page a:hover { opacity: 0.5; }

/* ── Utility ────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
