/* The install tutorial, /install/ (UV, 3 Nov). The drawn iPhone, its caption
   and controls, the steps; Full and Compact. See docs/systems/foundations.md,
   "The install tutorial". */

.install {
	/* The drawn iPhone follows the theme (UV, 3 Nov: light and dark apply
	   everywhere): iOS in dark mode here, in light mode in the light theme
	   (below). The site's own screen inside it uses the site's tokens. Every
	   colour in the drawing is one of these, set by an inline style, so the
	   drawing itself names no colour but the few that are the same in both. */
	--ios-bg: #1c1c1e;
	--ios-fill: #2c2c2e;
	--ios-sec: #8e8e93;
	--ios-blue: #0a84ff;
	--ios-green: #34c759;
	--ios-text: #fff;
	--ios-ph: #48484a;              /* plain shapes standing in for content */
	--ios-ph2: #3a3a3c;
	--ios-bar: #1e1e1e;             /* under the site, behind Safari's bottom bar */
	--ios-type-bg: #000;            /* the page while typing an address */
	--ios-line-10: rgba(255, 255, 255, 0.1);
	--ios-line-12: rgba(255, 255, 255, 0.12);
	--ios-line-14: rgba(255, 255, 255, 0.14);
	--ios-line-20: rgba(255, 255, 255, 0.2);
	--ios-line-25: rgba(255, 255, 255, 0.25);
	--ios-clear-bg: #e5e5ea;
	--ios-clear-x: #1c1c1e;
	--ios-glass: rgba(28, 28, 30, 0.72);
	--ios-glass-line: rgba(255, 255, 255, 0.2);
	--ios-menu: rgba(30, 30, 32, 0.97);
	--ios-sheet: rgba(34, 40, 37, 0.98);
	--ios-sheet-sec: #8e9a93;
	--ios-chip: rgba(0, 0, 0, 0.3);
	--ios-chip-line: rgba(255, 255, 255, 0.15);
	--ios-ppl: #3d4440;
	--ios-ppl-l: #4a524d;
	--ios-act: rgba(255, 255, 255, 0.1);
	--ios-list: rgba(255, 255, 255, 0.09);
	--ios-add: #4f8ef7;
	--ios-x-bg: #636366;
	--ios-x-fg: #2c2c2e;
	--ios-url: #6e6e73;
	--ios-tog-off: #39393d;
	--ios-kb: #1b1b1d;
	--ios-key: #3a3a3c;
	--ios-key2: #2a2a2c;
	--ios-key-down: #7a7a7f;
	--ios-keygo-down: #5aa9ff;
	--ios-wall-0: #4a4844;
	--ios-wall-1: #2e2d2b;
	--ios-wall-2: #3c3b38;
	--ios-widget: rgba(20, 20, 20, 0.55);
	--ios-app: rgba(25, 25, 25, 0.75);
	--ios-app-l: rgba(255, 255, 255, 0.35);
	--ios-hs-text: #fff;
	--ios-pill: rgba(0, 0, 0, 0.15);
	--ios-pill-line: rgba(255, 255, 255, 0.3);
	--ios-dock: rgba(255, 255, 255, 0.12);
	--ios-dock-line: rgba(255, 255, 255, 0.2);
	--ios-status: #fff;
	--ios-status-dim: rgba(255, 255, 255, 0.4);
	--ios-status-on: #000;
	/* The site's screen: its nav band takes the light's tint, as the real one does */
	--ins-nav-0: #1f2723;
	--ins-nav-1: #2b4537;
	--ins-nav-2: #26392e;
	--ins-nav-line: rgba(255, 255, 255, 0.12);
	--ins-finger: #61ffad;
	--ins-show-dark: inline;        /* which logo files the site's screen shows */
	--ins-show-light: none;
	--ios-font: -apple-system, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
	max-width: 960px;
	margin: 0 auto;
	padding: var(--space-6) var(--space-4) var(--space-7);
	display: grid;
	gap: var(--space-6);
}

/* In Compact the heading gives way, so the block sits right under the nav:
   the page is too short to scroll it there. */
.install.is-compact { padding-top: var(--space-2); }
.install.is-compact .install-head { display: none; }

.install-head {
	view-transition-name: ins-head;
	display: grid;
	gap: var(--space-2);
	justify-items: center;
	text-align: center;
}
.install-eyebrow {
	color: var(--color-primary);
	font-size: 0.85rem;
	font-weight: 600;
}
.install-head h1 {
	margin: 0;
	font-size: clamp(1.7rem, 6vw, 2.1rem);
	line-height: 1.1;
	text-wrap: balance;
}
.install-head p {
	margin: 0;
	max-width: 46ch;
	color: var(--text-muted);
	line-height: 1.5;
}

