/* =========================================================
   App-shell layout styles — Aaron & Tara Dating mobile app.
   Brand tokens come from ds/ds.css; this is the viewport
   shell + screen scaffolding that isn't a reusable
   component. (Adapted from the design system's dating-site
   UI kit: phone frame → real mobile viewport.)
   ========================================================= */

html, body { height: 100%; margin: 0; }
body {
  background:
    radial-gradient(120% 80% at 50% -10%, var(--mauve-50), transparent 60%),
    var(--paper-dim);
  font-family: var(--font-body);
  overscroll-behavior: none;
}

/* ---- app shell: full viewport, centered column on wide screens ---- */
#app {
  position: fixed;
  inset: 0;
  margin: 0 auto;
  max-width: 480px;
  background: var(--paper);
  overflow: hidden;
}
@media (min-width: 520px) {
  #app {
    box-shadow: var(--shadow-xl);
    border-left: 1px solid rgba(0, 0, 0, .06);
    border-right: 1px solid rgba(0, 0, 0, .06);
  }
}

/* screen scroll area */
.screen {
  position: absolute;
  inset: 0;
  padding-top: env(safe-area-inset-top, 0px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; /* keep bottom rubber-banding from chaining to the page and wedging the scroller */
}
.screen::-webkit-scrollbar { width: 0; }
.screen-pad { padding: 0 20px calc(var(--tabbar-h) + 28px); }

/* ---- "+" chooser sheet ---- */
.add-sheet {
  position: absolute;
  inset: 0;
  z-index: 20; /* above the tab bar */
  background: color-mix(in srgb, var(--ink-900) 34%, transparent);
  display: flex;
  align-items: flex-end;
}
.add-sheet__panel {
  width: 100%;
  background: var(--paper);
  border-radius: 24px 24px 0 0;
  padding: 14px 18px calc(env(safe-area-inset-bottom, 0px) + 18px);
  animation: sheet-up .22s ease-out;
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.add-sheet__title { font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--ink-900); margin: 0 0 10px 2px; }
.add-sheet__opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 10px;
  border: 0;
  background: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.add-sheet__opt:active { background: var(--surface-sunken); }
.add-sheet__opt h4 { margin: 0; font-size: 17px; }
.add-sheet__opt .by { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.add-sheet__opt .chev { width: 20px; height: 20px; color: var(--ink-300); }
.nudge-prefs { padding: 4px 0 12px; border-bottom: 1px solid var(--border-soft); }

/* ---- top bar ---- */
.appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 14px; /* screens supply horizontal padding via .screen-pad */
}
.appbar__logo { display: flex; align-items: center; gap: 9px; }
.appbar__badge { width: 34px; height: 34px; border-radius: 999px; background: var(--gradient-union); display: grid; place-items: center; box-shadow: var(--shadow-mauve); flex: none; }
.appbar__badge span { font-family: var(--font-display); font-size: 21px; color: #fff; font-weight: 600; line-height: 1; margin-top: -2px; }
.appbar__name { font-family: var(--font-display); font-size: 21px; font-weight: 600; color: var(--ink-900); line-height: 1; }
.appbar__name em { font-style: italic; color: var(--mauve-500); }

/* ---- screen heading ---- */
.screen-head { padding: 4px 0 14px; }
.screen-head .eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--text-muted); }
.screen-head h1 { font-size: 34px; line-height: 1.05; margin: 4px 0 0; }
.screen-head h1 em { font-style: italic; color: var(--mauve-500); }

.section-label { display: flex; align-items: center; gap: 8px; margin: 22px 2px 12px; }
.section-label span { font-family: var(--font-script); font-size: 22px; color: var(--brown-500); font-weight: 600; }
.section-label .line { flex: 1; height: 1px; background: var(--border); }

/* ---- date photo (placeholder duotone) ---- */
.photo {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.9);
}
.photo::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 90% at 80% 10%, rgba(255,255,255,.22), transparent 55%); }
.photo .ghost { width: 46px; height: 46px; opacity: .85; }
.photo .ghost svg { width: 100%; height: 100%; }

