/* =========================================================
   The Reptile Pit — Stylesheet
   Palette: white, natural wood brown, natural/dark green
   ========================================================= */

:root {
  --white: #ffffff;
  --bone: #f7f4ef;
  --brown-900: #3d2b1f;
  --brown-700: #6b4c33;
  --brown-500: #8d6b4f;
  --brown-200: #d9c6b0;
  --brown-100: #ece2d4;
  --green-900: #1e3a29;
  --green-700: #2f5d3a;
  --green-600: #3c7449;
  --green-500: #4f8a5b;
  --green-100: #e3efe4;
  --red-600: #c0392b;
  --red-700: #a93226;
  --text: #2a2420;
  --text-soft: #5c534b;
  --line: #e4ddd3;
  --shadow-sm: 0 1px 2px rgba(45, 30, 15, .06), 0 1px 3px rgba(45, 30, 15, .05);
  --shadow-md: 0 4px 12px rgba(45, 30, 15, .09), 0 2px 4px rgba(45, 30, 15, .05);
  --shadow-lg: 0 14px 40px rgba(30, 20, 10, .18);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --maxw: 1180px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bone);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

a { color: var(--green-700); }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--green-500);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--green-900);
  color: #fff;
  padding: .7rem 1.1rem;
  z-index: 999;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.wrap { width: min(100% - 2rem, var(--maxw)); margin-inline: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .72rem 1.25rem;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .05s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--green-700); color: #fff; }
.btn-primary:hover { background: var(--green-900); }

.btn-ghost {
  background: transparent;
  color: var(--green-900);
  border-color: var(--brown-200);
}
.btn-ghost:hover { background: var(--green-100); border-color: var(--green-500); }

.btn-dark { background: var(--brown-900); color: #fff; }
.btn-dark:hover { background: #1f150e; }

.btn-danger { background: var(--red-600); color: #fff; }
.btn-danger:hover { background: var(--red-700); }

.btn-sm { padding: .5rem .95rem; font-size: .85rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 0;
}
.brand { display: flex; flex-direction: column; text-decoration: none; color: inherit; line-height: 1.15; }
.brand-name { font-weight: 800; font-size: 1.25rem; letter-spacing: -.01em; color: var(--green-900); }
.brand-tag { font-size: .75rem; color: var(--text-soft); }

.site-nav { display: flex; gap: 1.25rem; }
.site-nav a { text-decoration: none; font-weight: 600; color: var(--brown-700); font-size: .95rem; }
.site-nav a:hover { color: var(--green-700); }

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(1200px 400px at 90% -10%, rgba(79, 138, 91, .18), transparent 60%),
    linear-gradient(180deg, #ffffff 0%, var(--bone) 100%);
  border-bottom: 1px solid var(--line);
}
.hero-inner { padding: 3.5rem 0 3rem; max-width: 720px; }
.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.9rem, 4.2vw, 3rem);
  line-height: 1.12;
  letter-spacing: -.02em;
  color: var(--green-900);
}
.hero-sub { margin: 0 0 1.6rem; color: var(--text-soft); font-size: 1.05rem; max-width: 55ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; }

/* ---------- Sections ---------- */
.section { padding: 3rem 0; }
.section-head { margin-bottom: 1.75rem; }
.section-head h2 {
  margin: 0 0 .35rem;
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  color: var(--green-900);
  letter-spacing: -.01em;
}
.section-sub { margin: 0; color: var(--text-soft); max-width: 62ch; }

/* ---------- Controls ---------- */
.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem 1.25rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  align-items: end;
}
.control { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.control-label { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--brown-700); }

.control input[type="search"],
.control input[type="number"],
.control select {
  width: 100%;
  padding: .6rem .7rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.control input:focus, .control select:focus {
  border-color: var(--green-500);
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 138, 91, .18);
}

.search-row { display: flex; gap: .5rem; }
.search-row input { flex: 1; }

.range-row { display: flex; align-items: center; gap: .4rem; }
.range-row input { flex: 1; min-width: 0; }
.range-dash { color: var(--text-soft); }

.control--actions { justify-content: flex-end; }

.result-count { margin: 1.25rem 0 .75rem; color: var(--text-soft); font-size: .9rem; }

/* ---------- Grid & Cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .18s ease;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  font: inherit;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--brown-100);
  overflow: hidden;
}
.card__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}
.card:hover .card__media img { transform: scale(1.03); }

.card__badge {
  position: absolute;
  top: .6rem; left: .6rem;
  background: rgba(30, 58, 41, .85);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .28rem .55rem;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.card__badge--sold { background: rgba(192, 57, 43, .92); }

.card__body { padding: .85rem 1rem 1rem; display: flex; flex-direction: column; gap: .2rem; }
.card__id { font-size: .85rem; font-weight: 700; color: var(--green-700); letter-spacing: .03em; }
.card__price { font-size: 1.15rem; font-weight: 800; color: var(--brown-900); }
.card__size { font-size: .85rem; color: var(--text-soft); }

/* ---------- Empty / States ---------- */
.empty {
  text-align: center;
  padding: 3rem 1rem;
  background: var(--white);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--text-soft);
}
.empty strong { color: var(--green-900); display: block; margin-bottom: .35rem; font-size: 1.1rem; }