/* ── Full: the screen, its caption and the controls, then the steps (beside
   them from 820px) ── */
.install-stage {
	--ins-pw: min(300px, 76vw);
	display: grid;
	gap: var(--space-4) var(--space-7);
	align-items: start;
	justify-items: center;
	grid-template-areas: "phone" "cap" "ctl" "steps";
	scroll-margin-top: var(--nav-total);
}
.install-stage > .install-phone { grid-area: phone; view-transition-name: ins-phone; }
.install-stage > .install-caption { grid-area: cap; view-transition-name: ins-cap; }
.install-stage > .install-controls { grid-area: ctl; view-transition-name: ins-ctl; }
.install-stage > .install-window {
	grid-area: steps;
	view-transition-name: ins-steps;
	justify-self: stretch;
	min-width: 0;
	margin-top: var(--space-3);
}
@media (min-width: 820px) {
	.install-stage {
		grid-template-columns: auto 1fr;
		grid-template-rows: auto auto 1fr;
		grid-template-areas: "phone steps" "cap steps" "ctl steps";
	}
	.install-stage > .install-window { margin-top: 0; }
}

/* ── Compact: a small screen with the live step beside it, held under the nav.
   About 198px tall with its padding: Safari's half-open Share sheet leaves about 211px of page under
   the nav on an iPhone (measured from UV's screenshots, 3 Nov). ── */
.install-stage.is-compact {
	--ins-pw: 84px;
	position: sticky;
	top: var(--nav-total);
	z-index: 5;
	grid-template-columns: var(--ins-pw) minmax(0, 1fr);
	grid-template-rows: auto auto;
	grid-template-areas: "phone steps" "phone ctl";
	gap: var(--space-2) var(--space-3);
	justify-items: stretch;
	padding-block: var(--space-2);
	background: var(--bg-base);   /* the page scrolls under it */
	box-shadow: var(--nm-raised);
}
.install-stage.is-compact > .install-caption { display: none; }
.install-stage.is-compact > .install-window {
	margin: 0;
	height: calc(var(--ins-pw) * 844 / 390 - 44px);
	overflow: hidden;
	-webkit-mask-image: linear-gradient(#000 72%, transparent);
	mask-image: linear-gradient(#000 72%, transparent);
}
/* The list slides inside its window here, so it has no panel of its own to move. */
.install-stage.is-compact .install-steps {
	gap: 6px;
	padding: 0;
	box-shadow: none;
	transition: transform 0.5s cubic-bezier(0.3, 0.7, 0.2, 1);
}
.install-stage.is-compact .install-steps > li + li { border-top: 0; }
.install-stage.is-compact .install-step { padding: 8px 10px; grid-template-columns: 24px 1fr; gap: 1px 10px; }
.install-stage.is-compact .install-step .num { width: 24px; height: 24px; font-size: 0.85rem; }
.install-stage.is-compact .install-step .st { line-height: 1.3; }
.install-stage.is-compact .install-step .sd { line-height: 1.35; }
.install-stage.is-compact > .install-controls { justify-content: flex-start; }
.install-stage.is-compact #ins-replay { display: none; }
.install-stage.is-compact .install-btn,
.install-stage.is-compact .install-seg button { min-height: 2.25rem; padding: 0.25rem var(--space-3); font-size: 0.85rem; }
.install-stage.is-compact .install-btn { box-shadow: var(--nm-sunken-small); }
.install-stage.is-compact .install-btn:active { box-shadow: var(--nm-pressed-small); }
.install-stage.is-compact .install-seg { box-shadow: var(--nm-sunken-small); }
::view-transition-group(ins-head),
::view-transition-group(ins-phone),
::view-transition-group(ins-cap),
::view-transition-group(ins-ctl),
::view-transition-group(ins-steps) {
	animation-duration: 0.45s;
	animation-timing-function: cubic-bezier(0.3, 0.7, 0.2, 1);
}

/* ── The screen: no phone frame, the rounded corners say iPhone; the light's
   shadow only lifts it off the page ── */
.install-phone {
	width: var(--ins-pw);
	max-width: 100%;
	aspect-ratio: 390 / 844;
	border-radius: 10.26% / 4.74%;
	box-shadow: var(--nm-raised);
}
.install-phone svg { display: block; width: 100%; height: 100%; }

.install-caption {
	display: grid;
	gap: 2px;
	min-height: 3.2em;
	text-align: center;
}
.install-caption .n {
	color: var(--color-primary);
	font-size: 0.85rem;
	font-weight: 600;
}
.install-caption .t { font-size: 1rem; font-weight: 600; }

.install-controls {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--space-3);
}
.install-btn,
.install-seg button {
	position: relative;
	min-height: var(--nm-field);
	padding: 0 var(--space-5);
	border: 0;
	border-radius: var(--radius-pill);
	background: transparent;
	color: var(--text-primary);
	font: inherit;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
}
.install-btn { box-shadow: var(--nm-sunken); }
.install-btn:active { box-shadow: var(--nm-pressed); }   /* a press, deeper (UV, 4 Dec: "Deeper inset while pressed") */
.install-seg {
	display: inline-flex;
	overflow: hidden;
	border-radius: var(--radius-pill);
	box-shadow: var(--nm-sunken);
}
.install-seg button { z-index: 1; }
/* What is on or chosen glows from its edge inward, faded on a layer of its own: a
   transition on these shadows would start again at every move of the light. */
.install-btn::after,
.install-seg button::after,
.install-step::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	box-shadow: inset 0 0 16px var(--nm-knob-glow);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
}
.install-btn.is-on::after,
.install-step.is-live::after { opacity: 1; }
[data-motion="reduce"] :is(.install-btn, .install-seg button, .install-step)::after { transition: none; }
@media (prefers-reduced-motion: reduce) {
	:root:not([data-motion="full"]) :is(.install-btn, .install-seg button, .install-step)::after { transition: none; }
}
.install-btn:focus-visible,
.install-seg button:focus-visible,
.install-step:focus-visible {
	outline: 2px solid var(--text-primary);
	outline-offset: 2px;
}

