/* Ensure the HTML hidden attribute is respected even when display is set in CSS */
[hidden] { display: none !important; }

:root {
  color-scheme: light;
  font-family: "Public Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 300;
  background: #fafafa;
  color: #121212;
  font-size: 16px;
  line-height: 1.6;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100%;
  background: #fafafa;
}

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

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

a:hover,
a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.container {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.site-header {
  padding: 2rem 0;
  border-bottom: 1px solid rgba(18, 18, 18, 0.06);
  background: #fafafa;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-decoration: none;
  color: #121212;
}

.wordmark {
  font-family: "Public Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.tagline {
  font-family: "Public Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #666;
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 0.35rem;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0.5rem;
}

.hamburger-line {
  width: 26px;
  height: 2px;
  background: #121212;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger[aria-expanded="true"] .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translateY(8px);
}

.hamburger[aria-expanded="true"] .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger[aria-expanded="true"] .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translateY(-8px);
}

.nav-menu {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-menu a {
  font-family: "Public Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #121212;
  transition: color 0.2s ease;
}

.nav-menu a:hover,
.nav-menu a:focus-visible {
  color: #666;
}

.site-footer {
  padding: 2rem 0 4rem;
  color: #666;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  border-top: 1px solid rgba(18, 18, 18, 0.06);
}

.page-title {
  max-width: 820px;
  margin-bottom: 3rem;
}

.page-title h1 {
  margin: 0;
  font-family: "Public Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(2rem, 4vw, 3.75rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.intro {
  margin: 1rem 0 0;
  max-width: 44rem;
  color: #555;
  font-size: 1rem;
}

/* ─── Public gallery grid ─────────────────────────────────────────── */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(var(--gallery-cols, 4), 1fr);
  gap: 1.5rem;
}

/* size → column spans */
.gallery-grid .gallery-item[data-size="small"]  { grid-column: span 1; }
.gallery-grid .gallery-item[data-size="medium"] { grid-column: span 2; }
.gallery-grid .gallery-item[data-size="large"]  { grid-column: span 3; }

/* responsive caps — override spans to stay within available columns */
@media (max-width: 1100px) {
  .gallery-grid {
    grid-template-columns: repeat(min(var(--gallery-cols, 4), 3), 1fr);
  }
  .gallery-grid .gallery-item[data-size="large"] { grid-column: span 3; }
}

@media (max-width: 760px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  .gallery-grid .gallery-item[data-size="medium"],
  .gallery-grid .gallery-item[data-size="large"] { grid-column: span 2; }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .gallery-grid .gallery-item[data-size="small"],
  .gallery-grid .gallery-item[data-size="medium"],
  .gallery-grid .gallery-item[data-size="large"] { grid-column: span 1; }
}

.gallery-item {
  background: #fff;
  border: 1px solid rgba(18, 18, 18, 0.08);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px rgba(18, 18, 18, 0.08);
}

.card-link {
  display: block;
  color: inherit;
}

.card-media {
  overflow: hidden;
  background: #e8e8e8;
}

.card-media img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}

.gallery-item:hover .card-media img {
  transform: scale(1.04);
}

.card-copy {
  padding: 1.2rem;
}

.card-copy h3 {
  margin: 0 0 0.75rem;
  font-family: "Public Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-copy .meta {
  margin: 0;
  font-size: 0.85rem;
  color: #777;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.essay-excerpt {
  margin: 1rem 0 0;
  color: #4a4a4a;
  font-size: 0.95rem;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-art .meta {
  text-transform: uppercase;
}

.card-art .card-media {
  position: relative;
}

.card-art-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 1.2rem 1rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.38) 50%, rgba(0, 0, 0, 0) 100%);
  color: #fff;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.card-art-overlay h3 {
  margin: 0 0 0.3rem;
  font-family: "Public Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-art-overlay .meta {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.78);
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-art-overlay .feed-type {
  color: rgba(255, 255, 255, 0.55);
}

.card-art-overlay .sold-badge {
  color: #ff7b7b;
}

.card-art-overlay .sold-badge::before {
  background: #ff7b7b;
}

