/*
Theme Name: Peter Lipton Photography v6
Author: Peter Lipton
Description: Art-photography portfolio theme. Vertical portfolio feed with series, pair, contact-sheet and full-bleed modules, a thumbnail index, an Editorial section and a CV-style About page. Fork of Peter Lipton Photography v5.
Version: 6.0.0
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: peter-lipton
Tags: photography, portfolio, minimal, custom-post-type
*/

/* ========================================
   RESET
   ======================================== */

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

ul, ol {
  list-style: none;
}

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

/* ========================================
   TOKENS
   One typeface, one text size, paper-tone ground.
   ======================================== */

:root {
  --color-bg: #f4f2ee;
  --color-text: #141414;
  --color-muted: #6f6c66;
  --color-line: rgba(20, 20, 20, 0.18);

  --font-size: 16px;
  --font-size-small: 13px;

  --header-height: 70px;
  --gutter: 45px;

  --spacing-xs: 8px;
  --spacing-sm: 16px;
  --spacing-md: 24px;
  --spacing-lg: 32px;
  --spacing-xl: 48px;
  --spacing-2xl: 64px;

  --fade: 0.8s ease-in-out;
}

body {
  font-family: var(--pnl-body-font, "Inter Tight"), -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-weight: var(--pnl-body-weight, 400);
  font-size: var(--font-size);
  line-height: 1.45;
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
  transition: background-color 0.6s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--pnl-heading-font, inherit);
  font-weight: var(--pnl-heading-weight, 400);
  font-size: inherit;
  line-height: inherit;
}

p {
  margin-bottom: 1.2em;
}

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

/* ========================================
   HEADER
   Portfolio: name left, text links + index glyph right.
   Other pages: Editorial left, name centre, About right.
   ======================================== */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  z-index: 1000;
  background: transparent;
  transition: transform 0.35s ease;
}

.site-header.header-hidden {
  transform: translateY(-100%);
}

.header-container {
  height: 100%;
  padding: 0 var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Section links: words on large screens, icons on phones */
.nav-link__icon {
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.nav-link__icon svg {
  width: 18px;
  height: 18px;
}

.site-title {
  font-family: var(--pnl-site-title-font, inherit);
  font-weight: var(--pnl-site-title-weight, inherit);
  font-size: inherit;
  line-height: inherit;
  margin: 0;
  white-space: nowrap;
}

.nav-link {
  font-family: var(--pnl-nav-font, inherit);
  font-weight: var(--pnl-nav-weight, inherit);
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.nav-link:hover {
  opacity: 0.6;
}

.nav-link.is-current {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  color: inherit;
  transition: opacity 0.2s ease;
}

.icon-button:hover {
  opacity: 0.6;
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.icon-button.is-current,
.nav-link.is-current .nav-link__icon {
  opacity: 0.45;
}

/* ========================================
   MAIN + FOOTER
   ======================================== */

.site-main {
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

.portfolio-page .site-main {
  margin-top: 0;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.site-footer {
  padding: var(--spacing-lg) var(--gutter);
  border-top: 1px solid var(--color-line);
  font-size: var(--font-size-small);
  color: var(--color-muted);
}

.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.footer-container p {
  margin: 0;
}

.footer-links {
  display: flex;
  gap: var(--spacing-md);
}

/* ========================================
   GENERIC PAGES
   ======================================== */

.content-container {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--spacing-2xl) var(--gutter) 96px;
}

.page-title {
  margin-bottom: var(--spacing-lg);
}

.entry-content a,
.page-body a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* ========================================
   ABOUT / CV
   ======================================== */

body.information-page {
  background-color: var(--about-bg-color, var(--color-bg));
  color: var(--about-text-color, var(--color-text));
}

.cv {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--spacing-2xl) var(--gutter) 96px;
  font-family: var(--pnl-about-body-font, inherit);
  font-size: var(--about-body-font-size, var(--font-size));
  line-height: 1.5;
}

.cv h1,
.cv h2,
.cv h3,
.cv h4 {
  font-family: var(--pnl-about-heading-font, inherit);
  font-size: var(--about-heading-font-size, var(--font-size-small));
  color: var(--color-muted);
  margin: var(--spacing-xl) 0 var(--spacing-sm);
  padding-top: var(--spacing-sm);
  border-top: 1px solid var(--color-line);
}

.cv > .cv__content > :first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.cv ul,
.cv ol {
  margin: 0 0 var(--spacing-md);
}

.cv li {
  padding: 6px 0;
  border-bottom: 1px solid var(--color-line);
}

.cv a {
  color: var(--about-link-color, inherit);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.cv a:hover {
  opacity: 0.6;
}

.cv__contact p {
  margin-bottom: 6px;
}

/* ========================================
   EDITORIAL INDEX (fixed overlay, page locked underneath)
   ======================================== */

body.journal-page {
  background-color: var(--journal-bg-color, var(--jg-bg-color, var(--color-bg)));
}

body.post-type-archive-journal {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.journal-grid-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--jg-bg-color, var(--color-bg));
  z-index: 100;
}

.journal-grid-overlay__scroll {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: var(--jg-padding-top, 120px) var(--jg-padding-sides, 45px) var(--jg-padding-bottom, 80px);
}

.journal-grid-overlay__container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--jg-spacing, 30px);
  margin: 0 auto;
}

.journal-grid-item {
  position: relative;
  display: block;
  width: calc((100% - (var(--jg-columns, 4) - 1) * var(--jg-spacing, 30px)) / var(--jg-columns, 4));
  max-width: var(--jg-item-size, none);
  opacity: 0;
  animation: journalItemFadeIn var(--fade) forwards;
}

@keyframes journalItemFadeIn {
  to { opacity: 1; }
}

.journal-grid-item__image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
}

.journal-grid-item__image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.3s ease;
}

