/* checkmeout.cc — warm cabin-ledger aesthetic.
   Cream paper, pine ink, amber accents. Fraunces display + Albert Sans UI. */

:root {
  --paper: #f5efe3;
  --paper-deep: #ede4d1;
  --card: #fffdf7;
  --ink: #26312a;
  --ink-soft: #5b6a5f;
  --ink-faint: #8a968c;
  --pine: #2e5d45;
  --pine-deep: #234a37;
  --pine-tint: #e9f1ea;
  --amber: #d9822b;
  --amber-deep: #b3542c;
  --amber-tint: #fbeee2;
  --line: rgba(38, 49, 42, 0.14);
  --radius: 18px;
  --shadow: 0 1px 2px rgba(38, 49, 42, 0.05), 0 8px 24px -12px rgba(38, 49, 42, 0.18);
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Albert Sans', -apple-system, 'Helvetica Neue', sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  padding-bottom: env(safe-area-inset-bottom);
  position: relative;
}

/* Paper grain */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 18px calc(28px + env(safe-area-inset-bottom));
}

/* ---------- Header ---------- */

.site-head {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 18px 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  font-family: var(--font-display);
  font-weight: 640;
  font-size: 19px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.brand-dot { color: var(--amber); }
.brand-admin {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-left: 4px;
}

.head-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--pine);
  text-decoration: none;
  border-bottom: 1.5px solid rgba(46, 93, 69, 0.35);
  padding-bottom: 1px;
}

.head-link.as-button {
  background: none;
  border: 0;
  border-bottom: 1.5px solid rgba(46, 93, 69, 0.35);
  padding: 0 0 1px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--pine);
  cursor: pointer;
}

.admin-nav { display: flex; gap: 16px; align-items: baseline; }
.inline-form { display: inline; }

/* ---------- Hero ---------- */

.hero { padding: 22px 0 8px; }

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber-deep);
}

.hero h1, .thanks h1 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(34px, 9vw, 44px);
  font-weight: 560;
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.lede {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--ink-soft);
  max-width: 46ch;
}

.checkout-by {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 2px 0 0;
  padding: 7px 13px;
  font-size: 14px;
  color: var(--pine-deep);
  background: var(--pine-tint);
  border: 1px solid rgba(46, 93, 69, 0.2);
  border-radius: 999px;
}

/* ---------- Cards ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 18px;
  margin: 16px 0;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 560;
  letter-spacing: -0.01em;
}

.step {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--paper);
  border-radius: 50%;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
}

/* ---------- Fields ---------- */

.field { display: block; margin: 0 0 12px; }
.field:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

