/* =========================================================
   Portfolio, About, Contact, Admin
   ========================================================= */

/* ============ 404 ============ */
.error-page {
  padding: 120px 0 100px;
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  position: relative;
}
.error-page .error-stamp {
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(140px, 22vw, 240px);
  line-height: 0.9;
  color: var(--walnut);
  opacity: 0.18;
  margin-bottom: -32px;
  user-select: none;
}
.error-page .eyebrow { display: block; margin-bottom: 18px; }
.error-page h1 {
  font-style: italic;
  font-weight: 400;
  margin-bottom: 22px;
}
.error-page h1 em { font-style: normal; color: var(--walnut); }
.error-page .lede {
  font-size: 18px;
  color: var(--ink-soft);
  max-width: 560px;
  margin: 0 auto 32px;
}
.error-page .actions {
  display: inline-flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
@media (max-width: 600px) {
  .error-page { padding: 80px 0 60px; }
  .error-page .actions .btn { padding: 12px 18px; }
}

/* ============ Page header (used on inner pages) ============ */
.page-head {
  padding: 80px 0 60px;
  border-bottom: 1px solid var(--rule);
}
.page-head .eyebrow { display: block; margin-bottom: 18px; }
.page-head h1 {
  font-style: italic;
  font-weight: 400;
  max-width: 900px;
}
.page-head h1 em { font-style: normal; color: var(--walnut); }
.page-head .lede {
  font-size: 19px;
  color: var(--ink-soft);
  max-width: 640px;
  margin-top: 24px;
}

/* ============ PORTFOLIO ============ */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 32px 0;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 48px;
}
.filters button {
  font-family: var(--f-mark);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 10px 18px;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 999px;
  transition: all 0.15s ease;
}
.filters button:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.filters button.on {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* Row-based grid for varied aspect ratios.
   We previously used CSS `column-count`, but that fills items
   top-to-bottom inside each column before moving to the next,
   which makes left-to-right reading order != DOM order. Aaron
   curates the portfolio with drag-reorder, so reading order
   needs to match. A row-based grid sacrifices a little visual
   tightness (some empty space below shorter cards in a row)
   in exchange for predictable order. */
.masonry {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  align-items: start;
}
@media (max-width: 1000px) { .masonry { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .masonry { grid-template-columns: 1fr; } }

.masonry .card {
  cursor: pointer;
  display: block;
}
.masonry .card .frame {
  overflow: hidden;
  position: relative;
  /* Gray pulsing placeholder shown until the <img> inside
     fires its `load` event and JS adds .is-loaded to the card.
     The card has `aspect-ratio` set inline from the DB so the
     placeholder takes up exactly the right amount of space. */
  background-color: oklch(0.90 0.015 70);
  animation: frame-pulse 1.6s ease-in-out infinite;
}
@keyframes frame-pulse {
  0%, 100% { background-color: oklch(0.90 0.015 70); }
  50%      { background-color: oklch(0.94 0.012 75); }
}
.masonry .card.is-loaded .frame {
  animation: none;
  background-color: var(--bg-deep);
}

.masonry .card .frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.5s ease;
}
.masonry .card.is-loaded .frame img { opacity: 1; }
.masonry .card.is-loaded:hover .frame img { transform: scale(1.03); }
.masonry .card .meta {
  padding: 14px 2px 4px;
}
.masonry .card .meta .title {
  font-family: var(--f-display);
  font-size: 21px;
  font-style: italic;
  margin-bottom: 4px;
  color: var(--ink);
}
.masonry .card .meta .cap {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0;
}
.masonry .card .meta .tag {
  display: inline-block;
  font-family: var(--f-mark);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass-ink);
  margin-bottom: 8px;
}

/* Progressive reveal — site.js promotes .is-pending → (no class)
   as the user scrolls. Cards revealed this way fade in subtly so
   it feels intentional, not jumpy. */
