/* ============================================================
   Johnny Hnrx — one-page portfolio
   Tokens first, then layout, then components, then responsive.
   ============================================================ */

/* Self-hosted fonts (latin subset only) — replaces the third-party
   Google Fonts stylesheet to remove a render-blocking request. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url(/assets/fonts/inter.woff2) format('woff2-variations');
  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: 'Poppins';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/assets/fonts/poppins-600.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: 'Poppins';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/assets/fonts/poppins-700.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;
}

:root {
  --bg: #000000;
  --fg: #ffffff;
  --fg-dim: #b3b3b3;
  --line: rgba(255, 255, 255, 0.35);
  --line-soft: rgba(255, 255, 255, 0.12);
  --font-display: "Poppins", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter", "Helvetica Neue", Arial, sans-serif;
  --radius: 10px;
  --gutter: 18px;
  --max-width: 1500px;
  --page-pad: 34px;
  --section-gap: 130px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

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

/* Visible focus ring for keyboard users only */
:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: -60px; left: 16px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--fg);
  color: var(--bg);
  border-radius: var(--radius);
}
.skip-link:focus { top: 16px; }

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  /* Left and right padding match the gallery's own inset, so the brand lines up
     with the first image and the icon with the last. */
  padding: 26px max(var(--page-pad), calc((100% - var(--max-width)) / 2 + var(--page-pad)));
  background: var(--bg);
}

.brand {
  justify-self: start;
  align-self: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 25px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  line-height: 1;
  transition: opacity 0.2s ease;
}
.brand:hover { opacity: 0.7; }

.site-nav {
  justify-self: center;
  align-self: center;
  display: flex;
  gap: 34px;
  font-size: 14px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Nav links: underline wipes in from the left, presses down on click */
.site-nav a {
  position: relative;
  opacity: 0.85;
  transition: opacity 0.2s ease, transform 0.12s ease;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -5px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.site-nav a:hover { opacity: 1; }

.site-nav a:hover::after,
.site-nav a:focus-visible::after,
.site-nav a.is-active::after,
.site-nav a[aria-current="page"]::after { transform: scaleX(1); }

.site-nav a:active { transform: translateY(1px); }
.site-nav a[aria-current="page"] { opacity: 1; }

.header-social {
  justify-self: end;
  align-self: center;
  display: inline-flex;
  line-height: 0;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}
.header-social:hover { opacity: 1; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  background: none;
  border: 0;
  cursor: pointer;
}
.nav-toggle__bar {
  width: 22px;
  height: 2px;
  background: var(--fg);
}

/* ---------- Sections ---------- */

.section, [id] { scroll-margin-top: 84px; }

.section {
  padding: var(--section-gap) var(--page-pad) 0;
  max-width: var(--max-width);
  margin: 0 auto;
}

/* First section sits closer to the header than the gap between sections */
main > .section:first-of-type { padding-top: 46px; }

.section__title {
  margin: 0 0 52px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(22px, 3vw, 27px);
  letter-spacing: -0.01em;
}

/* ---------- Gallery ----------
   CSS columns give the staggered look with no JavaScript layout work. */

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gutter);
  column-count: auto;
}

.gallery__item {
  margin: 0 0 var(--gutter);
  break-inside: avoid;
  border-radius: var(--radius);
  cursor: pointer;
}

.gallery__item img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  /* Very slow, very small: a 1.010 drift over 5s reads as ambient rather than as a zoom. */
  transition: transform 5000ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform-origin: center center;
  will-change: transform;
}

.gallery__item a:hover img,
.gallery__item a:focus-visible img {
  transition: transform 5000ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform: scale(1.010);
}

/* ---------- Work grid links ---------- */

.gallery__item a {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  isolation: isolate;
}

/* Project name sits under the frame and stays visible at all times */
.gallery__item figcaption {
  padding-top: 12px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-dim);
  transition: color 0.3s ease;
}

.gallery__item:hover figcaption { color: var(--fg); }

.section--project {
  max-width: 100%;
  padding-left: clamp(20px, 4vw, 56px);
  padding-right: clamp(20px, 4vw, 56px);
}

/* ---------- Projects ----------
   One centred row of uniform-height frames. Widths follow each photo's ratio. */

.project { max-width: 100%; margin: 0 auto; }

.project + .project { margin-top: calc(var(--section-gap) * 0.8); }

.project__head {
  margin-bottom: 22px;
  text-align: center;
}

