:root {
  /* Dark page background */
  --bg: #1a1a1a;
  --surface: #f3eadc;
  --text: #111;
  --muted: #666;
  --brand: #111;
  --radius: 16px;
  --shadow-1: 0 10px 28px rgba(0,0,0,.14);
  --shadow-2: 0 8px 22px rgba(0, 0, 0, 0.551);
  
  /* Frame properties */
  --frame-inner: 24px;
  --frame-outer: 32px;
  
  /* Frame border widths */
  --frame-inner: 10px;
  --frame-outer: 14px;
  
  /* Frame colors */
  --frame-color-inner: #3b221600;
  --frame-color-outer: #6b4d3500;
}

/* Reset-ish */
* { box-sizing: border-box }
html, body { margin: 0; padding: 0 }
img { max-width: 100%; height: auto; display: block }

/* Base */
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ===== Nav ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(1.05) blur(4px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1rem;
  background: rgba(255,255,255,.95);
  border-bottom: 1px solid rgba(0,0,0,.06);
}

.brand {
  color: var(--brand);
  text-decoration: none;
  font-weight: 750;
  letter-spacing: .2px;
}

.nav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.5rem;
}

.nav-menu a {
  text-decoration: none;
  color: var(--text);
  padding: .4rem .6rem;
  border-radius: 10px;
  transition: all 0.2s ease;
  position: relative;
}

.nav-menu a:hover {
  background: rgba(0,0,0,.06);
}

.nav-menu a[aria-current="page"] {
  background: rgba(0,0,0,.04);
  font-weight: 500;
}

/* Mobile nav */
.nav-toggle {
  display: none;
}

.hamburger {
  display: none;
  cursor: pointer;
  padding: .5rem;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: #222;
  margin: 5px 0;
  transition: transform .3s ease, opacity .3s ease;
}

@media (max-width: 767px) {
  .nav-toggle {
    position: absolute;
    clip: rect(0, 0, 0, 0);
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
  }

  .hamburger {
    display: block;
    z-index: 51;
  }

  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100vh;
    padding: 5rem 2rem 2rem;
    background: rgba(255,255,255,.98);
    flex-direction: column;
    gap: 1rem;
    transition: right .3s ease;
  }

  .nav-toggle:checked ~ .nav-menu {
    right: 0;
  }

  .nav-toggle:checked ~ .hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .nav-toggle:checked ~ .hamburger span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle:checked ~ .hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
  }
}

/* ===== Chaos Mode Toggle ===== */
.chaos-toggle {
  display: flex;
  align-items: center;
  margin-left: 1rem;
}

.chaos-mode-checkbox {
  display: none;
}

.chaos-mode-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.85rem;
  color: #666;
  font-weight: 500;
  user-select: none;
}

