/* ===========================================================================
   Dina's Fine Art — site styles
   Built on the Dina's Fine Arts design tokens. Adds: dark theme, accent
   emphasis var, layout utilities, premium scroll/hover/parallax animation.
   =========================================================================== */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--canvas);
  font-family: var(--font-body);
  color: var(--body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--clay); color: #fff; }

/* --- accent emphasis: the dominant accent voice (tweakable) --- */
:root { --accent: var(--clay); }

/* =========================================================================
   DARK THEME — warm charcoal-green floor, cream ink. Accents are preserved.
   ========================================================================= */
:root[data-theme="dark"] {
  --canvas: #14191a;
  --surface-soft: #1a201f;
  --surface-card: #202725;
  --surface-strong: #28312d;
  --surface-dark: #0f1313;
  --hairline: #323d39;

  --ink: #f3ece0;
  --body-strong: #e8dece;
  --body: #c7beb0;
  --muted: #9aa098;
  --muted-soft: #7c827a;
  --on-primary: #14191a;

  --color-primary: #f1e9da;     /* CTA inverts: cream fill on dark */
  --color-on-primary: #181d1d;
  --color-bg: var(--canvas);
  --color-bg-soft: var(--surface-soft);
  --color-bg-card: var(--surface-card);
  --color-bg-strong: var(--surface-strong);
  --color-border: var(--hairline);
  --text-heading: var(--ink);
  --text-lead: var(--body-strong);
  --text-body: var(--body);
  --text-muted: var(--muted);
  --text-faint: var(--muted-soft);

  /* warmer, slightly brighter accents so they sing on the dark floor */
  --clay: #d27a59;
  --ochre: #e0a847;
  --rose: #d99a92;
  --sage: #93a37e;
  --plum: #a596bb;
  --mint: #b6cfbe;
}
:root[data-theme="dark"] ::selection { background: var(--clay); color: #14191a; }

/* =========================================================================
   LAYOUT
   ========================================================================= */
.wrap { max-width: 1200px; margin: 0 auto; padding-left: 40px; padding-right: 40px; }
.wrap-wide { max-width: 1320px; margin: 0 auto; padding-left: 40px; padding-right: 40px; }
.band { padding-top: 96px; }
.band-tight { padding-top: 64px; }

.eyebrow {
  font-family: var(--font-body); font-size: var(--fs-caption-uc); font-weight: 600;
  letter-spacing: 1.8px; text-transform: uppercase; color: var(--accent); margin: 0 0 14px;
}
.display {
  font-family: var(--font-display); font-weight: 500; color: var(--ink);
  letter-spacing: -1px; line-height: 1.05; margin: 0;
}
.lead { font-size: var(--fs-title-md); line-height: 1.55; color: var(--body); margin: 0; }

.grid { display: grid; gap: 28px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* home rows: flex so a partial last row stays centred on the page */
.home-row { display: flex; flex-wrap: wrap; gap: 28px; justify-content: center; }
.home-row > * { flex: 0 0 calc(25% - 21px); max-width: calc(25% - 21px); }
.home-row.cols-3 > * { flex: 0 0 calc(33.3333% - 18.67px); max-width: calc(33.3333% - 18.67px); }
@media (max-width: 1000px) {
  .home-row > *, .home-row.cols-3 > * { flex-basis: calc(50% - 14px); max-width: calc(50% - 14px); }
}
@media (max-width: 640px) {
  .home-row > *, .home-row.cols-3 > * { flex-basis: 100%; max-width: 100%; }
}

@media (max-width: 1000px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .wrap, .wrap-wide { padding-left: 22px; padding-right: 22px; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .band { padding-top: 64px; }
}

/* --- responsive hooks: collapse inline-styled grids on small screens --- */
@media (max-width: 860px) {
  .rgrid { grid-template-columns: 1fr !important; gap: 36px !important; }
  .rgrid3 { grid-template-columns: 1fr !important; }
  .rgrid-comm { grid-template-columns: 1fr !important; }
  .rgrid-comm > div:last-child { min-height: 240px; }
  .rgrid-foot { grid-template-columns: 1fr 1fr !important; gap: 28px !important; }
}
@media (max-width: 520px) {
  .rgrid-foot { grid-template-columns: 1fr !important; }
}

/* =========================================================================
   ARTWORK CARD
   ========================================================================= */
.artcard {
  display: flex; flex-direction: column;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow: hidden; cursor: pointer;
  transition: transform .5s cubic-bezier(.2,.7,.2,1), box-shadow .5s ease, border-color .3s ease;
}
.artcard:hover { transform: translateY(-6px); box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--accent) 40%, var(--hairline)); }
.artcard__media { position: relative; overflow: hidden; background: var(--surface-strong); }
.artcard__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.1s cubic-bezier(.2,.7,.2,1); }
.artcard:hover .artcard__media img { transform: scale(1.06); }
/* hover-swap: second photo (close-up) fades in over the first */
.artcard__hoverimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .55s ease, transform 1.1s cubic-bezier(.2,.7,.2,1); }
.artcard.has-swap:hover .artcard__hoverimg { opacity: 1; transform: scale(1.06); }
.artcard__media::after {
  content: ""; position: absolute; inset: 0; opacity: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(20,20,18,.32));
  transition: opacity .5s ease;
}
.artcard:hover .artcard__media::after { opacity: 1; }
.artcard__view {
  position: absolute; left: 14px; bottom: 14px; z-index: 2;
  font-size: 12px; letter-spacing: .4px; font-weight: 600; color: #fff;
  opacity: 0; transform: translateY(8px); transition: opacity .45s ease, transform .45s ease;
  display: inline-flex; align-items: center; gap: 6px;
}
.artcard:hover .artcard__view { opacity: 1; transform: translateY(0); }
.artcard__badge { position: absolute; top: 14px; left: 14px; z-index: 2; }
.artcard__body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 3px; }
.artcard__title { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-title-lg); letter-spacing: -.4px; color: var(--ink); margin: 0; }
.artcard__meta { font-size: var(--fs-body-sm); color: var(--muted); margin: 0; }
.artcard__dims { font-size: var(--fs-caption); color: var(--muted-soft); margin: 0; }
.artcard__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.artcard__price { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-title-md); color: var(--ink); letter-spacing: -.2px; }
.artcard.sold { cursor: default; }
.artcard.sold:hover { transform: none; box-shadow: none; border-color: var(--hairline); }
.artcard.sold .artcard__media img { filter: saturate(.62); }

