/* ============================================
   Kätrin Beljaev — Main Stylesheet
=========================================== */

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --font-text: Inter, system-ui, sans-serif;
  --paper: #faf8f3;
  --ink: #292622;
  --line: #ded8ce;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-text);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--paper);
}

button {
  font-family: inherit;
}

img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
  border: 0;
}

a {
  color: #333;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
  font-style: normal;
  margin: 1em 0;
  color: #444;
  font-weight: 300;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-style: normal;
  line-height: 1em;
}

p {
  margin: 0 0 1em 0;
}

/* ---- Site Structure ---- */
.site {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-main {
  flex: 1;
}

/* ---- Header ---- */
.site-header {
  position: relative;
  z-index: 500;
  padding: 20px 0;
}

.header-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-wrapper > a {
  width: clamp(15rem, 32vw, 21rem);
  max-width: 100%;
}

.header-wrapper img {
  display: block;
  width: 100%;
  height: auto;
}

.site-branding {
  flex: 1;
}

.site-title {
  font-size: 36px;
  font-style: normal;
  margin: 0;
}

.site-title a {
  color: #333;
}

.site-description {
  font-size: 14px;
  color: #666;
  margin: 0;
  font-weight: 400;
}

/* ---- Navigation ---- */
.site-navigation {
  max-width: 1200px;
  margin: 10px auto 0;
  padding: 10px 20px;
  border-top: 1px solid var(--line);
}

.menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 14px;
}

.menu li {
  margin: 0;
}

.menu a {
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 13px;
}

.menu a:hover {
  color: #333;
}

/* ---- Content ---- */
#page {
  background-color: transparent;
}

#content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ---- Gallery navigation and collections ---- */
.gallery-title,
.home-galleries a {
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gallery-title {
  margin: 2rem 0 0;
  padding-inline: 1rem;
  text-align: center;
}

.home-galleries {
  display: grid;
  grid-template-columns: minmax(0, 23rem) repeat(2, minmax(0, 16rem));
  justify-content: center;
  align-items: center;
  gap: clamp(1.5rem, 5vw, 4rem);
  margin: clamp(2.5rem, 8vw, 6rem) auto;
  padding: 0 clamp(1rem, 5vw, 3rem);
  list-style: none;
  text-align: center;
}

.home-galleries a {
  display: grid;
  justify-items: center;
  gap: 1rem;
  padding: 0.5rem;
  color: var(--ink);
  font-size: clamp(1rem, 2vw, 1.45rem);
  font-weight: 300;
  line-height: 1.2;
}

.home-galleries img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
}

.home-galleries .featured-gallery a {
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 400;
}

.home-galleries a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.home-galleries a:hover span,
.home-galleries a:focus-visible span {
  text-decoration: underline;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1rem, 4vw, 3rem) clamp(0.5rem, 4vw, 3rem);
  max-width: 64rem;
  margin: clamp(1.5rem, 5vw, 3rem) auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
  list-style: none;
  text-align: center;
}

.project-grid a {
  display: grid;
  justify-items: center;
  gap: 0.65rem;
  overflow-wrap: anywhere;
  font-size: clamp(0.75rem, 2vw, 1.125rem);
  line-height: 1.35;
}

.project-grid img,
.project-grid-text-cover {
  width: min(100%, 13.5rem);
  aspect-ratio: 1;
  border-radius: 50%;
}

.project-grid img {
  object-fit: cover;
}

.project-grid-text-cover {
  display: grid;
  place-items: center;
  padding: 0.4rem;
  background: #ede8de;
}

.project-detail {
  max-width: 64rem;
  margin-inline: auto;
}

.gallery-project-text {
  max-width: 64ch;
  margin-top: 1.5rem;
}

.gallery-project-text a {
  text-decoration: underline;
}

.photo-row {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  margin: 1rem 0 0;
  padding: 0.375rem 0.375rem 0.75rem;
  list-style: none;
}

