:root {
  --bg: #f6f4f1;
  --surface: #ffffff;
  --ink: #17151a;
  --muted: #6d6873;
  --line: #e6e2dc;
  --accent: #c8102e;
  --accent-ink: #ffffff;
  --accent-soft: #fbe8eb;
  --ok: #1f7a4d;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 15, 25, .06), 0 8px 24px rgba(20, 15, 25, .06);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; margin: 0; line-height: 1.15; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { border-color: #cfc9c1; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: #a90d26; }
.btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.05); }
.btn.danger { color: var(--accent); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 18px; height: 18px; flex: none; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input { height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); outline: none; width: 100%; }
.input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(23,21,26,.08); }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.hint { font-size: 12.5px; color: var(--muted); }
.error { color: var(--accent); font-size: 13.5px; min-height: 1.2em; margin: 4px 0 10px; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 999px; background: #d6d1ca; position: relative; cursor: pointer; transition: background .15s; flex: none; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { left: 21px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

.modal-bg { position: fixed; inset: 0; background: rgba(15, 12, 18, .5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 440px; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); max-height: calc(100vh - 32px); overflow: auto; }
.modal h2 { font-size: 24px; margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
@keyframes fade { from { opacity: 0; } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; z-index: 200; box-shadow: var(--shadow); animation: fade .15s; }

.brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--serif); font-size: 22px; font-weight: 600; text-decoration: none; letter-spacing: -.02em; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.brand-mark::after { content: ''; width: 10px; height: 10px; border-radius: 50%; border: 2.5px solid #fff; }

/* Justified photo grid: each tile grows in proportion to its aspect ratio */
.jgrid { display: flex; flex-wrap: wrap; gap: 6px; }
.jgrid::after { content: ''; flex-grow: 999; }
.jtile { position: relative; overflow: hidden; background: #e9e5df; cursor: pointer; border-radius: 4px; }
.jtile i { display: block; }
.jtile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s, transform .4s; }
.jtile img.loaded { opacity: 1; }

@media (max-width: 600px) {
  .row { flex-direction: column; gap: 0; }
  .jgrid { gap: 3px; }
}