.masonry .card.is-pending { display: none; }
.masonry .card.is-revealing {
  animation: card-fade-in 0.35s ease both;
}
@keyframes card-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Sentinel — invisible but takes up a tiny slice of the column
   flow so IntersectionObserver can fire when it scrolls into
   view. We give it a hair of height so it actually has a box. */
.masonry-sentinel {
  height: 1px;
  width: 100%;
  pointer-events: none;
}

/* Lightbox */
.lightbox {
  position: fixed; inset: 0;
  background: oklch(0.15 0.02 50 / 0.94);
  z-index: 100;
  display: none;
  place-items: center;
  padding: 40px;
  cursor: zoom-out;
}
.lightbox.open { display: grid; }
.lightbox .box {
  max-width: min(1100px, 92vw);
  max-height: 90vh;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto;
  grid-template-areas:
    "img"
    "meta";
  gap: 16px;
  cursor: default;
}
/* When a piece has supplementals the strip sits as a vertical
   column to the right of the primary on desktop, and collapses
   to a horizontal row below on narrow screens. */
.lightbox.has-thumbs .box {
  max-width: min(1280px, 96vw);
  grid-template-columns: minmax(0, 1fr) 130px;
  grid-template-rows: 1fr auto;
  grid-template-areas:
    "img   thumbs"
    "meta  meta";
}
@media (max-width: 820px) {
  .lightbox.has-thumbs .box {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto auto;
    grid-template-areas:
      "img"
      "thumbs"
      "meta";
  }
}
.lightbox .box > img {
  grid-area: img;
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.lightbox .lb-thumbs { grid-area: thumbs; }
.lightbox .lb-meta   { grid-area: meta; }
.lightbox .lb-meta {
  color: oklch(0.92 0.01 80);
  text-align: center;
}
.lightbox .lb-meta .title { font-family: var(--f-display); font-size: 24px; font-style: italic; }
.lightbox .lb-meta .cap { font-size: 14px; color: oklch(0.78 0.01 80); margin-top: 6px; }
.lightbox .close {
  position: absolute;
  top: 24px; right: 24px;
  background: none;
  border: 1px solid oklch(0.7 0.01 80);
  color: oklch(0.92 0.01 80);
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
}
.lightbox .close:hover { background: oklch(0.92 0.01 80); color: var(--ink); }

/* Thumbnail strip — vertical column to the right of the primary
   on desktop, horizontal row below on narrow screens. Each
   thumbnail honors its supplemental's aspect ratio (set inline
   from the data-images JSON) so portraits read tall, landscapes
   read wide. */
.lightbox .lb-thumbs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  padding: 2px;
  max-height: 78vh;
  overflow-y: auto;
  overflow-x: hidden;
}
@media (max-width: 820px) {
  .lightbox .lb-thumbs {
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: flex-start;
  }
}
.lightbox .lb-thumbs[hidden] { display: none; }
.lightbox .lb-thumb {
  width: 110px;          /* fixed width on desktop; height comes from aspect-ratio */
  flex: 0 0 auto;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 120ms ease, border-color 120ms ease, transform 120ms ease;
  overflow: hidden;
}
@media (max-width: 820px) {
  .lightbox .lb-thumb {
    /* Switch the fixed dimension to height so the row has a
       consistent baseline and each photo's width flexes to
       match its aspect ratio. */
    width: auto;
    height: 90px;
  }
}
.lightbox .lb-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.lightbox .lb-thumb:hover { opacity: 0.9; }
.lightbox .lb-thumb.is-active {
  opacity: 1;
  border-color: oklch(0.92 0.01 80);
}

/* "+N more" badge on portfolio cards that carry supplementals.
   Anchored top-right inside .frame so it sits over the corner
   of the photo. Pointer-events off so it doesn't intercept the
   card's click → lightbox handler. */
.masonry .card .frame .more-badge {
  position: absolute;
  top: 10px; right: 10px;
  background: oklch(0.18 0.02 50 / 0.78);
  color: oklch(0.96 0.01 80);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: 999px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  pointer-events: none;
  z-index: 2;
}

