/* ==========================================================================
   André Soares Photography — stylesheet
   Palette "salt & basalt": pale mineral paper, volcanic ink, no accent colour.
   The photographs bring the colour.
   ========================================================================== */

@font-face {
  font-family: "Familjen Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/familjen-grotesk-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Familjen Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/familjen-grotesk-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Krylon (the typeface of the A.E.R.S. logo) for the name on the home page.
   Free for personal and commercial use: https://www.behance.net/tmrbnkrlsn */
@font-face {
  font-family: "Krylon";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/Krylon-Regular.woff2") format("woff2");
}

:root {
  /* colour */
  --salt: #f4f4f2;      /* page: light grey, close to white */
  --basalt: #1b1c1a;    /* ink */
  --ash: #6b6e68;       /* secondary text */
  --hairline: #d6d7d2;  /* rules, placeholders */
  --viewer: #141513;    /* lightbox backdrop */

  --bg: var(--salt);
  --fg: var(--basalt);
  --muted: var(--ash);
  --line: var(--hairline);

  /* type */
  --font: "Familjen Grotesk", "Helvetica Neue", Arial, system-ui, sans-serif;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: clamp(1.25rem, 1.05rem + 0.8vw, 1.75rem);
  --step-2: clamp(1.75rem, 1.2rem + 2.2vw, 3.25rem);
  --display: clamp(3.25rem, 11.5vw, 15rem);

  /* space */
  --gutter: clamp(1rem, 2.6vw, 2.5rem);
  --section: clamp(4rem, 10vw, 10rem);
  --gap: clamp(1rem, 2.6vw, 2.5rem);

  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1c1a;
    --fg: #e9e9e4;
    --muted: #9a9d96;
    --line: #34362f;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1c1a;
  --fg: #e9e9e4;
  --muted: #9a9d96;
  --line: #34362f;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: env(safe-area-inset-top, 0px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.5;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }

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

.skip-link {
  position: absolute; left: var(--gutter); top: -4rem;
  background: var(--fg); color: var(--bg); padding: 0.5rem 0.75rem; z-index: 50;
}
.skip-link:focus { top: calc(env(safe-area-inset-top, 0px) + 0.5rem); }

/* --------------------------------------------------------------------------
   Header & footer
   -------------------------------------------------------------------------- */

.site-header {
  position: relative;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline;
  gap: 0.5rem 1rem;
  padding: 1.1rem var(--gutter);
  font-size: clamp(1.125rem, 1rem + 0.45vw, 1.4rem);
}
.site-header a { text-decoration: none; }
.site-header nav a:hover, .site-header a[aria-current="page"] { text-decoration: underline; }
.site-header nav { display: flex; gap: 0.5rem 1.75rem; margin-left: auto; }
.site-header .wordmark { font-weight: 600; }

/* "Work" drop-down */
.dropdown { position: relative; }
.dropdown-toggle {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer;
  display: inline-flex; align-items: baseline; gap: 0.35em;
}
.dropdown-toggle::after {
  content: ""; width: 0.38em; height: 0.38em;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.2em) rotate(45deg);
  transition: transform 0.2s ease;
}
.dropdown-toggle[data-current], .dropdown-toggle:hover { text-decoration: underline; }
.dropdown.is-open .dropdown-toggle::after { transform: translateY(0.05em) rotate(-135deg); }

.dropdown-menu {
  position: absolute; z-index: 20;
  top: calc(100% + 0.6rem); right: 0;
  min-width: max-content;
  margin: 0; padding: 0.9rem 1.25rem 1rem;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: var(--step-1);
  line-height: 1.35;
  letter-spacing: -0.01em;
  opacity: 0; visibility: hidden; transform: translateY(-0.25rem);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
}
.dropdown-menu a { display: block; padding: 0.2rem 0; }
.dropdown-menu a:hover, .dropdown-menu a[aria-current="page"] { text-decoration: underline; }
.dropdown.is-open .dropdown-menu,
html:not(.js) .dropdown:focus-within .dropdown-menu {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
/* on computers with a mouse, it also opens on hover */
@media (hover: hover) {
  .dropdown:hover .dropdown-menu { opacity: 1; visibility: visible; transform: none; transition: opacity 0.18s ease, transform 0.18s ease; }
  .dropdown::before { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 0.8rem; } /* bridge the gap */
}

.site-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem;
  padding: 2rem var(--gutter) 1.5rem;
  margin-top: var(--section);
  border-top: 1px solid var(--line);
  font-size: var(--step--1);
  color: var(--muted);
}
.site-footer a { color: var(--fg); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer { align-items: flex-end; }
.signature { display: flex; align-items: flex-end; gap: 1rem; }
.signature .logo { display: block; line-height: 0; opacity: 0.85; transition: opacity 0.2s ease; }
.signature .logo:hover { opacity: 1; }
.signature img { width: auto; height: 2.75rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .signature img { filter: invert(0.92); } }
:root[data-theme="dark"] .signature img { filter: invert(0.92); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.5rem; }

/* --------------------------------------------------------------------------
   Large-scale type
   -------------------------------------------------------------------------- */

.display {
  margin: 0;
  font-size: var(--display);
  font-weight: 500;
  line-height: 0.86;
  letter-spacing: -0.045em;
  word-spacing: 0.06em;
  /* optical: pull the first letter to the gutter */
  margin-left: -0.04em;
}


/* Home: name on the left, introduction on the right, big photo filling the rest of the screen */
.masthead {
  display: grid;
  grid-template-columns: 1fr;
  row-gap: 1.25rem;
  padding: clamp(1rem, 4vw, 3rem) var(--gutter) clamp(1.25rem, 3vw, 2.5rem);
}
/* on large screens the script sizes the name to match the height of the introduction */
.masthead .display {
  font-family: "Krylon", Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 0.88;
  margin-left: -0.03em;
  font-size: clamp(4rem, 22vw, 16rem);
}
.masthead .display span { display: block; width: max-content; }
.masthead .lede {
  margin: 0;
  font-size: var(--step-1);
  line-height: 1.3;
  letter-spacing: -0.01em;
  max-width: 30ch;
}
@media (min-width: 900px) {
  .masthead {
    grid-template-columns: 1fr 1fr;
    column-gap: var(--gap);
    align-items: end;
  }
  .masthead .lede {
    max-width: 30ch;
    font-size: clamp(1.5rem, 0.6rem + 1.9vw, 3rem);
    line-height: 1.18;
    letter-spacing: -0.02em;
  }
  .masthead .display { font-size: 9vw; }
}

.hero {
  display: flex; flex-direction: column;
  /* --above is measured by the script: the height of everything above the photo */
  height: calc(100svh - var(--above, 22rem));
  min-height: 20rem;
  text-decoration: none;
}
.hero img {
  flex: 1; min-height: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: var(--c, var(--line));
}
.hero-caption {
  padding: 0.6rem var(--gutter) 0.9rem;
  font-size: var(--step--1);
  color: var(--muted);
}
.hero:hover .hero-caption { color: var(--fg); }

/* --------------------------------------------------------------------------
   Home: project index
   -------------------------------------------------------------------------- */

.projects { margin-top: var(--section); scroll-margin-top: 1rem; }

.project-card {
  display: block;
  text-decoration: none;
  margin-bottom: var(--section);
}
.project-card .cover {
  height: min(88svh, 62vw);
  min-height: 60svh;
  overflow: hidden;
  background: var(--line);
}
.project-card .cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 1.2s cubic-bezier(.2, .7, .2, 1);
}
.project-card:hover .cover img { transform: scale(1.015); }

.project-card .caption {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.25rem 2rem;
  padding: clamp(0.75rem, 1.5vw, 1.25rem) var(--gutter) 0;
}
.project-card .caption .display { font-size: clamp(3rem, 10vw, 12.5rem); }
.project-card .caption p { margin: 0; color: var(--muted); font-size: var(--step--1); }

@media (max-width: 700px) {
  .project-card .cover { height: auto; min-height: 0; aspect-ratio: 1; }
  .project-card .caption p { flex-basis: 100%; }
}

/* --------------------------------------------------------------------------
   Project page
   -------------------------------------------------------------------------- */

.project-head { padding: clamp(2rem, 7vw, 6rem) var(--gutter) 0; }

.project-meta {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gap);
  row-gap: 1rem;
  padding: clamp(1.5rem, 3vw, 2.5rem) var(--gutter) var(--section);
}
.project-meta dl { grid-column: 1 / -1; margin: 0; font-size: var(--step--1); }
.project-meta dt { color: var(--muted); }
.project-meta dd { margin: 0 0 0.6rem; }
.project-meta .text { grid-column: 1 / -1; font-size: var(--step-1); line-height: 1.35; max-width: 36ch; }
.project-meta .text p { margin: 0 0 0.8em; }
@media (min-width: 900px) {
  .project-meta dl { grid-column: 1 / 5; }
  .project-meta .text { grid-column: 7 / -1; }
}

