/* =========================================================
   Ron Pucherelli portfolio, shared styles for every page.
   Values are matched to the original Squarespace site.
   ========================================================= */

:root {
  --bg: #000;
  --text: #fff;
  --gray: #a1a1a1;        /* secondary text (Resume) */
  --cyan: #05f9fb;        /* company names (Resume) */
  --gold: #fbf905;        /* awards (Resume) */

  --page-pad: 1vw;        /* left/right page padding */
  --gap: 0.5vw;           /* gallery gap */
  --col-gap: 11px;        /* text page column gap */
  --header-pad: 3vw;      /* header top/bottom padding */
  --logo-height: 111px;
  --fade: 0.2s ease-in-out;

  /* Fluid text sizes, Squarespace's formula: 16px + (size - 1) x 1.2vw,
     growing with the window until it's 1500px wide. */
  --u: min(1vw, 15px);
  --fs-body: calc(16px + 0.24 * var(--u));   /* size 1.2: body text, menu */
  --fs-btn:  calc(16px + 0.12 * var(--u));   /* size 1.1: buttons */
  --fs-h3:   calc(16px + 1.44 * var(--u));   /* size 2.2: Resume section headings */
  --fs-h1:   calc(16px + 3.12 * var(--u));   /* size 3.6: page titles */
  /* Text-page content width: 1vw side margins (never under 11px), capped at 1500px */
  --container: min(1500px, calc(100vw - 2 * max(1vw, 11px)));
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Montserrat", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2.5vw;                     /* logo to menu */
  padding: var(--header-pad) var(--page-pad);
  background: var(--bg);
  transition: transform 0.3s ease;
}
.site-header.hidden { transform: translateY(-100%); }

.logo { flex: 0 0 auto; }
.logo img {
  display: block;
  height: var(--logo-height);   /* stays full size on desktop, like Squarespace */
  width: auto;
  max-width: none;
}

/* The menu sits to the right of the logo. When the window gets narrow,
   items wrap onto new right-aligned lines instead of shrinking the logo. */
.header-right { flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 2.5vw; }

/* Spacing works like Squarespace's: every item after the first has a 1.5vw left margin,
   which still counts when it starts a new line, so the menu wraps at the same points. */
.main-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.main-nav a + a { margin-left: 1.5vw; }
.main-nav a {
  font-size: var(--fs-body);
  line-height: 1.6;
  padding: 0.1em 0;
  white-space: nowrap;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
}
.main-nav a.active,
.main-nav a:hover { background-size: 100% 1px; }

.social { flex: 0 0 auto; display: flex; align-items: center; gap: 1.5vw; }
.social svg { width: 20px; height: 20px; fill: var(--text); display: block; }
.social a:hover { opacity: 0.7; }

.menu-toggle {
  display: none;
  position: relative;
  width: 36px; height: 36px;
  padding: 0; border: 0;
  background: none;
  cursor: pointer;
}
.menu-toggle span {
  position: absolute; left: 4px; right: 4px;
  height: 1px; background: var(--text);
  transition: transform 0.25s ease, top 0.25s ease;
}
.menu-toggle span:nth-child(1) { top: 13px; }
.menu-toggle span:nth-child(2) { top: 22px; }
.menu-open .menu-toggle span:nth-child(1) { top: 18px; transform: rotate(45deg); }
.menu-open .menu-toggle span:nth-child(2) { top: 18px; transform: rotate(-45deg); }

/* ---------- Page basics ---------- */

main { padding: 0 var(--page-pad); }

h1, h2, h3, h4 { font-weight: 400; margin: 0; }

.page-title {
  padding: 0 0 1vw;
  text-align: center;
  font-size: var(--fs-h1);
  line-height: 1.255;
}

footer {
  padding: 4rem var(--page-pad) 3rem;
  text-align: center;
  font-size: var(--fs-body);
}

/* ---------- Galleries (Work, Process, VisDev, Fern) ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);   /* always 3 across, tiles scale with the window */
  gap: var(--gap);
}

.tile {
  position: relative;
  display: block;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: #111;
  cursor: pointer;
}
.tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tile .thumb { opacity: 1; transition: opacity var(--fade); }
.tile .gif { opacity: 0; transition: opacity var(--fade); }

/* Crossfade to the GIF once it has loaded */
.tile.gif-ready:hover .gif,
.tile.gif-ready:focus-visible .gif { opacity: 1; }
.tile.gif-ready:hover .thumb,
.tile.gif-ready:focus-visible .thumb { opacity: 0; }

/* Fade-up as tiles come into view (Squarespace's "fade-up" gallery animation).
   Only applies when the script is running, so tiles never get stuck invisible. */
