/* -------------------------------------------------------------------------
   Meow and Paw — Returns portal styles

   Palette derives from the brand:
     --ink        #2E241C   deep warm brown (near-black, body text)
     --brown      #664D37   brand brown (primary CTAs, headings accents)
     --brown-soft #8C6F52   softer brown for hover / borders
     --cream      #F6F4F0   background
     --paper      #FFFFFF   card background
     --line       #E3DED4   hairline dividers
     --muted      #7A6E60   secondary text
     --focus      #A87C4F   accessible focus ring
     --alert      #B5382B   errors
   ------------------------------------------------------------------------- */

:root {
  --ink: #2E241C;
  --brown: #664D37;
  --brown-soft: #8C6F52;
  --cream: #F6F4F0;
  --paper: #FFFFFF;
  --line: #E3DED4;
  --muted: #7A6E60;
  --focus: #A87C4F;
  --alert: #B5382B;

  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;

  --shadow-card: 0 1px 2px rgba(46, 36, 28, 0.04), 0 8px 24px rgba(46, 36, 28, 0.05);
  --shadow-modal: 0 20px 60px rgba(46, 36, 28, 0.18);

  --display: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[hidden] { display: none !important; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--brown); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--brown-soft); }

button { font-family: inherit; }

/* -------------------------- Layout -------------------------- */

.page {
  max-width: 620px;
  margin: 0 auto;
  padding: 24px 20px 96px;
}

.brand {
  padding: 8px 0 32px;
  text-align: center;
}

.brand__link {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand__logo {
  width: 64px;
  height: 64px;
  display: block;
  object-fit: contain;
}
.brand__mark {
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: 22px;
  color: var(--brown);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.screen {
  animation: fade 220ms ease-out both;
}

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -------------------------- Cards + type -------------------------- */

.card {
  background: var(--paper);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-card);
}

.eyebrow {
  font-family: var(--body);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}

.display {
  font-family: var(--display);
  font-weight: 500;
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  color: var(--ink);
}

.display--sm { font-size: 32px; }

.lede {
  font-size: 16px;
  color: var(--muted);
  margin: 0 0 28px;
  line-height: 1.55;
}

.fineprint {
  margin: 28px 0 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* -------------------------- Form fields -------------------------- */

.form { display: flex; flex-direction: column; gap: 20px; }

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

.field__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.field__label em { font-style: normal; color: var(--muted); font-weight: 400; }

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

.field input,
.field textarea {
  font-family: inherit;
  font-size: 16px; /* 16px prevents iOS zoom on focus */
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  width: 100%;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brown);
  box-shadow: 0 0 0 3px rgba(102, 77, 55, 0.15);
}

.field textarea { resize: vertical; min-height: 96px; }

.form__error {
  color: var(--alert);
  font-size: 14px;
  margin: 4px 0 0;
  padding: 12px 14px;
  background: rgba(181, 56, 43, 0.06);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--alert);
}

/* -------------------------- Buttons -------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 60ms ease;
  text-decoration: none;
  width: 100%;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(168, 124, 79, 0.4);
}

.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--brown);
  color: var(--paper);
}
.btn--primary:hover { background: var(--brown-soft); }
.btn--primary:disabled {
  background: var(--line);
  color: var(--muted);
  cursor: not-allowed;
}

.btn--secondary {
  background: transparent;
  color: var(--brown);
  border-color: var(--brown);
}
.btn--secondary:hover { background: rgba(102, 77, 55, 0.06); }

.btn.is-loading .btn__label { opacity: 0.6; }
.btn.is-loading::after {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.backlink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 16px;
}
.backlink:hover { color: var(--brown); }

.iconbtn {
  background: none;
  border: none;
  width: 40px; height: 40px;
  font-size: 22px;
  color: var(--ink);
  cursor: pointer;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.iconbtn:hover { background: rgba(46, 36, 28, 0.05); }

/* -------------------------- Item list (screen 2) -------------------------- */

.items {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: grid;
  grid-template-columns: 68px 1fr auto;
  grid-template-areas: 'img body arrow';
  gap: 14px;
  align-items: center;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 60ms ease;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
}