/* ============ ABOUT ============ */
.about-hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 80px;
  align-items: center;
  padding: 80px 0;
}
@media (max-width: 900px) { .about-hero { grid-template-columns: 1fr; gap: 40px; } }
.about-hero .copy h1 {
  font-style: italic;
  font-weight: 400;
  margin-bottom: 24px;
}
.about-hero .copy h1 em { font-style: normal; color: var(--walnut); }
.about-hero .copy .lede {
  font-size: 22px;
  line-height: 1.55;
  color: var(--ink-soft);
  font-family: var(--f-display);
  font-style: italic;
}
.about-hero .photo {
  aspect-ratio: 4/5;
  background: var(--bg-deep);
  overflow: hidden;
  position: relative;
}
.about-hero .photo .placeholder {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(45deg,
      oklch(0.88 0.02 60) 0 6px,
      oklch(0.91 0.02 60) 6px 12px);
  display: grid;
  place-items: center;
}
.about-hero .photo .placeholder .pl-mono {
  background: var(--paper);
  padding: 14px 22px;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}

.about-body {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 64px;
  padding: 100px 0;
}
@media (max-width: 800px) { .about-body { grid-template-columns: 1fr; gap: 24px; } }
.about-body .chap-num {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--brass-ink);
}
.about-body .chap-num .ch {
  display: block;
  font-family: var(--f-display);
  font-style: italic;
  font-size: 56px;
  color: var(--walnut);
  line-height: 1;
  margin-top: 8px;
}
.about-body h2 {
  font-style: italic;
  font-weight: 400;
  margin-bottom: 24px;
}
.about-body h2 em { font-style: normal; color: var(--walnut); }
.about-body p {
  font-size: 18px;
  line-height: 1.75;
  color: var(--ink);
  max-width: 680px;
}
.about-body .pullquote {
  font-family: var(--f-display);
  font-size: 30px;
  font-style: italic;
  line-height: 1.35;
  color: var(--walnut);
  border-left: 2px solid var(--brass);
  padding: 8px 0 8px 28px;
  margin: 32px 0;
  max-width: 680px;
}
.about-body + .about-body { padding-top: 0; }

.about-figures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 48px 0;
  max-width: 760px;
}
.about-figures figure { margin: 0; }
.about-figures img { width: 100%; aspect-ratio: 4/5; object-fit: cover; display: block; }
.about-figures figcaption {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  margin-top: 8px;
}

.shop-stats {
  background: var(--bg-deep);
  padding: 80px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin: 80px 0;
}
.shop-stats .grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 40px;
}
@media (max-width: 800px) { .shop-stats .grid { grid-template-columns: 1fr 1fr; } }
.shop-stats .item .n {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 64px;
  line-height: 1;
  color: var(--walnut);
  margin-bottom: 12px;
}
.shop-stats .item .l {
  font-family: var(--f-mark);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ============ CONTACT ============ */
.contact-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 80px;
  padding: 80px 0 100px;
}
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; gap: 48px; } }

/* reCAPTCHA placeholder — shown on /contact and /admin/login
   when keys aren't configured yet. The real Google widget
   renders itself when present and ignores this rule. */
.recaptcha-slot {
  margin: 0;
  min-height: 78px;
  display: grid; place-items: center;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border: 1px dashed var(--rule-deep);
  border-radius: 4px;
  padding: 14px;
  background: var(--paper);
}

.form { display: grid; gap: 22px; }
.field { display: grid; gap: 8px; }
.field label {
  font-family: var(--f-mark);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
}
.field input, .field select, .field textarea {
  font-family: var(--f-body);
  font-size: 16px;
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 14px 16px;
  color: var(--ink);
  border-radius: 2px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--ink);
}
.field textarea { min-height: 160px; resize: vertical; }
.field.row { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 600px) { .field.row { grid-template-columns: 1fr; } }
.form .submit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}
.form .submit-row .small {
  font-size: 13px;
  color: var(--ink-muted);
}
.form-success {
  background: var(--bg-deep);
  border: 1px solid var(--moss);
  padding: 40px;
  text-align: center;
}
.form-success h3 {
  font-family: var(--f-display);
  font-style: italic;
  color: var(--moss);
  margin-bottom: 12px;
}

