/* Tommaso Pandolfo — portfolio
   The page is a sheet of paper that gets stained with ink as you read down it.
   Structural layer (rules, registration marks, labels) is drawn in the non-photo
   blue Tommaso uses for his underdrawing; the ink itself is the content. */

:root {
  --paper:    #E8E8E4;
  --paper-in: #DFDFDA;
  --ink:      #15161A;
  --void:     #0A0A0C;
  --pencil:   #5A8FC7;
  --blood:    #A82430;
  --mute:     #6C6C68;
  --mute-d:   #8C8C90;
  --rule:     rgba(21, 22, 26, .16);
  --rule-d:   rgba(255, 255, 255, .14);

  --display: "Bodoni Moda", "Didot", "Times New Roman", serif;
  --body:    "Archivo", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(1.25rem, 5vw, 5rem);
  --measure: 1440px;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

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

body {
  margin: 0;
  background: var(--void);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; }

button {
  font: inherit; color: inherit; background: none;
  border: 0; padding: 0; margin: 0; cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--pencil);
  outline-offset: 3px;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper);
  padding: .7rem 1.1rem; font-family: var(--mono); font-size: .78rem;
}
.skip:focus { left: 0; }

.wrap {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- shared type ---------- */

.eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--pencil);
}

.h2 {
  margin: .5rem 0 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.2rem, 6vw, 4.25rem);
  line-height: .98;
  letter-spacing: -.015em;
}

.head {
  position: relative;
  padding-block: clamp(4rem, 11vh, 8rem) clamp(2.5rem, 6vh, 4.5rem);
  border-bottom: 1px solid var(--rule);
}
.head--dark { border-bottom-color: var(--rule-d); }

/* Registration mark and printer's crop marks — the same marks Tommaso rules
   onto his sheets in non-photo blue before he inks. */
.reg {
  width: 21px; height: 21px;
  fill: none; stroke: var(--pencil); stroke-width: 1.15;
  opacity: .85;
}
.crop {
  width: 22px; height: 22px;
  fill: none; stroke: var(--pencil); stroke-width: 1;
  opacity: .7;
}
.head > .reg {
  position: absolute;
  top: clamp(2.4rem, 7vh, 5rem);
  left: 0;
}

/* ---------- surfaces ---------- */

.sheet, .hero {
  position: relative;
  background: var(--paper);
  color: var(--ink);
}
.sheet::after, .hero::after {
  content: "";
  position: absolute; inset: 0;
  background-image: var(--grain);
  background-size: 180px 180px;
  opacity: .16;
  mix-blend-mode: multiply;
  pointer-events: none;
}
.sheet > *, .hero > * { position: relative; z-index: 1; }

.void {
  position: relative;
  background: var(--void);
  color: #EDEDEF;
}
.void .h2 { color: #F2F2F0; }
.void figcaption { color: var(--mute-d); }

/* ---------- hero ---------- */

.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(4.5rem, 12vh, 7rem) var(--gutter) clamp(1.6rem, 5vh, 2.75rem);
  text-align: center;
}

.hero__marks {
  position: absolute;
  inset: clamp(1rem, 3vw, 2.1rem);
  z-index: 2;
  pointer-events: none;
}
.hero__marks .crop,
.commissions__marks .crop { position: absolute; }
.hero__marks .crop:nth-child(1),
.commissions__marks .crop:nth-child(1) { top: 0; left: 0; }
.hero__marks .crop:nth-child(2),
.commissions__marks .crop:nth-child(2) { top: 0; right: 0; transform: rotate(90deg); }
.hero__marks .crop:nth-child(3),
.commissions__marks .crop:nth-child(3) { bottom: 0; left: 0; transform: rotate(-90deg); }
.hero__marks .crop:nth-child(4),
.commissions__marks .crop:nth-child(4) { bottom: 0; right: 0; transform: rotate(180deg); }

.hero__inner { margin-block: auto; }

