/* ─────────────────────────────────────────────────────────────
   Phone app layer (≤ 760px). Apple HIG: 8pt grid, 16px gutters,
   17px body, 34px large titles, translucent bars, inset-grouped
   lists, 44pt targets, press states. Desktop is untouched.
   ───────────────────────────────────────────────────────────── */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }

.appbar, .msheet:not([open]), .apphome { display: none; }

@media (max-width: 760px) {
  :root { --ab-h: 44px; --tab-h: 50px; --g: 16px; --sec-2: rgba(60, 60, 67, .6); --grouped: #f2f2f7; --cell: #fff; --sep: rgba(60, 60, 67, .18); }
  :root[data-theme="dark"] { --sec-2: rgba(235, 235, 245, .6); --grouped: #000; --cell: #1c1c1e; --sep: rgba(84, 84, 88, .55); }
  html { -webkit-text-size-adjust: 100%; }
  body { font-size: 17px; letter-spacing: -0.011em; -webkit-tap-highlight-color: transparent; padding-top: calc(var(--ab-h) + env(safe-area-inset-top, 0px)); padding-bottom: calc(var(--tab-h) + 8px + env(safe-area-inset-bottom, 0px)); }
  body[data-page="home"] { padding-top: 0; }

  /* ── Navigation bar ── */
  .sitenav, .sitefoot, .hnav { display: none !important; }
  .appbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; position: fixed; z-index: 80; top: 0; left: 0; right: 0;
    height: calc(var(--ab-h) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 8px 0; color: var(--ink);
    background: transparent; border-bottom: .5px solid transparent; transition: background .25s, border-color .25s, backdrop-filter .25s; }
  .appbar.scrolled { background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom-color: var(--sep); }
  body[data-page="home"] .appbar:not(.scrolled) { color: var(--hero-ink); }
  .ab-l { display: flex; align-items: center; min-width: 0; }
  .ab-r { display: flex; justify-content: flex-end; }
  .ab-mark { display: grid; place-items: center; width: 44px; height: 44px; }
  .ab-mark .mark { width: 30px; height: 30px; border-radius: 9px; }
  .ab-back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding-right: 8px; color: var(--brand) !important; text-decoration: none !important; font-size: 17px; }
  .ab-back .i { width: 24px; height: 24px; stroke-width: 2.2; }
  .ab-title { font-size: 17px; font-weight: 600; letter-spacing: -0.011em; max-width: 56vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s; }
  .appbar.titled .ab-title { opacity: 1; transform: none; }
  .ab-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--brand) !important; }
  .ab-btn .i { width: 22px; height: 22px; }

  /* ── Tab bar: floating pill with a raised centre "Ask" button ── */
  .tabbar { display: grid !important; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; position: fixed; z-index: 80;
    left: 12px; right: 12px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); height: 64px; padding: 0 6px; border-radius: 32px;
    background: color-mix(in srgb, #141a33 92%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12), 0 14px 34px rgba(20, 26, 51, .28); user-select: none; -webkit-user-select: none; }
  :root[data-theme="dark"] .tabbar { background: color-mix(in srgb, #2c2c2e 92%, transparent); box-shadow: 0 14px 34px rgba(0, 0, 0, .5); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 56px; border: 0; background: none; padding: 0;
    font: inherit; font-size: 10px; font-weight: 500; letter-spacing: .01em; color: rgba(255, 255, 255, .62); text-decoration: none !important; cursor: pointer; }
  .tabbar .ti { width: 40px; height: 28px; border-radius: 14px; display: grid; place-items: center; background: none; transition: background .2s; }
  .tabbar .ti .i { width: 22px; height: 22px; stroke-width: 1.8; }
  .tabbar a[aria-current="page"], .tabbar button[aria-current="page"] { color: #fff; }
  .tabbar a[aria-current="page"] .ti, .tabbar button[aria-current="page"] .ti { background: rgba(255, 255, 255, .16); }
  .tabbar a:active .ti, .tabbar button:active .ti { transform: scale(.9); }
  .tabbar .tab-ask { color: #fff; }
  .tabbar .tab-ask .ti { width: 52px; height: 52px; border-radius: 50%; margin-top: -30px; background: var(--brand) !important; color: #fff;
    box-shadow: 0 0 0 5px color-mix(in srgb, #141a33 92%, transparent), 0 10px 22px color-mix(in srgb, var(--brand) 55%, transparent); }
  :root[data-theme="dark"] .tabbar .tab-ask .ti { box-shadow: 0 0 0 5px color-mix(in srgb, #2c2c2e 92%, transparent), 0 10px 22px rgba(0, 0, 0, .5); }
  .tabbar .tab-ask .ti .i { width: 26px; height: 26px; stroke-width: 2; }
  body { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important; }

  /* ── More sheet (iOS bottom sheet) ── */
  .msheet { position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: 100%; max-height: 88vh; padding: 8px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    border: 0; border-radius: 20px 20px 0 0; background: var(--grouped); color: var(--ink); overflow: auto; animation: sheetUp .34s cubic-bezier(.32, .72, 0, 1); }
  .msheet.closing { animation: sheetDown .22s ease-in forwards; }
  .msheet::backdrop { background: rgba(0, 0, 0, .35); }
  @keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
  @keyframes sheetDown { to { transform: translateY(100%); } }
  .ms-grab { width: 36px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 8px; }
  .ms-head { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin-bottom: 8px; }
  .ms-head strong { font-size: 20px; font-weight: 600; letter-spacing: -0.014em; }
  .ms-done { min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--brand); font: inherit; font-size: 17px; font-weight: 600; cursor: pointer; }
  .ms-label { margin: 24px 16px 8px; font-size: 13px; color: var(--sec-2); text-transform: uppercase; letter-spacing: .02em; }
  .ms-group { background: var(--cell); border-radius: 12px; overflow: hidden; }
  .ms-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 12px 8px 16px; color: var(--ink) !important; text-decoration: none !important; position: relative; }
  .ms-row + .ms-row::before { content: ""; position: absolute; top: 0; right: 0; left: 60px; border-top: .5px solid var(--sep); }
  .ms-row:active { background: var(--surface-2); }
  .ms-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--brand); color: #fff; flex-shrink: 0; }
  .ms-ic .i { width: 18px; height: 18px; stroke-width: 2; }
  .ms-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
  .ms-txt strong { font-size: 17px; font-weight: 400; }
  .ms-txt small { font-size: 13px; color: var(--sec-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ms-row[aria-current="page"] .ms-txt strong { color: var(--brand); font-weight: 600; }
  .ms-chev { color: var(--line-strong); display: grid; }
  .ms-chev .i { width: 16px; height: 16px; stroke-width: 2.2; }
  .ms-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px; border-radius: 9px; background: color-mix(in srgb, var(--ink) 8%, transparent); }
  .ms-seg button { min-height: 36px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
  .ms-seg button[aria-checked="true"] { background: var(--cell); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

  /* ── Large titles and page rhythm ── */
  .u-hero { padding: 8px var(--g) 24px; text-align: left; }
  .u-hero-in { align-items: flex-start; gap: 8px; }
  .u-hero .u-chip { display: none; }
  .u-hero h1 { font-size: 34px; font-weight: 700; line-height: 1.1; letter-spacing: -0.022em; }
  .u-lead { font-size: 17px; line-height: 1.45; color: var(--sec-2); }
  .u-ctas { margin-top: 8px; gap: 8px; }
  .u-body-wrap { padding: 24px var(--g) 0; gap: 40px; }
  .u-stage { margin: 16px 0 0; padding: 0; background: none; border-radius: 0; max-width: none; }
  .btn { min-height: 44px; font-size: 16px; border-radius: 12px; }
  h2 { letter-spacing: -0.02em; }
  .u-car-head h2, .p-sec h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.017em; }
  .u-car-head p { font-size: 15px; }
  .u-car-track { margin: 0 calc(-1 * var(--g)); padding: 0 var(--g) 4px; scroll-padding: 0 var(--g); grid-auto-columns: 80%; gap: 12px; }

  /* Cards: one radius tier, soft depth, press state */
  .u-card, .work-card, .p-card, .p-feat, .a-impact div, .p-facts div, .p-pn a { border-radius: 20px; }
  .u-card { padding: 20px; min-height: 0; }
  .u-card strong { font-size: 17px; }
  .u-card span { font-size: 15px; }
  .u-card:active, .work-card:active, .ap-card:active, .p-card:active, .p-feat:active, .btn:active, .fb:active, .cg-item:active, .chip:active, .tool:active, .value:active { transform: scale(.97); transition: transform .12s; }

  /* Filter chips: sticky under the bar, on material */
  .u-tabs { position: sticky; top: calc(var(--ab-h) + env(safe-area-inset-top, 0px)); z-index: 30; padding: 8px var(--g); margin: 0;
    background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: .5px solid var(--sep); }
  .u-tab { min-height: 36px; padding: 0 14px; font-size: 15px; position: relative; }
  .u-tab::after { content: ""; position: absolute; inset: -4px 0; }

  /* Closing call-to-action: a calm inset card, not a web banner */
  .u-end { width: auto; margin: 40px var(--g) 16px; padding: 24px; border-radius: 20px; background: var(--surface); color: var(--ink); text-align: left; align-items: flex-start; gap: 8px; }
  .u-end h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.017em; }
  .u-end p { color: var(--sec-2); font-size: 15px; margin: 0 0 8px; }
  .u-end .btn-primary { background: var(--brand); color: #fff !important; }

  /* ── Work ── */
  body[data-page="work"] .u-stage { display: none; }
  .u-grid { gap: 12px; }
  .work-card { padding: 20px; }
  .work-card strong { font-size: 17px; }
  .work-card span { font-size: 15px; }

  /* ── About: profile header + inset-grouped facts ── */
  .a-stage { display: flex !important; flex-direction: column; align-items: center; gap: 16px; padding: 0 !important; background: none !important; }
  .about-photo { width: 120px !important; height: 120px !important; margin: 0 auto; }
  .about-photo img { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; object-position: 50% 12%; background: var(--brand-tint); }
  .a-facts { width: 100%; margin: 0; padding: 0; list-style: none; background: var(--surface); border-radius: 14px; overflow: hidden; }
  .a-facts li { padding: 12px 16px; border: 0 !important; position: relative; }
  .a-facts li + li::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); }
  .a-facts small { font-size: 13px; color: var(--sec-2); }
  .a-facts strong { font-size: 17px; font-weight: 500; }
  .a-impact { gap: 12px; }
  .a-impact div { padding: 16px; }
  .a-impact strong { font-size: 28px; }
  .a-impact span { font-size: 13px; }
  .a-story { font-size: 17px; }
  .a-path-card { max-width: none; box-shadow: none; background: var(--surface); }

  /* ── Credentials: swipeable featured row + clean list ── */
  .feat-badges { display: grid !important; grid-auto-flow: column; grid-auto-columns: 62%; grid-template-columns: none !important; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
    margin: 0 calc(-1 * var(--g)); padding: 0 var(--g) 4px; scroll-padding: 0 var(--g); scrollbar-width: none; }
  .feat-badges::-webkit-scrollbar { display: none; }
  .fb { scroll-snap-align: start; padding: 20px 16px !important; border-radius: 20px !important; }
  .cg-pill { display: none !important; }
  .cg-txt strong { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; font-size: 16px; }
  .c-list { border-radius: 14px; }
  .cg-item { min-height: 60px; }

  /* ── Products ── */
  .ap-card { height: 420px; border-radius: 24px; }
  .p-switch { display: none; }
  .p-hero { margin: 8px var(--g) 0; width: auto; border-radius: 24px; padding: 24px 20px; }
  .p-hero h1 { font-size: 34px; letter-spacing: -0.022em; }
  .p-hero-tag { font-size: 20px; }
  .p-hero .u-lead { font-size: 17px; }
  .p-hero-vis { display: none; }
  .p-hero .u-ctas { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; }
  .p-hero .u-ctas .btn { justify-content: center; width: 100%; }
  .p-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .p-facts div { padding: 16px; }
  .p-feats { gap: 12px; }

  /* ── Resume: actions in one row, document full width ── */
  body[data-page="resume"] .u-ctas { display: grid; grid-template-columns: 1fr 1fr 1fr; width: 100%; }
  body[data-page="resume"] .u-ctas .btn-primary { grid-column: 1 / -1; justify-content: center; }
  body[data-page="resume"] .u-ctas .btn { padding: 0 8px; justify-content: center; }
  .doc-stage { margin: 16px 0 0 !important; }
  .doc { box-shadow: none !important; border: 0 !important; border-radius: 0 !important; padding: 8px var(--g) 24px !important; background: transparent !important; }
  .doc h1 { font-size: 28px; letter-spacing: -0.02em; }
  .doc .d-contact { display: flex; flex-direction: column; align-items: flex-start; gap: 0; }
  .doc .d-contact span[aria-hidden] { display: none; }
  .doc .d-contact a { display: inline-flex; align-items: center; min-height: 36px; }

  /* ── Journey ── */
  .tl-stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px; }
  .tl-card { border-radius: 20px; }
  .tl-p-nav .theme-toggle { width: 44px; height: 44px; }

  /* ── Home: native home screen (greeting, ask bar, JD match card, tiles, rows) ── */
  body[data-page="home"] .hero { display: none !important; }
  .apphome { display: block; padding: calc(var(--ab-h) + env(safe-area-inset-top, 0px) + 4px) var(--g) 8px; background: var(--hero-bg); }
  .ah-head { display: flex; align-items: center; gap: 12px; }
  .ah-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; object-position: 50% 8%; background: var(--brand-tint); }
  .ah-head strong { display: block; font-size: 15px; font-weight: 600; }
  .ah-head small { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--sec-2); }
  .ah-head small .i { width: 13px; height: 13px; }
  .ah-greet { margin: 24px 0 4px; font-size: 15px; color: var(--sec-2); }
  .ah-title { margin: 0; font-size: 28px; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
  .ah-search { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; margin: 16px 0 20px; padding: 0 16px; border: 1px solid var(--line); border-radius: 16px;
    background: var(--cell); color: var(--sec-2); font: inherit; font-size: 17px; text-align: left; cursor: text; box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(20, 26, 51, .06); }
  .ah-search-ic { color: var(--brand); display: grid; }
  .ah-search-ic .i { width: 20px; height: 20px; }
  .ah-promo { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 20px; border-radius: 24px; color: #fff !important; text-decoration: none !important;
    background: radial-gradient(120% 140% at 100% 0%, #3b5bdb 0%, #1d2c6b 45%, #141a33 100%); box-shadow: 0 16px 36px rgba(20, 26, 51, .28); }
  .ah-promo-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, .14); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
  .ah-promo-chip .i { width: 14px; height: 14px; }
  .ah-promo strong { font-size: 22px; font-weight: 700; line-height: 1.2; letter-spacing: -0.017em; }
  .ah-promo-sub { font-size: 15px; line-height: 1.4; color: rgba(255, 255, 255, .78); }
  .ah-promo-stats { display: flex; gap: 16px; margin-top: 4px; font-size: 13px; color: rgba(255, 255, 255, .72); }
  .ah-promo-stats b { display: block; font-size: 20px; color: #fff; letter-spacing: -0.02em; }
  .ah-promo-btn { margin-top: 8px; align-self: stretch; text-align: center; min-height: 48px; line-height: 48px; border-radius: 14px; background: #fff; color: #141a33; font-size: 16px; font-weight: 600; }
  .ah-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
  .ah-tile { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 72px; padding: 12px 12px 12px 16px; border-radius: 18px; background: var(--cell); color: var(--ink) !important; text-decoration: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 18px rgba(20, 26, 51, .05); }
  .ah-tile strong { display: block; font-size: 15px; font-weight: 600; }
  .ah-tile small { font-size: 12px; color: var(--sec-2); }
  .ah-tile-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand); flex-shrink: 0; }
  .ah-tile-ic .i { width: 20px; height: 20px; }
  .ah-sec { margin-top: 32px; }
  .ah-sec-h { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
  .ah-sec-h h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.014em; }
  .ah-sec-h a { min-height: 44px; display: inline-flex; align-items: center; font-size: 15px; color: var(--brand); text-decoration: none; }
  .ah-row { display: grid; grid-auto-flow: column; grid-auto-columns: 72%; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 calc(-1 * var(--g)); padding: 0 var(--g) 8px; scroll-padding: 0 var(--g); scrollbar-width: none; }
  .ah-row::-webkit-scrollbar { display: none; }
  .ah-role, .ah-prod { scroll-snap-align: start; display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 20px; color: var(--ink) !important; text-decoration: none !important; min-height: 176px; }
  .ah-role { background: var(--cell); box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 18px rgba(20, 26, 51, .05); }
  .ah-role-ic, .ah-prod-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand); margin-bottom: 4px; }
  .ah-prod-ic { background: var(--bg); color: var(--ink); }
  .ah-role-ic .i, .ah-prod-ic .i { width: 20px; height: 20px; }
  .ah-role strong, .ah-prod strong { font-size: 17px; font-weight: 600; letter-spacing: -0.011em; }
  .ah-role span, .ah-prod > span:last-child { font-size: 14px; line-height: 1.4; color: var(--sec-2); }
  .ah-role em { margin-top: auto; font-style: normal; font-size: 14px; font-weight: 600; color: var(--brand); }
  .ah-prod { position: relative; }
  .ah-badge { position: absolute; top: 12px; right: 12px; display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 999px; background: var(--bg); font-size: 11px; font-weight: 600; color: var(--ok); }
  .ah-badge .i { width: 12px; height: 12px; stroke-width: 2.6; }
  .ah-trust { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 20px 0 8px; font-size: 13px; color: var(--sec-2); }
  .ah-trust .i { width: 14px; height: 14px; color: var(--ok); stroke-width: 2.4; }
  .ah-tile:active, .ah-role:active, .ah-prod:active, .ah-promo:active, .ah-search:active { transform: scale(.97); transition: transform .12s; }

  /* ── Home: compact hero, chat as a full-screen view ── */
  .hero { min-height: 0; padding-top: calc(var(--ab-h) + env(safe-area-inset-top, 0px)); }
  .hero h1 { font-size: 34px !important; letter-spacing: -0.022em; line-height: 1.1; }
  .hero-desc { font-size: 17px !important; }
  .hero-visual { min-height: 340px !important; margin-top: 24px !important; }
  .orb { width: 290px; margin-left: -145px; }
  .portrait.cutout { width: min(330px, 86%); margin-left: calc(min(330px, 86%) / -2); }
  .chat-intro { display: none !important; }
  .hero-chip { min-height: 36px; position: relative; }
  .hero-chip::after { content: ""; position: absolute; inset: -4px 0; }
  .scroll-cue { margin-bottom: 24px; }
  .chat-section { padding: 24px 0 0; }
  .chat-intro { padding: 0 var(--g); margin-bottom: 16px; }
  .chat-intro h2 { font-size: 28px; letter-spacing: -0.02em; }
  .chat-intro p { font-size: 15px; color: var(--sec-2); }
  .app { height: calc(100dvh - var(--ab-h) - 88px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important; min-height: 460px;
    border-radius: 0 !important; border-left: 0 !important; border-right: 0 !important; border-bottom: 0 !important; box-shadow: none !important;
    scroll-margin-top: calc(var(--ab-h) + env(safe-area-inset-top, 0px)); }
  .chip { min-height: 36px; position: relative; font-size: 15px; }
  .chip::after { content: ""; position: absolute; inset: -4px 0; }
  .field input { font-size: 17px; }
  .composer { padding-bottom: 8px !important; }
  .hint { display: none; }
}

/* Installed app (home-screen PWA): no browser chrome, so no "scroll for more" hints */
@media (display-mode: standalone) and (max-width: 760px) {
  body { overscroll-behavior-y: none; }
}
@media (prefers-reduced-motion: reduce) {
  .msheet, .msheet.closing { animation: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