.item:hover { border-color: var(--brown-soft); }
.item:focus-visible {
  outline: none;
  border-color: var(--brown);
  box-shadow: 0 0 0 3px rgba(102, 77, 55, 0.15);
}

.item.is-selected {
  border-color: var(--brown);
  background: #FBF9F5;
}

.item__img {
  grid-area: img;
  width: 68px; height: 68px;
  border-radius: var(--radius-sm);
  background: var(--cream);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.item__img img { width: 100%; height: 100%; object-fit: cover; }
.item__img.is-empty::before {
  content: '🐾';
  font-size: 22px;
  opacity: 0.4;
}

.item__body { grid-area: body; min-width: 0; }
.item__title {
  font-weight: 500;
  font-size: 15px;
  line-height: 1.35;
  margin: 0 0 4px;
  color: var(--ink);
}
.item__meta {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.item__reason {
  margin-top: 6px;
  font-size: 13px;
  color: var(--brown);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}
.item__reason::before { content: '✓'; font-size: 14px; }

.item__arrow {
  grid-area: arrow;
  color: var(--muted);
  font-size: 18px;
}

/* -------------------------- Sticky bar -------------------------- */

.sticky-bar {
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, var(--cream) 60%, rgba(246, 244, 240, 0));
  padding: 24px 0 8px;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sticky-bar__summary {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* -------------------------- Reason modal (screen 3) -------------------------- */

.screen--modal {
  position: fixed;
  inset: 0;
  background: rgba(46, 36, 28, 0.55);
  padding: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeBg 200ms ease-out both;
}
@keyframes fadeBg { from { opacity: 0; } to { opacity: 1; } }

@media (min-width: 640px) {
  .screen--modal { align-items: center; padding: 24px; }
}

.modal {
  background: var(--paper);
  width: 100%;
  max-width: 560px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  animation: slideUp 260ms cubic-bezier(0.2, 0.9, 0.3, 1.1) both;
}

@media (min-width: 640px) {
  .modal { border-radius: var(--radius-lg); }
}

@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.modal__head {
  display: flex;
  justify-content: space-between;
  padding: 12px 12px 0;
}

.modal__body { padding: 8px 24px 32px; }

.modal__item {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.modal__item .item__img {
  width: 56px; height: 56px;
}

.modal__title {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 500;
  margin: 0 0 20px;
  line-height: 1.15;
  color: var(--ink);
}

.reason-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reason-list button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 16px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 120ms ease, background 120ms ease;
}

.reason-list button:hover {
  border-color: var(--brown-soft);
  background: #FBF9F5;
}

.reason-list button::after {
  content: '›';
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.reason-list button.is-textonly::after { content: ''; }

.comment-field { margin-top: 20px; }
.photo-field { margin-top: 16px; }
.photo-field__note {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 0;
}
.photo-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.photo-thumb {
  position: relative;
  width: 64px; height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--cream);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb button {
  position: absolute;
  top: 2px; right: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(46, 36, 28, 0.8);
  color: white;
  border: none;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.pane-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}
.pane-actions .btn { flex: 1; }

/* -------------------------- Review screen (4) -------------------------- */

.review {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review__item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.review__row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: center;
}

.review__item .item__img { width: 56px; height: 56px; }

.review__title {
  font-weight: 500;
  font-size: 15px;
  margin: 0 0 2px;
  color: var(--ink);
}

.review__meta {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.review__reason {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 14px;
  color: var(--ink);
}

.review__reason strong {
  font-weight: 500;
  color: var(--brown);
}

.review__note {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  white-space: pre-wrap;
}

/* -------------------------- Success screen (5) -------------------------- */

.card--success { text-align: center; }

.tick {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: rgba(102, 77, 55, 0.08);
  color: var(--brown);
  font-size: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

/* -------------------------- Small screens -------------------------- */

@media (max-width: 480px) {
  .card { padding: 32px 22px; }
  .display { font-size: 32px; }
  .display--sm { font-size: 26px; }
  .modal__title { font-size: 22px; }
  .modal__body { padding: 8px 20px 28px; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .screen, .modal, .screen--modal { animation: none !important; }
  .btn:active { transform: none; }
}