.splat {
  width: clamp(72px, 9vw, 104px);
  height: auto;
  margin: 0 auto clamp(1.4rem, 3.5vh, 2.4rem);
  display: block;
}
.splat__ink  { fill: var(--ink); }
.splat__blood { fill: var(--blood); }

.hero__name {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(3.05rem, 11.8vw, 10rem);
  line-height: .96;
  font-variant-ligatures: none;
}
.hero__line {
  display: block;
  text-transform: uppercase;
}
/* Optically justify the two words to one measure: TOMMASO is two glyphs short,
   so it carries the extra tracking. text-indent cancels the trailing letter-space
   that would otherwise pull centred text off-axis. */
.hero__line--a { letter-spacing: .062em; text-indent: .062em; }
.hero__line--b { letter-spacing: .012em; text-indent: .012em; }

.hero__role {
  margin: clamp(1.5rem, 4vh, 2.4rem) 0 0;
  font-family: var(--mono);
  font-size: clamp(.7rem, 1.5vw, .8rem);
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--mute);
}

.hero__foot {
  width: 100%;
  max-width: var(--measure);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.tag {
  text-decoration: none;
  color: var(--ink);
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--rule);
  transition: border-color .25s, color .25s;
}
.tag::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: .6em;
  border-radius: 50%;
  background: var(--blood);
  vertical-align: .12em;
}
.tag:hover { color: var(--blood); border-bottom-color: var(--blood); }

.hint {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: .55rem;
  text-decoration: none;
  color: var(--mute);
}
.hint svg {
  width: 10px; height: 28px;
  fill: none; stroke: currentColor; stroke-width: 1.2;
}
.hint:hover { color: var(--ink); }

/* ---------- works ---------- */

.work { margin: 0; }

.work__hit {
  display: block;
  width: 100%;
  position: relative;
  cursor: zoom-in;
}
.work__hit img {
  width: 100%;
  transition: opacity .35s ease;
}
.work__hit:hover img { opacity: .86; }

figcaption {
  margin-top: .85rem;
  font-size: .82rem;
  color: var(--mute);
  line-height: 1.4;
}
figcaption cite {
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: 1.06rem;
  color: var(--ink);
}
.void figcaption cite { color: #EDEDEF; }
figcaption span {
  font-family: var(--mono);
  font-size: .72rem;
  margin-left: .35em;   /* italic Bodoni eats the word space before the dash */
}

/* selected work: three pieces at deliberately different scales */
.recent {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(3rem, 7vw, 6rem) clamp(1.5rem, 4vw, 3.5rem);
  padding-block: clamp(3.5rem, 9vh, 6.5rem);
}
.work--lead   { grid-column: 1 / span 7; }
.work--tall   { grid-column: 9 / span 4; align-self: end; }
.work--offset { grid-column: 4 / span 5; }

.project {
  padding-bottom: clamp(4rem, 11vh, 8rem);
  border-top: 1px solid var(--rule);
  padding-top: clamp(2.5rem, 6vh, 4rem);
}
.eyebrow--project { margin-bottom: clamp(1.75rem, 4vh, 2.75rem); }
.project__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(1rem, 2.5vw, 2.25rem);
}

/* ---------- the descent ---------- */

.descent {
  position: relative;
  height: clamp(420px, 78vh, 760px);
  background: var(--paper);
  overflow: hidden;
}
.descent::after {
  content: "";
  position: absolute; inset: 0;
  background-image: var(--grain);
  background-size: 180px 180px;
  opacity: .16;
  mix-blend-mode: multiply;
  pointer-events: none;
}

/* Ink bleeding in from the sheet's edges, then pooling up from the bottom. */
.creep {
  position: absolute;
  top: 2%;
  width: clamp(70px, 12vw, 170px);
  height: 56%;
  fill: var(--void);
  overflow: visible;
  transition: transform 1.7s cubic-bezier(.19, 1, .22, 1) .15s,
              opacity 1.1s ease .15s;
  opacity: 0;
}
.creep--l { left: 0;  transform: translateX(-72%); }
.creep--r { right: 0; transform: translateX(72%); }

