:root {
  --bg: #f9f9f6;
  --fg: #111111;
  --divider: #d9d9d4;
  --accent: #111111;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --header-h: 80px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--fg);
  letter-spacing: 0.03em;
}

.page-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-shell > main:not(.panel-shell) {
  flex: 1;
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 2.75rem) clamp(1.5rem, 4vw, 3rem);
  display: grid;
  gap: clamp(1.5rem, 4vw, 2.75rem);
}

.page-shell > .panel-shell {
  flex: 1;
  width: 100%;
  margin: 0;
  padding: 0;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: clamp(1rem, 3vw, 2rem) clamp(1.5rem, 4vw, 3rem);
  background-color: rgba(249, 249, 246, 0.95);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--divider);
}

.site-brand-link {
  font-size: clamp(1.25rem, 4vw, 1.8rem);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--fg);
  text-decoration: none;
}

.site-primary {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  text-transform: lowercase;
  letter-spacing: 0.18em;
}

.site-link,
.site-link--section,
.site-link--shop,
.site-brand-link {
  color: var(--fg);
  text-decoration: none;
  border: none;
  transition: color 0.2s ease;
}

.site-link--section:hover,
.site-link--section:focus,
.site-link--shop:hover,
.site-link--shop:focus {
  color: var(--divider);
}

.site-brand-link:visited,
.site-brand-link:active,
.site-brand-link:focus {
  color: var(--fg);
}

.site-brand-link:hover {
  color: var(--divider);
}

html[data-panels="true"] body[data-current-section="ink"]   .site-link--section[data-section="ink"],
html[data-panels="true"] body[data-current-section="paint"] .site-link--section[data-section="paint"],
html[data-panels="true"] body[data-current-section="mural"] .site-link--section[data-section="mural"],
html[data-panels="true"] body[data-current-section="info"]  .site-link--section[data-section="info"] {
  color: var(--divider);
}

/* JS-driven active nav state */
.site-link--section.is-active {
  color: var(--divider);
}

body[data-page="shop"] .site-link--shop {
  color: var(--divider);
}

.section-heading {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  text-transform: uppercase;
  letter-spacing: 0.35em;
}

.section-intro {
  display: grid;
  gap: 0.75rem;
  max-width: 50ch;
}

.info-panel {
  display: grid;
  gap: clamp(1rem, 3vw, 2rem);
  max-width: min(780px, 100%);
  padding-left: 0;
  padding-right: 0;
  line-height: 1.6;
}

.info-panel h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.info-panel ul {
  list-style: none;
  padding: 0;
  margin: 00 0 2rem;
  display: grid;
  gap: 0.35rem;
}

.info-panel li {
  font-size: 0.95rem;
}


.detail-image {
  display: block;
}

.detail-meta {
  display: none;
}

.numeric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: clamp(1rem, 3vw, 2rem);
}

