/* Passage — mobile-first travel album, VSCO aesthetic + editorial palette */

:root {
  --m-bg: #0B0B0A;
  --m-bg-2: #141311;
  --m-fg: #EFE9DE;
  --m-fg-dim: rgba(239,233,222,0.62);
  --m-fg-faint: rgba(239,233,222,0.32);
  --m-line: rgba(239,233,222,0.12);
  --m-line-2: rgba(239,233,222,0.06);
  --m-accent: #D96A3E;
  --m-display: "Fraunces", Georgia, serif;
  --m-mono: "IBM Plex Mono", ui-monospace, monospace;
  --m-sans: "Inter Tight", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--m-bg); }
body {
  background: var(--m-bg);
  color: var(--m-fg);
  font-family: var(--m-sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Constrain on wide viewports so desktop visitors see the mobile design centered */
.m-app {
  background: var(--m-bg);
  color: var(--m-fg);
  min-height: 100vh;
  font-family: var(--m-sans);
  padding-bottom: 40px;
  position: relative;
  max-width: 520px;
  margin: 0 auto;
  box-shadow: 0 0 120px rgba(0,0,0,0.6);
}

/* Header */
.m-hd {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: 36px 1fr 36px;
  align-items: center;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: color-mix(in oklch, var(--m-bg) 80%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--m-line-2);
}
.m-hd-logo { font-family: var(--m-display); font-size: 22px; color: var(--m-accent); text-align: center; }
.m-hd-back, .m-hd-icon {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  background: none; border: 0; color: var(--m-fg); cursor: pointer; padding: 0;
}
.m-hd-right { display: flex; justify-content: flex-end; }
.m-pf-avatar-ph, .m-alb-cover-ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--m-fg-faint); font-family: var(--m-display); font-size: 28px;
  background: var(--m-bg-2);
}
.m-alb-cover-ph { font-size: 44px; }
.m-al-hero-ph {
  position: absolute; inset: 0; background: var(--m-bg-2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--m-display); font-size: 96px; color: var(--m-fg-faint);
}
.m-hd-title {
  font-family: var(--m-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--m-fg-dim);
  text-align: center;
}

/* Profile */
.m-profile { padding: 24px 20px 16px; border-bottom: 1px solid var(--m-line-2); }
.m-pf-row { display: flex; align-items: center; gap: 20px; margin-bottom: 16px; }
.m-pf-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background-size: cover; background-position: center;
  border: 1px solid var(--m-line);
  flex-shrink: 0;
}
.m-pf-stats { display: flex; flex: 1; justify-content: space-around; }
.m-pf-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.m-pf-stat b { font-family: var(--m-display); font-size: 22px; font-weight: 400; letter-spacing: -0.01em; }
.m-pf-stat span { font-family: var(--m-mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--m-fg-faint); }
.m-pf-name { font-family: var(--m-display); font-size: 26px; letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 4px; }
.m-pf-bio { font-family: var(--m-display); font-style: italic; font-size: 14px; color: var(--m-fg-dim); line-height: 1.4; font-weight: 300; text-wrap: pretty; }

/* Tabs */
.m-tabs {
  display: flex; gap: 4px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--m-line-2);
  position: sticky; top: 56px; z-index: 9;
  background: color-mix(in oklch, var(--m-bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.m-tab {
  flex: 1;
  padding: 8px 10px;
  background: none; border: 0;
  font-family: var(--m-mono); font-size: 10px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--m-fg-faint);
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.m-tab.is-active { color: var(--m-fg); border-bottom-color: var(--m-accent); }

/* Albums */
.m-albums { padding: 16px; display: grid; grid-template-columns: 1fr; gap: 20px; }
.m-alb-card { margin: 0; cursor: pointer; }
.m-alb-cover {
  aspect-ratio: 4/5;
  background-size: cover; background-position: center;
  margin-bottom: 10px;
  transition: transform 0.3s;
}
.m-alb-card:active .m-alb-cover { transform: scale(0.98); }
.m-alb-cap { padding: 0 2px; }
.m-alb-t { display: flex; align-items: baseline; gap: 10px; margin-bottom: 2px; }
.m-alb-num { font-family: var(--m-mono); font-size: 10px; color: var(--m-fg-faint); letter-spacing: 0.1em; }
.m-alb-title { font-family: var(--m-display); font-size: 22px; letter-spacing: -0.015em; line-height: 1.1; }
.m-alb-meta { font-family: var(--m-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--m-fg-dim); }

/* VSCO grid */
.m-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 2px;
}
.m-grid-cell {
  aspect-ratio: 1;
  background-size: cover; background-position: center;
  border: 0; padding: 0; cursor: pointer;
  transition: opacity 0.2s;
}
.m-grid-cell:active { opacity: 0.75; }

/* Map */
.m-map { padding: 16px; }
.m-atlas {
  position: relative;
  aspect-ratio: 2/1;
  background: var(--m-bg-2);
  border: 1px solid var(--m-line);
  margin-bottom: 20px;
}
.m-atlas-grid { position: absolute; inset: 0; width: 100%; height: 100%; }
.m-atlas-grid line { stroke: var(--m-line-2); stroke-width: 0.2; }
.m-pin {
  position: absolute; transform: translate(-50%, -50%);
  background: none; border: 0; padding: 6px; cursor: pointer;
}
.m-pin-dot {
  display: block;
  width: 8px; height: 8px; border-radius: 99px;
  background: var(--m-accent);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--m-accent) 30%, transparent);
}
.m-map-list { list-style: none; margin: 0; padding: 0; }
.m-map-row {
  display: grid; grid-template-columns: 16px 1fr auto 20px;
  gap: 14px; align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--m-line-2);
  cursor: pointer;
}
.m-map-dot { width: 6px; height: 6px; border-radius: 99px; background: var(--m-accent); }
.m-map-ttl { font-family: var(--m-display); font-size: 18px; letter-spacing: -0.01em; }
.m-map-sub { font-family: var(--m-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--m-fg-dim); }
.m-map-arr { font-family: var(--m-mono); color: var(--m-fg-faint); }

