:root {
  --wool: #f6f2eb;
  --linen: #ede6d8;
  --sand: #d4c9b4;
  --oak: #a8967e;
  --walnut: #6b5a48;
  --slate: #302620;
  --moss: #4a5a3c;
  --rust: #9a3a22;
  --line: rgba(48, 38, 32, 0.14);
  --display: 'Sora', 'Inter', sans-serif;
  --body: 'Inter', 'Helvetica Neue', sans-serif;
  --gutter: 16px;
}

@media (min-width: 768px) {
  :root {
    --gutter: 32px;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--wool);
  color: var(--slate);
  font: 300 15px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--slate);
  outline-offset: 2px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--walnut);
}

/* ── Buttons & inputs ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--slate);
  border-radius: 999px;
  background: none;
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
  white-space: nowrap;
}

.btn--solid {
  background: var(--slate);
  color: var(--wool);
}

.btn--quiet {
  border-color: var(--line);
}

.btn--danger {
  border-color: var(--rust);
  color: var(--rust);
}

.btn--small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.iconBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--wool);
  font-size: 15px;
  line-height: 1;
}

.iconBtn:disabled {
  opacity: 0.3;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__hint {
  font-size: 12px;
  color: var(--walnut);
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
  font-size: 16px; /* keeps iOS from zooming on focus */
}

.textarea {
  min-height: 120px;
  resize: vertical;
  font-family: var(--display);
  line-height: 1.6;
}

.textarea--tall {
  min-height: 260px;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: rgba(48, 38, 32, 0.5);
  outline: none;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
}

.switch input {
  width: 20px;
  height: 20px;
  accent-color: var(--moss);
}

/* ── Layout ── */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: max(12px, env(safe-area-inset-top)) var(--gutter) 12px;
  background: rgba(246, 242, 235, 0.94);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.top__brand {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

.top__nav {
  display: flex;
  gap: 4px;
}

.top__nav a {
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 13px;
  text-decoration: none;
}

.top__nav a.is-active {
  background: var(--linen);
}

.top__right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px var(--gutter) 96px;
}

.pageHead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.pageHead h1 {
  font-family: var(--display);
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 300;
  letter-spacing: -0.015em;
}

.crumb {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--walnut);
  text-decoration: none;
}

.card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 249, 0.6);
}

.card + .card {
  margin-top: 16px;
}

.card h2 {
  margin-bottom: 16px;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 400;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.row2 {
  display: grid;
  gap: 16px;
}

@media (min-width: 700px) {
  .row2 {
    grid-template-columns: 1fr 1fr;
  }
}

.muted {
  color: var(--walnut);
  font-size: 13px;
}

/* ── Publish status ── */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--walnut);
  white-space: nowrap;
}

.pill::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--oak);
}

.pill--live::before {
  background: var(--moss);
}

.pill--pending::before {
  background: #c8872e;
}

.pill--deploying::before {
  background: #c8872e;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(22, 17, 13, 0.35);
}

.sheet__panel {
  width: min(560px, 100%);
  max-height: 85vh;
  overflow: auto;
  padding: 24px var(--gutter) max(24px, env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  background: var(--wool);
}

@media (min-width: 700px) {
  .sheet {
    align-items: center;
  }

  .sheet__panel {
    border-radius: 18px;
    padding: 28px;
  }
}

.sheet__panel h2 {
  margin-bottom: 12px;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 300;
}

.sheet__list {
  margin: 12px 0 20px;
  padding-left: 18px;
  font-size: 14px;
}

.sheet__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Gallery list ── */

.glist {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.glist__row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.glist__thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--linen);
}

.glist__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.glist__main {
  min-width: 0;
  text-decoration: none;
}

.glist__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 400;
}

.glist__meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--walnut);
}

.glist__move {
  display: flex;
  gap: 6px;
}

.badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--linen);
  font-family: var(--body);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--walnut);
}

.badge--draft {
  background: #f3e2c4;
  color: #8a5a14;
}

.newGallery {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

@media (min-width: 700px) {
  .newGallery {
    grid-template-columns: 1fr 160px auto;
    align-items: end;
  }
}

/* ── Photos ── */

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 16px;
  border: 1.5px dashed var(--sand);
  border-radius: 14px;
  text-align: center;
  transition: background 0.2s, border-color 0.2s;
}

.drop.is-over {
  background: var(--linen);
  border-color: var(--walnut);
}

.progress {
  width: 100%;
  max-width: 320px;
  height: 4px;
  border-radius: 2px;
  background: var(--linen);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--moss);
  transition: width 0.2s;
}

.photos {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

@media (min-width: 700px) {
  .photos {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
  }
}

.photo {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.photo__img {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--linen);
}

.photo__img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.photo__tools {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 6px;
}

.photo__tools .iconBtn {
  width: 34px;
  height: 34px;
  background: rgba(246, 242, 235, 0.92);
  border: 0;
}

.photo__tools .is-cover {
  background: var(--slate);
  color: #f5c94c;
}

.photo__coverTag {
  position: absolute;
  left: 6px;
  bottom: 6px;
}

.caption {
  min-height: 64px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
  font-size: 14px;
  line-height: 1.4;
  resize: vertical;
}

.caption.is-saved {
  border-color: rgba(74, 90, 60, 0.6);
}

.photo__name {
  overflow: hidden;
  font-size: 11px;
  color: var(--oak);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ── FAQ editor ── */

.faqItem {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.faqItem__tools {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

/* ── Save bar ── */

.saveBar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin: 16px calc(var(--gutter) * -1) 0;
  padding: 12px var(--gutter) max(12px, env(safe-area-inset-bottom));
  background: rgba(246, 242, 235, 0.94);
  border-top: 1px solid var(--line);
}

/* ── Login ── */

.login {
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
}

.login form {
  display: flex;
  width: min(360px, 100%);
  flex-direction: column;
  gap: 16px;
}

.login h1 {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-align: center;
}

.error {
  color: var(--rust);
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--slate);
  color: var(--wool);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.25s, transform 0.25s;
}

.toast.is-shown {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-error {
  background: var(--rust);
}