.contact-info { padding-top: 8px; }
.contact-info h3 {
  font-family: var(--f-display);
  font-style: italic;
  margin-bottom: 8px;
}
.contact-info .block {
  padding: 24px 0;
  border-bottom: 1px solid var(--rule);
}
.contact-info .block:last-child { border-bottom: 0; }
.contact-info .eyebrow { display: block; margin-bottom: 12px; }
.contact-info p { color: var(--ink-soft); margin: 0; }
.contact-info .big {
  font-family: var(--f-display);
  font-size: 24px;
  color: var(--ink);
  font-style: italic;
}

/* ============ ADMIN ============ */
.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 84px);
  background: var(--bg);
}
@media (max-width: 800px) { .admin-shell { grid-template-columns: 1fr; } }

.admin-side {
  background: var(--ink);
  color: oklch(0.85 0.01 80);
  padding: 32px 24px;
}
.admin-side .who {
  display: flex; gap: 12px; align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid oklch(0.3 0.02 60);
  margin-bottom: 24px;
}
.admin-side .who .av {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--walnut);
  display: grid; place-items: center;
  color: var(--paper);
  font-family: var(--f-display);
  font-size: 18px;
}
.admin-side .who .n { color: var(--paper); font-size: 15px; line-height: 1.2; }
.admin-side .who .r { font-size: 12px; color: oklch(0.7 0.01 80); }

.admin-side nav { display: grid; gap: 4px; }
.admin-side nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  font-family: var(--f-mark);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  color: oklch(0.78 0.01 80);
  cursor: pointer;
  text-decoration: none;
  border-radius: 4px;
}
.admin-side nav a:hover { background: oklch(0.3 0.02 60); color: var(--paper); }
.admin-side nav a.on { background: var(--walnut); color: var(--paper); }
.admin-side .logout {
  margin-top: auto;
  padding: 10px 12px;
  color: oklch(0.7 0.01 80);
  font-size: 12px;
  cursor: pointer;
}

.admin-main { padding: 40px 48px; }
@media (max-width: 600px) { .admin-main { padding: 24px; } }