.photo-row li {
  flex: 0 0 clamp(7rem, 29vw, 13.5rem);
  scroll-snap-align: start;
}

.photo-row a,
.photo-row img {
  display: block;
  border-radius: 50%;
}

.photo-row img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
}

.photo-controls:not([hidden]) {
  display: contents;
}

.photo-controls button {
  grid-area: 1 / 1;
  width: 44px;
  height: 44px;
  margin-top: 1rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.25rem;
  cursor: pointer;
}

.photo-controls button[aria-disabled="true"] {
  opacity: 0.45;
  cursor: default;
}

.photo-gallery:has(.photo-controls:not([hidden])) {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: clamp(0.25rem, 1vw, 0.75rem);
}

.photo-gallery:has(.photo-controls:not([hidden])) .photo-row {
  grid-area: 1 / 2;
  padding-block: 0.375rem;
  scrollbar-width: none;
}

.photo-controls button[data-direction="1"] {
  grid-column: 3;
}

.photo-row a:focus-visible,
.photo-controls button:focus-visible,
.photo-viewer button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.photo-viewer {
  width: min(70rem, calc(100% - 1rem));
  max-width: none;
  max-height: calc(100% - 1rem);
  padding: clamp(0.5rem, 2vw, 1rem);
  border: 0;
  background: #211f1c;
  color: #fff;
}

.photo-viewer::backdrop {
  background: rgb(18 16 15 / 82%);
}

.photo-viewer-bar,
.photo-viewer-stage {
  display: grid;
  align-items: center;
  gap: 0.5rem;
}

.photo-viewer-bar {
  grid-template-columns: 1fr auto;
  margin-bottom: 0.5rem;
}

.photo-viewer-stage {
  grid-template-columns: 44px minmax(0, 1fr) 44px;
}

.photo-viewer-stage img {
  grid-column: 2;
  justify-self: center;
  max-height: calc(100dvh - 7rem);
  object-fit: contain;
}

.photo-viewer button {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #a9a39a;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 1.25rem;
  cursor: pointer;
}

.photo-viewer button[aria-disabled="true"] {
  opacity: 0.4;
  cursor: default;
}

@media (max-width: 600px) {
  .home-galleries {
    grid-template-columns: minmax(0, 21rem);
    justify-items: center;
  }

  .home-galleries li {
    width: min(100%, 15rem);
  }

  .home-galleries .featured-gallery {
    width: 100%;
  }
}

/* ---- Legacy gallery grid ---- */
#category-gal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 50px;
  gap: 0;
}

#category-gal article {
  margin: 0;
  padding: 10px 20px;
  width: 220px;
  text-align: center;
}

#category-gal article a {
  display: block;
}

#category-gal article img {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  filter: grayscale(100%);
  -webkit-filter: grayscale(100%);
  -moz-filter: grayscale(100%);
  -o-filter: grayscale(100%);
  -ms-filter: grayscale(100%);
  opacity: 0.8;
  -webkit-opacity: 0.8;
  -moz-opacity: 0.8;
  transition: all 0.3s ease-in-out;
  -webkit-transition: all 0.3s ease-in-out;
  -moz-transition: all 0.3s ease-in-out;
  -o-transition: all 0.3s ease-in-out;
  -ms-transition: all 0.3s ease-in-out;
  object-fit: cover;
}

#category-gal article a:hover img,
#category-gal article a:active img {
  border-radius: 50%;
  filter: none;
  -webkit-filter: none;
  -moz-filter: none;
  -o-filter: none;
  -ms-filter: none;
  opacity: 1;
  -webkit-opacity: 1;
  -moz-opacity: 1;
  transition: all 0.3s ease-in-out;
  -webkit-transition: all 0.3s ease-in-out;
  -moz-transition: all 0.3s ease-in-out;
  -o-transition: all 0.3s ease-in-out;
  -ms-transition: all 0.3s ease-in-out;
  width: 180px;
  height: 180px;
}