.gallery-item.card-art:hover .card-art-overlay {
  opacity: 1;
  transform: translateY(0);
}

/* Touch devices: always show the overlay — hover isn't available */
@media (hover: none) {
  .card-art-overlay {
    opacity: 1;
    transform: translateY(0);
  }
}

.feed-type {
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #999;
}

.card-essay {
  background: #f6f6f6;
}

.essay-copy {
  padding: 1.4rem;
}

.feed-type-essay {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #999;
  margin: 0 0 0.85rem;
}

.essay-excerpt {
  margin: 1rem 0 0;
  color: #4a4a4a;
  font-size: 0.95rem;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sold-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 1rem;
  color: #d32f2f;
  font-weight: 700;
  font-size: 0.78rem;
}

.sold-badge::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: #d32f2f;
}

.art-spread {
  display: grid;
  gap: 3rem;
}

.art-hero {
  overflow: hidden;
  background: #e8e8e8;
}

.art-hero img {
  width: 100%;
  height: auto;
  display: block;
}

.art-layout {
  display: grid;
  gap: 3rem;
  grid-template-columns: minmax(0, 2.2fr) minmax(240px, 1fr);
}

.art-copy {
  max-width: 55rem;
}

.art-copy h1 {
  margin: 0 0 1rem;
  font-family: "Public Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.art-copy .meta {
  margin: 1rem 0 2rem;
  font-size: 0.95rem;
  color: #666;
}

.writeup p {
  margin: 0 0 1.5rem;
  color: #333;
  font-size: 1.05rem;
  line-height: 1.75;
  max-width: 70ch;
}

