/* Dendra — camada de sistema iOS.
   Métricas, materiais e escala de texto das Human Interface Guidelines.
   Carrega depois de styles.css e interface.css e manda nas duas. */

:root {
	--font-ui: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
	--font-brand: 'Manrope', var(--font-ui);
	--ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
	/* Os dois galões do botão de menu do iOS (chevron.up.chevron.down). */
	--chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' \
width='10' height='16' viewBox='0 0 10 16' fill='none' stroke='%238e8e93' \
stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E\
%3Cpath d='M1.8 6.2 5 3l3.2 3.2'/%3E%3Cpath d='M1.8 9.8 5 13l3.2-3.2'/%3E%3C/svg%3E");
}

/* ---------- texto ---------- */

body {
	font-family: var(--font-ui);
	letter-spacing: -0.01em;
}

/* A letra da marca fica no conteúdo do mapa; o interface é todo San Francisco. */
.node-label,
.node-full,
.sticky-text,
.node-badges {
	font-family: var(--font-brand);
	letter-spacing: 0;
}

/* ---------- barra de navegação ---------- */

/* Sem barra: os controlos flutuam sobre o mapa, como no iOS 26. */
.navbar {
	gap: 8px;
	padding: max(8px, env(safe-area-inset-top)) 12px 8px;
	border-bottom: none;
	background: none;
	backdrop-filter: none;
	-webkit-backdrop-filter: none;
}

.nav-action {
	width: 44px;
	min-width: 44px;
	height: 44px;
	padding: 0;
	border-radius: 50%;
	font-size: 17px;
	font-weight: 400;
}

.nav-title {
	height: 44px;
	padding: 0 16px;
	border-radius: 22px;
	font-size: 17px;
	font-weight: 600;
	letter-spacing: -0.02em;
}

.nav-title:focus {
	background: var(--ios-panel);
	text-align: center;
}

.recent-map {
	height: 36px;
	border-radius: 18px;
	font-size: 13px;
}

/* O toque no iOS esbate o controlo em vez de lhe pintar o fundo. */
.nav-action:active,
.sheet-close:active,
.sheet-back:active,
.tabbar button:active,
.zoom-dock button:active,
.guest-button:active {
	background: var(--glass);
	opacity: 0.45;
	filter: none;
}

/* ---------- vidro líquido ---------- */

/* O vidro tinge-se com o mapa que tem por baixo e o texto acompanha-o:
   mapa escuro dá vidro escuro com letra clara, e ao contrário. */
.navbar .nav-action,
.nav-title,
.recent-map,
.editor-dock,
.zoom-dock,
.pill {
	border: none;
	background: var(--glass);
	background: color-mix(in srgb, var(--surface) 55%, #ffffff26);
	color: var(--text);
	box-shadow: inset 0 1px 0 var(--glass-shine),
		inset 0 -1px 0 var(--glass-edge),
		0 8px 24px var(--glass-shadow);
	backdrop-filter: var(--glass-filter);
	-webkit-backdrop-filter: var(--glass-filter);
}

/* O aro precisa de contexto próprio; o dock do zoom já é posicionado. */
.navbar .nav-action,
.nav-title,
.recent-map,
.editor-dock,
.pill {
	position: relative;
}

/* O aro que apanha a luz em cima à esquerda e reflecte em baixo à direita. */
.navbar .nav-action::after,
.nav-title::after,
.editor-dock::after,
.zoom-dock::after,
.pill::after {
	content: "";
	position: absolute;
	inset: 0;
	padding: 1px;
	border-radius: inherit;
	background: linear-gradient(145deg, var(--glass-shine), #ffffff00 30%,
		#ffffff00 70%, var(--glass-shine));
	mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	mask-composite: exclude;
	-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	-webkit-mask-composite: xor;
	pointer-events: none;
}

.editor-dock {
	border-radius: 32px;
}

.zoom-dock {
	border-radius: 24px;
}

#zoom-label {
	border-block: 0.5px solid var(--glass-edge);
}

/* O Fit vive com o zoom: é a terceira maneira de enquadrar o mapa. */
#btn-fit {
	border-top: 0.5px solid var(--glass-edge);
}