/* The stain rises to ~two thirds of the interstitial, so paper stays visible
   above the bleed edge and the transition is legible as a stain, not a fade. */
.flood {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 70%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  transform: translateY(100%);
  transition: transform 2s cubic-bezier(.19, 1, .22, 1);
  will-change: transform;
}
.flood__edge {
  display: block;
  width: 100%;
  height: clamp(150px, 30vh, 300px);
  fill: var(--void);
  overflow: visible;
}
.flood__body { flex: 1; background: var(--void); }

.descent.is-in .flood { transform: translateY(0); }
.descent.is-in .creep { opacity: 1; transform: translateX(0); }

/* ---------- dark works ---------- */

.dark-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(3.5rem, 8vw, 7rem) clamp(1.5rem, 4vw, 3.5rem);
  padding-block: clamp(4rem, 10vh, 7rem);
}
.dark-grid .work { grid-column: span 4; }
.dark-grid .work--wide { grid-column: span 6; }
.dark-grid .work:nth-child(2) { grid-column: 8 / span 5; }
.dark-grid .work:nth-child(3) { grid-column: 2 / span 4; }
.dark-grid .work:nth-child(6) { grid-column: 7 / span 5; }

/* ---------- about ---------- */

.about__wrap {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(2.5rem, 6vw, 5.5rem);
  align-items: center;
  padding-block: clamp(5rem, 13vh, 9rem);
  border-top: 1px solid var(--rule-d);
}
.about__portrait { margin: 0; max-width: 460px; }
.about__text { position: relative; padding-top: 2.4rem; }
.about__text > .reg { position: absolute; top: 0; left: 0; }
.about__text .eyebrow { margin-bottom: 1.6rem; }

.lede {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.35rem, 2.5vw, 2rem);
  line-height: 1.32;
  letter-spacing: -.005em;
  color: #F2F2F0;
  max-width: 30ch;
}

.links {
  list-style: none;
  margin: clamp(2rem, 5vh, 3.25rem) 0 0;
  padding: 0;
  font-family: var(--mono);
  font-size: .8rem;
}
.links li + li { margin-top: .7rem; }
.links a {
  text-decoration: none;
  color: var(--mute-d);
  padding-bottom: .25rem;
  border-bottom: 1px solid transparent;
  transition: color .25s, border-color .25s;
}
.links a:hover { color: #fff; border-bottom-color: var(--blood); }
.links--row { display: flex; gap: 2rem; }
.links--row li + li { margin-top: 0; }

/* ---------- archive ---------- */

.archive {
  columns: 3;
  column-gap: clamp(1.25rem, 3vw, 2.5rem);
  padding-block: clamp(3.5rem, 9vh, 6rem) clamp(5rem, 12vh, 8rem);
}
.archive .work {
  break-inside: avoid;
  margin-bottom: clamp(1.25rem, 3vw, 2.5rem);
}
.archive .work__hit { overflow: hidden; }
.archive figcaption {
  margin-top: .6rem;
  opacity: .55;
  transition: opacity .3s ease;
}
.archive .work:hover figcaption,
.archive .work:focus-within figcaption { opacity: 1; }

/* ---------- commissions ---------- */

.commissions {
  position: relative;
  border-top: 1px solid var(--rule-d);
  padding-block: clamp(6rem, 17vh, 12rem);
  text-align: center;
}
.commissions__marks {
  position: absolute;
  inset: clamp(1.25rem, 3vw, 2.5rem);
  pointer-events: none;
}
.commissions__marks .crop { opacity: .55; }

.commissions__title {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.5rem, 8vw, 6.5rem);
  line-height: .95;
  letter-spacing: -.02em;
  color: #F4F4F2;
}

