/* photo.sena.pt: paper, mats, a Didone for titles and a mono for the small print. */
@font-face { font-family: "Bodoni Moda"; src: url("/fonts/bodoni-moda-latin-opsz-normal.woff2") format("woff2"); font-weight: 400 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Bodoni Moda"; src: url("/fonts/bodoni-moda-latin-opsz-italic.woff2") format("woff2"); font-weight: 400 900; font-style: italic; font-display: swap; }
/* Wordmark: Chetta Vissto by Toni Studio (Filipe's licensed font), subset to Latin. */
@font-face { font-family: "Chetta Vissto"; src: url("/assets/fonts/chetta-vissto.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

:root {
  --paper: #eeebe5;
  --mat: #fbfaf7;
  --ink: #1b1a18;
  --muted: #858077;
  --rule: #d9d4ca;
  --serif: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: clamp(16px, 3.2vw, 44px);
  --ease: cubic-bezier(.2, .7, .1, 1);
  --shadow: rgba(30, 25, 15, .35);
  --ready: transparent;
  color-scheme: light;
}
/* Darkroom: warm near-black, charcoal mats, ink turns to paper. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --paper: #131210; --mat: #1d1c19; --ink: #ebe6dc; --muted: #8b857a; --rule: #2c2a26; --shadow: rgba(0, 0, 0, .7); --ready: #f0a43a; color-scheme: dark; }
}
:root[data-theme="dark"] { --paper: #131210; --mat: #1d1c19; --ink: #ebe6dc; --muted: #8b857a; --rule: #2c2a26; --shadow: rgba(0, 0, 0, .7); --ready: #f0a43a; color-scheme: dark; }
body { transition: background-color .5s var(--ease), color .5s var(--ease); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.6 var(--serif); font-optical-sizing: auto; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: lowercase; color: var(--muted); line-height: 1.7; }
.mono a { transition: color .3s var(--ease); }
.mono a:hover, .mono a[aria-current] { color: var(--ink); }
.display { font-family: var(--serif); font-weight: 400; font-style: normal; text-transform: uppercase; letter-spacing: .02em; line-height: .92; font-size: clamp(44px, 9vw, 132px); margin: 0; }

/* Header / footer */
.site-head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; padding: calc(var(--gutter) * .9) var(--gutter) var(--gutter); }
.wordmark { font: 400 clamp(22px, 2.4vw, 30px)/1 "Chetta Vissto", "American Typewriter", "Courier New", monospace; letter-spacing: 0; }
.site-head nav { display: flex; gap: clamp(14px, 2.4vw, 32px); white-space: nowrap; }
.wordmark { white-space: nowrap; }
@media (max-width: 520px) {
  .site-head { flex-direction: column; align-items: flex-start; gap: 12px; }
}
.site-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; padding: calc(var(--gutter) * 2) var(--gutter) var(--gutter); }

/* The picture: blurred placeholder underneath, the image fades in over it. */
.pic { display: block; position: relative; aspect-ratio: var(--ar); background: var(--ph) center / cover no-repeat; overflow: hidden; }
.pic img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .9s var(--ease); }
.pic img.is-loaded { opacity: 1; }
.no-js .pic img { opacity: 1; }

/* The wall: every photo sits centred in a square white mat, like the framed Instagram posts. */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: var(--gutter); padding: 0 var(--gutter); }
.tile { display: flex; flex-direction: column; gap: 12px; }
.mat { display: grid; place-items: center; background: var(--mat); box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 18px 40px -28px var(--shadow); transition: box-shadow .6s var(--ease), transform .6s var(--ease); }
.tile .mat { position: relative; aspect-ratio: 1; }
.tile .mat .pic { position: absolute; inset: 11%; width: auto; height: auto; }
/* Inside a mat the picture fills the mat's inner box and the photo is fitted (contained) within it. */
.mat .pic, .frame .pic { width: 100%; height: 100%; aspect-ratio: auto; background-size: contain; }
.mat .pic img, .frame .pic img { object-fit: contain; }
.plate .pic { aspect-ratio: var(--ar); height: auto; }
.tile .pic img { transition: opacity .9s var(--ease), transform 1.4s var(--ease); }
.tile:hover .mat { transform: translateY(-3px); box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 28px 50px -30px var(--shadow); }
.tile:hover .pic img.is-loaded { transform: scale(1.025); }
.tile .cap { padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Photo view: big plate on the left, the words on the right; stacked on small screens. */
.photo-view { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); grid-template-areas: "frame meta" "pager pager"; gap: var(--gutter) calc(var(--gutter) * 1.4); padding: 0 var(--gutter); align-items: end; min-height: calc(100svh - 120px); }
.frame { --fpad: clamp(14px, 3.5vw, 48px); --fh: calc(100svh - 260px); grid-area: frame; justify-self: center; width: min(100%, calc(var(--fh) * var(--arn) + 2 * var(--fpad))); margin: 0; display: grid; place-items: center; background: var(--mat); padding: var(--fpad); box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 30px 60px -40px var(--shadow); }
/* The frame hugs the photo: width follows the available height × aspect ratio, capped by the column. */
.frame .pic { aspect-ratio: var(--ar); height: auto; width: 100%; }
.frame .pic img { object-fit: contain; }
.meta { grid-area: meta; padding-bottom: 6px; }
.meta .title { font: italic 400 clamp(30px, 3.2vw, 44px)/1.05 var(--serif); margin: 0 0 14px; letter-spacing: -.01em; }
.meta .title.untitled { color: var(--muted); }
.meta .desc { font-size: 16px; line-height: 1.65; margin: 18px 0; max-width: 34ch; }
.meta .desc p { margin: 0 0 .8em; }
.meta .exif { padding-top: 14px; border-top: 1px solid var(--rule); margin-top: 18px; text-transform: none; letter-spacing: .08em; }
.meta .kicker { margin: 0 0 18px; }
.meta .where, .meta .src { margin: 0; }
.pager { grid-area: pager; display: flex; justify-content: space-between; border-top: 1px solid var(--rule); padding: 14px 0 0; }
.pager .back { text-align: center; }

