/* The look of the iOS shell, and of a shell that is neither (design-direction.md section 11; the structure is 95-native-shell.css).

   What an iPhone user expects of an app and Apple's Human Interface Guidelines say: a tab bar that floats over the content as
   frosted glass (iOS 26's), grouped lists in rounded cards on a quiet field with a hairline between rows, a sheet with a grabber and
   large rounded corners, the system face at the size the person chose, and a pressed state that is a small, quick give under the finger.
   Tessera is in it by what the platform leaves open: the purple on the selected tab, the tessera colors on the rows' tiles, the
   institution's face on the titles. 97-native-android.css overrides the parts that are Material's. Tokens only; no color is written. */

/* WebKit's Dynamic Type body style supplies the root size that every rem token reads.
   Match a real iOS body, so a nested native component preview never scales its browser
   document. The existing body and heading rules still choose their configured families. */
:root:has(> body[data-native="ios"]) {
  font: -apple-system-body;
}

[data-native] {
  --native-tabs-h: 3.875rem;
  --native-tabs-offset: max(var(--space-2), calc(var(--safe-bottom) - var(--space-3)));
  --native-group-radius: 1.25rem;
  --native-sheet-radius: 1.75rem;
}

/* ── The tab bar: glass ──────────────────────────────────────────────────
   A capsule inset from the edges and floating a little above the home indicator. The page shows through it, blurred and lifted a
   little in saturation, and a hairline and a soft shadow set it off from a page of any color. The label is the system's small
   semibold; the selected tab is filled with a wash of the accent, and its drawing is filled in a tint of itself as well, so the
   selection is a shape and a weight as well as a hue. */
[data-native] .native-tabs {
  padding-inline: calc(min(var(--space-4), 5%) + max(var(--safe-left), var(--safe-right)));
}
[data-native] .native-tabs-list {
  gap: 0.125rem;
  max-inline-size: 28rem;
  margin-inline: auto;
  padding: 0.3125rem;
  border: 1px solid color-mix(in srgb, var(--fg1) 9%, transparent);
  border-radius: min(999px, 20vi);
  background: color-mix(in srgb, var(--surface-raised) 92%, transparent);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--fg1) 14%, transparent);
}
/* Glass only where the engine can blur what is behind it: without the blur the page's words show through a translucent bar and make
   it hard to read, so the bar is nearly opaque there, and the glass is the lighter wash that only a blur makes legible. */
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  [data-native] .native-tabs-list {
    background: color-mix(in srgb, var(--surface-raised) 72%, transparent);
    -webkit-backdrop-filter: blur(28px) saturate(1.8);
    backdrop-filter: blur(28px) saturate(1.8);
  }
}
[data-native] .native-tab {
  gap: 0.125rem;
  padding: 0.375rem min(0.25rem, 8%);
  border-radius: 999px;
  color: var(--fg2);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.01em;
  transition: background-color 180ms ease, color 180ms ease, transform 140ms var(--native-ease);
}
[data-native] .native-tab[aria-current="page"] {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--fg1);
}
[data-native] .native-tab[aria-current="page"] .icon {
  fill: color-mix(in srgb, currentColor 24%, transparent);
  stroke-width: 2;
}
[data-native] .native-tab:active {
  transform: scale(0.94);
}

/* ── The assistant ───────────────────────────────────────────────────────
   The same glass as the bar, a circle, with the accent for its drawing: it is a control of the page and not part of the bar, so
   it floats on its own shadow. It gives a little under the finger like a tab does. */
[data-native] .assistant-fab {
  border: 1px solid color-mix(in srgb, var(--fg1) 9%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface-raised) 94%, transparent);
  color: var(--accent-text);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--fg1) 16%, transparent);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  [data-native] .assistant-fab {
    background: color-mix(in srgb, var(--surface-raised) 78%, transparent);
    -webkit-backdrop-filter: blur(28px) saturate(1.8);
    backdrop-filter: blur(28px) saturate(1.8);
  }
}
[data-native] .assistant-fab:hover {
  transform: none;
  border-color: color-mix(in srgb, var(--fg1) 9%, transparent);
}
[data-native] .assistant-fab:active {
  transform: scale(0.94);
}

/* ── The sheet ───────────────────────────────────────────────────────────
   Large rounded corners, the grouped field behind rounded groups, a heading in small tracked capitals, rows in the system's regular
   17px (a phone's body size). */
[data-native] .native-menu {
  border-start-start-radius: var(--native-sheet-radius);
  border-start-end-radius: var(--native-sheet-radius);
}
[data-native] .native-group-title {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
[data-native] .native-group-list {
  border-radius: var(--native-group-radius);
  background: var(--surface-raised);
}
[data-native] .native-row {
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.3;
  transition: background-color 120ms ease;
}
/* The hairline between two rows starts where the words do, past the tile, as a list in Settings draws it. */
[data-native] .native-group-list > li + li > .native-row::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: calc(var(--space-3) + 1.875rem + var(--space-3)) 0;
  border-block-start: 1px solid var(--rule);
}
[data-native] .native-row:active {
  background: color-mix(in srgb, var(--fg1) 7%, transparent);
}
[data-native] .native-row[aria-current="page"] .native-row-label {
  color: var(--accent-text);
  font-weight: 650;
}
[data-native] .native-tile {
  inline-size: 1.875rem;
  block-size: 1.875rem;
  border-radius: 0.5rem;
}
[data-native] .native-account-who {
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.3;
}