.art-details {
  border-top: 1px solid rgba(18, 18, 18, 0.08);
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.price {
  margin: 0.5rem 0 0;
  font-size: 2rem;
  font-family: "Public Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.button {
  border: 1px solid #121212;
  background: transparent;
  color: #121212;
  padding: 0.95rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.button-primary {
  background: #f5f5f5;
}

.button-primary:hover {
  background: #ebebeb;
}

.button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.flash-messages {
  max-width: 820px;
  margin: 1rem auto 0;
}

.flash {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-weight: 700;
}

.flash-success {
  background: #e9f7ef;
  color: #1a5c3c;
  border: 1px solid #c8ebd6;
}

.flash-error {
  background: #fdecea;
  color: #7f1c1c;
  border: 1px solid #f5c2c2;
}

.idle-warning {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #2b2b2b;
  color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  max-width: 360px;
}

.idle-warning p {
  margin: 0;
  font-weight: 700;
}

.idle-warning button {
  flex-shrink: 0;
}

.admin-form,
.admin-table,
.admin-grid {
  max-width: 820px;
  margin-bottom: 2rem;
}

.admin-form label {
  display: block;
  margin-bottom: 1rem;
  color: #121212;
}

.admin-form input[type="text"],
.admin-form input[type="url"],
.admin-form input[type="password"],
.admin-form input[type="number"],
.admin-form textarea,
.admin-form select {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(18, 18, 18, 0.16);
  border-radius: 8px;
  margin-top: 0.5rem;
  font-size: 1rem;
}

.admin-form button {
  margin-top: 1rem;
  padding: 0.95rem 1.5rem;
  border: none;
  background: #121212;
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.admin-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
}

.hint {
  margin: 0.5rem 0 1rem;
  font-size: 0.95rem;
  color: #555;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 0.9rem 0.75rem;
  border-bottom: 1px solid rgba(18, 18, 18, 0.08);
  text-align: left;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.admin-actions a,
.admin-actions button {
  color: #121212;
  background: transparent;
  border: 1px solid rgba(18, 18, 18, 0.16);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
}

.admin-actions .action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.admin-actions .action-group-secondary {
  margin-left: 0.5rem;
}

.admin-base-link,
.admin-item-link {
  display: inline-block;
}

.admin-card {
  display: block;
  padding: 1.5rem;
  border: 1px solid rgba(18, 18, 18, 0.12);
  background: #fff;
  text-decoration: none;
  color: inherit;
  border-radius: 18px;
}

.button-secondary {
  border-color: rgba(18, 18, 18, 0.2);
  background: white;
}

.admin-shell {
  min-height: 100vh;
  background: #f5f5f5;
}

.admin-header {
  background: #121212;
  color: #fff;
}

.admin-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 2rem;
}

.admin-brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.admin-wordmark,
.admin-brand a {
  font-family: "Public Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  text-decoration: none;
}

.admin-tagline {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.72);
}

.admin-nav,
.admin-utilities {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.admin-nav,
.admin-utilities {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.admin-nav a,
.admin-utilities a {
  color: #f5f5f5;
  border: 1px solid transparent;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease;
}

.admin-nav a:hover,
.admin-utilities a:hover {
  background: rgba(255, 255, 255, 0.08);
}

.admin-nav a {
  font-size: 0.92rem;
  font-weight: 700;
}

.admin-utilities a {
  font-size: 0.85rem;
  font-weight: 700;
}

.admin-main,
.admin-page {
  width: min(1200px, calc(100% - 4rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.admin-page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-page-header h1 {
  margin: 0;
}

.page-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.admin-flash-messages {
  margin: 1rem 0 2rem;
}

.admin-table th {
  font-weight: 700;
  color: #333;
  background: #fff;
}

.admin-table tr:nth-child(even) {
  background: #fbfbfb;
}

@media (max-width: 780px) {
  .admin-header {
    padding: 1rem 1rem;
    flex-direction: column;
    align-items: stretch;
  }

  .admin-main {
    width: min(100%, calc(100% - 2rem));
    padding: 1.5rem 0 3rem;
  }

  .admin-page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-actions {
    justify-content: flex-start;
  }
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.admin-logout {
  border-color: #7f1c1c;
}

.hint {
  margin: 0.5rem 0 1rem;
  font-size: 0.95rem;
  color: #555;
}

.image-gallery {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.image-card {
  overflow: hidden;
  background: #e8e8e8;
}

.image-card img {
  width: 100%;
  height: auto;
  display: block;
}

.blog-list {
  display: grid;
  gap: 2rem;
}

.blog-item {
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(18, 18, 18, 0.08);
}

.blog-item:last-child {
  border-bottom: none;
}

.blog-item h2 {
  margin: 0 0 0.75rem;
  font-family: "Public Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  line-height: 1.1;
}

.blog-item .meta {
  margin: 0 0 1rem;
  color: #666;
  font-size: 0.95rem;
}

.blog-item p {
  margin: 0;
  color: #333;
  max-width: 70ch;
}

.blog-detail {
  display: grid;
  gap: 2.5rem;
  max-width: 72rem;
}

.blog-detail h1 {
  font-family: "Public Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(2rem, 4vw, 3.25rem);
  margin: 0;
}

.blog-detail .meta {
  margin: 0 0 2rem;
  color: #666;
  font-size: 0.95rem;
}

.blog-detail p {
  color: #333;
  font-size: 1.05rem;
  line-height: 1.75;
  max-width: 75ch;
  margin: 0 0 1.5rem;
}

.blog-detail p:last-child {
  margin-bottom: 0;
}

@media (max-width: 1024px) {
  .grid-feed {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .art-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .art-details {
    border-top: none;
    border-bottom: 1px solid rgba(18, 18, 18, 0.08);
    padding-top: 0;
    padding-bottom: 2rem;
  }
}

@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .nav-menu {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: #fafafa;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(18, 18, 18, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    z-index: 50;
  }

  .nav-menu.open {
    max-height: 280px;
  }

  .nav-menu a {
    width: 100%;
    padding: 0.9rem 0;
    border-bottom: 1px solid rgba(18, 18, 18, 0.06);
  }

  .nav-menu a:last-child {
    border-bottom: none;
    padding-bottom: 1.25rem;
  }

  .container {
    width: 100%;
    padding: 1.5rem 1rem 3rem;
  }

  .page-title h1 {
    font-size: clamp(1.75rem, 6vw, 2.75rem);
  }

  .cover-media {
    min-height: 320px;
  }

  .grid-feed {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .site-header {
    padding: 1.25rem 0;
  }

  .header-container {
    width: min(100%, calc(100% - 2rem));
  }

  .wordmark {
    font-size: 1.5rem;
  }

  .cover-copy h2 {
    font-size: 2rem;
  }

  .essay-copy {
    padding: 1rem;
  }

  .card-copy {
    padding: 1rem;
  }

  .art-copy h1 {
    font-size: clamp(1.75rem, 7vw, 2.5rem);
  }

  .price {
    font-size: 1.6rem;
  }
}

.image-preview {
  margin: 0.5rem 0 1rem;
}

.image-preview img {
  max-width: 240px;
  max-height: 240px;
  display: block;
  border-radius: 8px;
  border: 1px solid rgba(18, 18, 18, 0.12);
}

.image-preview-remove {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #555;
}

.gallery-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0.5rem 0 1rem;
}

.gallery-preview-item {
  text-align: center;
}

.gallery-preview-item img {
  max-width: 140px;
  max-height: 140px;
  display: block;
  border-radius: 8px;
  border: 1px solid rgba(18, 18, 18, 0.12);
  margin-bottom: 0.4rem;
}

.gallery-preview-item label {
  font-size: 0.85rem;
  color: #555;
}

.more-work {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(18, 18, 18, 0.08);
}

.more-work-heading {
  margin: 0 0 1.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #999;
}

.more-work-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.more-work-item {
  display: block;
  text-decoration: none;
  color: inherit;
}

.more-work-thumb {
  overflow: hidden;
  background: #e8e8e8;
  aspect-ratio: 3 / 4;
}

.more-work-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.more-work-item:hover .more-work-thumb img {
  transform: scale(1.04);
}

.more-work-placeholder {
  width: 100%;
  height: 100%;
  background: #e8e8e8;
}

.more-work-title {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 768px) {
  .more-work-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .more-work-row::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 480px) {
  .more-work-row {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }
}

.blog-item-media,
.blog-detail-media {
  overflow: hidden;
  border-radius: 8px;
  background: #e8e8e8;
}

.blog-item-media {
  margin-bottom: 1rem;
  max-width: 32rem;
}

.blog-detail-media img,
.blog-item-media img {
  width: 100%;
  height: auto;
  display: block;
}

/* ─── Admin shell ─────────────────────────────────────────────────── */

.admin-shell {
  background: #f4f4f4;
  min-height: 100vh;
}

/* ─── Admin header ────────────────────────────────────────────────── */

.admin-header {
  background: #111;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 200;
}

.admin-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 2rem;
  position: relative;
}

/* Hamburger — hidden on desktop */
.admin-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  flex-shrink: 0;
}

.admin-hline {
  width: 22px;
  height: 2px;
  background: #fff;
  display: block;
  transition: transform 0.2s, opacity 0.2s;
}

.admin-hamburger[aria-expanded="true"] .admin-hline:nth-child(1) {
  transform: rotate(45deg) translateY(7px);
}

.admin-hamburger[aria-expanded="true"] .admin-hline:nth-child(2) {
  opacity: 0;
}

.admin-hamburger[aria-expanded="true"] .admin-hline:nth-child(3) {
  transform: rotate(-45deg) translateY(-7px);
}

/* ─── Admin nav ───────────────────────────────────────────────────── */

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.admin-nav a {
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.admin-nav a:hover,
.admin-nav a:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
}

.admin-logout-link {
  color: rgba(255, 100, 100, 0.9) !important;
}

.admin-logout-link:hover {
  background: rgba(255, 80, 80, 0.12) !important;
  color: #ff8a8a !important;
}

/* View Site button — visually distinct from nav links */
.admin-view-site {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
  color: #fff !important;
  margin-left: 0.25rem;
}

.admin-view-site:hover,
.admin-view-site:focus-visible {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
  color: #fff !important;
  text-decoration: none;
}

/* Tooltip — appears below the button after a short hover delay */
.admin-view-site::after {
  content: "Opens in a new tab";
  position: absolute;
  top: calc(100% + 0.55rem);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 18, 18, 0.9);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  padding: 0.3rem 0.6rem;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  /* Show with a brief delay so it doesn't flash on accidental hover */
  transition: opacity 0.12s ease 0s;
  z-index: 400;
}

.admin-view-site:hover::after,
.admin-view-site:focus-visible::after {
  opacity: 1;
  transition: opacity 0.12s ease 0.35s;
}

/* ─── Admin flash messages ────────────────────────────────────────── */

.admin-flash-outer {
  background: #f4f4f4;
  padding: 0.75rem 2rem 0;
}

.admin-flash-messages {
  width: min(1200px, calc(100% - 0px));
  margin: 0 auto;
}

.admin-flash-messages .flash {
  padding: 0.85rem 1.1rem;
  border-radius: 7px;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.admin-flash-messages .flash-success::before {
  content: "✓";
  font-size: 0.9rem;
}

.admin-flash-messages .flash-error::before {
  content: "!";
  font-size: 0.9rem;
  font-weight: 900;
}

/* ─── Admin page content ──────────────────────────────────────────── */

.admin-page {
  width: min(1200px, calc(100% - 4rem));
  margin: 0 auto;
  padding: 2rem 0 5rem;
}

/* Admin headings are back-office, not editorial — keep them modest */
.admin-page-header h1 {
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

.admin-page-header p {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  color: #555;
}

/* ─── Admin dashboard cards ───────────────────────────────────────── */

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.875rem;
}

.admin-card {
  display: block;
  padding: 1.4rem 1.5rem;
  border: 1px solid rgba(18, 18, 18, 0.1);
  background: #fff;
  text-decoration: none;
  color: inherit;
  border-radius: 10px;
  transition: box-shadow 0.15s, transform 0.15s;
}

.admin-card:hover {
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.admin-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
}

.admin-card p {
  margin: 0;
  font-size: 0.9rem;
  color: #666;
}

.admin-logout {
  border-color: rgba(200, 40, 40, 0.25);
  background: #fff9f9;
}

.admin-logout:hover {
  box-shadow: 0 4px 16px rgba(200, 40, 40, 0.1);
}

.admin-logout h2 {
  color: #b91c1c;
}

/* ─── Admin forms ─────────────────────────────────────────────────── */

.admin-form,
.admin-table,
.admin-grid {
  max-width: 860px;
}

.admin-form label {
  display: block;
  margin-bottom: 1.1rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #222;
  letter-spacing: 0.01em;
}

.admin-form input[type="text"],
.admin-form input[type="url"],
.admin-form input[type="email"],
.admin-form input[type="password"],
.admin-form input[type="number"],
.admin-form textarea,
.admin-form select {
  display: block;
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid #d0d0d0;
  border-radius: 7px;
  margin-top: 0.4rem;
  font-size: 0.97rem;
  font-family: inherit;
  font-weight: 300;
  background: #fff;
  color: #121212;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
  border-color: #555;
  box-shadow: 0 0 0 3px rgba(18, 18, 18, 0.08);
  outline: none;
}

.admin-form textarea {
  resize: vertical;
  min-height: 120px;
}

.admin-form button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 1.4rem;
  border: none;
  background: #111;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s;
}

.admin-form button:hover {
  background: #333;
}

.admin-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(18, 18, 18, 0.08);
}

.admin-form-actions .button-secondary {
  background: #fff;
  border: 1px solid #d0d0d0;
  color: #333;
  padding: 0.75rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.admin-form-actions .button-secondary:hover {
  background: #f5f5f5;
  border-color: #bbb;
  text-decoration: none;
}

/* Hint text under form fields */
.hint {
  margin: 0.35rem 0 0.9rem;
  font-size: 0.855rem;
  color: #777;
  font-weight: 300;
}

/* ─── Admin page header actions ───────────────────────────────────── */

.admin-page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.admin-page-header > div:first-child {
  min-width: 0;
}

.page-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.page-actions .button,
.page-actions .button-primary {
  padding: 0.65rem 1.1rem;
  font-size: 0.875rem;
  border-radius: 7px;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  background: #111;
  color: #fff;
  border: none;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s;
}

.page-actions .button:hover,
.page-actions .button-primary:hover {
  background: #333;
  text-decoration: none;
}

/* ─── Admin tables ────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  border: 1px solid rgba(18, 18, 18, 0.1);
  background: #fff;
  margin-bottom: 2rem;
  max-width: 100%;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.admin-table th {
  background: #f8f8f8;
  font-size: 0.775rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #555;
  padding: 0.8rem 1rem;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid rgba(18, 18, 18, 0.1);
}

.admin-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(18, 18, 18, 0.06);
  vertical-align: middle;
  color: #222;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr:hover {
  background: #fafafa;
}

/* ─── Table action buttons ────────────────────────────────────────── */

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.action-group {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.action-group-secondary {
  padding-left: 0.25rem;
  border-left: 1px solid rgba(18, 18, 18, 0.1);
  margin-left: 0.1rem;
}

.admin-actions a,
.admin-actions button {
  color: #333;
  background: transparent;
  border: 1px solid #d0d0d0;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}

.admin-actions a:hover,
.admin-actions button:hover {
  background: #f0f0f0;
  border-color: #bbb;
  text-decoration: none;
}

.action-delete {
  color: #b91c1c !important;
  border-color: rgba(185, 28, 28, 0.25) !important;
}

.action-delete:hover {
  background: #fff0f0 !important;
  border-color: rgba(185, 28, 28, 0.5) !important;
}

.action-ship {
  color: #166534 !important;
  border: 1px solid rgba(22, 101, 52, 0.3) !important;
  background: transparent;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
}

.action-ship:hover {
  background: #f0fdf4 !important;
}

/* ─── Status badges ───────────────────────────────────────────────── */

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-available {
  background: #dcfce7;
  color: #166534;
}

.status-sold {
  background: #fee2e2;
  color: #b91c1c;
}

.status-delivered {
  background: #dcfce7;
  color: #166534;
}

.status-shipped {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-awaiting-shipment {
  background: #fef9c3;
  color: #854d0e;
}

/* ─── Empty state ─────────────────────────────────────────────────── */

.empty-state {
  color: #777;
  font-size: 1rem;
  padding: 1.5rem 0;
}

.empty-state a {
  color: #121212;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ─── Idle warning toast ──────────────────────────────────────────── */

.idle-warning {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #1a1a1a;
  color: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  max-width: 360px;
}

.idle-warning p {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.idle-warning button {
  flex-shrink: 0;
  background: #fff;
  color: #111;
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

/* ─── Admin responsive ────────────────────────────────────────────── */

@media (max-width: 900px) {
  .admin-header-inner {
    padding: 0.9rem 1.5rem;
  }

  .admin-page {
    width: calc(100% - 3rem);
  }

  .admin-flash-outer {
    padding: 0.75rem 1.5rem 0;
  }
}

@media (max-width: 680px) {
  /* Show hamburger, collapse nav */
  .admin-hamburger {
    display: flex;
    order: 3;
  }

  .admin-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #111;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 1rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    z-index: 100;
  }

  .admin-nav.open {
    display: flex;
  }

  .admin-nav a {
    padding: 0.75rem 0.5rem;
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    font-size: 0.95rem;
  }

  .admin-nav a:last-child {
    border-bottom: none;
  }

  /* On mobile: no hover tooltip (touch devices don't hover); show inline note instead */
  .admin-view-site {
    border: none !important;
    margin-left: 0 !important;
  }

  .admin-view-site::after {
    display: none;
  }

  .admin-view-site::before {
    content: "new tab";
    font-size: 0.72rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.45);
    margin-left: 0.4rem;
  }

  .admin-header-inner {
    padding: 0.9rem 1.25rem;
  }

  .admin-page {
    width: calc(100% - 2.5rem);
    padding-top: 1.5rem;
  }

  .admin-flash-outer {
    padding: 0.75rem 1.25rem 0;
  }

  .admin-page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-actions {
    justify-content: flex-start;
  }

  .admin-form-actions {
    flex-direction: column;
  }

  .admin-form-actions button,
  .admin-form-actions .button-secondary {
    width: 100%;
    justify-content: center;
  }
}

/* Responsive tables: card stacking at phone width */
@media (max-width: 600px) {
  .table-wrap {
    border: none;
    background: transparent;
    border-radius: 0;
  }

  .admin-table {
    display: block;
  }

  .admin-table thead {
    display: none;
  }

  .admin-table tbody {
    display: block;
  }

  .admin-table tr {
    display: block;
    background: #fff;
    border: 1px solid rgba(18, 18, 18, 0.1);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    overflow: hidden;
  }

  .admin-table td {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(18, 18, 18, 0.06);
    padding: 0.6rem 0.9rem;
    font-size: 0.92rem;
  }

  .admin-table td:last-child {
    border-bottom: none;
  }

  .admin-table td[data-label=""]  {
    /* Action cells with no label — remove the pseudo-element space */
    padding-top: 0.5rem;
    padding-bottom: 0.6rem;
  }

  .admin-table td::before {
    content: attr(data-label);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #888;
    min-width: 5.5rem;
    flex-shrink: 0;
    padding-top: 0.1rem;
  }

  .admin-table td[data-label=""]::before {
    display: none;
  }

  .admin-actions {
    flex-wrap: wrap;
  }
}

/* ─── Gallery layout editor ───────────────────────────────────────── */

.gallery-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.col-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #666;
  margin-right: 0.25rem;
}

.col-control-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.col-btn {
  background: #f0f0f0;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  padding: 0.35rem 0.8rem;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  color: #444;
}

.col-btn:hover {
  background: #e4e4e4;
  border-color: #bbb;
}

.col-btn.active {
  background: #111;
  border-color: #111;
  color: #fff;
}

.save-status {
  font-size: 0.82rem;
  color: #777;
  min-width: 5rem;
}

.save-status-error {
  color: #b91c1c;
}

/* drag grid */
.gallery-editor-grid {
  display: grid;
  grid-template-columns: repeat(var(--editor-cols, 4), 1fr);
  gap: 0.75rem;
}

.gallery-tile {
  background: #fff;
  border: 2px solid rgba(18, 18, 18, 0.1);
  border-radius: 8px;
  overflow: hidden;
  cursor: grab;
  transition: border-color 0.15s, box-shadow 0.15s;
  user-select: none;
}

.gallery-tile:hover {
  border-color: rgba(18, 18, 18, 0.28);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
}

.gallery-tile.tile-ghost {
  opacity: 0.35;
  border: 2px dashed #aaa;
}

.gallery-tile.tile-chosen {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  cursor: grabbing;
}

/* size spans in editor (mirrors public gallery spans) */
.gallery-editor-grid .gallery-tile[data-size="small"]  { grid-column: span 1; }
.gallery-editor-grid .gallery-tile[data-size="medium"] { grid-column: span 2; }
.gallery-editor-grid .gallery-tile[data-size="large"]  { grid-column: span 3; }

.tile-media {
  overflow: hidden;
  background: #e8e8e8;
  aspect-ratio: 4 / 3;
}

.tile-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.tile-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  color: #999;
}

.tile-info {
  padding: 0.45rem 0.6rem 0.5rem;
}

.tile-title {
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #111;
  margin-bottom: 0.2rem;
}

.tile-badges {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.tile-size-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #888;
}

.tile-sold-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #b91c1c;
  background: #fee2e2;
  padding: 0.1rem 0.4rem;
  border-radius: 100px;
}

/* responsive editor grid: cap columns on smaller screens */
@media (max-width: 900px) {
  .gallery-editor-grid {
    grid-template-columns: repeat(min(var(--editor-cols, 3), 3), 1fr);
  }
}

@media (max-width: 600px) {
  .gallery-editor-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .gallery-editor-grid .gallery-tile[data-size="small"],
  .gallery-editor-grid .gallery-tile[data-size="medium"],
  .gallery-editor-grid .gallery-tile[data-size="large"] { grid-column: span 1; }
}
