/* 迹录 · 手机外壳 v1（开屏 + 底部五键）
   规格来源：sketch/v4-auth-shell-spec.md
   只在 ≤768px 生效；body[data-tab] 才挂底栏，桌面端整块隐藏。 */

/* 旧的顶部快捷入口条与新底栏重复，撤掉 */
.m-entry { display: none !important; }

/* 底栏口径唯一来源（@design）：栏体恒 56，安全区取 max(8px, env)，
   内容让位 = 栏高 + 8。任何地方要用底栏高度只许读 --jl-tabbar-h，
   不许再写一遍 56px/64px —— 两处各写一个数就是 .pm-gh 51/42 那类事故的同一个根。
   env() 第二参数保留 0px 兜底：不支持 env 的内核退化成 56 栏体，不会整条 calc 失效。 */
:root {
  --jl-tab-safe: max(8px, env(safe-area-inset-bottom, 0px));
  --jl-tabbar-h: calc(56px + var(--jl-tab-safe));
}

@media (max-width: 768px) {
  /* 底栏占位：栏高 + 8 呼吸 */
  body[data-tab] {
    padding-bottom: calc(var(--jl-tabbar-h) + 8px);
  }

  /* ---------------- 底部五键 ---------------- */
  .jl-tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 300;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    height: var(--jl-tabbar-h);
    padding-bottom: var(--jl-tab-safe);
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    backdrop-filter: blur(20px) saturate(1.6);
    border-top: 1px solid #EEF1F6;
    box-shadow: 0 -1px 12px rgba(24, 32, 54, 0.04);
  }

  .jl-tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-width: 0;
    text-decoration: none;
    color: #8A93A8;
    font-size: 10px;
    line-height: 1;
    letter-spacing: 0.2px;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.16s ease;
  }
  /* 原 gap 2px（列方向）。Chrome 83 的 flex 不支持 gap，改用子项上外边距，值不变 */
  .jl-tab > * + * { margin-top: 2px; }
  .jl-tab:active { opacity: 0.7; }
  .jl-tab.on { color: #8B4326; font-weight: 500; }
  .jl-tab svg {
    width: 22px; height: 22px;
    fill: none; stroke: currentColor;
    stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  }
  .jl-tab-label { font-size: 10px; }

  /* 中间 ＋：44×44 渐变块，在栏体内居中（@design 2026-10-26：原来是 margin-top:-14px 向上顶出栏体，
     实测 plus 顶到栏顶 -0.5px，视觉上压在 border-top 上；改为 align-self:center，上下留白回到对称）。
     栏体 64（56 + 8 安全区）里 44 的块，纯居中会得到「上 6.5 / 下 5.5」——多的 0.5 是 1px border-top
     被算进内容盒。translateY(-0.5px) 抵掉这条 border，得到上 6 / 下 6（dsf=2 时正好 1 物理像素），
     安全区抬到 34 时依然 6/6（栏高 90 同步加 34）。 */
  .jl-tab-create {
    align-self: center;
    justify-content: center;
    transform: translateY(-0.5px);
    color: #FFFFFF;
  }
  .jl-tab-create .jl-plus {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px; height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, #9E4F2E 0%, #8B4326 100%);
    box-shadow: 0 4px 12px rgba(139, 67, 38, 0.32);
    color: #fff;
  }
  .jl-tab-create .jl-plus svg {
    width: 22px; height: 22px; stroke-width: 2.2; color: #fff;
  }
  .jl-tab-create.on { color: #8B4326; }

  /* 「我」上的未读红点 */
  .jl-dot {
    position: absolute;
    top: 6px;
    left: calc(50% + 7px);
    min-width: 15px; height: 15px;
    padding: 0 4px;
    border-radius: 8px;
    background: #E8452C;
    color: #fff;
    font-size: 9px;
    font-weight: 600;
    line-height: 15px;
    text-align: center;
  }
  .jl-dot[hidden] { display: none; }

  /* 灯箱 / 全屏层打开时让位 */
  body.jl-shell-off .jl-tabbar { display: none; }

  /* ---------------- 开屏 ---------------- */
  .jl-splash {
    position: fixed;
    /* inset 简写要 Chrome 87+；华为旧 WebView(Chrome 83) 上会被整条丢弃 →
       开屏塌成内容大小的小白块。四边写全，兼容层不能省。 */
    top: 0; right: 0; bottom: 0; left: 0;
    top:0;right:0;bottom:0;left:0;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    transition: opacity 0.32s ease;
  }
  .jl-splash::before,
  .jl-splash::after {
    content: '';
    position: absolute;
    width: 420px; height: 420px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
  }
  .jl-splash::before { background: #F9EBDD; top: -120px; left: -140px; }
  .jl-splash::after  { background: #E4F0FF; bottom: -140px; right: -150px; }

  .jl-splash-mark {
    position: relative;
    width: 84px; height: 84px;
    border-radius: 19px;
    background: linear-gradient(135deg, #9E4F2E 0%, #8B4326 100%);
    color: #fff;
    font-size: 34px;
    font-weight: 600;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 32px rgba(139, 67, 38, 0.22);
    overflow: hidden; /* 位图是方形满版，圆角靠容器裁 */
    animation: jl-mark-in 0.52s cubic-bezier(0.22, 0.8, 0.3, 1) both;
  }
  /* 开屏标记用 3x 位图铺满容器：字形与桌面图标同源，不再依赖系统字体回退 */
  .jl-splash-mark-img {
    position: absolute; top:0;right:0;bottom:0;left:0;
    width: 100%; height: 100%;
    border-radius: inherit;
    display: block;
  }
  .jl-splash-name {
    position: relative;
    margin-top: 18px;
    font-size: 15px;
    letter-spacing: 6px;
    color: #48507A;
    text-indent: 6px;
    animation: jl-fade-in 0.5s 0.14s both;
  }
  .jl-splash-bar {
    position: absolute;
    left: 50%;
    bottom: 96px;
    width: 120px; height: 2px;
    margin-left: -60px;
    border-radius: 2px;
    background: #EEF0F6;
    overflow: hidden;
  }
  .jl-splash-bar i {
    display: block;
    width: 100%; height: 100%;
    background: #8B4326;
    transform-origin: left center;
    animation: jl-bar 1.1s cubic-bezier(0.35, 0, 0.3, 1) both;
  }

  .jl-splash-out { opacity: 0; pointer-events: none; }
  .jl-splash[hidden] { display: none; }

  /* 已播过（站内跳转 / 刷新）：首帧就不显示，避免闪一下 */
  html.jl-splash-done .jl-splash { display: none; }

  @keyframes jl-mark-in {
    from { opacity: 0; transform: scale(0.86) translateY(6px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
  }
  @keyframes jl-fade-in {
    from { opacity: 0; } to { opacity: 1; }
  }
  @keyframes jl-bar {
    from { transform: scaleX(0); } to { transform: scaleX(1); }
  }

  @media (prefers-reduced-motion: reduce) {
    .jl-splash-mark,
    .jl-splash-name,
    .jl-splash-bar i { animation: none; }
  }
}

/* 桌面端：任何情况下都不出现 */
@media (min-width: 769px) {
  .jl-tabbar, .jl-splash { display: none !important; }
}

/* 收藏页：两列 3:4，风格对齐小红书。scope 到 .fav-grid，
   避免影响 profile 里共用 .journey-card 的「我的游记」卡片 */
@media (max-width: 768px) {
  .fav-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px 12px !important;
    padding: 12px 12px 4px !important;
  }
  .fav-grid .journey-card {
    border: 0 !important;
    border-radius: 10px;
    background: #fff;
    box-shadow: none !important;
    padding: 0 !important;
    overflow: hidden;
  }
  .fav-grid .journey-cover {
    position: relative;
    aspect-ratio: 3 / 4;
    width: 100%;
    height: auto !important;
    border-radius: 10px;
    overflow: hidden;
    background: #F3F5F9;
  }
  /* Chrome 83 没有 aspect-ratio：3:4 封面塌成图片自然高（390 下 236→118）。
     用 padding-top 133.3333% 还回比例，图片绝对定位铺满；仅 83 生效，现代内核仍是原生 AR。 */
  html:not(.fg-ok) .fav-grid .journey-cover {
    aspect-ratio: auto;
    height: 0 !important;
    padding-top: 133.3333%;
  }
  html:not(.fg-ok) .fav-grid .journey-cover > img {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
  }
  .fav-grid .journey-cover img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
  }
  .fav-grid .jl-fav-badge {
    position: absolute;
    right: 6px; bottom: 6px;
    min-width: 18px;
    padding: 1px 5px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.42);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    color: #fff;
    text-align: center;
    font-size: 10px;
    line-height: 15px;
  }
  .fav-grid .journey-info { padding: 0 !important; }
  .fav-grid .journey-title {
    margin: 8px 2px 0 !important;
    font-size: 13px !important;
    line-height: 1.35 !important;
    font-weight: 500;
    color: #2E3652;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .fav-grid .journey-meta {
    margin: 4px 2px 0 !important;
    font-size: 11px !important;
    color: #8A93A8 !important;
  }
  /* 只留日期那一行 */
  .fav-grid .journey-meta span:not(.jl-fav-date) { display: none; }
}

/* 收藏分页（批 D）：骨架 / 加载更多 / 到底 / 重试。
   骨架必须和真卡同尺寸，所以它跟 .fav-grid 住在同一个文件——卡从 3:4 改 4:5 时这里跟着改，
   分两处各算一遍就会重演 35%/42% 那种两套真值。 */
.fav-skel { cursor: default; }
.fav-skel .journey-cover { background: var(--jl-n100, #EEF3F9); }
.fav-skel .sk-line { height: 12px; border-radius: 4px; background: var(--jl-n100, #EEF3F9); }
.fav-skel .sk-line + .sk-line { width: 58%; height: 10px; margin-top: 8px; }
.fav-more { display: flex; justify-content: center; padding: 4px 0 24px; }
.fav-more button { width: 160px; height: 44px; min-height: 44px; padding: 0; border-radius: 999px;
  background: #fff; border: 1px solid var(--jl-n200, #E5EDF5); color: var(--jl-text, #48507A);
  font-size: 13.5px; font-weight: 500; font-family: inherit; cursor: pointer; }
.fav-more button:active { background: var(--jl-n50, #F6F9FC); }
.fav-more button[disabled] { opacity: .55; cursor: default; }
.fav-end { text-align: center; font-size: 12.5px; color: var(--jl-n400, #93A6BE); padding: 20px 0; }
/* 失败态占的是「到底」那一格，不弹 toast；高度锁 44，点一下重试 */
.fav-end.is-err { color: var(--jl-purple-700, #8B4326); min-height: 44px; padding: 12px 0; cursor: pointer; }
#favSentinel { height: 1px; }
@media (max-width: 768px) { .fav-more { display: none !important; } }

/* iOS 刘海/小白条：viewport-fit=cover 之后 nav 不能顶到状态栏下 */
@media (max-width: 768px) {
  /* 手机壳页面不再要顶栏：功能全在底部五键，顶栏只留桌面 */
  body[data-tab] > .nav { display: none !important; }
  body[data-tab] { padding-top: env(safe-area-inset-top, 0px); }
  body:not([data-tab]) > .nav {
    height: auto;
    min-height: 56px;
    padding-top: env(safe-area-inset-top, 0px);
  }
}