.thumbnail-title {
  display: none;
}

/* ---- Posts ---- */
.post {
  margin-bottom: 40px;
}

.post-thumbnail {
  margin-bottom: 20px;
}

.post-thumbnail img {
  max-width: 100%;
  height: auto;
}

.entry-title {
  font-size: 32px;
  font-size: 3.2rem;
  font-style: normal;
  line-height: 1em;
  margin: 0 0 20px 0;
  color: #444;
}

.entry-title a {
  color: #444;
}

.entry-content {
  font-weight: 400;
}

.entry-content img {
  max-width: 100%;
  height: auto;
}

.entry-content figure {
  margin: 1em 0;
}

.entry-content figcaption {
  font-style: italic;
  color: #666;
  font-size: 0.9em;
}

/* ---- WP Block Gallery ---- */
.wp-block-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 1em 0;
}

.wp-block-gallery .blocks-gallery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
}

.wp-block-gallery .blocks-gallery-grid .blocks-gallery-item {
  flex: 0 0 calc(33.333% - 7px);
  max-width: calc(33.333% - 7px);
}

.wp-block-gallery .blocks-gallery-grid .blocks-gallery-item figure {
  margin: 0;
}

.wp-block-gallery img {
  width: 100%;
  height: auto;
}

/* ---- Categories/Archives ---- */
.category-gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 50px;
}

/* ---- Footer ---- */
.site-footer {
  background-color: #f9f9f9;
  border-top: 1px solid #eee;
  padding: 20px;
  margin-top: 40px;
}

.site-info {
  max-width: 1200px;
  margin: 0 auto;
  font-size: 13px;
  color: #999;
}

.site-info a {
  color: #999;
}

.site-info p {
  margin: 0 0 5px 0;
}

/* ---- Page specific ---- */
.page .entry-content {
  max-width: 800px;
}

/* CV Page styling */
.cv-page {
  max-width: 48rem;
  margin-inline: auto;
}

.cv-page .entry-content img {
  display: block;
  width: min(100%, 30rem);
  aspect-ratio: 5 / 6;
  object-fit: cover;
  object-position: center 88%;
  clip-path: inset(0 2% 0 3.5%);
}

.cv-page .entry-content h2 {
  font-size: 1.5em;
  margin: 2rem 0 0.8rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.cv-page .entry-content ul {
  margin: 0;
  padding-inline-start: 1.25rem;
}

.cv-page .entry-content li + li {
  margin-top: 0.4rem;
}

/* ---- Responsive ---- */
@media screen and (max-width: 768px) {
  .header-wrapper {
    flex-direction: column;
    text-align: center;
  }

  .menu {
    justify-content: center;
    gap: 15px;
  }

  #category-gal article {
    width: 160px;
    padding: 10px 10px;
  }

  #category-gal article img {
    width: 140px;
    height: 140px;
  }

  #category-gal article a:hover img,
  #category-gal article a:active img {
    width: 140px;
    height: 140px;
  }

  .wp-block-gallery .blocks-gallery-grid .blocks-gallery-item {
    flex: 0 0 calc(50% - 5px);
    max-width: calc(50% - 5px);
  }

  h1 {
    font-size: 2rem;
  }
}

@media screen and (max-width: 480px) {
  #category-gal article {
    width: 130px;
    padding: 5px;
  }

  #category-gal article img {
    width: 110px;
    height: 110px;
  }

  #category-gal article a:hover img,
  #category-gal article a:active img {
    width: 110px;
    height: 110px;
  }

  .menu {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  .wp-block-gallery .blocks-gallery-grid .blocks-gallery-item {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* ---- Post format ---- */
.format-gallery .entry-content {
  /* Gallery posts have their own styling */
}

/* ---- Taxonomy archives ---- */
.term-description {
  margin-bottom: 30px;
}

/* ---- Home template specific ---- */
.home .site-content {
  padding-top: 20px;
}