@media (max-width: 900px) {
  .photo-view { grid-template-columns: 1fr; grid-template-areas: "frame" "meta" "pager"; min-height: 0; }
  .frame { justify-self: stretch; width: auto; }
  .frame .pic { width: 100%; }
}

/* Series */
.series { padding: 0 var(--gutter); }
.series-head { padding: clamp(24px, 6vw, 90px) 0 clamp(36px, 7vw, 110px); max-width: 1100px; }
.series-head .desc { font-size: 18px; max-width: 46ch; margin-top: 28px; }
.series-head .mono { margin: 0 0 18px; }
.series-strip { display: grid; gap: clamp(40px, 9vw, 140px); justify-items: center; }
.plate { width: min(100%, 1100px); }
.plate .mat { padding: clamp(14px, 4vw, 56px); }
.plate:nth-child(even) { justify-self: end; width: min(100%, 860px); }
.plate:nth-child(3n) { justify-self: start; width: min(100%, 760px); }
.series-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: calc(var(--gutter) * 1.6) var(--gutter); padding: 0 var(--gutter); }
.series-card { display: grid; gap: 16px; }
.series-card .mat { position: relative; aspect-ratio: 4 / 3; }
.series-card .mat .pic { position: absolute; inset: 9%; width: auto; height: auto; }
.series-card-text { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.series-card .display { font-size: clamp(28px, 3.4vw, 44px); }
.empty, .nf { padding: 10vh var(--gutter); }

/* Motion: things rise gently into view; page changes cross-fade and the photo glides between pages. */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 1s var(--ease), transform 1.2s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }
.page-photo .meta > * { animation: rise .9s var(--ease) both; }
.page-photo .meta > *:nth-child(2) { animation-delay: .06s; }
.page-photo .meta > *:nth-child(3) { animation-delay: .12s; }
.page-photo .meta > *:nth-child(4) { animation-delay: .18s; }
.page-photo .meta > *:nth-child(5) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

@view-transition { navigation: auto; }
::view-transition-group(*) { animation-duration: .65s; animation-timing-function: var(--ease); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .4s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  @view-transition { navigation: none; }
}

/* Phones: two-up wall, like a contact sheet. Kept last so it overrides the base grid. */
@media (max-width: 520px) {
  .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .tile .mat .pic { inset: 9%; }
  .tile { gap: 8px; }
  .tile .cap { font-size: 10px; letter-spacing: .1em; }
}

/* The flash: a little hot-shoe flash gun. Its ready light glows in the darkroom. */
.flash { appearance: none; border: 0; background: none; padding: 0 2px; margin: -6px 0 0; color: var(--muted); cursor: pointer; line-height: 0; transition: color .3s var(--ease), transform .3s var(--ease); }
.flash:hover, .flash:focus-visible { color: var(--ink); transform: translateY(-1px) rotate(-4deg); }
.flash:focus-visible { outline: 1px solid var(--muted); outline-offset: 4px; }
.flash svg { overflow: visible; }
.flash-head, .flash-body { fill: none; stroke: currentColor; stroke-width: 1.4; }
.flash-lens, .flash-foot { fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linecap: round; opacity: .7; }
.flash-ready { fill: var(--ready); stroke: currentColor; stroke-width: 1; transition: fill .5s var(--ease); }
:root[data-theme="dark"] .flash-ready { filter: drop-shadow(0 0 3px var(--ready)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .flash-ready { filter: drop-shadow(0 0 3px var(--ready)); } }
.flash.firing .flash-head { animation: pop .35s var(--ease); }
@keyframes pop { 40% { fill: #fffdf6; transform: translateY(-1px); } }

/* The burst: white light from the flash, fading like a real one. */
.burst { position: fixed; inset: 0; z-index: 100; pointer-events: none; background: radial-gradient(circle at var(--bx, 90%) var(--by, 5%), #fffef9 0%, rgba(255, 253, 244, .92) 35%, rgba(255, 252, 240, .75) 100%); animation: burst .75s cubic-bezier(.1, .8, .2, 1) forwards; }
@keyframes burst { 0% { opacity: 0; } 8% { opacity: 1; } 100% { opacity: 0; } }

/* Spreads: a piece whose gutter carries text (title, caption) is shown whole, across the full width. */
.series-strip .plate.wide { width: 100%; justify-self: stretch; }
.series-strip .plate.wide .mat { padding: clamp(10px, 2vw, 28px); }