/* ── The steps: one sunken panel holds them, a hairline between each ── */
.install-steps {
	position: relative;
	display: grid;
	margin: 0;
	padding: var(--space-2);
	border-radius: var(--nm-field-radius);
	box-shadow: var(--nm-sunken);
	list-style: none;
}
.install-steps > li + li { border-top: 1px solid var(--border-color); }
.install-step {
	position: relative;
	display: grid;
	grid-template-columns: 30px 1fr;
	gap: 2px var(--space-3);
	align-items: start;
	width: 100%;
	overflow: hidden;
	padding: var(--space-3) 14px;
	border: 0;
	border-radius: var(--nm-field-radius);
	background: transparent;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
}
.install-step .num {
	grid-row: span 2;
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	color: var(--text-muted);
	font-size: 1rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}
.install-step .st { font-weight: 600; }
.install-step .sd { color: var(--text-muted); font-size: 0.85rem; }
.install-step .bar {
	position: absolute;
	left: 0;
	bottom: 0;
	width: 0;
	height: 2px;
	background: var(--color-primary);
}
.install-step.is-live .num,
.install-step.is-done .num { color: var(--color-primary); }

/* ── Inside the drawing ── */
.install-phone svg text { font-family: var(--ios-font); }
.install-phone .i-glass { fill: var(--ios-glass); stroke: var(--ios-glass-line); stroke-width: 1; }
.install-phone .i-ic { fill: none; stroke: var(--ios-text); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.install-phone .i-key { fill: var(--ios-key); }
.install-phone .i-key2 { fill: var(--ios-key2); }
.install-phone .i-keygo { fill: var(--ios-blue); }
.install-phone .i-key.i-down,
.install-phone .i-key2.i-down { fill: var(--ios-key-down); }
.install-phone .i-keygo.i-down { fill: var(--ios-keygo-down); }
.install-phone .i-keyl { fill: var(--ios-text); font-size: 21px; text-anchor: middle; }
.install-phone .i-ph { fill: var(--ios-ph); }
.install-phone .i-lbl { fill: var(--ios-text); font-size: 12.5px; text-anchor: middle; }
.install-phone .i-row { fill: var(--ios-text); font-size: 15.5px; }

/* ── Which steps (13 Nov): "Not your phone?", and the written sections ──
   One section per kind of device; install.js shows one. Claude's first look,
   for UV to refine. */
.install-for[hidden],
.install-pick[hidden] { display: none; }
.install-for {
	display: grid;
	gap: var(--space-4);
	justify-items: center;
}
.install-link {
	padding: var(--space-1) var(--space-2);
	border: 0;
	background: none;
	color: var(--color-primary);
	font: inherit;
	font-size: 0.9rem;
	text-decoration: underline;
	text-underline-offset: 0.2em;
	cursor: pointer;
}
.install-pick {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--space-2);
}
.install-pick .install-btn { min-height: 2.25rem; padding: 0 var(--space-4); font-size: 0.9rem; }
.install-pick .install-btn[aria-pressed="true"] { color: var(--color-primary); box-shadow: var(--nm-sunken); }
.install-lead,
.install-note {
	margin: 0;
	max-width: 46ch;
	text-align: center;
	line-height: 1.5;
}
.install-note { color: var(--text-muted); font-size: 0.9rem; }
.install-note strong { color: var(--text-primary); }
.install-cta {
	display: grid;
	gap: var(--space-2);
	justify-items: center;
	text-align: center;
}
.install-cta[hidden] { display: none; }
.install-cta-note { color: var(--text-muted); font-size: 0.85rem; max-width: 40ch; }
.install-btn-main {
	display: inline-flex;
	align-items: center;
	color: var(--color-primary);
	text-decoration: none;
	font-size: 1.1rem;
}
.install-list {
	list-style: none;
	counter-reset: ins;
	margin: 0;
	padding: 0;
	width: min(100%, 32rem);
	box-shadow: var(--nm-sunken);
	border-radius: var(--radius-lg);
}
.install-list > li {
	counter-increment: ins;
	display: grid;
	grid-template-columns: 2rem 1fr;
	column-gap: var(--space-2);
	padding: var(--space-3) var(--space-4);
}
.install-list > li + li { border-top: 1px solid var(--border-color); }
.install-list > li::before {
	content: counter(ins);
	grid-row: span 2;
	color: var(--color-primary);
	font-weight: 700;
}
.install-list .st { font-weight: 600; }
.install-list .sd { color: var(--text-muted); font-size: 0.85rem; }