.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}
.admin-head h2 { font-family: var(--f-display); font-size: 32px; }
.admin-head .crumb {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.upload {
  border: 2px dashed var(--rule-deep);
  background: var(--paper);
  padding: 36px;
  text-align: center;
  border-radius: 4px;
  margin-bottom: 32px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.upload:hover { border-color: var(--walnut); background: var(--bg-deep); }
.upload .ic {
  font-size: 28px;
  color: var(--walnut);
  margin-bottom: 8px;
}
.upload .t { font-family: var(--f-display); font-size: 22px; font-style: italic; }
.upload .s { font-size: 13px; color: var(--ink-muted); margin-top: 4px; }

/* Admin grid view-filters — pill row above the cards. The
   counts live-update from admin.js when stars are toggled or
   cards are deleted. */
.admin-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 0 0 24px;
}
.admin-filters button {
  font-family: var(--f-mark);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 999px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.admin-filters button:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.admin-filters button.on {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.admin-filters .count {
  opacity: 0.7;
  font-weight: 400;
  margin-left: 6px;
}
.admin-filters-empty {
  width: 100%;
  margin-top: 16px;
  padding: 24px;
  background: var(--paper);
  border: 1px dashed var(--rule-deep);
  border-radius: 4px;
  color: var(--ink-muted);
  font-family: var(--f-mono);
  font-size: 13px;
  text-align: center;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.admin-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  overflow: hidden;
  border-radius: 4px;
  position: relative;
}
.admin-card.dragging { opacity: 0.5; }
.admin-card.drag-over { outline: 2px solid var(--walnut); outline-offset: -2px; }
/* AJAX delete — the row gets is-deleting while the request is
   in flight, then is-removing when the server confirms; the
   element is dropped from the DOM after the transition. */
.admin-card { transition: opacity 0.25s ease, transform 0.25s ease; }
.admin-card.is-deleting { opacity: 0.5; pointer-events: none; }
.admin-card.is-removing { opacity: 0; transform: scale(0.92); pointer-events: none; }
.admin-card .ph {
  aspect-ratio: 4/3;
  background: var(--bg-deep);
  position: relative;
  overflow: hidden;
}
.admin-card .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.admin-card .ord {
  position: absolute;
  top: 10px; left: 10px;
  background: oklch(0.15 0 0 / 0.7);
  color: var(--paper);
  font-family: var(--f-mono);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 2px;
}
.admin-card .grip {
  position: absolute;
  top: 10px; right: 10px;
  background: oklch(0.15 0 0 / 0.7);
  color: var(--paper);
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 2px;
  cursor: grab;
  font-size: 14px;
}
/* "Featured on home" toggle — overlay on the bottom-right of
   each tile. POSTs to portfolio_feature.php via the existing
   [data-toggle-featured] handler in admin.js. ON state uses
   the brass highlight; OFF state is a neutral ghost. */
.admin-card .star {
  position: absolute;
  bottom: 10px; right: 10px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: oklch(0.15 0 0 / 0.65);
  color: oklch(0.92 0.01 80);
  border: 0;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.admin-card .star:hover  { transform: scale(1.08); background: oklch(0.15 0 0 / 0.85); }
.admin-card .star:focus  { outline: 2px solid var(--brass); outline-offset: 2px; }
.admin-card .star.on {
  background: var(--brass);
  color: var(--ink);
  box-shadow: 0 2px 8px oklch(0 0 0 / 0.25);
}
.admin-card .star.is-saving { opacity: 0.6; cursor: progress; }
/* Shake + red-flash treatment when the user tries to feature a
   fifth piece. The toast next to it carries the explanation. */
.admin-card .star.is-limit {
  animation: star-shake 0.45s ease-out;
  background: oklch(0.55 0.18 25);
  color: var(--paper);
}
@keyframes star-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-4px); }
  40%      { transform: translateX(4px); }
  60%      { transform: translateX(-3px); }
  80%      { transform: translateX(3px); }
}
.admin-card .body { padding: 14px 16px; }
.admin-card .body .ti {
  font-family: var(--f-display);
  font-size: 18px;
  font-style: italic;
  margin: 0 -6px 4px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: text;
  outline: none;
  transition: background 0.15s ease, border-color 0.15s ease;
  /* keep titles to a single line of intent — wrapping is OK,
     but the user should see a clear "field" affordance */
}
.admin-card .body .ti:hover {
  background: var(--bg-deep);
  border-color: var(--rule);
}
.admin-card .body .ti:focus {
  background: var(--paper);
  border-color: var(--walnut);
  box-shadow: 0 0 0 3px oklch(0.92 0.04 70);
}
.admin-card .body .ti.is-saving  { border-color: var(--brass); }
.admin-card .body .ti.is-saved   { animation: ca-saved 0.6s ease; }
.admin-card .body .ti.is-error   { border-color: oklch(0.55 0.13 25); background: oklch(0.96 0.04 25); }
.admin-card .body .ca {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 -6px 12px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: text;
  /* Clamp to 2 lines normally; the :focus rule below removes
     the clamp while the user is editing so they see all of it. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: background 0.15s ease, border-color 0.15s ease;
  outline: none;
}
.admin-card .body .ca:hover {
  background: var(--bg-deep);
  border-color: var(--rule);
}
.admin-card .body .ca:focus {
  background: var(--paper);
  border-color: var(--walnut);
  /* unclamp while editing */
  display: block;
  overflow: visible;
  white-space: pre-wrap;
  cursor: text;
  box-shadow: 0 0 0 3px oklch(0.92 0.04 70);
}
.admin-card .body .ca.is-saving  { border-color: var(--brass); }
.admin-card .body .ca.is-saved   { animation: ca-saved 0.6s ease; }
.admin-card .body .ca.is-error   { border-color: oklch(0.55 0.13 25); background: oklch(0.96 0.04 25); }
@keyframes ca-saved {
  0%   { background: oklch(0.94 0.07 130); border-color: var(--moss); }
  100% { background: var(--paper);          border-color: transparent; }
}
/* Per-tile category reassignment — small uppercase select that
   sits between the caption and the action buttons. POSTs to
   portfolio_field.php on change. */
.admin-card .body .cat-row {
  margin: 0 -6px 12px;
}
.admin-card .body .cat-row select {
  width: 100%;
  font-family: var(--f-mark);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--brass-ink);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 6px 8px;
  cursor: pointer;
  outline: none;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.admin-card .body .cat-row select:hover {
  background: var(--bg-deep);
  border-color: var(--ink-soft);
}
.admin-card .body .cat-row select:focus {
  border-color: var(--walnut);
  box-shadow: 0 0 0 3px oklch(0.92 0.04 70);
}
.admin-card .body .cat-row select.is-saving { border-color: var(--brass); }
.admin-card .body .cat-row select.is-saved  { animation: ca-saved 0.6s ease; }
.admin-card .body .cat-row select.is-error  {
  border-color: oklch(0.55 0.13 25);
  background: oklch(0.96 0.04 25);
}

.admin-card .body .actions {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--rule);
  padding-top: 10px;
}
.admin-card .body .actions button {
  font-family: var(--f-mark);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 2px;
  flex: 1;
}
.admin-card .body .actions button:hover { border-color: var(--ink); color: var(--ink); }
.admin-card .body .actions button.del { color: oklch(0.45 0.13 25); }
.admin-card .body .actions button.del:hover { background: oklch(0.45 0.13 25); color: var(--paper); border-color: oklch(0.45 0.13 25); }