input[type='text'],
input[type='date'],
input[type='password'],
textarea {
  width: 100%;
  padding: 13px 14px;
  font: inherit;
  font-size: 16px; /* prevents iOS zoom-on-focus */
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

input[type='date'] { min-height: 48px; }

input:focus-visible, textarea:focus-visible {
  border-color: var(--pine);
  box-shadow: 0 0 0 3px rgba(46, 93, 69, 0.15);
}

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

.dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ---------- Progress ---------- */

.progress {
  position: sticky;
  top: calc(8px + env(safe-area-inset-top));
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  padding: 10px 14px;
  background: rgba(255, 253, 247, 0.88);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.progress-track {
  flex: 1;
  height: 8px;
  background: var(--paper-deep);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--amber), var(--pine));
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.progress-text {
  flex: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* ---------- Checklist ---------- */

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

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.25s, border-color 0.25s;
}

.check-item:active { transform: scale(0.99); }

.check-item input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.tick {
  flex: none;
  width: 30px;
  height: 30px;
  margin-top: 1px;
  border: 2px solid var(--ink-faint);
  border-radius: 50%;
  position: relative;
  transition: background 0.2s, border-color 0.2s;
}

.tick::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 12px;
  width: 11px;
  height: 6px;
  border-left: 2.5px solid var(--card);
  border-bottom: 2.5px solid var(--card);
  transform: rotate(-45deg) scale(0);
  transform-origin: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Checked-state: sibling selector works on every iOS version; the JS-added
   .is-on class covers the card tint, with a :has() rule (kept as its own
   block — a :has() in a selector list would invalidate the whole rule on old
   Safari) so the tint also works without JS on modern browsers. */
.check-item input:checked + .tick {
  background: var(--pine);
  border-color: var(--pine);
}

.check-item input:checked + .tick::after { transform: rotate(-45deg) scale(1); }

.check-item.is-on {
  background: var(--pine-tint);
  border-color: rgba(46, 93, 69, 0.45);
}

.check-item:has(input:checked) {
  background: var(--pine-tint);
  border-color: rgba(46, 93, 69, 0.45);
}

.check-item input:focus-visible + .tick {
  outline: 3px solid rgba(46, 93, 69, 0.35);
  outline-offset: 3px;
}

.check-text { display: block; min-width: 0; }

.check-label {
  display: block;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
}

.check-note {
  display: block;
  margin-top: 3px;
  font-size: 13.5px;
  color: var(--ink-soft);
}

/* ---------- Photos ---------- */

.photo-add {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
  border: 1.5px dashed rgba(46, 93, 69, 0.45);
  border-radius: 12px;
  color: var(--pine);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.photo-add:active { background: var(--pine-tint); }
.photo-add input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.photo-add-label { font-weight: 600; }
.photo-add-hint { margin-left: auto; font-size: 13px; color: var(--ink-faint); }

.photo-add:has(input:focus-visible) {
  outline: 3px solid rgba(46, 93, 69, 0.35);
  outline-offset: 2px;
}

.photo-previews {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.photo-previews img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}

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

.submit {
  display: block;
  width: 100%;
  margin: 20px 0 0;
  padding: 17px;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fdfbf5;
  background: var(--pine);
  border: 0;
  border-radius: 14px;
  box-shadow: 0 10px 22px -10px rgba(35, 74, 55, 0.55);
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.submit:active { transform: scale(0.98); background: var(--pine-deep); }
.submit[disabled] { opacity: 0.7; }

.btn, .btn-ghost {
  display: inline-block;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 12px;
  -webkit-tap-highlight-color: transparent;
}

.btn { background: var(--pine); color: #fdfbf5; }
.btn-ghost { color: var(--pine); border: 1.5px solid rgba(46, 93, 69, 0.4); }

.btn-danger {
  padding: 11px 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--amber-deep);
  background: none;
  border: 1.5px solid rgba(179, 84, 44, 0.4);
  border-radius: 12px;
  cursor: pointer;
}

.fine {
  margin: 12px 0 0;
  font-size: 13px;
  text-align: center;
  color: var(--ink-faint);
}

/* ---------- Banners ---------- */

.banner {
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14.5px;
}

.banner-error {
  background: var(--amber-tint);
  border: 1px solid rgba(179, 84, 44, 0.3);
  color: var(--amber-deep);
}

/* ---------- Thanks ---------- */

.thanks { text-align: center; padding-top: 12vh; }

.thanks-mark { color: var(--pine); margin-bottom: 18px; }

.thanks-circle {
  stroke-dasharray: 190;
  stroke-dashoffset: 190;
  animation: draw 0.7s 0.1s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

.thanks-check {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: draw 0.45s 0.65s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

@keyframes draw { to { stroke-dashoffset: 0; } }

.thanks .lede { margin: 0 auto 22px; }

/* ---------- Info page ---------- */

.card-emergency { border-color: rgba(179, 84, 44, 0.35); }

.em-list { list-style: none; margin: 0; padding: 0; }

.em-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--line);
}

.em-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.em-list li:first-child { padding-top: 0; }

.em-label { font-size: 14.5px; color: var(--ink-soft); }

.em-number {
  flex: none;
  font-weight: 700;
  font-size: 16px;
  color: var(--amber-deep);
  text-decoration: none;
  white-space: nowrap;
}

.wifi { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.wifi div { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.wifi dt { font-size: 14.5px; color: var(--ink-soft); }
.wifi dd { margin: 0; font-weight: 600; }

.mono {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.prose { margin: 0; color: var(--ink); }

.prop-card h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 560;
  font-size: 24px;
}

.prop-links { display: flex; gap: 10px; }

/* ---------- Footer ---------- */

.site-foot {
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 18px calc(24px + env(safe-area-inset-bottom));
  text-align: center;
}

.site-foot p {
  margin: 0;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- Admin ---------- */

.admin-title {
  margin: 18px 0 6px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 560;
  letter-spacing: -0.01em;
}

.admin-sub { margin: 0 0 16px; color: var(--ink-soft); font-size: 14.5px; }

.login-card { max-width: 380px; margin: 14vh auto 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }

.chip {
  padding: 7px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
}

.chip-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.report-list { display: flex; flex-direction: column; gap: 10px; }

.report-row {
  display: block;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--ink);
}

.report-row:active { transform: scale(0.995); }

.report-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.report-guest { font-weight: 700; font-size: 16.5px; }
.report-prop { font-size: 13.5px; color: var(--pine); font-weight: 600; }

.report-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}

.badge {
  padding: 2.5px 9px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 999px;
}

.badge-done { background: var(--pine-tint); color: var(--pine-deep); }
.badge-missed { background: var(--amber-tint); color: var(--amber-deep); }
.badge-note { background: var(--paper-deep); color: var(--ink-soft); }
.badge-photos { background: var(--paper-deep); color: var(--ink-soft); }
.badge-sent { background: var(--pine-tint); color: var(--pine-deep); }
.badge-pending { background: var(--paper-deep); color: var(--ink-soft); }
.badge-failed { background: var(--amber-tint); color: var(--amber-deep); }
.badge-skipped { background: var(--paper-deep); color: var(--ink-faint); }

.empty { color: var(--ink-faint); font-size: 14.5px; }

.back-link { display: inline-block; margin-top: 14px; }

.detail-head { margin-bottom: 4px; }
.detail-sub { margin: 0; color: var(--ink-soft); font-size: 14.5px; }

.detail-list { list-style: none; margin: 0; padding: 0; }

.detail-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 15px;
}

.detail-item:last-child { border-bottom: 0; }
.detail-item span { font-weight: 700; }
.is-done span { color: var(--pine); }
.is-missed { color: var(--amber-deep); font-weight: 600; }
.is-missed span { color: var(--amber-deep); }

.report-comments {
  margin: 0;
  padding: 12px 14px;
  background: var(--paper);
  border-left: 3px solid var(--amber);
  border-radius: 0 10px 10px 0;
  font-size: 15px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.qr-card { text-align: center; }
.qr-svg { max-width: 220px; margin: 0 auto; }
.qr-svg svg { width: 100%; height: auto; }
.qr-url { margin: 10px 0 4px; color: var(--ink-soft); word-break: break-all; }

form[data-confirm] { margin: 20px 0; text-align: right; }

/* ---------- Wider screens ---------- */

@media (min-width: 700px) {
  .wrap, .site-head, .site-foot { max-width: 620px; }
  .hero { padding-top: 34px; }
  .photo-previews { grid-template-columns: repeat(6, 1fr); }
}

/* ---------- Print (QR page) ---------- */

@media print {
  body::after { display: none; }
  .site-head, .back-link, .admin-title, .admin-sub, .fine { display: none; }
  .card { box-shadow: none; page-break-inside: avoid; }
  body { background: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 0.01ms !important; }
}
