:root {
  --bg: #d6c8c541;
  --text: #1d1c1cec;
  --muted: #666;
  --border: #e8e8e8;
  --accent: #0f0f0f;
  --overlay-bg: rgba(10, 10, 10, 0.5);
  --overlay-panel: rgba(255, 255, 255, 0.9);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-y: scroll;
  background: var(--bg);
}

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: "adobe-jenson-pro", serif;
  font-weight: 400;
  font-style: normal;
  line-height: 1.5;
  height: 100%;
}

html, body p {
  font-size: 1.1rem;
  }

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

.visually-hidden {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

/* Header / Navbar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  /*background: var(--bg);*/
  padding-bottom: 0.5rem;
  padding-top: 0.5rem;
}

.header-bar {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  padding: 0.75rem 1rem;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  gap: 0.75rem;
}

/* Logo as image */
.logo {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  justify-self: center;
}

/* Control logo height and keep aspect ratio */
.logo img {
  height: 80px;
  width: auto;
  display: block;
  border-radius: 1000px;
}

.site-nav {
  justify-self: center;
}

.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1rem;
}

.nav-links a {
  padding: 0.4rem 0.2rem 0.4rem 0.6rem;
  border-bottom: 2px solid transparent;
  transition: border-color 200ms ease;
  font-size: 1.5rem;
  letter-spacing: 0.2rem;
}

.nav-links a:hover {
  border-color: var(--border);
}

.nav-links a.active {
  border-color: var(--accent);
}

/* Menu toggle (shown on small screens) */
.menu-toggle {
  background: transparent;
  border: none;
  padding: 0.25rem;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.menu-toggle .bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  margin: 3px 0;
}

/* Overlay popup menu */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease-in-out, 
    background 200ms ease-in-out,
    backdrop-filter 200ms ease-in-out;
  pointer-events: none;
  z-index: 100;
}

.overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.overlay-nav {
  position: absolute;
  top: 40%;
  left: 10%;
  right: 10%;
  background: var(--overlay-panel);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  transform: translateY(-8px);
  transition: transform 240ms ease;
}

.overlay.open .overlay-nav {
  transform: translateY(0);
}

.overlay-nav ul {
  list-style: none;
  margin: 0;
  padding: 1.5rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.overlay-nav a {
  font-size: 1.8rem;
  border-radius: 8px;
  padding: 0.4rem 0.2rem 0.5rem 0.9rem;
  border: 1px solid transparent;
  opacity: 0.85;
  letter-spacing: 0.7rem;
  transition: border-color 240ms ease-in-out, background 240ms ease-in-out;
}

.overlay-nav a:hover {
  background: #fff;
  border-color: var(--border);
  transition: border-color 240ms ease-in-out, background 240ms ease-in-out;
}

.close-overlay {
  position: absolute;
  top: 1%;
  right: 2%;
  background: transparent;
  border: none;
  font-size: 2.8rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  color: var(--text);
  opacity: 0.6;
}

/* Layout */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
}

/* Portfolio masonry with CSS columns */
.portfolio-grid {
  column-count: 1;           /* phone: 1 column */
  column-gap: 0.75rem;       /* spacing between columns */
}

.card {
  display: inline-block;      /* makes elements flow into columns */
  width: 100%;
  margin-bottom: 0.75rem;     /* vertical spacing */
  break-inside: avoid;        /* prevent card from breaking across columns */
  overflow: hidden;
  border-radius: 8px;
}

.card img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 400ms, filter 150ms ease-in-out;
  filter : brightness(100%);
}

.card:hover img {
  transition: transform 600ms, filter 150ms ease-in-out;
  transform: scale(1.01);
  filter: brightness(98%);  
}

/* About page sections */
.about-section {
  padding: 1rem 0;
}

.portrait-section .portrait-wrap {
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  justify-content: center;
}
.portrait-wrap img{
  display: block;
  width: 50%;
  }

.bio-section .bio-text {
  max-width: 780px;
  margin: 0 auto;
  text-align: center;
  padding: 1rem 0;
}

.bio-text h2 {
  margin: 0 0 0.5rem;
}

.bio-text p {
  color: var(--muted);
}

.categories-section .categories-grid {
  display: grid;
  gap: 1rem;
}

.category h3 {
  margin-bottom: 0.5rem;
}

.category ul {
  margin: 0;
  padding-left: 1.2rem;
}

/* Contact page */
.contact-section {
  max-width: 720px;
  margin: 2rem auto;
  text-align: center;
}

.contact-line {
  font-size: 1.05rem;
}

.social-links {
  margin-top: 1rem;
}

.social-link {
  display: inline-block;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.social-link:hover {
  background: #fafafa;
}

/* Footer */
.site-footer {
  padding-top: 1rem;
  padding-bottom: 1rem;
  /*background: var(--bg);*/

  /* Ensure predictable stacking and centering */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem; /* space between icons and the text */
}

.footer-icons {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 45px; height: 45px;
  color: var(--text);
  filter: brightness(92%) contrast(50%);
  transition: filter 250ms ease-in-out;
}

.icon-link:hover {
  filter: brightness(100%) contrast(100%);
}

/* Artwork details page */
.artwork-root .loading {
  text-align: center;
  color: var(--muted);
  padding: 2rem 0;
}

.artwork-details {
  display: grid;
  gap: 1rem;
}

.artwork-header {
  text-align: center;
}
.artwork-title {
  margin: 0;
  font-weight: 600;
}
.artwork-meta {
  color: var(--muted);
  display: inline-flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.artwork-hero {
  overflow: hidden;
  display: flex;
  justify-content: center;
}
.artwork-hero img {
  width: 75%;
  height: auto;
  display: block;
  border-radius: 12px;
}

.artwork-gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.artwork-thumb {
  border-radius: 10px;
  overflow: hidden;
  background: #f7f7f7;
}
.artwork-thumb img {
  width: 100%;
  height: auto;
  display: block;
}

.artwork-description {
  max-width: 780px;
  margin: 0 auto;
  color: var(--text);
  text-align: center;
}

.artwork-actions {
  text-align: center;
}
.back-link {
  display: inline-block;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
}
.back-link:hover {
  background: #fafafa;
}

/* Responsive breakpoints for column counts */
@media (min-width: 640px) {
  .portfolio-grid {
    column-count: 2;          /* tablet: 2 columns */
    column-gap: 1rem;
  }
  .card {
    margin-bottom: 1rem;
  }
  .logo img {
    height: 60px;
  }
  .menu-toggle { 
    display: none; 
  }
  .logo { 
    justify-self: start;
  }
  .artwork-gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

@media (min-width: 960px) {
  .portfolio-grid {
    column-count: 3;          /* desktop: 3 columns */
    column-gap: 1.25rem;
  }
  .card {
    margin-bottom: 1.25rem;
  }
  .artwork-gallery {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }
}

/* Show hamburger on small screens, hide desktop nav */
@media (max-width: 639px) {
  .menu-toggle {
    display: inline-block;
  }
  .site-nav {
    display: none;
  }
  .logo img {
    height: 90px;
  }
}