.numeric-card {
  border: 1px solid var(--fg);
  background: rgba(255, 255, 255, 0.6);
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.numeric-card:hover,
.numeric-card:focus {
  background: var(--fg);
  color: var(--bg);
}


.site-footer {
  margin: 0;
  padding: clamp(1rem, 3vw, 2rem) clamp(1.5rem, 4vw, 3rem);
  display: flex;
  justify-content: flex-end;
  position: relative;
  z-index: 50;
  border-top: 1px solid var(--divider);
}

.site-footer__link {
  text-transform: lowercase;
  letter-spacing: 0.2em;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
  padding-bottom: 2px;
}

.site-footer__link:hover,
.site-footer__link:focus {
  border-bottom-color: var(--fg);
}


.placeholder-grid {
  display: grid;
  gap: 1rem;
  max-width: 60ch;
}

.placeholder-grid p {
  margin: 0;
  line-height: 1.6;
}

@media (max-width: 960px) {
  /* masonry columns handled in masonry.css */
}

@media (max-width: 640px) {
  .site-header {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .site-primary {
    justify-content: flex-start;
  }
}



@media (max-width: 319px) {
  html[data-panels="true"],
  html[data-panels="true"] body {
    overflow: auto !important;
  }
}

/* === FINAL FOOTER (Option B & Option D) === */
footer.footer-index {
  position: static;
  width: 100%;
  background: var(--bg);
  border-top: 1px solid var(--divider);
  padding: clamp(1rem, 3vw, 2rem) clamp(1.5rem, 4vw, 3rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
}

.detail-id {
  display: none;
}

body[data-page^="detail-"] .detail-id {
  display: inline-flex;
  margin-right: auto;
  letter-spacing: 0.15em;
  font-size: 0.9rem;
}

.footer-index-link {
  margin-left: auto;
  text-decoration: none;
  text-transform: lowercase !important;
  letter-spacing: 0.15em;
  color: var(--fg);
  transition: color 0.2s ease;
}

.footer-index-link:hover,
.footer-index-link:focus {
  color: var(--divider);
}

/* Footer active state on /index/ */
body[data-page="index"] .footer-index-link {
  color: var(--divider);
}

/* Brand color toggle when index panel is active */
body[data-current-section="index"] .site-brand-link {
  color: var(--divider);
}

@media (hover: none) and (pointer: coarse) {
  body[data-current-section="index"] .site-brand-link {
    color: var(--divider);
  }
}

/* CV block hidden state */
.cv-hidden {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity 0.45s ease,
    transform 0.45s ease;
}

.cv-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.info-cv-button {
  margin-top: 1rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--fg);
  transition: color 0.2s ease;
}

.info-cv-button:hover {
  color: var(--divider);
}


/* === DETAIL PAGE DESKTOP TOP-PADDING FIX (>900px only) === */

/* === FIX PARENT GRID STRETCHING ON INDEX PAGE === */
body[data-page="index"] main {
  display: block !important;
}

/* === DISABLE STICKY HOVER FOR BRAND LINK ON TOUCH DEVICES ONLY === */
@media (hover: none) and (pointer: coarse) {
  /* On mobile, brand color depends on which panel is active */
  body[data-current-section="index"] .site-brand-link,
  body[data-current-section="index"] .site-brand-link:active,
  body[data-current-section="index"] .site-brand-link:focus {
    color: var(--divider) !important;
  }

  body:not([data-current-section="index"]) .site-brand-link,
  body:not([data-current-section="index"]) .site-brand-link:active,
  body:not([data-current-section="index"]) .site-brand-link:focus {
    color: var(--fg) !important;
  }
}

/* === DETAIL PAGES: BASE FIT + ORIENTATION EXPAND ON CLICK (Option B) === */
body[data-page^="detail-"] .page-shell > main:not(.panel-shell) {
  margin: 0;
  padding: 0;
  width: 100%;
}

body[data-page^="detail-"] .detail-hero {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  box-sizing: border-box;
  padding: 6px;
}

/* Base state: image fully fits inside viewport (no horizontal overflow) */
body[data-page^="detail-"] .detail-hero img {
  display: block;
  width: auto;
  height: auto;
  margin: 0;
  max-width: calc(100vw - 12px);
  max-height: calc(100vh - var(--header-h, 80px) - 12px);
}

@media (orientation: portrait) {
  body[data-page^="detail-"] .detail-hero img.detail-orientation-expand {
    max-height: calc(100vh - var(--header-h, 80px) - 12px - 16px - 6px);
    max-width: none;
  }
}

@media (orientation: landscape) {
  body[data-page^="detail-"] .detail-hero img.detail-orientation-expand {
    max-width: calc(100vw - 12px - 16px - 6px);
    max-height: none;
  }
}

body[data-page^="detail-"].detail-expand-scroll-x {
  overflow-x: auto;
}

/* === CANONICAL PANEL BOTTOM GAP ON CONTENT CONTAINERS === */
#masonry-ink,
#masonry-paint,
#masonry-mural,
.info-panel {
  padding-bottom: 6px;
}