/* masonry mode */
.masonry { columns: 3; column-gap: 28px; }
.masonry > * { break-inside: avoid; margin-bottom: 28px; }
@media (max-width: 1000px) { .masonry { columns: 2; } }
@media (max-width: 640px) { .masonry { columns: 1; } }

/* =========================================================================
   NAV
   ========================================================================= */
.nav {
  position: sticky; top: 0; z-index: 50; height: 74px;
  background: color-mix(in srgb, var(--canvas) 86%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--hairline) 70%, transparent);
}
.nav__inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.nav__links { display: flex; align-items: center; gap: 34px; }
.nav__link {
  font-size: var(--fs-nav); font-weight: 500; color: var(--muted); cursor: pointer;
  position: relative; padding: 4px 0; letter-spacing: .1px; transition: color .25s ease; background: none; border: none;
}
.nav__link:hover { color: var(--ink); }
.nav__link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .3s ease;
}
.nav__link:hover::after, .nav__link.active::after { transform: scaleX(1); }
.nav__link.active { color: var(--ink); }
.nav__right { display: flex; align-items: center; gap: 14px; }
.theme-toggle {
  width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--hairline);
  background: var(--canvas); color: var(--ink); cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; transition: background-color .25s ease, transform .4s ease;
}
.theme-toggle:hover { background: var(--surface-card); }
:root[data-theme="dark"] .theme-toggle svg { transform: rotate(180deg); }

.nav__burger { display: none; background: none; border: none; cursor: pointer; color: var(--ink); padding: 8px; }
.mobile-menu { display: none; }
@media (max-width: 860px) {
  .nav__links { display: none; }
  .nav__burger { display: inline-flex; }
  .nav__signin { display: none; }
  .mobile-menu {
    display: flex; flex-direction: column; gap: 4px; position: fixed; inset: 74px 0 auto 0; z-index: 49;
    background: var(--canvas); border-bottom: 1px solid var(--hairline); padding: 14px 22px 22px;
    transform: translateY(-12px); opacity: 0; pointer-events: none; transition: opacity .3s ease, transform .3s ease;
  }
  .mobile-menu.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
  .mobile-menu button { text-align: left; background: none; border: none; padding: 14px 4px; font-size: 18px;
    font-family: var(--font-display); color: var(--ink); border-bottom: 1px solid var(--hairline); cursor: pointer; }
}

/* =========================================================================
   ANIMATIONS
   ========================================================================= */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .85s cubic-bezier(.2,.7,.2,1), transform .85s cubic-bezier(.2,.7,.2,1); will-change: opacity, transform; }
.reveal.in { opacity: 1; transform: none; }
.reveal-scale { opacity: 0; transform: scale(.94) translateY(20px); transition: opacity .85s ease, transform .85s cubic-bezier(.2,.7,.2,1); }
.reveal-scale.in { opacity: 1; transform: none; }