/* Album detail */
.m-al-hero {
  position: relative;
  aspect-ratio: 4/5;
  background-size: cover; background-position: center;
}
.m-al-veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, transparent 40%, rgba(0,0,0,0.7) 100%);
}
.m-al-meta {
  position: absolute; inset: auto 0 0 0;
  padding: 20px;
  color: #fff;
}
.m-al-sub { font-family: var(--m-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.85; margin-bottom: 10px; }
.m-al-title { font-family: var(--m-display); font-size: 44px; font-weight: 400; letter-spacing: -0.03em; line-height: 0.95; margin: 0; }
.m-al-italic { font-family: var(--m-display); font-style: italic; font-size: 16px; opacity: 0.85; font-weight: 300; margin-top: 4px; }

.m-al-caption {
  margin: 0;
  padding: 24px 20px;
  font-family: var(--m-display);
  font-size: 16px;
  line-height: 1.45;
  color: var(--m-fg-dim);
  font-weight: 300;
  border-bottom: 1px solid var(--m-line-2);
  text-wrap: pretty;
}
.m-al-stats {
  display: flex; justify-content: space-around;
  padding: 16px 20px;
  border-bottom: 1px solid var(--m-line-2);
}
.m-al-stats > div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.m-al-stats b { font-family: var(--m-display); font-size: 20px; font-weight: 400; letter-spacing: -0.01em; }
.m-al-stats span { font-family: var(--m-mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--m-fg-faint); }
.m-al-grid { padding: 12px 2px; }
.m-al-foot {
  text-align: center;
  padding: 16px 20px 32px;
  font-family: var(--m-mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--m-fg-faint);
}

/* Photo viewer — full-bleed on the app surface */
.m-viewer {
  position: fixed; inset: 0;
  background: #000;
  color: #fff;
  display: flex; flex-direction: column;
  z-index: 50;
  animation: fadeIn 0.2s ease;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.m-vw-top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px 10px;
}
.m-vw-x { width: 36px; height: 36px; background: none; border: 0; color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.m-vw-count { font-family: var(--m-mono); font-size: 11px; letter-spacing: 0.12em; color: rgba(255,255,255,0.7); }
.m-vw-stage {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
}
.m-vw-stage img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
}
.m-vw-cap { padding: 16px 20px 4px; }
.m-vw-t { font-family: var(--m-display); font-size: 18px; letter-spacing: -0.01em; margin-bottom: 2px; }
.m-vw-s { font-family: var(--m-mono); font-size: 11px; letter-spacing: 0.06em; color: rgba(255,255,255,0.65); text-transform: uppercase; }
.m-vw-dots {
  display: flex; justify-content: center; gap: 5px;
  padding: 14px 20px 20px;
}
.m-vw-dot { width: 5px; height: 5px; border-radius: 99px; background: rgba(255,255,255,0.25); transition: background 0.2s, transform 0.2s; }
.m-vw-dot.is-on { background: #fff; transform: scale(1.3); }

/* Empty states */
.m-empty {
  padding: 80px 28px 60px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.m-empty-inline { padding: 24px 20px 40px; }
.m-empty-mark { font-family: var(--m-display); font-size: 56px; color: var(--m-accent); opacity: 0.75; }
.m-empty-t { font-family: var(--m-display); font-size: 22px; letter-spacing: -0.01em; }
.m-empty-s { font-family: var(--m-display); font-style: italic; font-size: 14px; color: var(--m-fg-dim); line-height: 1.45; font-weight: 300; max-width: 30ch; }

/* Buttons */
.m-btn-primary {
  margin-top: 10px;
  font-family: var(--m-mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 12px 18px; border-radius: 999px;
  background: var(--m-accent); color: #0B0B0A; border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.m-btn-primary:active { transform: scale(0.98); }
.m-btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--m-mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 10px 14px; border-radius: 999px;
  background: transparent; color: var(--m-fg);
  border: 1px solid var(--m-line);
  cursor: pointer;
}
.m-btn-ghost.m-danger { color: rgba(239,180,160,0.9); border-color: rgba(217,106,62,0.3); }
.m-btn-ghost:active { background: rgba(239,233,222,0.05); }

/* Album action row */
.m-al-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--m-line-2);
}

/* FAB — pinned to the bottom-right of the 520px app column */
.m-fab {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: calc(50% + 184px);
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--m-accent); color: #0B0B0A; border: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.3);
  z-index: 20;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s;
}
.m-fab:active { transform: scale(0.94); }
@media (max-width: 520px) {
  .m-fab { left: auto; right: 20px; }
}

/* Sheet (new album) */
.m-sheet-wrap {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: m-fade 0.2s ease;
}
@keyframes m-fade { from { opacity: 0; } to { opacity: 1; } }
.m-sheet {
  width: 100%; max-width: 520px;
  background: var(--m-bg);
  border-top: 1px solid var(--m-line);
  border-radius: 20px 20px 0 0;
  max-height: 92vh;
  display: flex; flex-direction: column;
  animation: m-slide 0.25s cubic-bezier(.2,.8,.2,1);
  padding-bottom: env(safe-area-inset-bottom);
}
@keyframes m-slide { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.m-sheet-hd {
  display: grid; grid-template-columns: 60px 1fr 60px; align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--m-line-2);
}
.m-sheet-x, .m-sheet-ok {
  background: none; border: 0; cursor: pointer; padding: 6px;
  font-family: var(--m-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--m-fg-dim);
}
.m-sheet-ok { color: var(--m-accent); text-align: right; font-weight: 500; }
.m-sheet-ok:disabled { color: var(--m-fg-faint); cursor: not-allowed; }
.m-sheet-t { text-align: center; font-family: var(--m-display); font-size: 18px; }
.m-sheet-body {
  padding: 20px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
}
.m-field { display: flex; flex-direction: column; gap: 6px; }
.m-field > span {
  font-family: var(--m-mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--m-fg-faint);
}
.m-field input[type="text"],
.m-field input[type="number"],
.m-field input:not([type]),
.m-field textarea {
  background: var(--m-bg-2);
  border: 1px solid var(--m-line-2);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: var(--m-sans); font-size: 16px; /* prevent iOS zoom */
  color: var(--m-fg);
  outline: none;
  transition: border-color 0.15s;
}
.m-field input:focus, .m-field textarea:focus { border-color: var(--m-accent); }
.m-field textarea { resize: none; font-family: var(--m-display); font-weight: 300; }
.m-field input[type="file"] {
  font-family: var(--m-mono); font-size: 12px; color: var(--m-fg-dim);
  padding: 10px 0;
}
.m-field-row { display: grid; grid-template-columns: 1fr 1fr 90px; gap: 10px; }
.m-field-sm { max-width: 100%; }

@media (max-width: 520px) {
  .m-app { max-width: 100%; box-shadow: none; }
}

/* Splash */
.m-splash {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--m-bg);
}
.m-splash-mark { font-family: var(--m-display); font-size: 56px; color: var(--m-accent); opacity: 0.7; animation: m-pulse 1.4s ease-in-out infinite; }
@keyframes m-pulse { 0%,100% { opacity: 0.35; } 50% { opacity: 0.85; } }