.mailto {
  display: inline-block;
  margin-top: clamp(2rem, 5vh, 3.25rem);
  font-family: var(--mono);
  font-size: clamp(.85rem, 2.1vw, 1.15rem);
  letter-spacing: .02em;
  text-decoration: none;
  color: #EDEDEF;
  padding-bottom: .45rem;
  border-bottom: 1px solid var(--rule-d);
  transition: color .25s, border-color .25s;
  overflow-wrap: anywhere;
}
.mailto:hover { color: #fff; border-bottom-color: var(--blood); }

.commissions .links--row {
  justify-content: center;
  margin-top: clamp(1.75rem, 4vh, 2.5rem);
}

/* ---------- footer ---------- */

.foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--measure);
  margin-inline: auto;
  padding: 1.75rem var(--gutter) 2.25rem;
  border-top: 1px solid var(--rule-d);
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--mute-d);
}
.foot p { margin: 0; }
.foot a { text-decoration: none; }
.foot a:hover { color: #fff; }

/* ---------- lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #08080A;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  opacity: 0;
  transition: opacity .28s ease;
}
.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }

.lb__fig {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  max-width: 100%;
}
.lb__img {
  max-height: 78vh;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.lb__cap {
  margin: 0;
  text-align: center;
  color: var(--mute-d);
  font-size: .8rem;
}
.lb__cap cite {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.1rem;
  color: #F2F2F0;
}
.lb__cap span { font-family: var(--mono); font-size: .72rem; }

.lb__close, .lb__nav {
  position: absolute;
  color: #EDEDEF;
  opacity: .55;
  transition: opacity .2s;
  line-height: 1;
}
.lb__close:hover, .lb__nav:hover { opacity: 1; }
.lb__close {
  top: clamp(.75rem, 2.5vw, 1.75rem);
  right: clamp(.75rem, 2.5vw, 1.75rem);
  font-size: 2.1rem;
  width: 44px; height: 44px;
}
.lb__nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.6rem;
  width: 48px; height: 64px;
}
.lb__nav--prev { left: clamp(.25rem, 1.5vw, 1.25rem); }
.lb__nav--next { right: clamp(.25rem, 1.5vw, 1.25rem); }

body.is-locked { overflow: hidden; }

/* ---------- scroll reveals ---------- */

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .85s ease, transform .95s cubic-bezier(.19, 1, .22, 1);
}
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */

@media (max-width: 1000px) {
  .recent { gap: clamp(2.5rem, 7vw, 4rem) 1.5rem; }
  .work--lead   { grid-column: 1 / span 9; }
  .work--tall   { grid-column: 6 / span 7; }
  .work--offset { grid-column: 2 / span 8; }

  .dark-grid .work,
  .dark-grid .work--wide { grid-column: span 6; }
  .dark-grid .work:nth-child(2),
  .dark-grid .work:nth-child(3),
  .dark-grid .work:nth-child(6) { grid-column: span 6; }

  .about__wrap { grid-template-columns: 1fr; gap: 3rem; }
  .about__portrait { max-width: 380px; }

  .archive { columns: 2; }
}

@media (max-width: 640px) {
  .recent {
    grid-template-columns: 1fr;
    gap: clamp(2.75rem, 9vw, 3.5rem);
  }
  .work--lead, .work--tall, .work--offset { grid-column: 1 / -1; }
  .work--tall { max-width: 74%; }
  .work--offset { max-width: 86%; margin-left: auto; }

  .project__grid { grid-template-columns: 1fr 1fr; gap: 1rem; }

  .dark-grid { grid-template-columns: 1fr; }
  .dark-grid .work,
  .dark-grid .work--wide,
  .dark-grid .work:nth-child(2),
  .dark-grid .work:nth-child(3),
  .dark-grid .work:nth-child(6) { grid-column: 1 / -1; }

  .archive { columns: 1; }

  .hero__foot {
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
  }
  .hero__line--a { letter-spacing: .118em; text-indent: .118em; }

  /* The bleed edge is drawn with preserveAspectRatio="none"; at phone widths a
     tall edge stretches the tendrils into hairlines, so keep it shallow. */
  .descent { height: clamp(360px, 56vh, 560px); }
  .flood__edge { height: 110px; }
  .creep { display: none; }

  .lb__nav { font-size: 2rem; width: 40px; }
  .lb__img { max-height: 66vh; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .flood { transform: translateY(0); }
  .creep { opacity: 1; transform: none; }
}