.js .grid[data-animation="fade-up"] .tile { opacity: 0; }
.js .grid[data-animation="fade-up"] .tile.show {
  animation: tile-fade-up 800ms cubic-bezier(.4, 0, .2, 1) both;
}
@keyframes tile-fade-up {
  from { opacity: 0; transform: translateY(25px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .js .grid[data-animation="fade-up"] .tile { opacity: 1; }
  .js .grid[data-animation="fade-up"] .tile.show { animation: none; }
}

/* Two-column version used on the Fern page. Like Squarespace, its side margin is
   the larger of 1vw + 11px or 2vw, the width caps at 1500px, and each image is
   10 grid rows tall (rows are 2.15% of the content width, with 11px gaps). */
.grid--two {
  --fern-container: min(1500px, calc(100vw - 2 * max(1vw + 11px, 2vw)));
  width: var(--fern-container);
  margin: 0 auto;
  grid-template-columns: repeat(2, 1fr);
  gap: 11px;
}
.grid--two .tile { aspect-ratio: auto; height: calc(min(1500px, 96vw) * 0.215 + 99px); }
/* Fern title: its box is 83px or 3 grid rows tall (whichever is bigger), then a 2vw gap */
.fern-title { font-size: 83px; line-height: 1; box-sizing: content-box; min-height: max(83px, calc(var(--container) * 0.0645 + 22px)); padding: 0 0 2vw; }

/* ---------- Text pages (About Me, Resume, Contact) ----------
   A 24-column grid like Squarespace's. Place a block with
   style="grid-column: <start> / span <width>". On phones every
   block stacks full width automatically. */

.layout {
  width: var(--container);   /* Squarespace's content width: columns stop growing at 1500px and stay centered */
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  column-gap: var(--col-gap);
  row-gap: 0;
  align-items: start;
}

/* Resume */
.resume { font-size: var(--fs-body); }
/* Squarespace's text spacing */
.resume p { margin: 16px 0; white-space: pre-wrap; }   /* keeps spaces exactly as typed, like Squarespace */
.resume > :first-child { margin-top: 0; }
.resume h3 { font-size: var(--fs-h3); font-weight: 700; line-height: 1.333; margin: 32px 0; }
.resume ul { margin: 1em 0; padding-left: 40px; }
.resume li { margin: 0; }
.resume li p { margin: 0.5em 0; }
.resume .lead { color: var(--gray); }
.gray { color: var(--gray); }
.cyan { color: var(--cyan); }
.gold { color: var(--gold); }

/* About Me */
.about-photo img {
  display: block;
  width: 100%;
  /* Squarespace sizes this box as 10 grid rows (each 2.15% of the content width) plus 9 gaps */
  height: calc(var(--container) * 0.215 + 99px);
  object-fit: contain;
  object-position: left center;
}
.caption { margin: 0.6rem 0 0; text-align: right; font-size: 16px; font-style: italic; }
.about-text { font-size: var(--fs-body); line-height: 1.388; }
.about-text p { margin: 0 0 1.388em; white-space: pre-wrap; }
.about-text p:last-of-type { margin-bottom: 0; }
/* The button sits in a 2-row slot under the text, vertically centered, 4 columns wide at most */
.about-button {
  display: flex;
  align-items: center;
  margin-top: 11px;
  min-height: calc(var(--container) * 0.043 + 11px);
  max-width: calc((var(--container) - 23 * var(--col-gap)) / 24 * 4 + 3 * var(--col-gap));
}

/* Buttons (About "Contact Me", form "Send") */
.button {
  display: inline-block;
  padding: 20.8px 34.736px;
  border: 2px solid var(--text);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-btn);
  font-weight: 500;
  line-height: normal;
  letter-spacing: 0.04em;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.button:hover { background: var(--text); color: var(--bg); }

/* Contact (spacing and sizes match the Squarespace form) */
.contact-layout { padding-top: 6.6vw; }
.contact-title { text-align: right; font-size: var(--fs-h1); line-height: 1.255; }
.contact-form { font-size: var(--fs-body); }
.contact-form .button { font-size: 16px; line-height: 21px; }
.contact-form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.contact-form legend,
.contact-form .field > label { display: block; padding: 0 0 4px; line-height: 1.6; }
.contact-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 1px; }
.contact-form .row label { display: block; font-size: 16px; line-height: 1.6; padding: 4px 0 2px; margin-bottom: -1px; }
.contact-form .row > div,
.contact-form .field { margin-bottom: 20px; }
.contact-form .req { font-size: 16px; opacity: 0.7; margin-left: 10px; }
.contact-form input,
.contact-form textarea {
  display: block;
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(0, 0, 0, 0.55);
  border-radius: 0;
  background: rgba(250, 250, 250, 0.8);
  color: #000;
  font-family: inherit;
  font-size: var(--fs-body);
  line-height: 1.6;
}
.contact-form textarea { height: 100px; resize: vertical; }
.contact-form input:focus,
.contact-form textarea:focus { outline: 2px solid var(--cyan); outline-offset: 0; background: #fafafa; }
.honeypot { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.form-thanks { font-size: var(--fs-body); display: none; }
.sent .form-thanks { display: block; }
.sent .contact-form { display: none; }

/* ---------- Lightbox (matches the Squarespace lightbox plugin) ---------- */

.lightbox { position: fixed; inset: 0; z-index: 1000; visibility: hidden; pointer-events: none; }
.lightbox.open { visibility: visible; pointer-events: auto; }

.lb-bg {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.95);   /* same as the Squarespace lightbox plugin: black at 95% */
  opacity: 0;
  transition: opacity 0.366s cubic-bezier(.47,0,.74,.71);
}
.lightbox.open .lb-bg { opacity: 1; transition-timing-function: cubic-bezier(.22,.61,.36,1); }

.lb-stage {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 44px;
  opacity: 0;
  transition: opacity 0.366s ease;
}
.lightbox.open .lb-stage { opacity: 1; }

.lb-video { width: min(100%, calc((100vh - 88px) * 16 / 9)); aspect-ratio: 16 / 9; background: #000; }
.lb-video iframe { width: 100%; height: 100%; border: 0; display: block; }

.lb-btn, .lb-counter { position: absolute; z-index: 2; opacity: 1; transition: opacity 0.25s ease; }
.lightbox.idle .lb-btn,
.lightbox.idle .lb-counter { opacity: 0; }

.lb-btn { width: 44px; height: 44px; padding: 10px; border: 0; background: rgba(30,30,30,.6); color: #ccc; cursor: pointer; }
.lb-btn:hover { color: #fff; }
.lb-btn svg { width: 100%; height: 100%; fill: currentColor; display: block; }
.lb-btn[hidden] { display: none; }
.lb-close { top: 0; right: 0; }
.lb-prev, .lb-next { top: calc(50% - 50px); width: 70px; height: 100px; padding: 31px 26px 31px 6px; background: none; }
.lb-prev { left: 0; }
.lb-next { right: 0; padding: 31px 6px 31px 26px; }
.lb-prev svg, .lb-next svg { background: rgba(30,30,30,.6); padding: 6px; width: 40px; height: 40px; }
.lb-counter { top: 0; left: 0; height: 44px; line-height: 44px; padding: 0 10px; color: #ccc; font-size: 13px; mix-blend-mode: difference; }

body.no-scroll { overflow: hidden; }

/* ---------- Smaller windows ---------- */

/* Phone-style menu below 800px, like the original */
@media (max-width: 799px) {
  :root { --header-pad: 6vw; --logo-height: 12.25vw; }

  .menu-toggle { display: block; z-index: 2; flex: 0 0 auto; }
  .header-right {
    position: fixed; inset: 0;
    flex-direction: column; justify-content: center; gap: 2.5rem;
    background: var(--bg);
    opacity: 0; visibility: hidden;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
  }
  .menu-open .header-right { opacity: 1; visibility: visible; transition: opacity 0.25s ease; }
  .main-nav { flex-direction: column; gap: 1.2rem; }
  .main-nav a + a { margin-left: 0; }
  .main-nav a { font-size: 1.6rem; }
  .social { gap: 1.5rem; }
  .logo img { max-width: calc(100vw - var(--page-pad) * 2 - 50px); object-fit: contain; object-position: left center; }
}

/* Phone layout below 768px */
@media (max-width: 767px) {
  :root { --logo-height: 30px; }

  main { padding: 0 4vw; }
  .page-title, .contact-title, .fern-title { font-size: 2.4rem; text-align: center !important; padding: 1rem 0 !important; }

  .layout { display: block; width: auto; }
  .layout > * { margin-bottom: 1.5rem; }
  .contact-layout { padding-top: 0; }
  .about-photo img { height: auto; }
  .contact-form .row { grid-template-columns: 1fr; }

  .grid--two { grid-template-columns: 1fr; width: auto; }
  .grid--two .tile { height: auto; aspect-ratio: 686 / 396; }

  .lb-stage { padding: 44px 0; }
  .lb-prev, .lb-next { display: none; }
}
