/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --sidebar-width: 320px;
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --color-muted: #666666;
  --color-accent: #222222;
  --color-overlay: rgba(0, 0, 0, 0.7);
  --font-main: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --transition: 0.3s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
  cursor: none;
}

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

img {
  max-width: 100%;
  display: block;
}

/* ===== Custom Cursor ===== */
.cursor {
  position: fixed;
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transition: transform 0.15s ease, background 0.2s ease;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
}

.cursor.hover {
  transform: translate(-50%, -50%) scale(2);
  background: #ffffff;
  border-color: #ffffff;
}

/* ===== Layout ===== */
.app {
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  z-index: 100;
  background: var(--color-bg);
  border-right: 1px solid #f0f0f0;
}

.sidebar-logo {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}

.sidebar-subtitle {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 3rem;
}

.sidebar-nav {
  list-style: none;
  flex: 1;
}

.sidebar-nav li {
  margin-bottom: 0.5rem;
}

.sidebar-nav a {
  display: block;
  padding: 0.6rem 0;
  font-size: 0.95rem;
  color: var(--color-muted);
  transition: color var(--transition), transform var(--transition);
  border-left: 2px solid transparent;
  padding-left: 1rem;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: var(--color-text);
  border-left-color: var(--color-text);
  transform: translateX(4px);
}

.sidebar-footer {
  font-size: 0.75rem;
  color: var(--color-muted);
}

/* ===== Main Content ===== */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 4rem 5rem;
  min-height: 100vh;
}

.section {
  margin-bottom: 6rem;
}

.section-title {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 1rem;
  letter-spacing: -0.5px;
}

.section-subtitle {
  font-size: 1.1rem;
  color: var(--color-muted);
  margin-bottom: 2rem;
  max-width: 600px;
}

/* ===== Hero ===== */
.hero {
  padding: 6rem 0;
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  letter-spacing: -1px;
}

.hero p {
  font-size: 1.2rem;
  color: var(--color-muted);
  max-width: 500px;
  margin-bottom: 2rem;
}

.hero-cta {
  display: inline-block;
  padding: 0.8rem 2rem;
  background: var(--color-accent);
  color: #fff;
  border-radius: 4px;
  font-weight: 500;
  transition: opacity var(--transition);
}

.hero-cta:hover {
  opacity: 0.85;
}

/* ===== Gallery Grid ===== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  aspect-ratio: 4/3;
  background: #f5f5f5;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition);
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: var(--color-overlay);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity var(--transition);
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

.gallery-overlay h3 {
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.gallery-overlay p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
}

/* ===== About ===== */
.about-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.about-text p {
  margin-bottom: 1rem;
  color: var(--color-muted);
}

.about-image {
  border-radius: 4px;
  overflow: hidden;
  aspect-ratio: 3/4;
  background: #f5f5f5;
}

.about-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== Contact ===== */
.contact-form {
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-form input,
.contact-form textarea {
  padding: 0.8rem 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  transition: border-color var(--transition);
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--color-text);
}

.contact-form textarea {
  min-height: 150px;
  resize: vertical;
}

.contact-form button {
  padding: 0.8rem 2rem;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: opacity var(--transition);
  align-self: flex-start;
}

.contact-form button:hover {
  opacity: 0.85;
}

/* ===== Mobile Menu Toggle ===== */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 200;
  background: var(--color-bg);
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 0.5rem;
  cursor: pointer;
}