/* The light theme: iOS in light mode, and the site's light screen */
[data-theme="light"] .install {
	--ios-bg: #f2f2f7;
	--ios-fill: #ffffff;
	--ios-sec: #8e8e93;
	--ios-blue: #007aff;
	--ios-green: #34c759;
	--ios-text: #000;
	--ios-ph: #d1d1d6;
	--ios-ph2: #e5e5ea;
	--ios-bar: #f9f9f9;
	--ios-type-bg: #fff;
	--ios-line-10: rgba(0, 0, 0, 0.1);
	--ios-line-12: rgba(0, 0, 0, 0.12);
	--ios-line-14: rgba(0, 0, 0, 0.12);
	--ios-line-20: rgba(0, 0, 0, 0.15);
	--ios-line-25: rgba(0, 0, 0, 0.15);
	--ios-clear-bg: #c7c7cc;
	--ios-clear-x: #fff;
	--ios-glass: rgba(255, 255, 255, 0.78);
	--ios-glass-line: rgba(0, 0, 0, 0.08);
	--ios-menu: rgba(249, 249, 249, 0.97);
	--ios-sheet: rgba(242, 242, 247, 0.98);
	--ios-sheet-sec: #8e8e93;
	--ios-chip: rgba(0, 0, 0, 0.06);
	--ios-chip-line: rgba(0, 0, 0, 0.1);
	--ios-ppl: #d1d1d6;
	--ios-ppl-l: #c7c7cc;
	--ios-act: #fff;
	--ios-list: #fff;
	--ios-add: #007aff;
	--ios-x-bg: #c7c7cc;
	--ios-x-fg: #fff;
	--ios-url: #8e8e93;
	--ios-tog-off: #e9e9eb;
	--ios-kb: #d1d3d9;
	--ios-key: #fff;
	--ios-key2: #abb0ba;
	--ios-key-down: #c4c7ce;
	--ios-keygo-down: #4da3ff;
	--ios-wall-0: #d9d4cb;
	--ios-wall-1: #efebe4;
	--ios-wall-2: #e2ddd4;
	--ios-widget: rgba(255, 255, 255, 0.55);
	--ios-app: rgba(255, 255, 255, 0.75);
	--ios-app-l: rgba(0, 0, 0, 0.25);
	--ios-hs-text: #000;
	--ios-pill: rgba(255, 255, 255, 0.4);
	--ios-pill-line: rgba(0, 0, 0, 0.12);
	--ios-dock: rgba(255, 255, 255, 0.45);
	--ios-dock-line: rgba(0, 0, 0, 0.08);
	--ios-status: #000;
	--ios-status-dim: rgba(0, 0, 0, 0.35);
	--ios-status-on: #fff;
	--ins-nav-0: color-mix(in srgb, var(--color-primary) 6%, var(--bg-base));
	--ins-nav-1: color-mix(in srgb, var(--color-primary) 18%, var(--bg-base));
	--ins-nav-2: color-mix(in srgb, var(--color-primary) 13%, var(--bg-base));
	--ins-nav-line: color-mix(in srgb, var(--text-primary) 12%, transparent);
	--ins-finger: var(--color-primary);
	--ins-show-dark: none;
	--ins-show-light: inline;
}