/* ---- date card (feed) ---- */
.datecard { display: flex; flex-direction: column; }
.datecard .photo { height: 168px; border-radius: 0; }
.datecard__body { padding: 14px 16px 16px; }
.datecard__top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.datecard h3 { font-size: 23px; line-height: 1.1; margin: 0 0 6px; }
.datecard__meta { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-muted); font-weight: 600; }
.datecard__meta svg { width: 15px; height: 15px; }
.datecard__meta .dot { width: 3px; height: 3px; border-radius: 999px; background: var(--ink-300); }
.datecard__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.datecard__foot .chev { width: 20px; height: 20px; color: var(--ink-300); }

.feed { display: flex; flex-direction: column; gap: 16px; }

/* ---- bottom tab bar ---- */
.tabbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 14px calc(env(safe-area-inset-bottom, 0px));
  z-index: 10;
}
.tabbar__item { display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: 0; cursor: pointer; color: var(--text-subtle); font-family: var(--font-body); font-size: 10px; font-weight: 700; letter-spacing: .02em; padding: 6px 14px; transition: var(--transition-color); }
.tabbar__item svg { width: 23px; height: 23px; }
.tabbar__item.is-active { color: var(--primary); }
.tabbar__fab { width: 46px; height: 46px; border-radius: 999px; background: var(--gradient-union); display: grid; place-items: center; box-shadow: var(--shadow-mauve); border: 0; cursor: pointer; align-self: flex-end; margin-bottom: 14px; transition: transform var(--dur-fast) var(--ease-spring); }
.tabbar__fab:active { transform: scale(.92); }
.tabbar__fab svg { width: 22px; height: 22px; color: #fff; }

/* clickable venue address (date cards + detail "Where" row) */
.place-link { color: var(--brown-500); text-decoration: none; }
.place-link:hover { text-decoration: underline; }
.kv__v .place-link { color: var(--text); text-decoration: underline; text-decoration-color: var(--mauve-300); text-underline-offset: 3px; }

/* ---- detail screen ---- */
/* same aspect as the date-card photo (350x168 within a 390 shell), so a saved
   framing shows identically here — just larger. Fixed 300px heights made the
   photo "shift" the moment an edit was saved. */
.detail-hero { position: relative; aspect-ratio: 25 / 12; max-height: 300px; }
.detail-hero .photo { position: absolute; inset: 0; border-radius: 0; }
.detail-hero__top { position: absolute; top: 14px; left: 16px; right: 16px; display: flex; justify-content: space-between; z-index: 3; }
.detail-hero__chrome { background: rgba(32,23,29,.34); backdrop-filter: blur(6px); color: #fff; }
/* bottom padding clears the floating tab bar so the last action button is reachable */
.detail-sheet { position: relative; margin-top: -28px; background: var(--paper); border-radius: 28px 28px 0 0; padding: 22px 20px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 24px); z-index: 2; }
.detail-sheet h1 { font-size: 32px; line-height: 1.06; margin: 10px 0 8px; }
.grabber { width: 42px; height: 5px; border-radius: 999px; background: var(--border); margin: 0 auto 6px; }
.detail-row { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-muted); font-weight: 600; }
.detail-note { font-size: 16px; line-height: 1.6; color: var(--ink-700); margin: 16px 0; }
.detail-actions { display: flex; gap: 10px; margin: 18px 0 8px; }

.kv { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border-soft); }
.kv:last-child { border-bottom: 0; }
.kv__ico { width: 38px; height: 38px; border-radius: 12px; background: var(--surface-sunken); display: grid; place-items: center; color: var(--brown-500); flex: none; }
.kv__ico svg { width: 19px; height: 19px; }
.kv__k { font-size: 12px; color: var(--text-muted); font-weight: 700; }
.kv__v { font-size: 15px; color: var(--text); font-weight: 600; }