.mobile-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-text);
  margin: 4px 0;
  transition: transform var(--transition);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .mobile-toggle {
    display: block;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
    padding: 5rem 2rem 3rem;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .about-content {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  body {
    cursor: auto;
  }

  .cursor {
    display: none;
  }
}

/* Portfolio refinements */
:root { --color-bg: #f9f8f5; --color-text: #21231f; --color-muted: #62665f; --color-accent: #435846; --color-overlay: rgba(18, 27, 20, .76); }
body { cursor: auto; }
.sidebar { background: var(--color-bg); border-right-color: #dedfd8; }
.main { max-width: 1700px; }
.gallery-item { border: 0; padding: 0; width: 100%; text-align: left; cursor: pointer; font: inherit; box-shadow: 0 10px 28px rgba(25, 35, 26, .08); }
.gallery-item:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid #809f81; outline-offset: 3px; }
.gallery-item:hover .gallery-overlay, .gallery-item:focus-visible .gallery-overlay { opacity: 1; }
.gallery-full { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; }
.gallery-hero, .about-hero, .contact-hero { padding: 3rem 0 2.5rem; }
.gallery-hero h1, .about-hero h1, .contact-hero h1 { font-size: clamp(2.7rem, 6vw, 5rem); line-height: 1.05; letter-spacing: -.05em; }
.subtitle { color: var(--color-muted); font-size: 1.1rem; margin-top: .6rem; }
.about-section, .contact-section { margin-bottom: 3rem; }
.about-section h2, .contact-section h2 { margin-bottom: 1rem; }
.about-section p, .contact-section p { max-width: 65ch; color: var(--color-muted); margin-bottom: 1rem; }
.about-section:first-of-type { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(220px, .7fr); gap: 3rem; align-items: start; }
.about-image { max-height: 440px; }
.about-list, .contact-details { padding-left: 1.25rem; }
.contact-section { display: grid; grid-template-columns: minmax(230px, 1fr) minmax(280px, 1.2fr); gap: 3rem; }
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-status { min-height: 1.5rem; font-size: .9rem; }
.form-status.success { color: #276339; }
.form-status.error { color: #9b3636; }
.btn-submit:disabled { opacity: .6; cursor: wait; }
.artwork-detail { border: 0; padding: 0; width: min(92vw, 1050px); max-height: 92vh; margin: auto; border-radius: 8px; background: var(--color-bg); color: var(--color-text); box-shadow: 0 25px 90px #0005; }
.artwork-detail::backdrop { background: rgba(12, 18, 13, .8); }
.detail-inner { position: relative; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(230px, .8fr); }
.detail-media { background: #202820; display: grid; place-items: center; min-height: 280px; }
.detail-media img, .detail-media video { width: 100%; max-height: 86vh; object-fit: contain; }
.detail-copy { padding: 3rem 2rem; align-self: center; }
.detail-copy h2 { font-size: 2rem; line-height: 1.1; margin-bottom: .6rem; }
.detail-copy p { margin-top: 1rem; color: var(--color-muted); }
.detail-close { position: absolute; top: 1rem; right: 1rem; z-index: 2; border: 0; border-radius: 50%; background: var(--color-bg); width: 2.4rem; height: 2.4rem; font-size: 1.5rem; cursor: pointer; }
.media-badge { position: absolute; top: 1rem; left: 1rem; padding: .25rem .6rem; background: #fff; color: #222; border-radius: 3px; font-size: .8rem; font-weight: 700; }
@media (max-width: 700px) { .main { padding: 5rem 1.25rem 2rem; } .about-section:first-of-type, .contact-section, .detail-inner { grid-template-columns: 1fr; } .detail-copy { padding: 1.5rem; } .detail-media img, .detail-media video { max-height: 55vh; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }

.video-section { margin-top: 4rem; }
.video-item { max-width: 420px; }
.video-item[hidden] { display: none; }
.collection-link { margin-top: 2rem; }

/* Journal and editor */
.eyebrow { color: var(--color-accent); font-size: .75rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; margin-bottom: .8rem; }
.journal-posts { max-width: 900px; }
.journal-post { padding: 2.5rem 0 3.5rem; border-top: 1px solid #d9ddd4; }
.journal-copy { max-width: 70ch; }
.journal-date { color: var(--color-muted); font-size: .85rem; }
.journal-post h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); line-height: 1.15; margin: .6rem 0 1.5rem; }
.journal-post p { white-space: pre-line; margin: 0 0 1rem; color: #444a43; }
.journal-image { width: 100%; max-height: 650px; object-fit: contain; background: #e7e9e3; margin-top: 2rem; border-radius: 5px; }
.journal-video { width: 100%; aspect-ratio: 16 / 9; border: 0; margin-top: 2rem; border-radius: 5px; background: #151515; }
.empty-state { padding: 2rem 0; color: var(--color-muted); }
.admin-layout { width: min(100% - 2rem, 1000px); margin: 0 auto; padding: 3rem 0 6rem; }
.admin-header { display: flex; justify-content: space-between; align-items: start; gap: 2rem; margin-bottom: 3rem; }
.admin-header h1 { font-size: clamp(2.5rem, 6vw, 4rem); line-height: 1.1; }
.admin-header p:last-child { color: var(--color-muted); margin-top: 1rem; }
.admin-header a { color: var(--color-accent); text-decoration: underline; white-space: nowrap; }
.admin-form { display: grid; gap: .65rem; max-width: 760px; }
.admin-form label { font-weight: 600; margin-top: 1rem; }
.admin-form small { color: var(--color-muted); font-weight: 400; }
.admin-form input, .admin-form textarea { width: 100%; padding: .8rem 1rem; border: 1px solid #cfd5ca; border-radius: 4px; background: white; font: inherit; }
.admin-form textarea { resize: vertical; }
.admin-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }
.admin-actions button { font: inherit; cursor: pointer; border: 0; }
.secondary-button { background: transparent; color: var(--color-accent); text-decoration: underline; }
.admin-existing { margin-top: 4rem; border-top: 1px solid #cfd5ca; padding-top: 2rem; }
.admin-existing h2 { margin-bottom: 1rem; }
.admin-post-row { display: flex; align-items: center; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid #e0e2dc; }
.admin-post-row strong { flex: 1; }
.admin-post-row button { padding: .4rem .75rem; border: 1px solid #cfd5ca; border-radius: 4px; background: white; cursor: pointer; }
@media (max-width: 600px) { .admin-header { display: block; } .admin-header a { display: inline-block; margin-top: 1rem; } }

/* Published work and home previews */
.published-grid:not(:empty) { margin-bottom: 2.5rem; }
.gallery-item img { user-select: none; -webkit-user-drag: none; }
.video-preview { width: 100%; height: 100%; display: grid; place-items: center; background: #26352a; color: white; font-size: 3rem; }
.gallery-overlay strong { color: white; font-size: 1.1rem; }
.gallery-overlay span { color: #eee; font-size: .85rem; }
.detail-media { position: relative; }
.detail-media iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; }
.detail-previous, .detail-next { position: absolute; top: 50%; transform: translateY(-50%); border: 0; border-radius: 50%; background: #fff; color: #17221a; width: 2.4rem; height: 2.4rem; font-size: 1.8rem; cursor: pointer; }
.detail-previous { left: .8rem; } .detail-next { right: .8rem; }
.detail-counter { position: absolute; bottom: .7rem; right: 1rem; color: white; background: #0008; padding: .15rem .5rem; border-radius: 3px; }
.section-heading-row { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.5rem; }
.section-heading-row a { color: var(--color-accent); text-decoration: underline; }
.journal-preview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; }
.journal-preview { display: block; background: white; border: 1px solid #e3e5df; border-radius: 5px; overflow: hidden; transition: transform .2s ease, box-shadow .2s ease; }
.journal-preview:hover { transform: translateY(-3px); box-shadow: 0 14px 24px #1a2a1a16; }
.journal-preview img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.journal-preview div { padding: 1.25rem; }
.journal-preview time { color: var(--color-muted); font-size: .8rem; }
.journal-preview h3 { margin: .4rem 0; font-size: 1.25rem; }
.journal-preview p { color: var(--color-muted); font-size: .9rem; }
.social-links { display: flex; flex-wrap: wrap; gap: .3rem .8rem; margin-bottom: 1rem; font-size: .8rem; color: var(--color-accent); }
.social-links:empty { display: none; }
.social-links a { text-decoration: underline; text-underline-offset: 3px; }
.admin-jump { display: flex; gap: 1.5rem; margin: 0 0 2rem; }
.admin-jump a { color: var(--color-accent); text-decoration: underline; }
.admin-section-title { margin: 2rem 0 1rem; }
.admin-help { color: var(--color-muted); max-width: 65ch; margin: .5rem 0 1rem; }
.admin-subheading { margin: 2rem 0 1rem; }
.admin-media-list:empty { display: none; }
.social-edit-row { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(180px, 2fr) auto; gap: .5rem; margin: .5rem 0; }
.social-edit-row button { width: 2.5rem; border: 1px solid #cfd5ca; border-radius: 4px; background: white; cursor: pointer; }
.admin-social { margin-top: 3rem; }
@media (max-width: 600px) { .section-heading-row { align-items: start; flex-direction: column; } .social-edit-row { grid-template-columns: 1fr auto; } .social-edit-row input[type=url] { grid-column: 1; } .social-edit-row button { grid-row: 1 / 3; grid-column: 2; } }

/* Journal date wheel */
.journal-main { height: 100vh; min-height: 0; overflow-y: auto; scroll-snap-type: y proximity; overscroll-behavior-y: contain; padding-right: 13rem; }
.journal-main .gallery-hero { scroll-snap-align: start; }
.journal-post { scroll-snap-align: start; scroll-margin-top: 1.5rem; min-height: min(75vh, 660px); }
.journal-date-rail { position: fixed; top: 50%; right: clamp(.75rem, 2vw, 2rem); transform: translateY(-50%); z-index: 20; display: flex; flex-direction: column; gap: .25rem; max-height: 72vh; overflow-y: auto; padding: 1rem .4rem 1rem 1.2rem; scrollbar-width: none; scroll-snap-type: y proximity; }
.journal-date-rail::-webkit-scrollbar { display: none; }
.journal-date-rail::before { content: ''; position: absolute; left: 1.57rem; top: 0; bottom: 0; width: 1px; background: #bdc9bc; }
.date-marker { position: relative; display: flex; align-items: center; gap: .8rem; min-height: 2.5rem; border: 0; background: transparent; color: var(--color-muted); font: inherit; font-size: .72rem; text-align: left; cursor: pointer; scroll-snap-align: center; white-space: nowrap; }
.date-dot { position: relative; z-index: 1; width: .75rem; height: .75rem; flex: 0 0 .75rem; border: 2px solid #7a967d; border-radius: 50%; background: var(--color-bg); transition: transform .2s ease, background .2s ease; }
.date-marker:hover, .date-marker.active { color: var(--color-text); font-weight: 700; }
.date-marker.active .date-dot { transform: scale(1.25); background: var(--color-accent); border-color: var(--color-accent); }
@media (max-width: 1100px) { .journal-main { padding-right: 9rem; } .date-label { max-width: 6rem; white-space: normal; } }
@media (max-width: 700px) { .journal-main { height: 100dvh; padding-right: 1.25rem; padding-bottom: 6rem; } .journal-date-rail { top: auto; left: 0; right: 0; bottom: 0; transform: none; flex-direction: row; gap: 1rem; max-height: none; padding: .5rem 1rem; overflow-x: auto; overflow-y: hidden; background: var(--color-bg); border-top: 1px solid #d9ddd4; scroll-snap-type: x proximity; } .journal-date-rail::before { display: none; } .date-marker { scroll-snap-align: center; } .date-label { max-width: none; white-space: nowrap; } }

/* Analytics dashboard */
.admin-header-links { display: flex; flex-direction: column; gap: .5rem; align-items: flex-end; }
.analytics-toolbar { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.analytics-toolbar select { padding: .5rem; border: 1px solid #ccd3c9; background: white; font: inherit; }
.analytics-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin: 2rem 0; }
.analytics-cards > div { display: flex; flex-direction: column; padding: 1.5rem; background: white; border: 1px solid #dce2d9; border-radius: 5px; }
.analytics-cards span, .analytics-cards small { color: var(--color-muted); }
.analytics-cards strong { font-size: 2rem; margin: .3rem 0; }
.analytics-panel { background: white; border: 1px solid #dce2d9; border-radius: 5px; padding: 1.5rem; margin: 1rem 0; }
.analytics-panel h2 { font-size: 1.25rem; margin-bottom: 1rem; }
.analytics-panel p { color: var(--color-muted); font-size: .85rem; margin-bottom: .8rem; }
.analytics-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.analytics-columns .analytics-panel { margin: 0; }
.analytics-list-row { display: flex; justify-content: space-between; gap: .8rem; border-top: 1px solid #e4e7e1; padding: .5rem 0; font-size: .9rem; }
.analytics-list-row span { overflow-wrap: anywhere; }
.daily-chart { display: flex; gap: .4rem; align-items: flex-end; min-height: 160px; overflow-x: auto; }
.daily-column { flex: 1 0 26px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 150px; font-size: .65rem; color: var(--color-muted); }
.daily-bar { width: 100%; min-height: 4px; background: var(--color-accent); border-radius: 3px 3px 0 0; }
.table-scroll { overflow-x: auto; }
.analytics-panel table { border-collapse: collapse; width: 100%; text-align: left; }
.analytics-panel th, .analytics-panel td { padding: .7rem; border-bottom: 1px solid #e4e7e1; white-space: nowrap; }
.privacy-main { max-width: 900px; }
.privacy-main h1 { font-size: clamp(2.5rem, 5vw, 4rem); margin-bottom: 2rem; }
.privacy-main p { margin-bottom: 1rem; color: var(--color-muted); }
@media (max-width: 600px) { .analytics-toolbar { flex-wrap: wrap; } .admin-header-links { align-items: flex-start; } }

#manage-posts .analytics-columns { margin-top: 1rem; }
#manage-posts h3 { font-size: 1rem; margin-bottom: .5rem; }
#manage-posts .admin-post-row { gap: .6rem; }
#manage-posts .admin-post-row strong { min-width: 0; overflow-wrap: anywhere; }
#manage-posts .admin-post-row a { padding: .4rem .25rem; }