.zoom-dock button,
.tabbar button,
.navbar .nav-action {
	color: var(--text);
}

.zoom-dock button svg {
	width: 20px;
	height: 20px;
}

#zoom-label {
	color: var(--text);
	opacity: 0.6;
}

.pill {
	color: var(--text);
}

/* ---------- materiais ---------- */

.statusbar {
	background: none;
}

/* ---------- folhas ---------- */

.sheet {
	background: #00000066;
	animation: sheet-dim 0.4s ease;
}

@keyframes sheet-dim {
	from {
		background: #00000000;
	}
}

.sheet-panel {
	background: var(--sheet-bg);
	box-shadow: 0 -8px 40px #00000040;
	backdrop-filter: none;
	-webkit-backdrop-filter: none;
	animation-duration: 0.42s;
}

.grabber {
	width: 36px;
	height: 5px;
	margin-top: 5px;
	background: var(--ios-tertiary);
	cursor: grab;
}

/* Pega e cabeçalho são a área de arrasto: o browser não pode roubar o gesto. */
.grabber,
.sheet-panel>header {
	touch-action: none;
}

.sheet-panel>header:not(.sheet-nav) {
	position: relative;
	justify-content: center;
	min-height: 44px;
	padding: 6px 56px 8px;
}

.sheet-panel h2 {
	font-size: 17px;
	font-weight: 600;
	letter-spacing: -0.02em;
}

.sheet-panel>header:not(.sheet-nav)>.sheet-close {
	position: absolute;
	right: 14px;
}

/* O fecho tem 30 pontos à vista e 44 ao toque, como nos da Apple. */
.sheet-panel .sheet-close[data-close] {
	position: relative;
	width: 30px;
	height: 30px;
	min-width: 30px;
	min-height: 30px;
	padding: 0;
	border-radius: 50%;
	background: var(--fill-tertiary);
	color: var(--ios-secondary);
}

.sheet-panel>header:not(.sheet-nav)>.sheet-close[data-close] {
	position: absolute;
}

.sheet-panel .sheet-close[data-close]::after {
	content: "";
	position: absolute;
	inset: -7px;
}

.sheet-nav>.sheet-close:first-child {
	justify-self: start;
}

.sheet-back,
.sheet-nav .sheet-close,
#intro-skip {
	font-size: 17px;
}

/* ---------- listas agrupadas ---------- */