.journal-grid-item__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.journal-grid-item__title {
  font-size: var(--jg-title-size, var(--font-size));
  text-align: center;
  padding: var(--spacing-md);
  line-height: 1.3;
}

@media (hover: hover) {
  .journal-grid-item:hover .journal-grid-item__overlay {
    opacity: 1;
  }

  .journal-grid-item:hover .journal-grid-item__image {
    opacity: 0;
  }
}

/* Touch devices: title under the thumbnail */
@media (hover: none) {
  .journal-grid-item__overlay {
    position: static;
    opacity: 1;
    margin-top: var(--spacing-xs);
  }

  .journal-grid-item__title {
    padding: 0;
    font-size: var(--font-size-small);
  }
}

.journal-grid-overlay .no-content {
  width: 100%;
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--color-muted);
}

/* ========================================
   EDITORIAL ENTRY (single, with infinite loading)
   ======================================== */

.journal-entries-container {
  background-color: var(--journal-bg-color, var(--color-bg));
  color: var(--journal-text-color, var(--color-text));
  min-height: 100vh;
  padding-bottom: var(--journal-bottom-padding, 120px);
}

.journal-entry {
  max-width: var(--journal-max-width, 100%);
  margin: 0 auto;
  padding: 0 var(--journal-side-margins, 45px);
}

.journal-entry + .journal-entry {
  margin-top: calc(var(--journal-entry-separator, 200px) * 0.5);
}

.journal-entry__gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--journal-image-spacing, 100px);
  padding-top: var(--journal-header-margin, 120px);
  align-items: center;
}

.journal-entry__gallery--cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.gallery-item--title {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
}

.journal-entry__title {
  font-family: var(--pnl-journal-title-font, var(--pnl-heading-font, inherit));
  font-size: var(--journal-title-font-size, 48px);
  font-weight: var(--pnl-journal-title-weight, var(--pnl-heading-weight, 400));
  line-height: 1.15;
  text-align: center;
  max-width: 90%;
}

.journal-entry__description {
  font-family: var(--pnl-journal-body-font, var(--pnl-body-font, inherit));
  font-size: var(--journal-desc-font-size, var(--font-size));
  margin: var(--journal-desc-padding-top, 20px) 0 0;
  text-align: center;
  max-width: 90%;
  color: var(--color-muted);
}

.journal-entry__gallery .gallery-item img {
  width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
  opacity: 0;
  animation: journalItemFadeIn var(--fade) forwards;
}

.journal-entry__gallery .gallery-caption {
  margin-top: 0.75rem;
  font-size: var(--font-size-small);
  color: var(--color-muted);
  text-align: center;
}

.gallery-item--content {
  grid-column: 1 / -1;
}

.journal-entry__content {
  max-width: 640px;
  margin: 0 auto;
}

.journal-entry__content a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.journal-loading {
  display: flex;
  justify-content: center;
  padding: 80px 0;
}

.journal-loading__spinner {
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-line);
  border-top-color: var(--color-text);
  border-radius: 50%;
  animation: journalSpin 0.8s linear infinite;
}

@keyframes journalSpin {
  to { transform: rotate(360deg); }
}

/* ========================================
   RESPONSIVE (two breakpoints, like the reference)
   ======================================== */

@media (min-width: 760px) and (max-width: 1019px) {
  .journal-grid-item {
    width: calc((100% - var(--jg-spacing, 30px)) / 2);
  }
}

@media (max-width: 759px) {
  :root {
    --header-height: 56px;
    --gutter: 20px;
  }

  .site-nav {
    gap: 18px;
  }

  .nav-link__text {
    display: none;
  }

  .nav-link__icon {
    display: inline-flex;
  }

  .nav-link.is-current {
    text-decoration: none;
  }

  .content-container,
  .cv {
    padding-top: var(--spacing-xl);
  }

  .journal-grid-overlay__scroll {
    padding: var(--jg-padding-top, 100px) var(--gutter) var(--jg-padding-bottom, 60px);
  }

  .journal-grid-item {
    width: 100%;
  }

  .journal-entry {
    padding: 0 var(--gutter);
  }

  .journal-entry__gallery,
  .journal-entry__gallery--cols-3 {
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
    padding-top: calc(var(--journal-header-margin, 120px) * 0.5);
  }

  .journal-entry__title {
    font-size: var(--journal-title-font-size-mobile, 32px);
  }

  .gallery-item--title {
    min-height: 160px;
  }

  .footer-container {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