/* Edit modal */
.modal-bg {
  position: fixed; inset: 0;
  background: oklch(0.15 0.02 50 / 0.7);
  z-index: 200;
  display: grid; place-items: center;
  padding: 24px;
}
.modal {
  background: var(--paper);
  width: min(560px, 100%);
  border-radius: 6px;
  overflow: hidden;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--rule);
}
.modal-head h3 { font-family: var(--f-display); font-style: italic; }
.modal-head .x {
  background: none; border: 0; font-size: 20px; cursor: pointer;
  color: var(--ink-soft);
}
.modal-body { padding: 24px; }
.modal-body .preview {
  aspect-ratio: 4/3;
  background: var(--bg-deep);
  margin-bottom: 20px;
  overflow: hidden;
}
.modal-body .preview img { width: 100%; height: 100%; object-fit: cover; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px;
  background: var(--bg-deep);
  border-top: 1px solid var(--rule);
}

/* Login */
.login-shell {
  min-height: calc(100vh - 84px);
  display: grid;
  place-items: center;
  padding: 48px var(--pad);
}
.login-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 48px;
  width: min(440px, 100%);
  border-radius: 4px;
}
.login-card .logo-mark { width: 56px; height: 56px; margin-bottom: 24px; }
.login-card h2 { font-family: var(--f-display); font-style: italic; margin-bottom: 8px; }
.login-card .sub { color: var(--ink-soft); margin-bottom: 28px; font-size: 15px; }
.login-card .hint {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 16px;
  padding: 10px 12px;
  background: var(--bg-deep);
  border-radius: 2px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 32px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 14px 22px;
  border-radius: 4px;
  font-size: 14px;
  z-index: 300;
  box-shadow: 0 8px 24px oklch(0 0 0 / 0.2);
  animation: rise 0.25s ease;
  max-width: min(560px, calc(100vw - 40px));
}
.toast.toast-error {
  background: oklch(0.40 0.18 25);
  color: var(--paper);
  border: 1px solid oklch(0.60 0.18 25);
}
@keyframes rise {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