.sheet-body {
	gap: 0;
	padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.group h3 {
	padding: 26px 16px 7px;
	font-size: 13px;
	font-weight: 400;
	letter-spacing: 0.01em;
}

.group>* {
	position: relative;
}

.group>:not(h3, .note, .due-note) {
	background: var(--sheet-card);
}

.group>:nth-child(1 of :not(h3, .note, .due-note, [hidden])) {
	border-radius: var(--radius-card) var(--radius-card) 0 0;
}

.group>:nth-last-child(1 of :not(h3, .note, .due-note, [hidden])) {
	border-radius: 0 0 var(--radius-card) var(--radius-card);
}

.group>:nth-child(1 of :not(h3, .note, .due-note, [hidden])):nth-last-child(1 of
	:not(h3, .note, .due-note, [hidden])) {
	border-radius: var(--radius-card);
}

/* A linha de separação começa alinhada com o texto, não na margem do cartão. */
.group>:not(h3, .note, .due-note)+:not(h3, .note, .due-note)::before {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	left: 16px;
	height: 0.5px;
	background: var(--ios-separator);
}

.group>.choice-row+.choice-row::before {
	left: 56px;
}

.group>.note,
.group>.due-note {
	padding: 7px 16px 0;
	font-size: 13px;
}

.row {
	min-height: 44px;
	padding: 11px 16px;
	border-top: none;
	font-size: 17px;
}

.row-copy strong,
.choice-copy strong {
	font-size: 17px;
	font-weight: 400;
}

.row-copy small,
.choice-copy small {
	font-size: 13px;
	line-height: 1.4;
}

.row.action:active,
.choice-row:active,
.list button:active {
	background: var(--ios-panel-2);
}

.choice-row {
	grid-template-columns: 29px minmax(0, 1fr) 12px;
	min-height: 60px;
	padding: 9px 16px;
	border-top: none;
}

.choice-symbol {
	width: 29px;
	height: 29px;
	border-radius: 7px;
	font-size: 16px;
}

.choice-symbol svg {
	width: 18px;
	height: 18px;
}

.choice-chevron {
	color: var(--ios-tertiary);
	font-size: 17px;
	font-weight: 600;
}

/* ---------- mapas ---------- */

.map-view-switch {
	background: var(--fill-tertiary);
}

.map-view-switch button {
	font-size: 15px;
}

.map-view-switch button.on {
	background: var(--sheet-card);
	box-shadow: 0 1px 3px #00000014;
}

.map-card {
	gap: 10px;
	padding: 12px;
	border: none;
	background: var(--sheet-card);
	box-shadow: 0 1px 3px #00000014;
}

.map-card.current {
	/* Anel por dentro: o corpo do sheet faz scroll e cortava-o no topo. */
	box-shadow: inset 0 0 0 2px var(--ios-blue), 0 1px 3px #00000014;
}

.map-card h3 {
	font-size: 17px;
	font-weight: 600;
	letter-spacing: -0.02em;
}

.map-card .meta {
	font-size: 13px;
}

.map-preview {
	border-radius: 8px;
}

.map-actions button {
	border-radius: 10px;
	background: var(--fill-tertiary);
	font-size: 15px;
}

.zoom-dock {
	border: 0.5px solid var(--ios-separator);
	border-radius: 22px;
}

/* ---------- controlos ---------- */

.row select,
.sheet-body select {
	max-width: 60%;
	padding: 3px 18px 3px 6px;
	border: none;
	border-radius: 6px;
	appearance: none;
	background: transparent var(--chevron) no-repeat right 1px center / 10px 16px;
	color: var(--ios-secondary);
	font-size: 17px;
	text-align: right;
	text-align-last: right;
}

.people-add-form {
	background: transparent;
}

/* Botão cheio: o texto acompanha o fundo da app para ter contraste nos dois modos. */
.sheet-body form>button[type="submit"],
.people-add-form>button {
	border: none;
	border-radius: 10px;
	background: var(--ios-blue);
	color: var(--ios-bg);
	font-size: 17px;
	font-weight: 600;
}

.sheet-body .swatch,
.sheet-body .icon-option {
	min-height: 0;
}

.guest-button {
	min-height: 44px;
	border-radius: 12px;
	font-size: 15px;
}

.switch {
	transition: background 0.25s var(--ease-sheet);
}

.switch::after {
	transition: transform 0.25s var(--ease-sheet);
}

.statusbar {
	font-size: 12px;
	letter-spacing: 0;
}

/* A lupa e o menu de copiar do iOS denunciam logo que aquilo é uma página. */
.navbar,
.editor-dock,
.zoom-dock,
.statusbar,
.sheet-panel>header,
.group h3 {
	-webkit-touch-callout: none;
	user-select: none;
	-webkit-user-select: none;
}

/* Quem pede menos transparência no iOS fica com as barras opacas. */
@media (prefers-reduced-transparency: reduce) {

	.navbar .nav-action,
	.nav-title,
	.recent-map,
	.editor-dock,
	.zoom-dock,
	.pill {
		background: var(--surface);
		backdrop-filter: none;
		-webkit-backdrop-filter: none;
	}

	.navbar .nav-action::after,
	.nav-title::after,
	.editor-dock::after,
	.zoom-dock::after,
	.pill::after {
		display: none;
	}
}
