/* ==========================================================================
   Site stylesheet.
   Loaded by the live site AND by the admin preview (public/admin/preview.js),
   so what you see in the preview is the same CSS the visitors get.

   Structure:  1. defaults  2. shared components  3. themes  4. accent colors
   Each theme sets colors, type, spacing AND the layout of the navigation bar.
   ========================================================================== */

/* ---------- 1. Defaults ---------- */
:root {
  --bg: #faf7f2; --ink: #221f1b; --muted: #6b655c; --line: #e4ddd0; --rule: #e4ddd0; --card: #ffffff;
  --accent: #b5573b; --accent-ink: #ffffff;
  --radius: 6px; --max: 1120px; --veil: 0.86;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }

/* Everything lives inside .site, which carries data-theme and data-accent */
.site {
  position: relative; isolation: isolate;
  min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--sans); color: var(--ink); background: var(--bg); line-height: 1.6;
}
/* Optional background image, with a veil so text stays readable */
.site.has-bg::before { content: ''; position: fixed; inset: 0; z-index: -2; background: var(--bg-image) center / cover no-repeat; }
.site.has-bg::after { content: ''; position: fixed; inset: 0; z-index: -1; background: var(--bg); opacity: var(--veil); }

/* ---------- 2. Shared components ---------- */
:where(.site) img { max-width: 100%; display: block; }
:where(.site) a { color: inherit; } /* :where keeps this weaker than .btn and nav colors */
.site h1, .site h2, .site h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 0.5em; }
.site h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
.site h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
.site p { margin: 0 0 1em; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.site main { flex: 1; padding: 32px 0 64px; }
.muted { color: var(--muted); }
.notice { padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin: 16px 0; font-size: 0.95rem; }

/* Header and navigation */
.site-header { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.brand-block { display: flex; flex-direction: column; }
.brand { font-family: var(--serif); font-size: 1.25rem; text-decoration: none; font-weight: 600; }
.tagline { display: none; color: var(--muted); font-size: 0.9rem; }
.site nav { display: flex; gap: 20px; flex-wrap: wrap; }
.site nav a { text-decoration: none; color: var(--muted); font-size: 0.95rem; }
.site nav a:hover, .site nav a[aria-current='page'] { color: var(--ink); border-bottom: 2px solid var(--accent); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0; font-size: 0.9rem; color: var(--muted); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.social { display: flex; gap: 16px; }

/* Hero */
.hero { padding: 72px 0 48px; text-align: center; }
.hero p { color: var(--muted); font-size: 1.15rem; max-width: 560px; margin: 0 auto 1.5em; }

/* Buttons */
.btn {
  display: inline-block; padding: 12px 24px; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink); text-decoration: none;
  font-weight: 600; border: 0; cursor: pointer; font-size: 1rem; font-family: inherit; line-height: 1.4;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn[aria-disabled='true'] { background: var(--line); color: var(--muted); cursor: not-allowed; pointer-events: none; }

/* Gallery */
.grid { display: grid; gap: 28px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { text-decoration: none; display: block; }
.card .thumb { aspect-ratio: 4 / 5; overflow: hidden; background: var(--line); border-radius: var(--radius); position: relative; }
.card img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.card:hover img { transform: scale(1.03); }
.card h3 { margin: 12px 0 2px; font-size: 1.1rem; }
.card .meta { color: var(--muted); font-size: 0.9rem; }
.tag { position: absolute; top: 10px; left: 10px; background: rgba(0, 0, 0, 0.75); color: #fff; padding: 3px 10px; font-size: 0.78rem; border-radius: 99px; letter-spacing: 0.04em; text-transform: uppercase; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 28px; }
.filters button { background: transparent; border: 1px solid var(--line); color: var(--ink); padding: 6px 16px; border-radius: 99px; cursor: pointer; font-size: 0.9rem; font-family: inherit; }
.filters button[aria-pressed='true'] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Artwork page */
.artwork { display: grid; gap: 40px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 860px) { .artwork { grid-template-columns: 1.2fr 1fr; } }
.artwork .photo img { width: 100%; border-radius: var(--radius); }
.artwork dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 20px; margin: 20px 0; }
.artwork dt { color: var(--muted); }
.artwork dd { margin: 0; }
.price { font-family: var(--serif); font-size: 1.8rem; margin: 8px 0 20px; }
.back { display: inline-block; margin-bottom: 20px; color: var(--muted); text-decoration: none; }
.buy-form { margin: 0; }

/* About and text pages */
.prose { max-width: 680px; }
.about { display: grid; gap: 36px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 760px) { .about.has-photo { grid-template-columns: 280px 1fr; } }
.about img { border-radius: var(--radius); width: 100%; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

/* ==========================================================================
   3. THEMES
   ========================================================================== */

/* ---- Classic: warm paper, serif, brand left / links right ---- */
[data-theme='classic'] {
  --bg: #faf7f2; --ink: #221f1b; --muted: #6b655c; --line: #e4ddd0; --rule: #e4ddd0; --card: #ffffff;
  --accent: #b5573b; --accent-ink: #ffffff; --radius: 6px;
}
@media (prefers-color-scheme: dark) {
  [data-theme='classic'] { --bg: #17150f; --ink: #f1ece2; --muted: #a39b8d; --line: #332e24; --rule: #332e24; --card: #1f1c15; }
}

/* ---- Gallery: white cube. Centered stacked header, matted artwork ---- */
[data-theme='gallery'] {
  --bg: #ffffff; --ink: #151515; --muted: #7b7b7b; --line: #ececec; --rule: #ececec; --card: #ffffff;
  --accent: #151515; --accent-ink: #ffffff; --radius: 0; --max: 1280px; --veil: 0.93;
  --serif: var(--sans);
}
[data-theme='gallery'] h1, [data-theme='gallery'] h2, [data-theme='gallery'] h3 { font-weight: 300; letter-spacing: 0.04em; }
[data-theme='gallery'] .site-header { border-bottom: 0; }
[data-theme='gallery'] .site-header .wrap { flex-direction: column; justify-content: center; gap: 16px; padding-top: 32px; padding-bottom: 22px; }
[data-theme='gallery'] .brand { font-size: 0.95rem; font-weight: 500; letter-spacing: 0.42em; text-transform: uppercase; }
[data-theme='gallery'] nav { justify-content: center; gap: 34px; }
[data-theme='gallery'] nav a { font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; }
[data-theme='gallery'] .hero { padding: 96px 0 64px; }
[data-theme='gallery'] .hero h1 { font-weight: 200; text-transform: uppercase; letter-spacing: 0.3em; font-size: clamp(1.8rem, 5vw, 3rem); }
[data-theme='gallery'] .btn { border-radius: 0; text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.75rem; padding: 14px 30px; }
[data-theme='gallery'] .grid { gap: 56px 36px; }
[data-theme='gallery'] .card .thumb { background: #f3f3f1; padding: 9%; display: grid; place-items: center; }
[data-theme='gallery'] .card img { width: auto; height: auto; max-height: 100%; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16); }
[data-theme='gallery'] .card:hover img { transform: none; }
[data-theme='gallery'] .card h3 { text-align: center; font-size: 0.85rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.16em; margin-top: 18px; }
[data-theme='gallery'] .card .meta { text-align: center; }
[data-theme='gallery'] .artwork .photo { background: #f3f3f1; padding: 6%; }
[data-theme='gallery'] .artwork .photo img { box-shadow: 0 12px 34px rgba(0, 0, 0, 0.18); }
[data-theme='gallery'] .filters { justify-content: center; }
[data-theme='gallery'] .filters button { border-radius: 0; text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.72rem; }

/* ---- Noir: dark, glowing accent, pill navigation ---- */
[data-theme='noir'] {
  color-scheme: dark;
  --bg: #0d0d10; --ink: #ededf0; --muted: #9a9aa6; --line: #26262d; --rule: #26262d; --card: #16161b;
  --accent: #d9a940; --accent-ink: #14110a; --radius: 12px; --veil: 0.88;
  --serif: var(--sans);
}
[data-theme='noir'] h1, [data-theme='noir'] h2, [data-theme='noir'] h3 { font-weight: 700; letter-spacing: -0.02em; }
[data-theme='noir'] .site-header { background: color-mix(in srgb, var(--bg) 70%, transparent); border-bottom-color: transparent; }
[data-theme='noir'] .brand { font-weight: 700; letter-spacing: 0.01em; display: inline-flex; align-items: center; gap: 10px; }
[data-theme='noir'] .brand::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent); }
[data-theme='noir'] nav { gap: 6px; }
[data-theme='noir'] nav a { padding: 6px 15px; border-radius: 99px; border-bottom: 0; }
[data-theme='noir'] nav a:hover { background: rgba(255, 255, 255, 0.08); border-bottom: 0; }
[data-theme='noir'] nav a[aria-current='page'] { background: var(--accent); color: var(--accent-ink); border-bottom: 0; }
[data-theme='noir'] .hero { padding: 100px 0 56px; background: radial-gradient(60% 90% at 50% 0%, color-mix(in srgb, var(--accent) 20%, transparent), transparent); }
[data-theme='noir'] .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: border-color 0.2s, box-shadow 0.2s; }
[data-theme='noir'] .card:hover { border-color: var(--accent); box-shadow: 0 0 28px color-mix(in srgb, var(--accent) 25%, transparent); }
[data-theme='noir'] .card .thumb { border-radius: 0; }
[data-theme='noir'] .card h3 { padding: 0 16px; margin-top: 14px; }
[data-theme='noir'] .card .meta { padding: 0 16px 16px; }
[data-theme='noir'] .site-footer { border-top-color: var(--line); }

/* ---- Editorial: newspaper masthead, rules, italic serif ---- */
[data-theme='editorial'] {
  --bg: #f4efe6; --ink: #1a1a1a; --muted: #5f594e; --line: #d3cab8; --rule: #1a1a1a; --card: #fbf8f2;
  --accent: #8c2f1b; --accent-ink: #ffffff; --radius: 0; --max: 1180px;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
}
[data-theme='editorial'] .site-header { position: static; background: transparent; backdrop-filter: none; border-top: 6px solid var(--rule); border-bottom: 0; }
[data-theme='editorial'] .site-header .wrap { flex-direction: column; justify-content: center; gap: 0; padding-top: 26px; padding-bottom: 0; }
[data-theme='editorial'] .brand-block { align-items: center; text-align: center; padding-bottom: 18px; }
[data-theme='editorial'] .brand { font-size: clamp(2rem, 7vw, 3.8rem); font-weight: 700; letter-spacing: -0.01em; line-height: 1.05; }
[data-theme='editorial'] .tagline { display: block; font-family: var(--serif); font-style: italic; margin-top: 6px; }
[data-theme='editorial'] nav { width: 100%; justify-content: center; gap: 34px; padding: 11px 0; border-top: 1px solid var(--rule); border-bottom: 3px double var(--rule); }
[data-theme='editorial'] nav a { font-size: 0.74rem; letter-spacing: 0.18em; text-transform: uppercase; }
[data-theme='editorial'] nav a:hover, [data-theme='editorial'] nav a[aria-current='page'] { border-bottom: 0; color: var(--accent); }
[data-theme='editorial'] h2 { border-bottom: 1px solid var(--rule); padding-bottom: 8px; }
[data-theme='editorial'] .hero { text-align: left; padding: 56px 0 40px; border-bottom: 1px solid var(--rule); margin-bottom: 36px; }
[data-theme='editorial'] .hero h1 { font-size: clamp(2.6rem, 8vw, 5.4rem); font-weight: 400; font-style: italic; letter-spacing: -0.02em; }
[data-theme='editorial'] .hero p { margin-left: 0; font-family: var(--serif); font-style: italic; max-width: 620px; }
[data-theme='editorial'] .btn { border-radius: 0; text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.78rem; }
[data-theme='editorial'] .card .thumb { aspect-ratio: 3 / 4; border: 1px solid var(--rule); }
[data-theme='editorial'] .card h3 { font-size: 1.2rem; font-style: italic; font-weight: 400; margin-top: 10px; }
[data-theme='editorial'] .card .meta { text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.72rem; }
[data-theme='editorial'] .filters button { border-radius: 0; text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.72rem; }
[data-theme='editorial'] .site-footer { border-top: 3px double var(--rule); }

/* ---- Studio: bold and playful, floating pill navigation, hard shadows ---- */
[data-theme='studio'] {
  --bg: #fff6e3; --ink: #1b1b1b; --muted: #5d5546; --line: #1b1b1b; --rule: #1b1b1b; --card: #ffffff;
  --accent: #ff5a36; --accent-ink: #ffffff; --radius: 18px; --veil: 0.9;
  --serif: 'Avenir Next', 'Trebuchet MS', system-ui, sans-serif;
}
[data-theme='studio'] h1, [data-theme='studio'] h2, [data-theme='studio'] h3 { font-weight: 800; letter-spacing: -0.03em; }
[data-theme='studio'] .site-header { position: sticky; top: 14px; background: transparent; backdrop-filter: none; border-bottom: 0; padding: 0 14px; margin-top: 14px; }
[data-theme='studio'] .site-header .wrap { background: var(--card); border: 2px solid var(--ink); border-radius: 999px; box-shadow: 4px 4px 0 var(--ink); padding: 8px 12px 8px 24px; }
[data-theme='studio'] .brand { font-weight: 800; letter-spacing: -0.03em; }
[data-theme='studio'] nav { gap: 4px; }
[data-theme='studio'] nav a { padding: 5px 16px; border-radius: 99px; border-bottom: 0; color: var(--ink); font-weight: 600; }
[data-theme='studio'] nav a:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); border-bottom: 0; }
[data-theme='studio'] nav a[aria-current='page'] { background: var(--accent); color: var(--accent-ink); border-bottom: 0; }
[data-theme='studio'] .hero { margin-top: 32px; padding: 64px 24px 56px; background: var(--accent); color: var(--accent-ink); border: 2px solid var(--ink); border-radius: 28px; box-shadow: 6px 6px 0 var(--ink); }
[data-theme='studio'] .hero p { color: inherit; }
[data-theme='studio'] .hero + section { margin-top: 48px; }
[data-theme='studio'] .btn { border: 2px solid var(--ink); border-radius: 99px; box-shadow: 3px 3px 0 var(--ink); transition: transform 0.12s, box-shadow 0.12s; }
[data-theme='studio'] .btn:hover { filter: none; transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
[data-theme='studio'] .hero .btn { background: var(--ink); color: var(--bg); }
[data-theme='studio'] .btn[aria-disabled='true'] { box-shadow: none; border-color: var(--muted); }
[data-theme='studio'] .card { background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: 5px 5px 0 var(--ink); overflow: hidden; transition: transform 0.12s, box-shadow 0.12s; }
[data-theme='studio'] .card:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }
[data-theme='studio'] .card .thumb { border-radius: 0; border-bottom: 2px solid var(--ink); }
[data-theme='studio'] .card h3 { padding: 0 16px; margin-top: 12px; }
[data-theme='studio'] .card .meta { padding: 0 16px 14px; }
[data-theme='studio'] .tag { background: var(--ink); }
[data-theme='studio'] .filters button { border: 2px solid var(--ink); font-weight: 600; }
[data-theme='studio'] .artwork .photo img { border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); }
[data-theme='studio'] .site-footer { border-top: 2px solid var(--ink); }

/* ---- Portfolio: fixed sidebar navigation on desktop ---- */
[data-theme='portfolio'] {
  --bg: #fbfbf9; --ink: #1c1c1c; --muted: #75716a; --line: #e6e4de; --rule: #e6e4de; --card: #ffffff;
  --accent: #3d6b4f; --accent-ink: #ffffff; --radius: 3px; --max: 980px;
}
[data-theme='portfolio'] .tagline { display: block; margin-top: 6px; }
[data-theme='portfolio'] .brand { font-size: 1.6rem; line-height: 1.15; }
[data-theme='portfolio'] .hero { text-align: left; padding: 24px 0 40px; }
[data-theme='portfolio'] .hero p { margin-left: 0; }
@media (min-width: 861px) {
  [data-theme='portfolio'] { display: grid; grid-template-columns: 270px minmax(0, 1fr); grid-template-rows: 1fr auto; }
  [data-theme='portfolio'] .site-header { grid-row: 1 / span 2; position: sticky; top: 0; height: 100vh; align-self: start; border-bottom: 0; border-right: 1px solid var(--line); backdrop-filter: none; }
  [data-theme='portfolio'] .site-header .wrap { flex-direction: column; align-items: flex-start; justify-content: flex-start; flex-wrap: nowrap; gap: 36px; padding: 44px 30px; }
  [data-theme='portfolio'] nav { flex-direction: column; gap: 12px; }
  [data-theme='portfolio'] nav a { font-size: 1.02rem; }
  [data-theme='portfolio'] main { padding: 44px 0 64px; }
  [data-theme='portfolio'] .site-footer .wrap { padding: 0 40px; }
  [data-theme='portfolio'] main .wrap { padding: 0 40px; }
}

/* ==========================================================================
   4. ACCENT OVERRIDES. Optional, applied on top of whichever theme is active.
      "default" has no rule, so the theme keeps its own accent.
   ========================================================================== */
[data-accent='clay']     { --accent: #b5573b; --accent-ink: #ffffff; }
[data-accent='ocean']    { --accent: #2f6f8f; --accent-ink: #ffffff; }
[data-accent='forest']   { --accent: #3d6b4f; --accent-ink: #ffffff; }
[data-accent='plum']     { --accent: #7a3e65; --accent-ink: #ffffff; }
[data-accent='charcoal'] { --accent: #2b2b2b; --accent-ink: #ffffff; }
[data-accent='gold']     { --accent: #c9972b; --accent-ink: #1f1a0e; }