.state { text-align: center; padding: 2.5rem 1rem; color: var(--text-soft); }
.state--error { color: var(--red-600); }

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--brown-200);
  border-top-color: var(--green-700);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  display: inline-block;
  margin-bottom: .75rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Contact ---------- */
.section--contact { background: linear-gradient(180deg, var(--bone), #fff); border-top: 1px solid var(--line); }
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.contact-card {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: 1.1rem 1.25rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .18s ease, border-color .15s ease;
}
.contact-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--green-500); }
.contact-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--green-100);
  color: var(--green-700);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.contact-body { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.contact-body strong { color: var(--green-900); font-size: .95rem; }
.contact-body span { color: var(--text-soft); font-size: .88rem; word-break: break-word; }

/* ---------- Footer ---------- */
.site-footer { background: var(--green-900); color: #e7efe8; padding: 1.75rem 0; }
.footer-inner { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; align-items: center; }
.site-footer p { margin: 0; font-size: .9rem; }
.footer-fine { color: #b9c9bc; font-size: .82rem !important; }

/* ---------- Photo Viewer ---------- */
.viewer { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 1rem; }
.viewer[hidden] { display: none; }
.viewer__backdrop { position: absolute; inset: 0; background: rgba(20, 15, 10, .78); backdrop-filter: blur(4px); }
.viewer__panel {
  position: relative;
  width: min(100%, 900px);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1rem 1rem 1.25rem;
}
.viewer__close {
  position: absolute; top: .6rem; right: .6rem;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, .9);
  color: var(--brown-900);
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  z-index: 2;
}
.viewer__close:hover { background: var(--brown-100); }

.viewer__stage {
  position: relative;
  background: #f1ece5;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  display: grid; place-items: center;
}
.viewer__stage img { width: 100%; height: 100%; object-fit: contain; user-select: none; }

.viewer__nav {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, .88);
  color: var(--brown-900);
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.viewer__nav:hover { background: #fff; }
.viewer__nav--prev { left: .6rem; }
.viewer__nav--next { right: .6rem; }
.viewer__nav[disabled] { opacity: .35; cursor: not-allowed; }

.viewer__counter { text-align: center; margin: .6rem 0 .2rem; font-size: .85rem; color: var(--text-soft); font-weight: 600; letter-spacing: .05em; }

.viewer__info { text-align: center; padding: 0 .5rem; }
.viewer__title { margin: .25rem 0; font-size: 1.4rem; color: var(--green-900); letter-spacing: .02em; }
.viewer__price { margin: 0; font-size: 1.35rem; font-weight: 800; color: var(--brown-900); }
.viewer__size { margin: .2rem 0; color: var(--text-soft); }
.viewer__status { margin: .2rem 0 .6rem; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.viewer__status--sold { color: var(--red-600); }
.viewer__status--available { color: var(--green-700); }

.viewer__actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; padding-top: .5rem; }

/* SOLD overlay */
.sold-overlay {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(192, 57, 43, .32);
  pointer-events: none;
}
.sold-overlay span {
  font-size: clamp(2rem, 8vw, 4.5rem);
  font-weight: 900;
  color: #fff;
  letter-spacing: .12em;
  text-shadow: 0 3px 14px rgba(0, 0, 0, .45);
  border: 5px solid rgba(255, 255, 255, .9);
  padding: .1em .35em;
  transform: rotate(-8deg);
  background: rgba(192, 57, 43, .55);
  border-radius: 8px;
}

/* ---------- Admin Panel ---------- */
.admin {
  position: fixed; inset: 0; z-index: 70;
  background: #f4f1eb;
  display: flex; flex-direction: column;
}
.admin[hidden] { display: none; }

.admin__bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: .85rem 1.25rem;
  background: var(--green-900);
  color: #fff;
  border-bottom: 3px solid var(--green-500);
}
.admin__bar h2 { margin: 0; font-size: 1.15rem; letter-spacing: .02em; }
.admin__bar-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.admin__hint { font-size: .82rem; color: #cfe0d3; min-height: 1em; }
.admin__bar .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .35); }
.admin__bar .btn-ghost:hover { background: rgba(255, 255, 255, .12); border-color: #fff; }
.admin__bar .btn-dark { background: #fff; color: var(--green-900); }
.admin__bar .btn-dark:hover { background: var(--green-100); }

.admin__body { flex: 1; overflow-y: auto; padding: 1.25rem; }

.admin__tabs { display: flex; gap: .4rem; margin-bottom: 1.25rem; border-bottom: 2px solid var(--line); }
.tab {
  padding: .6rem 1.1rem;
  border: none;
  background: transparent;
  font-weight: 700;
  color: var(--text-soft);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-size: .92rem;
}
.tab.is-active { color: var(--green-900); border-bottom-color: var(--green-700); }
.tab:hover { color: var(--green-700); }

.admin__view { max-width: 1000px; margin-inline: auto; }

/* Admin list */
.admin-list { display: flex; flex-direction: column; gap: .6rem; }
.admin-item {
  display: flex; align-items: center; gap: 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.admin-item__thumb {
  width: 60px; height: 60px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--brown-100);
  flex-shrink: 0;
}
.admin-item__info { flex: 1; min-width: 140px; display: flex; flex-direction: column; }
.admin-item__id { font-weight: 800; color: var(--green-900); }
.admin-item__meta { font-size: .82rem; color: var(--text-soft); }
.admin-item__status {
  font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: .22rem .6rem; border-radius: 999px;
}
.admin-item__status--available { background: var(--green-100); color: var(--green-700); }
.admin-item__status--sold { background: #fbe6e2; color: var(--red-600); }
.admin-item__actions { display: flex; gap: .5rem; }

/* Admin form */
.admin-form {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  max-width: 720px;
  margin-inline: auto;
}
.admin-form__title { margin: 0 0 1.25rem; font-size: 1.25rem; color: var(--green-900); }

.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.field-grid--3 { grid-template-columns: repeat(3, 1fr); }

.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-size: .82rem; font-weight: 700; color: var(--brown-700); text-transform: uppercase; letter-spacing: .04em; }
.field input, .field select {
  padding: .6rem .7rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  width: 100%;
}
.field input:focus, .field select:focus { border-color: var(--green-500); outline: none; box-shadow: 0 0 0 3px rgba(79, 138, 91, .18); }
.field-help { margin: 0; font-size: .75rem; color: var(--text-soft); }

.input-prefix { display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.input-prefix:focus-within { border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(79, 138, 91, .18); }
.input-prefix .prefix { display: grid; place-items: center; padding: 0 .7rem; background: var(--brown-100); color: var(--brown-700); font-weight: 700; font-size: .9rem; }
.input-prefix input { border: none !important; box-shadow: none !important; background: transparent !important; flex: 1; min-width: 0; }
.input-prefix input:focus { outline: none; }

.fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem; margin: 1.25rem 0; }
.fieldset legend { padding: 0 .5rem; font-weight: 700; color: var(--brown-700); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }

.photo-picker { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-top: .5rem; }
.file-btn { position: relative; cursor: pointer; }
.photo-hint { font-size: .8rem; color: var(--text-soft); }

.photo-existing, .photo-pending { margin-bottom: 1rem; }
.photo-label { font-size: .85rem; font-weight: 700; color: var(--brown-700); margin: 0 0 .5rem; }
.thumb-row { display: flex; gap: .6rem; flex-wrap: wrap; }

.thumb {
  position: relative;
  width: 96px; height: 96px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--line);
  background: var(--brown-100);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb__remove {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(192, 57, 43, .92);
  color: #fff;
  font-size: .85rem;
  line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
}
.thumb__remove:hover { background: var(--red-700); }
.thumb__tag {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: .65rem;
  padding: .15rem .3rem;
  text-align: center;
}
.thumb__order { position: absolute; top: 4px; left: 4px; background: rgba(30, 58, 41, .9); color: #fff; font-size: .65rem; padding: .1rem .3rem; border-radius: 4px; }

.admin-form__actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.25rem; }
.admin-form__status { margin: 1rem 0 0; font-size: .88rem; color: var(--text-soft); min-height: 1.2em; }
.admin-form__status--error { color: var(--red-600); }
.admin-form__status--success { color: var(--green-700); }

/* ---------- Confirm Dialog ---------- */
.confirm { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 1rem; }
.confirm[hidden] { display: none; }
.confirm__backdrop { position: absolute; inset: 0; background: rgba(20, 15, 10, .7); }
.confirm__box {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.confirm__box h3 { margin: 0 0 .5rem; color: var(--green-900); }
.confirm__box p { margin: 0 0 1.25rem; color: var(--text-soft); }
.confirm__actions { display: flex; gap: .6rem; justify-content: flex-end; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green-900);
  color: #fff;
  padding: .75rem 1.25rem;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  font-size: .9rem;
  z-index: 90;
  max-width: calc(100% - 2rem);
  text-align: center;
}
.toast[hidden] { display: none; }
.toast--error { background: var(--red-600); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .hero-inner { padding: 2.5rem 0 2rem; }
  .field-grid--3 { grid-template-columns: 1fr 1fr; }
  .viewer__panel { padding: .75rem .75rem 1rem; border-radius: var(--radius); }
  .viewer__stage { aspect-ratio: 1 / 1; }
  .admin__bar { padding: .75rem 1rem; }
  .admin__body { padding: 1rem; }
  .admin-form { padding: 1.1rem; }
  .admin-item__actions { width: 100%; justify-content: flex-end; }
}

@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
  .field-grid--3 { grid-template-columns: 1fr; }
  .brand-name { font-size: 1.1rem; }
  .site-nav { gap: .85rem; }
  .site-nav a { font-size: .88rem; }
}