/* Gallery ---------------------------------------------------------------- */

.gallery { display: flex; flex-direction: column; gap: var(--section); }

.photo { margin: 0; padding: 0 var(--gutter); }
.photo a { display: block; cursor: zoom-in; }

.photo img {
  width: 100%;
  height: auto;
  /* used before the image has loaded or when width/height are missing */
  aspect-ratio: auto 3 / 2;
  max-height: 92svh;
  object-fit: contain;
  background: var(--c, var(--line));
  transition: opacity 0.6s ease;
}
.photo img.is-loaded { background: transparent; }
.js .photo img:not(.is-loaded) { opacity: 0; }

.photo figcaption {
  margin-top: 0.6rem;
  font-size: var(--step--1);
  color: var(--muted);
}

/* Edge to edge — best for landscapes and panoramas */
.photo--full { padding: 0; }
.photo--full img { max-height: none; object-fit: cover; }
.photo--full figcaption { padding: 0 var(--gutter); }

/* Narrower, pushed to one side — adds rhythm between big images */
@media (min-width: 900px) {
  .photo--left  { padding-right: 38%; }
  .photo--right { padding-left: 38%; }
  .photo--left img, .photo--right img { max-height: 80svh; }
}

/* Two side by side (stacked on phones) */
.pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  padding: 0 var(--gutter);
  align-items: end;
}
.pair .photo { padding: 0; }
@media (min-width: 700px) {
  .pair { grid-template-columns: 1fr 1fr; }
}

