@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html,body { width: 100%; min-height: 100%; background: #4A2418; color: #fff; overflow-x: hidden; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01'; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }

:root {
  --accent: #E85D2F;
  --accent-deep: #C4441C;
  --accent-light: #FFB088;
  --coral-accent: #FF8F66;
  --glass: rgba(255,255,255,0.11);
  --glass-b: rgba(255,255,255,0.18);
  --serif: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --text-secondary: rgba(255,255,255,0.85);
  --text-tertiary: rgba(255,255,255,0.65);

  /* Liquid Glass polering — kun border + inner top-highlight, ingen opacity-endring */
  --lg-border: 0.5px solid rgba(255,255,255,0.22);
  --lg-highlight: inset 0 1px 0 rgba(255,255,255,0.25);

  /* Orange-knapper: ren mørkskygge istedenfor brennende glow */
  --orange-shadow: 0 2px 6px rgba(0,0,0,0.18);

  /* Visible focus-ring for accessibility */
  --focus-ring: 0 0 0 2px rgba(255,176,136,0.7);
}

/* Accessibility: respekter prefers-reduced-transparency (iOS 26 Reduce Transparency-setting) */
@media (prefers-reduced-transparency: reduce) {
  .tt-circle, .m-search, .d-search .f, .d-search .filt, .th-input,
  .p-edit, .p-stat, .bottom-nav, .ic-btn {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(30,14,10,0.85) !important;
  }
}

/* Visible focus-ring for keyboard/switch-control */
button:focus-visible, a:focus-visible, [role="button"]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.phone {
  width: 100%; max-width: 390px;
  min-height: 100vh;
  margin: 0 auto;
  background:
    radial-gradient(ellipse 150% 65% at 30% 0%, rgba(255,190,145,0.55), transparent 55%),
    radial-gradient(ellipse 140% 60% at 75% 10%, rgba(240,155,110,0.35), transparent 50%),
    linear-gradient(180deg, #B0654A 0%, #9A5636 32%, #834A24 64%, #6E3C1D 100%);
  position: relative;
  overflow-x: hidden;
  padding-bottom: 120px;
  isolation: isolate;
}
.phone::before {
  content: '';
  position: absolute;
  inset: -6%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle 200px at 12% 10%, rgba(255,155,75,0.76) 0%, transparent 68%),
    radial-gradient(circle 185px at 82% 16%, rgba(255,120,55,0.7) 0%, transparent 68%),
    radial-gradient(circle 205px at 58% 40%, rgba(255,110,50,0.52) 0%, transparent 68%),
    radial-gradient(circle 175px at 28% 68%, rgba(255,145,70,0.6) 0%, transparent 68%),
    radial-gradient(circle 200px at 90% 78%, rgba(255,135,65,0.56) 0%, transparent 68%);
  filter: blur(52px);
  animation: floatGradient 20s ease-in-out infinite alternate;
  will-change: transform;
}
.phone::after {
  content: '';
  position: absolute;
  inset: -8%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle 160px at 70% 26%, rgba(255,140,65,0.6) 0%, transparent 68%),
    radial-gradient(circle 175px at 18% 34%, rgba(255,115,50,0.5) 0%, transparent 68%),
    radial-gradient(circle 150px at 46% 86%, rgba(255,160,80,0.54) 0%, transparent 68%),
    radial-gradient(circle 160px at 88% 58%, rgba(255,125,60,0.54) 0%, transparent 68%),
    radial-gradient(circle 145px at 8% 90%, rgba(255,150,75,0.5) 0%, transparent 68%);
  filter: blur(48px);
  animation: floatGradient2 26s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes floatGradient {
  0%   { transform: translate(0, 0) scale(1); }
  25%  { transform: translate(-7%, 5%) scale(1.1); }
  50%  { transform: translate(6%, -6%) scale(1.04); }
  75%  { transform: translate(-5%, -4%) scale(1.12); }
  100% { transform: translate(4%, 3%) scale(1.06); }
}
@keyframes floatGradient2 {
  0%   { transform: translate(0, 0) scale(1.06); }
  33%  { transform: translate(7%, 6%) scale(1.14); }
  66%  { transform: translate(-6%, 4%) scale(1.0); }
  100% { transform: translate(5%, -5%) scale(1.1); }
}

/* Blobs — V16 exact colors */
.blob { position: absolute; border-radius: 50%; filter: blur(100px); pointer-events: none; z-index: 0; will-change: transform; mix-blend-mode: screen; }
.blob-coral    { background: radial-gradient(circle, rgba(92,130,117,0.55), transparent 70%); width: 460px; height: 460px; top: -160px; right: -160px; }
.blob-rose     { background: radial-gradient(circle, rgba(165,194,181,0.55), transparent 70%); width: 380px; height: 380px; top: 25%; left: -140px; }
.blob-purple   { background: radial-gradient(circle, rgba(45,74,62,0.55), transparent 70%); width: 420px; height: 420px; top: 50%; right: -160px; }
.blob-peach    { background: radial-gradient(circle, rgba(165,194,181,0.55), transparent 70%); width: 380px; height: 380px; top: 12%; left: -120px; }
.blob-sage     { background: radial-gradient(circle, rgba(92,130,117,0.45), transparent 70%); width: 320px; height: 320px; top: 38%; right: -100px; }
.blob-sand     { background: radial-gradient(circle, rgba(216,201,168,0.55), transparent 70%); width: 320px; height: 320px; bottom: 220px; left: -110px; }
.blob-lavender { background: radial-gradient(circle, rgba(165,194,181,0.55), transparent 70%); width: 340px; height: 340px; bottom: 100px; right: -120px; }
.blob-float { animation: blobFloat 14s ease-in-out infinite; }
.blob-float.d2 { animation-duration: 18s; animation-delay: -4s; }
.blob-float.d3 { animation-duration: 22s; animation-delay: -8s; }
@keyframes blobFloat { 0%,100%{transform:translate(0,0) scale(1);} 50%{transform:translate(34px,-40px) scale(1.12);} }

/* All content above the gradient — but not nav */
.phone > *:not(.bottom-nav):not(.blob):not(.fab):not(.create-fab) { position: relative; z-index: 2; }
.bottom-nav { z-index: 50; }
/* FAB-er må ligge over innhold (som ellers arver z-index:2 fra regelen over) og over nav */
.phone .fab, .phone .create-fab { z-index: 60 !important; }

/* V16 display typography */
.editorial-title, .section-title, .pf-name {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

/* Status bar */
.status-bar { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px 4px; font-size: 14px; font-weight: 600; color: #fff; position: relative; z-index: 5; }
.status-bar .icons { display: flex; gap: 6px; align-items: center; }
.status-bar svg { width: 16px; height: 16px; }

/* Top bar (tt-bar) — V16 exact */
.tt-bar { display: flex; align-items: center; justify-content: space-between; padding: 8px 18px 14px; position: relative; z-index: 5; }
.tt-title { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -40%); font-size: 17px; font-weight: 600; color: #fff; letter-spacing: -0.01em; white-space: nowrap; }
.tt-circle { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.14); border: var(--lg-border); color: #fff; flex-shrink: 0; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: var(--lg-highlight); }
.tt-circle svg { width: 16px; height: 16px; stroke-width: 1.8; }

/* Editorial header — V16 exact */
.editorial-header { padding: 12px 24px 16px; position: relative; z-index: 5; }
.editorial-title { font-size: 26px; font-weight: 700; line-height: 1.05; letter-spacing: -0.03em; color: #fff; }

/* Section label — V16 exact */
.ios-section-label, .tlabel { font-size: 11px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: rgba(255,255,255,0.5); padding: 8px 28px 8px; margin: 0; }

/* Private/Official toggle */
.pp-toggle { display: flex; justify-content: center; gap: 26px; padding: 2px 18px 14px; }
.pp-toggle button { color: var(--text-tertiary); font-size: 17px; font-weight: 700; letter-spacing: -0.01em; padding: 4px 0; }
.pp-toggle button.on { color: var(--accent); }

/* Event card */
.ev-card {
  display: block;
  margin: 0 18px 14px;
  border-radius: 22px; overflow: hidden;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
  position: relative;
}
.ev-card .hero { width: 100%; height: 180px; object-fit: cover; display: block; }
.ev-card .date { position: absolute; top: 12px; left: 12px; background: #fff; color: #1F1B16; border-radius: 12px; padding: 6px 11px; text-align: center; box-shadow: 0 6px 16px rgba(0,0,0,0.3); }
.ev-card .date .d { display: block; font-size: 18px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.ev-card .date .m { display: block; font-size: 10px; font-weight: 700; color: var(--accent); margin-top: 3px; letter-spacing: 0.5px; }
.ev-card .feat { position: absolute; top: 12px; right: 12px; background: var(--accent); color: #fff; padding: 5px 11px; border-radius: 999px; font-size: 10px; font-weight: 800; box-shadow: var(--orange-shadow); }
.ev-card .body { padding: 12px 14px 14px; display: flex; align-items: center; gap: 10px; }
.ev-card .body .txt { flex: 1; min-width: 0; }
.ev-card .body .t { font-family: var(--serif); font-size: 19px; font-weight: 600; color: #fff; letter-spacing: -0.01em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-card .body .m { font-size: 11px; color: var(--text-secondary); margin-top: 3px; font-weight: 500; }
.ev-card .body .acts { display: flex; gap: 7px; }
.ev-card .body .a { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.16); display: flex; align-items: center; justify-content: center; color: #fff; }
.ev-card .body .a svg { width: 13px; height: 13px; }

/* Discover */
.d-search { display: flex; gap: 10px; margin: 0 18px 16px; }
.d-search .f { flex: 1; display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: rgba(255,255,255,0.1); border: var(--lg-border); border-radius: 14px; color: var(--text-tertiary); font-size: 14px; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: var(--lg-highlight); }
.d-search .f svg { width: 16px; height: 16px; color: currentColor; }
.d-search .filt { width: 44px; height: 44px; border-radius: 14px; background: rgba(255,255,255,0.1); border: var(--lg-border); display: flex; align-items: center; justify-content: center; color: #fff; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: var(--lg-highlight); }
.d-search .filt svg { width: 17px; height: 17px; }

.d-label { font-family: var(--serif); font-size: 19px; font-weight: 600; color: #fff; letter-spacing: -0.02em; padding: 0 22px 10px; display: flex; justify-content: space-between; align-items: baseline; }
.d-label .side { font-family: 'Inter'; font-size: 10px; font-weight: 700; color: var(--accent-light); text-transform: uppercase; letter-spacing: 1px; }

.conns { display: flex; gap: 14px; padding: 0 22px 16px; overflow-x: auto; scrollbar-width: none; }
.conns::-webkit-scrollbar { display: none; }
.conn { flex-shrink: 0; text-align: center; width: 62px; }
.conn img { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,0.22); display: block; margin: 0 auto 6px; }
.conn .n { font-size: 11px; color: rgba(255,255,255,0.8); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.places { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 18px; }
.place { position: relative; aspect-ratio: 1; border-radius: 18px; overflow: hidden; border: 1px solid rgba(255,255,255,0.14); box-shadow: 0 10px 26px rgba(0,0,0,0.3); display: block; }
.place img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.place::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.7), transparent 55%); }
.place .logo { position: absolute; top: 9px; left: 9px; width: 34px; height: 34px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; color: #1F1B16; z-index: 2; box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
.place .nm { position: absolute; left: 11px; right: 11px; bottom: 11px; color: #fff; font-size: 13px; font-weight: 700; z-index: 2; letter-spacing: -0.01em; }

/* Messages list */
.m-search { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: rgba(255,255,255,0.1); border: var(--lg-border); border-radius: 14px; color: var(--text-tertiary); font-size: 14px; margin: 0 18px 10px; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: var(--lg-highlight); }
.m-search svg { width: 16px; height: 16px; }
.m-list { padding: 0 10px; }
.m-row { display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 14px; }
.m-row .av { width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; color: #fff; background: linear-gradient(135deg, var(--accent-light), var(--accent)); border: 1px solid rgba(255,255,255,0.2); overflow: hidden; }
.m-row .av img { width: 100%; height: 100%; object-fit: cover; }
.m-row .bd { flex: 1; min-width: 0; }
.m-row .bd .n { font-size: 14px; font-weight: 700; color: #fff; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-row .bd .p { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-row .bd .p .e { color: var(--accent-light); }
.m-row .sd { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.m-row .sd .tm { font-size: 10px; color: var(--text-tertiary); }
.m-row .sd .dt { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(232,93,47,0.7); }

/* Chat thread */
.th-head { display: flex; align-items: center; gap: 10px; padding: 8px 18px 10px; }
.th-head .back { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.16); display: flex; align-items: center; justify-content: center; color: #fff; }
.th-head .back svg { width: 15px; height: 15px; stroke: #fff; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.th-head .tt { flex: 1; display: flex; align-items: center; gap: 10px; justify-content: center; }
.th-head .tt .gav { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg,var(--accent-light),var(--accent)); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 12px; border: 1px solid rgba(255,255,255,0.2); }
.th-head .tt .nm { font-family: var(--serif); font-size: 18px; font-weight: 600; color: #fff; letter-spacing: -0.01em; }

.msgs { display: flex; flex-direction: column; gap: 9px; padding: 0 18px 20px; }
.date-sep { text-align: center; font-size: 10px; color: rgba(255,255,255,0.45); font-weight: 700; margin: 6px 0 2px; text-transform: uppercase; letter-spacing: 1px; }
.m { display: flex; align-items: flex-end; gap: 8px; max-width: 82%; align-self: flex-start; }
.m .mav { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; object-fit: cover; border: 1px solid rgba(255,255,255,0.2); }
.m .bub { padding: 10px 14px; border-radius: 18px; font-size: 13px; line-height: 1.4; color: #fff; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.12); border-bottom-left-radius: 6px; }

.mev { align-self: flex-start; max-width: 82%; display: flex; gap: 8px; align-items: flex-end; padding: 0 18px; }
.mev .mav { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.mev .wr { border-radius: 18px; overflow: hidden; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14); max-width: 220px; }
.mev .wr img { width: 100%; height: 110px; object-fit: cover; display: block; }
.mev .wr .in { padding: 10px 14px 12px; }
.mev .wr .in .t { font-family: var(--serif); font-size: 17px; font-weight: 600; color: #fff; letter-spacing: -0.01em; }
.mev .wr .in .d { font-size: 10px; color: rgba(255,255,255,0.6); margin-top: 3px; font-weight: 500; }
.mev .wr .in .b { margin-top: 9px; display: inline-flex; padding: 5px 11px; border-radius: 999px; background: rgba(232,93,47,0.18); border: 1px solid rgba(232,93,47,0.4); color: var(--accent-light); font-size: 10px; font-weight: 700; }

/* Chat input — V16 style with + and send */
.th-input {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  margin: 16px 18px 0;
  background: rgba(30,14,10,0.5);
  border: var(--lg-border);
  border-radius: 999px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--lg-highlight);
}
.th-input input { flex: 1; background: transparent; border: none; outline: none; color: #fff; font-size: 14px; font-family: inherit; }
.th-input input::placeholder { color: rgba(255,255,255,0.45); }
.th-input .send { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: var(--orange-shadow); }
.th-input .send svg { width: 13px; height: 13px; stroke: #fff; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* Profile */
.prof { display: flex; flex-direction: column; align-items: center; padding: 4px 24px 10px; text-align: center; }
.prof .pav { width: 104px; height: 104px; border-radius: 50%; object-fit: cover; box-shadow: 0 14px 34px rgba(0,0,0,0.35); margin-bottom: 10px; }
.prof .nm { font-family: var(--serif); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: #fff; line-height: 1.1; }
.prof .bi { font-size: 12px; color: var(--text-secondary); margin-top: 6px; line-height: 1.5; max-width: 290px; }
.p-chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.p-chips .c { padding: 4px 10px; border-radius: 999px; background: rgba(232,93,47,0.16); border: 1px solid rgba(232,93,47,0.35); color: var(--accent-light); font-size: 10px; font-weight: 700; }
.p-edit { display: block; margin: 10px 24px 12px; padding: 11px 20px; border-radius: 14px; background: rgba(255,255,255,0.1); border: var(--lg-border); color: #fff; font-size: 11px; font-weight: 700; text-align: center; letter-spacing: 0.08em; text-transform: uppercase; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: var(--lg-highlight); }
.p-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; padding: 0 24px 12px; }
.p-stat { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 11px 8px; background: rgba(255,255,255,0.08); border: var(--lg-border); border-radius: 16px; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); color: #fff; box-shadow: var(--lg-highlight); }
.p-stat svg { width: 16px; height: 16px; stroke: var(--accent-light); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.p-stat .val { font-family: var(--serif); font-size: 15px; font-weight: 600; color: #fff; }
.p-stat .lb { font-size: 10px; color: var(--text-secondary); font-weight: 600; }
.p-tab { display: flex; gap: 22px; padding: 0 24px 10px; }
.p-tab button { color: var(--text-tertiary); font-size: 12px; font-weight: 700; padding: 4px 0; position: relative; }
.p-tab button.on { color: #fff; }
.p-tab button.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; }
.p-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 18px; }
.p-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; border: 1px solid rgba(255,255,255,0.12); }

/* Hide scrollbars */
.m-list::-webkit-scrollbar, .msgs::-webkit-scrollbar { display: none; }
.m-list, .msgs { scrollbar-width: none; }

/* Bottom nav — fixed to bottom, matches original Connect app */
.bottom-nav {
  /* Flytende oval «pill» som ligger lavt mot bunnen */
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom));
  width: calc(100% - 28px); max-width: 362px;
  padding: 10px 16px;
  display: flex; justify-content: space-around; align-items: center;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(34px) saturate(180%);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 999px;
  box-shadow: 0 12px 34px rgba(0,0,0,0.34), inset 0 1px 0 rgba(255,255,255,0.28);
  z-index: 50;
}
.nav-item {
  position: relative;
  color: var(--text-tertiary);
  text-decoration: none;
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  transition: color 0.2s ease;
}
.nav-item svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item.active { color: var(--accent); }
.nav-item:active { transform: scale(0.92); }
.nav-badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: linear-gradient(135deg, #FF9A5C, #E85D2F);
  border-radius: 999px;
  color: #fff; font-size: 9px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid #4A2418;
  box-shadow: var(--orange-shadow);
}

/* ============================================================
   Community-module additions (migrated from v22)
   Scoped to .phone:has(.phone-scroll) — pages without
   .phone-scroll are unaffected.
   ============================================================ */

/* When a page wraps its content in .phone-scroll, switch to flex layout so the action bar
   and bottom-nav stick to the visible bottom regardless of content length — works in
   mobile/iframe AND desktop. Pages without .phone-scroll are unaffected. */
.phone:has(.phone-scroll) {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding-bottom: 0 !important;
}
.phone-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.phone:has(.phone-scroll) .actions-bar {
  position: relative !important;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
  transform: none !important;
  width: 100% !important;
  max-width: none !important;
  flex-shrink: 0;
}
/* Bunnmeny forblir en flytende pill (fixed) også på scroll-sider */
.phone:has(.phone-scroll) > .bottom-nav {
  position: fixed !important;
  left: 50% !important; right: auto !important;
  transform: translateX(-50%) !important;
  bottom: calc(10px + env(safe-area-inset-bottom)) !important;
  width: calc(100% - 28px) !important; max-width: 362px !important;
}
/* Action bar inside scroll: sticky-bottom so it sits right after content but stays visible while scrolling longer steps */
.phone:has(.phone-scroll) .phone-scroll > .actions-bar {
  position: sticky !important;
  bottom: 0;
  margin-top: auto;
  z-index: 5;
}

/* Desktop direct-view: wrap .phone in an iPhone bezel so the page always shows real iPhone proportions.
   Inside iframes (viewport = 390px) this media query never fires, so the embedded preview is unchanged. */
@media (min-width: 500px) {
  html, body { background: #1c0f09; }
  body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 0;
  }
  .phone {
    width: 390px;
    height: 844px;
    min-height: 844px;
    max-height: 844px;
    border-radius: 48px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.55), 0 0 0 10px #1c0f09, 0 0 0 12px rgba(255,255,255,0.08);
    overflow-x: hidden;
    overflow-y: auto;
  }
  /* Pages with .phone-scroll handle their own internal scroll, so .phone itself stays clipped. */
  .phone:has(.phone-scroll) {
    overflow: hidden !important;
  }
}

/* Larger desktop screens: scale the phone bezel up so it feels properly iPhone-sized, not tiny */
@media (min-width: 1100px) and (min-height: 950px) {
  body {
    padding: 70px 0 calc(844px * 0.3 + 70px);
  }
  .phone {
    transform: scale(1.25);
    transform-origin: top center;
  }
}
@media (min-width: 1400px) and (min-height: 1100px) {
  body {
    padding: 80px 0 calc(844px * 0.4 + 80px);
  }
  .phone {
    transform: scale(1.35);
  }
}