.project__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-style: italic;
  font-size: clamp(17px, 2vw, 20px);
  letter-spacing: 0.06em;
}

.project__meta {
  margin: 8px 0 0;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.project__note {
  max-width: 780px;
  margin: 0 auto 70px;
  text-align: center;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--fg-dim);
}

.project__grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 22px;
}

.project__grid .gallery__item {
  margin: 0;
  cursor: zoom-in;
  border-radius: 0;
}

.project__grid .gallery__item img {
  height: 360px;
  width: auto;
  max-width: 100%;
  object-fit: cover;
  border-radius: 2px;
  transition: opacity 0.3s ease;
}

.project__grid .gallery__item:hover img { opacity: 0.82; }

/* Previous and next project, set large like the reference */
.project-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  max-width: 100%;
  margin: 90px auto 0;
  padding-top: 0;
  border-top: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(20px, 3vw, 30px);
  letter-spacing: 0.08em;
  color: var(--fg-dim);
}
.project-nav a { transition: color 0.25s ease, letter-spacing 0.25s ease; }
.project-nav a:hover { color: var(--fg); letter-spacing: 0.12em; }

.back-link {
  margin: 0 auto 46px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-dim);
}
.back-link a { border-bottom: 1px solid transparent; transition: color 0.2s ease, border-color 0.2s ease; }
.back-link a:hover { color: var(--fg); border-bottom-color: var(--line); }

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

.about {
  display: grid;
  grid-template-columns: minmax(260px, 380px) 1fr;
  gap: 56px;
  align-items: center;
  max-width: 1020px;
  margin: 0 auto;
  min-height: calc(100vh - 420px);
  padding-block: 20px;
}

.about__body .all-work { justify-content: flex-start; margin-top: 34px; }

.about__portrait { margin: 0; }

.about__portrait img {
  width: 100%;
  max-width: 300px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius);
}

.about__portrait figcaption {
  margin-top: 12px;
  font-size: 12px;
  color: var(--fg-dim);
}

.about__body p { margin: 0 0 20px; color: var(--fg-dim); }

.about__lead {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(19px, 2.4vw, 23px);
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.about__body .about__lead { color: var(--fg); margin-bottom: 28px; }

.about__facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px 30px;
  margin: 38px 0;
  padding: 30px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.about__facts dt {
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.about__facts dd { margin: 5px 0 0; font-size: 14px; }

/* ---------- Buttons ---------- */

.btn {
  display: block;
  margin: 44px auto 0;
  padding: 11px 26px;
  background: var(--fg);
  color: var(--bg);
  border: 0;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.btn:hover { opacity: 0.82; }
.btn[disabled] { opacity: 0.5; cursor: default; }

.btn--ghost {
  display: inline-block;
  margin: 0;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--line);
}
.btn--ghost:hover { background: var(--fg); color: var(--bg); opacity: 1; }

.all-work { display: flex; justify-content: center; margin: 56px 0 0; }

.page-intro {
  max-width: 560px;
  margin: 0 auto 60px;
  text-align: center;
  color: var(--fg-dim);
}

/* ---------- Contact form ---------- */

.section--contact { padding-bottom: 40px; }

.contact-form { max-width: 660px; margin: 0 auto; }

.field { margin-bottom: 34px; }

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
}

.field input,
.field textarea {
  width: 100%;
  padding: 6px 2px;
  background: transparent;
  color: var(--fg);
  border: 0;
  border-bottom: 1px solid var(--line);
  font: inherit;
  font-size: 16px;
  border-radius: 0;
  transition: border-color 0.2s ease;
}

.field input:focus,
.field textarea:focus { border-bottom-color: var(--fg); outline: none; }

.field textarea { resize: vertical; min-height: 46px; }

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] { border-bottom-color: #ff6b6b; }

.form-status {
  margin: 18px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--fg-dim);
  min-height: 20px;
}

.form-note {
  margin: 30px 0 0;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--fg-dim);
}

.form-note a {
  color: var(--fg);
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  transition: border-color 0.2s ease;
}
.form-note a:hover { border-bottom-color: var(--fg); }

/* Honeypot: hidden from people, visible to bots that fill every field */
.hp { position: absolute; left: -9999px; opacity: 0; }

/* Keyword line under the copyright, matching the pattern Joao asked for.
   Deliberately a <p>, not the h1 - see the h1 note in index.html. */