/* ── Buttons ─────────────────────────────────────────────────────────────
   The three the platform has, from the three the component has. The primary button is the prominent one: filled with the accent, a
   capsule, 17px semibold. The secondary is the tinted one: the accent's own wash behind accent text, no edge. The quiet one is the plain
   one: accent text and nothing around it. Large enough to hit (a finger's 44, the usual 48), and pressed it gives a little and dims, as a
   control does under a finger. A destination's own danger styling (the console's tinted red, the light shell's solid one) is left alone. */
[data-native] .btn {
  min-block-size: 3rem;
  padding-block: 0.625rem;
  padding-inline: 1.5rem;
  border-radius: 999px;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  transition: opacity 120ms ease, transform 140ms var(--native-ease), background-color 160ms ease;
}
[data-native] .btn-sm {
  min-block-size: var(--target-min);
  padding-block: 0.4rem;
  padding-inline: 1.125rem;
  font-size: 1rem;
}
[data-native] .btn-lg {
  min-block-size: 3.25rem;
  padding-inline: 1.75rem;
  font-size: 1.125rem;
}
[data-native] .btn-secondary {
  --btn-bg: color-mix(in srgb, var(--accent) 13%, transparent);
  --btn-fg: var(--accent-text);
  --btn-border: transparent;
}
[data-native] .btn-quiet {
  --btn-bg: transparent;
  --btn-fg: var(--accent-text);
  --btn-border: transparent;
  padding-inline: 0.875rem;
  font-weight: 500;
}
[data-native] .btn:active:where(:not(:disabled, [aria-disabled="true"])) {
  opacity: 0.8;
  transform: scale(0.97);
}

/* ── Fields ──────────────────────────────────────────────────────────────
   Rounded and roomy, the system's 17px (which is also what keeps iOS from zooming into one). The edge stays the control line, so a field is
   found by its boundary at 3:1 (WCAG 1.4.11) as well as by its shape. */
[data-native] {
  --native-field-radius: 0.75rem;
  --native-card-radius: 1rem;
}
[data-native] .field .field-control {
  min-block-size: 3rem;
  padding-inline: var(--space-4);
  border-radius: var(--native-field-radius);
  font-size: 1.0625rem;
}
[data-native] .field-label {
  font-size: 0.9375rem;
  font-weight: 600;
}

/* ── Cards and grouped lists ─────────────────────────────────────────────
   Every card the shared components draw has the platform's corners. And a list of entries, or of doors (the hubs), is not a stack of
   cards on iOS but one grouped card: the rows share a surface and a radius, a hairline between them, as a list in Settings is. */
[data-native] :is(.entry, .link-card, .card-panel, .sheet, .tform:has(> .form-section), .person-picker, .person-search, .callout) {
  border-radius: var(--native-card-radius);
}
[data-native]:not([data-native="android"]) :is(.entry-list, .link-cards) {
  gap: 0;
  overflow: hidden;
  border-radius: var(--native-group-radius);
  background: var(--surface-raised);
}
[data-native]:not([data-native="android"]) .entry-list > .entry {
  padding-block: var(--space-4);
  border-block: 0;
  border-inline-end: 0;
  border-radius: 0;
  background: transparent;
}
[data-native]:not([data-native="android"]) .entry-list > .entry:not([data-tone]) {
  border-inline-start: 0;
}
[data-native]:not([data-native="android"]) .entry-list > .entry + .entry {
  border-block-start: 1px solid var(--rule);
}
[data-native]:not([data-native="android"]) .link-cards {
  grid-template-columns: minmax(0, 1fr);
}
[data-native]:not([data-native="android"]) .link-card {
  padding-block: var(--space-4);
  border: 0;
  border-radius: 0;
  background: transparent;
}
[data-native]:not([data-native="android"]) .link-cards > li + li > .link-card {
  border-block-start: 1px solid var(--rule);
}

@media (prefers-reduced-motion: reduce) {
  [data-native] .native-tab,
  [data-native] .native-row,
  [data-native] .btn {
    transition: none;
  }
  [data-native] .native-tab:active,
  [data-native] .btn:active {
    transform: none;
  }
}

/* ── The way back: iOS's mark ────────────────────────────────────────────
   The chevron, a little larger and heavier than the page's icons, as the system's own back chevron is; the arrow is Android's. */
[data-native] .native-back-arrow {
  display: none;
}
[data-native] .native-back-chevron {
  --icon-size: 1.75rem;
  stroke-width: 2.25;
}