/* A short passage of text between images */
.interlude {
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gap);
}
.interlude p {
  grid-column: 1 / -1;
  margin: 0;
  font-size: var(--step-2);
  line-height: 1.12;
  letter-spacing: -0.025em;
  max-width: 22ch;
}
@media (min-width: 900px) {
  .interlude p { grid-column: 3 / -1; }
}

/* Next project ------------------------------------------------------------ */

.next {
  display: block;
  margin-top: var(--section);
  padding: 2rem var(--gutter) 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
}
.next .label { display: block; color: var(--muted); font-size: var(--step--1); margin-bottom: 0.5rem; }
.next .display { transition: letter-spacing 0.5s ease; }
.next:hover .display { letter-spacing: -0.04em; }

/* --------------------------------------------------------------------------
   About
   -------------------------------------------------------------------------- */

.about {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gap);
  row-gap: 2.5rem;
  padding: clamp(1.5rem, 3vw, 2.5rem) var(--gutter) 0;
}
.about .portrait { grid-column: 1 / -1; margin: 0; }
.about .portrait img { width: 100%; height: auto; aspect-ratio: auto 3 / 4; background: var(--c, var(--line)); }
.about .bio { grid-column: 1 / -1; }
.about .bio .statement {
  font-size: var(--step-2); line-height: 1.12; letter-spacing: -0.025em;
  margin: 0 0 2rem; max-width: 24ch;
}
.about .bio p { max-width: 42ch; }
.about .contact { list-style: none; padding: 0; margin: 2rem 0 0; font-size: var(--step-1); }
.about .contact li { border-top: 1px solid var(--line); }
.about .contact li:last-child { border-bottom: 1px solid var(--line); }
.about .contact a { display: flex; justify-content: space-between; padding: 0.7rem 0; text-decoration: none; }
.about .contact a span { color: var(--muted); font-size: var(--step--1); align-self: center; }
.about .contact a:hover { text-decoration: underline; }
@media (min-width: 900px) {
  .about .portrait { grid-column: 1 / 6; }
  .about .bio { grid-column: 7 / -1; align-self: end; }
}

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */

.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: var(--viewer);
  color: #e9e9e4;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}
.lightbox.is-open { opacity: 1; visibility: visible; transition: opacity 0.3s ease; }

.lightbox-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem var(--gutter);
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
}
.lightbox button {
  font: inherit; color: inherit; background: none; border: 0; padding: 0.5rem;
  cursor: pointer; margin: -0.5rem;
}
.lightbox button:hover { text-decoration: underline; }

.lightbox-stage {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: 0 var(--gutter);
  touch-action: pan-y pinch-zoom;
}
.lightbox-stage img {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  user-select: none; -webkit-user-drag: none;
  transition: opacity 0.25s ease;
}
.lightbox-stage img.is-loading { opacity: 0.25; }

.lightbox-nav {
  position: absolute; top: 0; bottom: 0; width: 30%;
  margin: 0 !important; padding: 0 !important;
  font-size: 0 !important;
}
.lightbox-nav.prev { left: 0; cursor: w-resize; }
.lightbox-nav.next { right: 0; cursor: e-resize; }

.lightbox-foot {
  padding: 0.75rem var(--gutter);
  font-size: var(--step--1);
  color: #a3a69f;
  min-height: 2.75rem;
  display: flex; justify-content: space-between; gap: 1rem;
}
.lightbox-foot .arrows { display: flex; gap: 1.5rem; }

@media (hover: none) {
  .lightbox-foot .arrows { display: none; }
}

body.no-scroll { overflow: hidden; }

/* --------------------------------------------------------------------------
   The one orchestrated moment: the masthead rises on first load
   -------------------------------------------------------------------------- */

.rise { overflow: hidden; padding-top: 0.08em; }
.rise > * { display: inline-block; animation: rise 1.1s cubic-bezier(.2, .7, .1, 1) both; }
@keyframes rise { from { transform: translateY(105%); } to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
