/* Living Keepsakes – mobile-first styles for public pages, claim flow, editor and admin */
:root {
  --bg: #f6f1ea; --card: #fffdf9; --ink: #2b2622; --muted: #7a6f66; --line: #e6ddd2;
  --accent: #8a5a44; --accent-ink: #fff; --ok: #2f6b4f; --err: #a33a2b; --warn: #8a6a1d;
  --radius: 14px; --shadow: 0 1px 2px rgba(60,40,20,.06), 0 8px 24px rgba(60,40,20,.08);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); }
a { color: var(--accent); }
img { max-width: 100%; display: block; }
.ks-devbar { background: #b4471f; color: #fff; text-align: center; font: 600 12px/1.8 var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.ks-wrap { max-width: 720px; margin: 0 auto; padding: 20px 16px 48px; }
.ks-wrap-wide { max-width: 1100px; }
.ks-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin: 16px 0; }
.ks-brand { font: 600 13px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); text-align: center; margin: 8px 0 4px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: .2em 0 .5em; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 18px; }
.ks-muted { color: var(--muted); font-size: 14px; }
.ks-center { text-align: center; }
label { display: block; font-weight: 600; margin: 14px 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], textarea, select {
  width: 100%; padding: 12px 14px; font: inherit; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea { min-height: 140px; resize: vertical; }
.ks-pin { font: 600 26px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .25em; text-align: center; }
.ks-btn { display: inline-block; border: 0; border-radius: 999px; padding: 12px 22px; font: 600 16px/1.2 var(--sans); cursor: pointer;
  background: var(--accent); color: var(--accent-ink); text-decoration: none; text-align: center; }
.ks-btn-block { display: block; width: 100%; margin-top: 18px; }
.ks-btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.ks-btn-small { padding: 6px 12px; font-size: 13px; }
.ks-btn-danger { background: var(--err); }
.ks-btn:disabled { opacity: .5; }
.ks-alert { border-radius: 10px; padding: 12px 14px; margin: 12px 0; font-size: 15px; }
.ks-alert-error { background: #f8e3df; color: var(--err); }
.ks-alert-ok { background: #e2f0e8; color: var(--ok); }
.ks-alert-info { background: #f1ebdf; color: var(--warn); }
.ks-steps { display: flex; gap: 8px; justify-content: center; margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.ks-steps li { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); }
.ks-steps li.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Public memorial page */
.ks-public .ks-hero { text-align: center; padding: 28px 8px 8px; }
.ks-public .ks-hero h1 { font-size: 34px; margin-bottom: 8px; }
.ks-public .ks-ornament { width: 56px; height: 1px; background: var(--accent); margin: 14px auto; opacity: .6; }
.ks-story { font-family: var(--serif); font-size: 19px; line-height: 1.65; white-space: pre-line; text-align: center; margin: 0 auto; max-width: 34em; }
.ks-audio { margin: 22px 0; }
.ks-audio audio { width: 100%; }
.ks-gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 18px; }
.ks-gallery a { display: block; border-radius: 10px; overflow: hidden; background: #e9e0d4; aspect-ratio: 1/1; }
.ks-gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.ks-gallery a:first-child { grid-column: 1 / -1; aspect-ratio: 4/3; }
@media (min-width: 640px) { .ks-gallery { grid-template-columns: repeat(3, 1fr); } }
.ks-lightbox { position: fixed; inset: 0; background: rgba(20,15,10,.94); display: none; align-items: center; justify-content: center; z-index: 10; }
.ks-lightbox.open { display: flex; }
.ks-lightbox img { max-width: 96vw; max-height: 88vh; border-radius: 6px; }
.ks-lightbox button { position: absolute; background: none; border: 0; color: #fff; font-size: 34px; padding: 14px; cursor: pointer; }
.ks-lb-close { top: 4px; right: 6px; } .ks-lb-prev { left: 2px; top: 50%; transform: translateY(-50%); } .ks-lb-next { right: 2px; top: 50%; transform: translateY(-50%); }
.ks-footer { text-align: center; font-size: 13px; color: var(--muted); margin-top: 36px; }
.ks-footer a { color: var(--muted); }

/* Editor */
.ks-meter { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 6px 0; }
.ks-meter span { display: block; height: 100%; background: var(--accent); }
.ks-photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .ks-photos { grid-template-columns: repeat(3, 1fr); } }
.ks-photo { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.ks-photo img { aspect-ratio: 1/1; object-fit: cover; width: 100%; }
.ks-photo .ks-tools { display: flex; justify-content: space-between; gap: 4px; padding: 6px; }
.ks-photo form { display: inline; margin: 0; }
.ks-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ks-topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }

/* Admin tables */
.ks-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ks-table th, .ks-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.ks-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ks-table-wrap { overflow-x: auto; }
.ks-badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--line); }
.ks-badge-unclaimed { background: #f1ebdf; color: var(--warn); }
.ks-badge-claimed { background: #e2f0e8; color: var(--ok); }
.ks-badge-disabled { background: #eee; color: #777; }
code, .ks-mono { font-family: ui-monospace, Menlo, Consolas, monospace; }

/* Styled QR (admin batch page + owner QR page) */
.ks-qrstyle-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.ks-qrthumb-lg { width: 120px; height: 120px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.ks-qrcell { min-width: 170px; }
.ks-qrcell .ks-qrthumb { float: left; width: 56px; height: 56px; margin-right: 8px; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.ks-qr-downloads { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