/* Auth */
.m-auth {
  min-height: 100vh;
  max-width: 420px;
  margin: 0 auto;
  padding: 80px 28px 40px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  color: var(--m-fg);
  font-family: var(--m-sans);
}
.m-auth-mark { font-family: var(--m-display); font-size: 64px; color: var(--m-accent); margin-bottom: 12px; }
.m-auth-t { font-family: var(--m-display); font-size: 42px; letter-spacing: -0.02em; margin: 0 0 6px; font-weight: 400; }
.m-auth-s { font-family: var(--m-display); font-style: italic; color: var(--m-fg-dim); margin-bottom: 36px; font-weight: 300; font-size: 15px; }
.m-auth-form { width: 100%; display: flex; flex-direction: column; gap: 16px; text-align: left; }
.m-auth-form .m-btn-primary { margin-top: 10px; padding: 14px; width: 100%; text-align: center; }
.m-auth-alt {
  margin-top: 28px;
  font-family: var(--m-mono); font-size: 11px; letter-spacing: 0.08em;
  color: var(--m-fg-faint);
  text-transform: uppercase;
}
.m-auth-alt a { color: var(--m-accent); text-decoration: none; }
.m-auth-alt a:hover { text-decoration: underline; }

/* Profile extras */
.m-pf-handle { font-family: var(--m-mono); font-size: 11px; letter-spacing: 0.08em; color: var(--m-fg-faint); text-transform: uppercase; margin-bottom: 8px; }
.m-pf-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.m-btn-xs { font-size: 9px; padding: 6px 12px; }

/* Header extras */
.m-hd-right-group { display: flex; justify-content: flex-end; align-items: center; }
.m-hd-text {
  width: auto; padding: 0 12px; font-family: var(--m-mono); font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--m-accent);
}

/* Error */
.m-err {
  padding: 10px 14px;
  background: rgba(217,106,62,0.12);
  border: 1px solid rgba(217,106,62,0.35);
  border-radius: 10px;
  color: rgba(239,180,160,0.95);
  font-family: var(--m-mono); font-size: 11px; letter-spacing: 0.04em;
}