/* Entrance keyframes used on always-visible content animate TRANSFORM ONLY —
   never opacity — so that if the animation timeline is frozen (capture iframes,
   background tabs) or unsupported, the resting state is fully visible. */
@keyframes heroRise { from { transform: translateY(26px); } to { transform: none; } }
@keyframes risePop { from { transform: translateY(18px) scale(.985); } to { transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.94) translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes drift { 0%,100% { transform: translate(0,0) rotate(0); } 50% { transform: translate(8px,-10px) rotate(2deg); } }
/* transform-only entrance for overlays — safe when timeline is frozen */
@keyframes enterPop { from { transform: scale(.972) translateY(10px); } to { transform: none; } }
@keyframes enterImg { from { transform: scale(.97); } to { transform: none; } }

.hero-rise { animation: heroRise .9s cubic-bezier(.2,.7,.2,1) both; }
.filter-pop { animation: risePop .55s cubic-bezier(.2,.7,.2,1) both; }

/* parallax media */
.parallax { will-change: transform; }

/* float chips on hero */
.floaty { animation: floaty 7s ease-in-out infinite; }

/* modal */
.overlay {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px;
  background: color-mix(in srgb, var(--surface-dark) 62%, transparent);
  backdrop-filter: blur(6px);
}
.modal {
  width: min(560px, 100%); max-height: 90vh; overflow: auto; background: var(--canvas);
  border: 1px solid var(--hairline); border-radius: var(--radius-xl); padding: 36px;
  animation: enterPop .4s cubic-bezier(.2,.7,.2,1) both;
}
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: grid; grid-template-columns: 1.3fr .9fr;
  background: var(--canvas);
}
.lightbox__img { background: var(--surface-dark); display: grid; place-items: center; overflow: auto; padding: 40px; }
.lightbox__img img { max-width: 100%; max-height: 86vh; object-fit: contain; border-radius: 4px; box-shadow: var(--shadow-lift); animation: enterImg .5s cubic-bezier(.2,.7,.2,1) both; }
.lightbox__panel { padding: 56px 48px; overflow: auto; display: flex; flex-direction: column; }
.lb-photo-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 40px; height: 40px; border-radius: 999px; border: none; cursor: pointer;
  background: rgba(20,20,18,.5); color: #fff; display: grid; place-items: center;
  backdrop-filter: blur(4px); transition: background-color .2s ease;
}
.lb-photo-nav:hover { background: rgba(20,20,18,.8); }
.lb-close-mobile {
  display: none; position: absolute; top: 12px; right: 12px; z-index: 6;
  width: 40px; height: 40px; border-radius: 999px; border: none; cursor: pointer;
  background: rgba(20,20,18,.6); color: #fff; place-items: center; backdrop-filter: blur(4px);
}
@media (max-width: 860px) {
  /* one natural scroll: the whole sheet scrolls, dragging anywhere incl. the photo */
  .lightbox { display: block; grid-template-columns: 1fr; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .lightbox__img { display: block; text-align: center; padding: 16px; min-height: auto; overflow: visible; }
  .lightbox__main { display: block !important; min-height: auto !important; width: 100% !important; }
  .lightbox__img img { max-height: 62vh !important; }
  .lightbox__panel { overflow: visible; padding: 24px 22px 48px; }
  .lb-close-mobile { display: grid; }
}

/* reduced motion + motion-off tweak */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .reveal-scale { opacity: 1; transform: none; transition: none; }
  .hero-rise, .filter-pop, .floaty, .parallax { animation: none !important; }
}
:root.motion-off .reveal, :root.motion-off .reveal-scale { opacity: 1 !important; transform: none !important; transition: none !important; }
:root.motion-off .hero-rise, :root.motion-off .filter-pop, :root.motion-off .floaty { animation: none !important; }
:root.motion-off .artcard, :root.motion-off .artcard__media img, :root.motion-off .artcard__hoverimg { transition: none !important; }
:root.motion-off .parallax { transform: none !important; }

/* misc */
.divider { height: 1px; background: var(--hairline); border: none; }
.pill-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { display:inline-flex; align-items:center; gap:7px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--hairline); background: var(--canvas); color: var(--muted); font-size: var(--fs-body-sm); cursor: pointer; transition: all .2s ease; }
.chip:hover { color: var(--ink); border-color: color-mix(in srgb, var(--accent) 45%, var(--hairline)); }
.chip.active { background: var(--ink); color: var(--canvas); border-color: var(--ink); }
:root[data-theme="dark"] .chip.active { background: var(--ink); color: #14191a; }