/* ---- plan screen ---- */
.plan-form { display: flex; flex-direction: column; gap: 18px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
/* iOS Safari gives date/time inputs an intrinsic UA width that ignores the layout
   and overflows small screens (iPhone SE) — strip the UA chrome and make them fill
   their cell like every other input. */
.field-row > * { min-width: 0; }
.field-row input { width: 100%; min-width: 0; }
.screen input[type='date'],
.screen input[type='time'] {
  -webkit-appearance: none;
  appearance: none;
  display: flex;         /* centers WebKit's inner value shim vertically */
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
/* appearance:none centers the value horizontally and floats it high on iOS —
   pin it left and let the flex parent handle the vertical centering */
input::-webkit-date-and-time-value { text-align: left; margin: 0; }

/* ---- edit screen: live-style card photo + length slider ---- */
.cover-edit__ph { height: 168px; width: 100%; }
.cover-edit__btns { display: flex; gap: 8px; margin-top: 10px; }
.cover-edit__tap { cursor: pointer; }
.cover-edit__tap img { user-select: none; -webkit-user-drag: none; }
.cover-edit__cue {
  position: absolute; right: 8px; bottom: 8px; z-index: 2;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; color: #fff;
  background: color-mix(in srgb, var(--ink-900) 55%, transparent);
  border-radius: 999px; padding: 5px 11px;
  pointer-events: none;
}
.cover-edit__cue svg { width: 13px; height: 13px; }

/* ---- pop-out framing editor: bottom sheet with a real card-sized window ---- */
.cover-adjust {
  position: fixed;
  inset: 0;
  z-index: 30; /* above the tab bar and add-sheet */
  background: color-mix(in srgb, var(--ink-900) 34%, transparent);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.cover-adjust__sheet {
  width: 100%;
  max-width: 480px; /* the app shell's width, so the card mock is true to size */
  background: var(--paper);
  border-radius: 24px 24px 0 0;
  padding: 12px 20px calc(env(safe-area-inset-bottom, 0px) + 18px);
  animation: sheet-up .22s ease-out;
}
.cover-adjust__head { display: flex; align-items: center; justify-content: space-between; }
/* borderless so the photo window width matches the real card exactly */
.cover-adjust__card { border-radius: var(--radius-lg); overflow: hidden; background: var(--surface-raised, var(--paper)); box-shadow: 0 10px 26px color-mix(in srgb, var(--ink-900) 14%, transparent); }
.cover-adjust__box { touch-action: none; cursor: grab; }
.cover-adjust__box:active { cursor: grabbing; }
.cover-adjust__box img { user-select: none; -webkit-user-drag: none; }
.cover-adjust__zoom { display: flex; align-items: center; gap: 10px; margin: 14px 2px 4px; color: var(--text-muted); }
.cover-adjust__zoom svg { width: 18px; height: 18px; flex: none; }
.cover-adjust__zoom .len-slider { flex: 1; }
.cover-adjust__actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; }
.cover-pick { margin-top: 12px; }
.cover-pick .atd-field__label { display: block; margin-bottom: 6px; }
.cover-pick__row { display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 2px 2px 6px; scrollbar-width: none; }
.cover-pick__row::-webkit-scrollbar { display: none; }
.cover-pick__opt { position: relative; flex: 0 0 92px; height: 68px; padding: 0; border: 2px solid transparent; cursor: pointer; }
.cover-pick__opt.is-on { border-color: var(--mauve-500); }
.cover-pick__check { position: absolute; right: 6px; bottom: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--mauve-500); color: #fff; display: flex; align-items: center; justify-content: center; }
.cover-pick__check svg, .cover-pick__check i { width: 14px; height: 14px; display: block; }
.len-val { font-size: 14px; font-weight: 700; color: var(--brown-500); }
.len-slider { width: 100%; height: 30px; margin-top: 8px; accent-color: var(--mauve-500); touch-action: pan-x; }
.len-slider:disabled { opacity: .4; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.who-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.who-opt { border: 1.5px solid var(--border); border-radius: var(--radius-md); padding: 12px 8px; text-align: center; cursor: pointer; background: var(--surface-raised); transition: var(--transition-color); }
.who-opt .nm { font-size: 13px; font-weight: 700; color: var(--text); margin-top: 6px; }
.who-opt.is-on { border-color: var(--mauve-400); background: var(--mauve-50); box-shadow: var(--ring); }

/* ---- profile ---- */
.profile-hero { text-align: center; padding: 12px 0 6px; }
.profile-hero h1 { font-size: 30px; margin: 14px 0 2px; }
.profile-hero .sub { font-family: var(--font-script); font-size: 22px; color: var(--brown-500); font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 6px 0; }
.stat { text-align: center; padding: 16px 8px; }
.stat b { display: block; font-family: var(--font-display); font-size: 58px; font-weight: 600; color: var(--mauve-500); line-height: .95; letter-spacing: -.02em; }
.stat > span { font-size: 11px; color: var(--text-muted); font-weight: 800; letter-spacing: .08em; margin-top: 8px; display: block; }
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border-soft); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .lab { font-size: 15px; font-weight: 600; color: var(--text); }

/* ---- idea tile ---- */
.idea { display: flex; align-items: center; gap: 14px; }
.idea__ico { width: 46px; height: 46px; border-radius: var(--radius-md); display: grid; place-items: center; color: #fff; flex: none; }
.idea__ico svg { width: 22px; height: 22px; }
.idea h4 { font-family: var(--font-body); font-size: 16px; font-weight: 700; color: var(--text); margin: 0; }
.idea .by { font-size: 12px; color: var(--text-muted); font-weight: 600; }

/* badges with a lock icon */
.atd-badge svg { width: 10px; height: 10px; }

/* memories strip (past-date photos) */
.mem-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mem-strip .photo { height: 76px; border-radius: var(--radius-md); }
.mem-strip .photo .ghost { width: 26px; height: 26px; }
.mem-add { border: 1.5px dashed var(--mauve-300); border-radius: var(--radius-md); background: var(--mauve-50); color: var(--mauve-600); display: grid; place-items: center; cursor: pointer; transition: var(--transition-color); }
.mem-add:hover { background: var(--mauve-100); }
.mem-add svg { width: 22px; height: 22px; }
.mem-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

.detail-row svg { width: 16px; height: 16px; color: var(--brown-500); }

/* ---- idea detail ---- */
.idea-hero { text-align: center; padding: 10px 0 4px; }
.idea-hero .idea__ico { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: var(--radius-lg); }
.idea-hero .idea__ico svg { width: 30px; height: 30px; }
.idea-hero h1 { font-size: 30px; line-height: 1.08; margin: 0 0 4px; }

/* ---- AI spark ---- */
.spark { border-radius: var(--radius-lg); background: var(--gradient-union); color: #fff; padding: 18px; box-shadow: var(--shadow-md); position: relative; overflow: hidden; }
.spark::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 90% at 85% 0%, rgba(255,255,255,.25), transparent 55%); pointer-events: none; }
.spark h3 { font-family: var(--font-display); font-size: 24px; margin: 0 0 2px; color: #fff; }
.spark .sub { font-family: var(--font-script); font-size: 19px; font-weight: 600; opacity: .9; }
.spark .atd-btn { position: relative; z-index: 1; background: #fff; color: var(--mauve-700); box-shadow: none; margin-top: 12px; }
.spark .atd-btn:hover { background: var(--mauve-50); }
.thinking { font-family: var(--font-script); font-size: 21px; font-weight: 600; text-align: center; padding: 12px 0 2px; animation: breathe 1.4s var(--ease-in-out) infinite alternate; position: relative; z-index: 1; }
@keyframes breathe { from { opacity: .35; } to { opacity: 1; } }
.spark-why { font-family: var(--font-script); font-size: 18px; font-weight: 600; color: var(--brown-500); line-height: 1.2; }

/* ---- games ---- */
.gamecard { min-height: 340px; border-radius: var(--radius-xl); background: var(--surface-raised); border: 1px solid var(--border-soft); box-shadow: var(--shadow-md); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px 26px; text-align: center; position: relative; overflow: hidden; }
.gamecard::before { content: "&"; position: absolute; right: -14px; bottom: -46px; font-family: var(--font-display); font-size: 190px; font-weight: 600; color: var(--mauve-50); line-height: 1; pointer-events: none; }
.gamecard .q { position: relative; font-family: var(--font-display); font-size: 27px; font-weight: 600; line-height: 1.22; color: var(--ink-900); }
.game-controls { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 16px; }

/* ---- packing list ---- */
.pack-list { display: flex; flex-direction: column; gap: 10px; padding: 10px 0 2px; }

/* enter animation */
@media (prefers-reduced-motion: no-preference) {
  .screen[data-anim] > * { animation: rise var(--dur-slow) var(--ease-out) both; }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } }
}

/* ---- boot / loading screen ---- */
.boot-screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(120% 80% at 50% -10%, var(--mauve-50), transparent 60%), var(--paper);
}
.boot-script { font-family: var(--font-script); font-size: 24px; color: var(--brown-500); font-weight: 600; animation: breathe 1.4s var(--ease-in-out) infinite alternate; }

/* ---- real photos in grids & strips ---- */
.photo-grid .photo--img { height: 96px; border-radius: var(--radius-md); background: var(--paper-dim); }
.photo--img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-grid .mem-add { min-height: 96px; }

/* ---- event (getaway) card accent ---- */
.event-card { border: 1.5px solid var(--mauve-200, var(--border)); }

/* ---- pull-to-refresh ---- */
.ptr {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: flex-end; justify-content: center;
  overflow: hidden; z-index: 5; pointer-events: none;
  font-family: var(--font-script); font-size: 20px; font-weight: 600; color: var(--brown-500);
}
.ptr span { padding-bottom: 8px; }

/* ---- game card: discreet archive + archived list toggle ---- */
.gamecard { position: relative; }
.card-archive {
  position: absolute; top: 10px; right: 10px;
  background: none; border: 0; cursor: pointer; padding: 8px;
  color: var(--ink-300); opacity: .55; transition: var(--transition-color);
}
.card-archive:hover { opacity: 1; color: var(--brown-500); }
.card-archive svg { width: 17px; height: 17px; }
.archived-toggle {
  background: none; border: 0; cursor: pointer;
  font-size: 12px; font-weight: 700; color: var(--text-subtle);
  text-decoration: underline; text-underline-offset: 3px;
}

/* ---- photo delete (signed-in): tap x, tap again to confirm ---- */
.photo-del {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  width: 26px; height: 26px; border-radius: 999px; border: 0; cursor: pointer;
  display: grid; place-items: center;
  background: rgba(32,23,29,.45); color: #fff; backdrop-filter: blur(4px);
  transition: var(--transition-color);
}
.photo-del svg { width: 14px; height: 14px; }
.photo-del.is-armed { background: #B3423A; }

/* ---- venue photo attribution (Google Places requirement) ---- */
.photo-credit {
  position: absolute; left: 8px; bottom: 6px; z-index: 2;
  font-size: 10px; font-weight: 600; color: rgba(255,255,255,.92);
  background: rgba(32,23,29,.45); padding: 2px 7px; border-radius: 999px;
  backdrop-filter: blur(4px); max-width: 70%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}

/* ---- photo upload progress (under a photo grid) ---- */
.upbar {
  margin-top: 10px; padding: 10px 12px;
  background: var(--mauve-50); border: 1px solid var(--mauve-100);
  border-radius: var(--radius-md);
}
.upbar__row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-700); }
.upbar__hint { font-size: 11px; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.upbar__track { margin-top: 8px; height: 6px; border-radius: 999px; background: var(--mauve-100); overflow: hidden; }
.upbar__fill { height: 100%; border-radius: 999px; background: var(--mauve-500); transition: width .3s ease; }
.upbar.is-done { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-700); }
.upbar.is-done svg { width: 16px; height: 16px; color: var(--mauve-600); flex: none; }
.mem-add.is-busy { opacity: .55; pointer-events: none; }

/* one-line confirmation after "We did it!" saves */
.saved-flash { text-align: center; font-family: var(--font-script); font-size: 21px; font-weight: 600; color: var(--brown-500); margin-top: 14px; }

/* switches can be disabled (push toggle while saving / unsupported browser) */
.atd-switch input:disabled + .atd-switch__track { opacity: .45; cursor: not-allowed; }