.chaos-mode-text {
  margin-right: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chaos-mode-switch {
  position: relative;
  width: 52px;
  height: 28px;
  background: #ccc;
  border-radius: 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.chaos-mode-switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.chaos-mode-checkbox:checked + .chaos-mode-label .chaos-mode-switch {
  background: linear-gradient(135deg, #ff6b6b, #ff4757);
  box-shadow: inset 0 1px 3px rgba(255, 75, 87, 0.3), 0 0 12px rgba(255, 107, 107, 0.4);
}

.chaos-mode-checkbox:checked + .chaos-mode-label .chaos-mode-switch::before {
  transform: translateX(24px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.chaos-mode-label:hover .chaos-mode-switch {
  background: #999;
}

.chaos-mode-checkbox:checked + .chaos-mode-label:hover .chaos-mode-switch {
  background: linear-gradient(135deg, #ff5252, #ff3838);
}

/* Chaos Mode Effects */
body.chaos-mode {
  animation: chaos-bg 2s infinite;
}

@keyframes chaos-bg {
  0% { background: #1a1a1a; }
  25% { background: #2a0a0a; }
  50% { background: #1a0a2a; }
  75% { background: #0a1a2a; }
  100% { background: #1a1a1a; }
}

/* Apply chaos animations to all elements except navigation */
body.chaos-mode *:not(.site-header):not(.site-header *):not(.chaos-toggle):not(.chaos-toggle *) {
  animation: chaos-float 3s infinite ease-in-out,
             chaos-rotate 4s infinite linear,
             chaos-shake 0.5s infinite ease-in-out;
  animation-delay: calc(var(--chaos-delay, 0) * 1s);
  animation-duration: calc(3s + var(--chaos-duration, 0) * 2s);
}

@keyframes chaos-float {
  0%, 100% { transform: translateY(0px) translateX(0px); }
  25% { transform: translateY(-30px) translateX(20px); }
  50% { transform: translateY(20px) translateX(-30px); }
  75% { transform: translateY(-20px) translateX(30px); }
}

@keyframes chaos-rotate {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(90deg) scale(1.1); }
  50% { transform: rotate(180deg) scale(0.9); }
  75% { transform: rotate(270deg) scale(1.05); }
  100% { transform: rotate(360deg) scale(1); }
}

@keyframes chaos-shake {
  0%, 100% { transform: translateX(0px) rotate(0deg); }
  10% { transform: translateX(-5px) rotate(-2deg); }
  20% { transform: translateX(5px) rotate(2deg); }
  30% { transform: translateX(-3px) rotate(-1deg); }
  40% { transform: translateX(3px) rotate(1deg); }
  50% { transform: translateX(-2px) rotate(-0.5deg); }
  60% { transform: translateX(2px) rotate(0.5deg); }
  70% { transform: translateX(-1px) rotate(-0.2deg); }
  80% { transform: translateX(1px) rotate(0.2deg); }
  90% { transform: translateX(-0.5px) rotate(-0.1deg); }
}

/* Random positioning for chaos mode */
body.chaos-mode main > * {
  position: relative !important;
}

body.chaos-mode .piece {
  animation: chaos-float 2s infinite ease-in-out,
             chaos-rotate 3s infinite linear,
             chaos-shake 0.3s infinite ease-in-out,
             chaos-position 5s infinite ease-in-out;
}

body.chaos-mode .piece-media img {
  animation: chaos-float 1.5s infinite ease-in-out,
             chaos-rotate 2.5s infinite linear reverse,
             chaos-shake 0.2s infinite ease-in-out,
             chaos-scale 1s infinite ease-in-out;
}

@keyframes chaos-position {
  0%, 100% { top: 0; left: 0; }
  25% { top: -50px; left: 30px; }
  50% { top: 40px; left: -40px; }
  75% { top: -30px; left: 50px; }
}

@keyframes chaos-scale {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* Add random delays to create more chaos */
body.chaos-mode .piece:nth-child(odd) {
  --chaos-delay: 0.5;
  --chaos-duration: 1;
}

body.chaos-mode .piece:nth-child(even) {
  --chaos-delay: 1;
  --chaos-duration: 0.5;
}

body.chaos-mode .piece:nth-child(3n) {
  --chaos-delay: 1.5;
  --chaos-duration: 1.5;
}

/* Chaos mode for text elements */
body.chaos-mode h1,
body.chaos-mode h2,
body.chaos-mode h3,
body.chaos-mode p,
body.chaos-mode .piece-title,
body.chaos-mode .piece-meta,
body.chaos-mode .piece-price {
  animation: chaos-text 1s infinite ease-in-out,
             chaos-shake 0.4s infinite ease-in-out;
  animation-delay: calc(var(--chaos-delay, 0) * 0.5s);
}

@keyframes chaos-text {
  0%, 100% { 
    transform: translateY(0) scale(1) rotate(0deg);
    opacity: 1;
  }
  25% { 
    transform: translateY(-10px) scale(1.1) rotate(5deg);
    opacity: 0.8;
  }
  50% { 
    transform: translateY(5px) scale(0.9) rotate(-3deg);
    opacity: 0.9;
  }
  75% { 
    transform: translateY(-5px) scale(1.05) rotate(2deg);
    opacity: 0.85;
  }
}

/* ===== Layout ===== */
.container {
  max-width: 1000px;
  margin: 1rem auto 3rem;
  padding: 0 1rem;
}

/* ===== Piece (tile) ===== */

.piece-title {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 1px;
  font-family: 'merriweather', serif;
}

/* ===== Price ===== */
.piece-price {
  font-size: 1rem;
  color: #111;
  font-weight: 600;
  margin: .25rem 0 0 0;
}

/* ===== Painting Metadata ===== */
.piece-meta-portrait {
  font-size: 0.9rem;             /* match non-portrait size */
  color: rgba(0, 0, 0, 0.55);    /* subdued neutral tone */
  font-family: 'Inter', sans-serif; /* keep it clean */
  letter-spacing: 0px;
  margin-top: 0rem;
  text-align: right;
  font-style: italic;            /* optional — feels classy and understated */
}

/* ===== Painting Metadata ===== */
.piece-meta {
  font-size: 0.9rem;             /* small and elegant */
  color: rgba(0, 0, 0, 0.55);    /* subdued neutral tone */
  font-family: 'Inter', sans-serif; /* keep it clean */
  letter-spacing: 0px;
  text-align: left;
  font-style: italic;            /* optional — feels classy and understated */
}

.piece {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 0 8px 6px rgba(64, 64, 64, 0.8), var(--shadow-2);
  overflow: visible;
  margin: 1rem 0 2rem;
  display: flex;
  flex-direction: column;
  max-height: none; /* allow card to grow with content on desktop too */
  position: relative;
}

.piece::before {
  content: "";
  position: absolute;
  top: -60px;
  left: -60px;
  right: -60px;
  bottom: -60px;
  background: radial-gradient(circle at center, rgba(119, 196, 199, 0) 0%, rgba(137, 151, 149, 0.308) 100%);
  border-radius: calc(var(--radius) + 60px);
  z-index: -1;
  filter: blur(100px);
  opacity: 0.5
}

.piece-media {
  padding: 3rem;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
}

.piece-media {
  padding: 3rem;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
}

.piece-media img {
  max-width: calc(100% - 6rem);
  max-height: calc(75vh - 6rem);
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow:
    inset 0 6px 12px rgba(255,255,255,0.6),
    inset 0 -6px 12px rgba(0,0,0,0.06),
    0 0 0 var(--frame-inner) var(--frame-color-inner),
    0 0 0 var(--frame-outer) var(--frame-color-outer),
    0 48px 96px rgba(0,0,0,0.40),
    0 16px 32px rgba(0,0,0,0.20);
  filter: drop-shadow(0 36px 80px rgba(0,0,0,.45));
  transition: filter .22s ease, box-shadow .22s ease;
  cursor: pointer;
}

.piece-content {
  padding: 0 2rem 2rem 2rem;
}

/* Portrait layout (10% taller than wide) */
@media (min-width: 768px) {
  .piece.is-portrait {
    flex-direction: row;
    align-items: stretch;
  }

  .piece.is-portrait .piece-media {
    flex: 0 0 65%;
    max-width: 55%;
    padding: 3rem 1.5rem 3rem 1.5rem;
  }

  .piece.is-portrait .piece-content {
    flex: 1;
    padding: 2rem 2rem 2rem 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 0;
    max-width: 85%;
    text-align: right;
  }
}

/* ===== Mobile styles ===== */
@media (max-width: 767px) {
  :root {
    --frame-inner: 16px;
    --frame-outer: 24px;
  }
  
  .container {
    padding: 0 .5rem; /* small side gutters on mobile */
    margin: 0 auto 2rem;
    max-width: 100vw;
  }

  .piece {
    margin: 1rem 0;
    border-radius: 10px;
    box-shadow: var(--shadow-1);
    max-height: none;
  }

  .piece-media {
    padding: 1rem;
  }

  :root {
    --frame-inner: 6px;
    --frame-outer: 10px;
  }
  
  .piece-media {
    padding: 0;
  }

  .piece-media img {
    max-width: 100%;
    width: 100%;
    height: auto;
    max-height: none;
    display: block;
    object-fit: contain;
    box-shadow:
      inset 0 6px 12px rgba(255,255,255,0.6),
      inset 0 -6px 12px rgba(0,0,0,0.06),
      0 0 0 var(--frame-inner) var(--frame-color-inner),
      0 0 0 var(--frame-outer) var(--frame-color-outer),
      0 48px 96px rgba(0,0,0,0.40),
      0 16px 32px rgba(0,0,0,0.20);
  }

  .piece-content {
    padding: 1rem;
    max-width: 100%;
  }

  /* Left-align meta for portrait pieces on mobile */
  .piece.is-portrait .piece-meta-portrait {
    text-align: left;
  }

  .nav {
    flex-direction: column;
    gap: .5rem;
    padding: .5rem;
  }

  .nav-menu {
    flex-direction: column;
    gap: .5rem;
    width: 100%;
    align-items: flex-start;
  }
}

/* ===== Fullscreen viewer styles ===== */
.fullscreen-viewer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(30, 20, 10, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.fullscreen-viewer.active {
  opacity: 1;
  pointer-events: auto;
}

.fullscreen-viewer img {
  max-width: 96vw;
  max-height: 92vh;
  box-shadow: 0 32px 72px rgba(0,0,0,0.30);
  background: #fff;
  object-fit: contain;
}

.viewer-active {
  overflow: hidden;
}

/* ===== Shop Page ===== */
.page-header {
  text-align: center;
  padding: 2rem 1rem;
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 2.5rem;
  margin: 0 0 1rem;
}

.shop-coming-soon {
  text-align: center;
  padding: 4rem 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}

.shop-coming-soon h2 {
  font-size: 2rem;
  margin: 0 0 1rem;
}

.shop-coming-soon p {
  max-width: 600px;
  margin: 1rem auto;
  color: var(--muted);
}

.shop-coming-soon a {
  color: var(--brand);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.shop-coming-soon a:hover {
  opacity: 0.8;
}

/* ===== About & Contact Pages ===== */
.about-content,
.contact-content {
  max-width: 800px;
  color: white;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.contact-content h1,
.contact-content p {
  color: white;
}

.prose {
  line-height: 1.7;
}

.prose h2 {
  margin: 2rem 0 1rem;
  font-size: 1.5rem;
}

.prose p {
  margin: 1rem 0;
}

/* Subtle gray text-bubble for quotes inside pieces */
.piece-body .prose p > i,
.piece-body.prose p > i {
  display: block;
  position: relative;
  background: rgba(0,0,0,0.04);
  color: #444;
  padding: .75rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.06);
  margin: .25rem 0 .35rem 0; /* breathing room above/below bubble */
}

/* Prefer a dedicated paragraph as the bubble container */
.piece-body .prose p.quote,
.piece-body.prose p.quote {
  position: relative;
  background: rgba(0,0,0,0.04);
  color: #444;
  padding: .75rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.06);
  margin: .25rem 0 .35rem 0;
}

.piece-body .prose p.quote i,
.piece-body.prose p.quote i {
  display: inline;
  background: transparent;
  border: 0;
  padding: 0;
}

.piece-body .prose p.quote .quote-author,
.piece-body.prose p.quote .quote-author {
  display: block;
  font-size: .9rem;
  color: rgba(0,0,0,0.55);
  margin-top: .5rem;
  padding-left: .25rem;
}

.piece-body .prose p > i::before,
.piece-body.prose p > i::before {
  content: none;
  display: none;
}

/* Sender name under the quote bubble */
.piece-body .prose .quote-author,
.piece-body.prose .quote-author {
  display: block;
  font-size: .9rem;
  color: rgba(0,0,0,0.55);
  margin: 0 0 .75rem 0;
  padding-left: .5rem; /* slight indent from bubble edge */
}

.piece-body .prose .quote-author::before,
.piece-body.prose .quote-author::before {
  content: "\2014\00A0"; /* em dash + non-breaking space */
}

.prose ul {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.contact-info {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.contact-methods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin: 3rem 0;
}

.contact-method {
  padding: 1.5rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}

.contact-method h2 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
}

.social-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.contact-method a {
  color: var(--brand);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.contact-method a:hover {
  border-color: currentColor;
}

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  margin-top: auto;
}

/* ===== Purchase Notice (Gallery) ===== */
.purchase-notice {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px;
  box-shadow: var(--shadow-1);
  z-index: 9999;
}

.purchase-notice .purchase-text {
  margin: 0;
}

.purchase-notice a {
  color: var(--brand);
  text-decoration: underline;
}

.purchase-notice .purchase-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: #555;
  font-size: 1rem;
  cursor: pointer;
  padding: .25rem .4rem;
  border-radius: 6px;
}

.purchase-notice .purchase-close:hover {
  background: rgba(0,0,0,.06);
}

@media (max-width: 767px) {
  .purchase-notice {
    width: calc(100vw - 1rem);
    bottom: 12px;
    padding: .75rem;
    gap: .5rem;
  }
  .purchase-notice .purchase-text { font-size: .95rem; }
}

/* ===== Text Alignment ===== */
.text-right {
  text-align: right !important;
}