.footer-tagline {
  margin: 8px 0 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  line-height: 1.6;
  color: var(--fg-dim);
  opacity: 0.7;
}

/* ---------- Footer ---------- */

.site-footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 90px clamp(20px, 4vw, 56px) 54px;
  text-align: center;
}

.footer-note {
  margin: 0 auto;
  max-width: 620px;
  font-size: 14px;
  color: var(--fg-dim);
}

.footer-note a {
  color: var(--fg);
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  transition: border-color 0.2s ease;
}
.footer-note a:hover { border-bottom-color: var(--fg); }

.footer-meta {
  margin: 38px 0 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--fg-dim);
  opacity: 0.7;
}

.footer-meta a { transition: opacity 0.2s ease; }
.footer-meta a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Legal pages ---------- */

.legal { max-width: 720px; margin: 0 auto; }
.legal h2 {
  margin: 40px 0 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
}
.legal p, .legal li { color: var(--fg-dim); font-size: 14px; }
.legal ul { padding-left: 20px; }
.legal a { color: var(--fg); border-bottom: 1px solid var(--line); }

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

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  background: rgba(0, 0, 0, 0.94);
}
.lightbox[hidden] { display: none; }

.lightbox__img {
  max-width: min(92vw, 1200px);
  max-height: 88vh;
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.lightbox__img.is-loaded {
  opacity: 1;
}

.lightbox__close,
.lightbox__nav {
  background: none;
  border: 0;
  color: var(--fg);
  cursor: pointer;
  line-height: 1;
}

.lightbox__close {
  position: absolute;
  top: 18px; right: 22px;
  font-size: 34px;
}

.lightbox__nav { font-size: 48px; padding: 0 6px; opacity: 0.7; }
.lightbox__nav:hover { opacity: 1; }

/* ---------- Section divider ---------- */

.rule {
  height: 1px;
  width: calc(100% - var(--page-pad) * 2);
  max-width: var(--max-width);
  margin: var(--section-gap) auto 0;
  border: 0;
  background: var(--line-soft);
}

.rule + .section { padding-top: var(--section-gap); }

/* Overrides .reveal so the line draws sideways instead of fading upward */
.rule.reveal { opacity: 1; transform: scaleX(0); transform-origin: left center; }
.rule.reveal.is-visible { transform: scaleX(1); transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1); }

/* ---------- Scroll reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.is-visible { opacity: 1; transform: none; }

.gallery__item:nth-child(3n + 2) { transition-delay: 0.08s; }
.gallery__item:nth-child(3n + 3) { transition-delay: 0.16s; }

/* ---------- Responsive ---------- */

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

@media (max-width: 900px) {
  :root { --section-gap: 84px; --page-pad: 20px; }

  .nav-toggle { display: flex; justify-self: end; }
  .site-header { grid-template-columns: 1fr auto; padding: 18px var(--page-pad); }
  .header-social { display: none; }

  .site-nav {
    justify-self: stretch;
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  .site-nav a { padding: 15px var(--page-pad); min-height: 44px; }
  .site-nav a::after { left: var(--page-pad); right: var(--page-pad); bottom: 8px; }
  .site-nav.is-open { max-height: 280px; }

  .project__grid .gallery__item img { height: 300px; }

  .about { grid-template-columns: 1fr; gap: 32px; }
  .about__portrait { max-width: 340px; margin: 0 auto; }
  .about__facts { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .project__grid { gap: 14px; }
  .project__grid .gallery__item img { height: 210px; }
  .project__head { flex-direction: column; gap: 6px; }
  .gallery__item { transition-delay: 0s; }
  .gallery__item a:hover img { transform: none; }

  /* Nav buttons move below the photo so they stop covering it */
  .lightbox { flex-wrap: wrap; padding: 56px 12px 12px; gap: 8px; }
  .lightbox__img { order: 1; flex: 1 0 100%; max-height: 74vh; }
  .lightbox__nav { order: 2; font-size: 30px; min-width: 56px; min-height: 48px; }
  .lightbox__close { top: 10px; right: 14px; min-width: 48px; min-height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .site-nav a, .site-nav a::after { transition: none; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .rule.reveal, .rule.reveal.is-visible { transform: none; transition: none; }
  .gallery__item { transition-delay: 0s; }
  .gallery__item img { transition: none; }
  .gallery__item a:hover img, .gallery__item a:focus-visible img { transition: none; }
  .lightbox__img { transition: none; }
}
