/*
 * Typingo: My Progress: summary, the 30 days, charts, letters, fingers and the practice calendar.
 */

/* ---------- My Progress ---------- */
.ty-progress {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 2.5rem;
}

/* One column that never grows past the screen; wide parts (the calendar) scroll inside themselves. */
.ty-progress__body {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 2.5rem;
}

.ty-progress__or {
	align-self: center;
	color: var(--ty-muted);
}

.ty-psection__title {
	margin-bottom: 0.35rem;
	font-size: 1.35rem;
}

.ty-psection__lead {
	max-width: 68ch;
	margin-bottom: 1.1rem;
	color: var(--ty-muted);
}

.ty-pnext {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem 2rem;
	padding: clamp(1.1rem, 3vw, 1.6rem);
	border-radius: var(--ty-radius);
	background: color-mix(in srgb, var(--ty-primary) 8%, var(--ty-surface));
}

.ty-pnext__text {
	flex: 1 1 320px;
}

.ty-pnext__eyebrow {
	margin: 0 0 0.2rem;
	color: var(--ty-muted);
	font-size: 0.9rem;
}

.ty-pnext__title {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 600;
}

.ty-pnext__bar {
	margin: 0.75rem 0 0;
}

.ty-pstats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
	gap: 1rem;
}

.ty-pstat {
	padding: 1.1rem 1.2rem;
	border: 1px solid var(--ty-line);
	border-radius: 16px;
	background: var(--ty-surface);
}

.ty-pstat p {
	margin: 0;
}

.ty-pstat__label {
	color: var(--ty-muted);
	font-size: 0.9rem;
}

.ty-pstat__value {
	font-size: 1.9rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	line-height: 1.3;
}

.ty-pstat__note {
	color: var(--ty-muted);
	font-size: 0.82rem;
}

.ty-pdays {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ty-pdays__day a,
.ty-pdays__day span {
	display: grid;
	place-items: center;
	aspect-ratio: 1;
	min-height: 44px;
	border: 1px solid var(--ty-line);
	border-radius: 12px;
	background: var(--ty-surface);
	color: var(--ty-ink);
	font-weight: 500;
	text-decoration: none;
}

.ty-pdays__day.is-done a {
	border-color: transparent;
	background: color-mix(in srgb, var(--ty-accent) 80%, #000);
	color: #fff;
}

.ty-pdays__day.is-current a {
	border: 2px solid var(--ty-primary);
	color: var(--ty-link);
	font-weight: 700;
}

.ty-pdays__day.is-locked span {
	color: var(--ty-muted);
	background: var(--ty-surface-2);
}

.ty-pdays__day a:hover {
	border-color: var(--ty-primary);
}

.ty-pcharts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
	gap: 1rem;
}

.ty-pchart {
	margin: 0;
	padding: 1rem 1.1rem 0.6rem;
	border: 1px solid var(--ty-line);
	border-radius: 16px;
	background: var(--ty-surface);
}

.ty-pchart__title {
	margin-bottom: 0.3rem;
	color: var(--ty-ink);
	font-size: 0.95rem;
	font-weight: 600;
}

.ty-ptable {
	margin-top: 1rem;
	overflow-x: auto;
}

.ty-ptable summary {
	font-weight: 600;
	cursor: pointer;
}

.ty-ptable table {
	margin-top: 0.75rem;
	font-size: 0.95rem;
	font-variant-numeric: tabular-nums;
}

.ty-ptable th {
	color: var(--ty-muted);
	font-weight: 500;
}

.ty-pletters {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 0.45rem;
	max-width: 640px;
}

.ty-pletters__row {
	display: flex;
	gap: clamp(0.2rem, 1.2vw, 0.45rem);
}

.ty-pletters__row:nth-child(2) {
	padding-left: 3%;
}

.ty-pletters__row:nth-child(3) {
	padding-left: 8%;
}

.ty-pletter {
	display: grid;
	flex: 0 1 56px;
	/* Square tiles may shrink on small phones instead of pushing the page wider. */
	min-width: 0;
	place-items: center;
	aspect-ratio: 1;
	border: 1px solid var(--ty-line);
	border-bottom: 4px solid var(--ty-f);
	border-radius: 12px;
	background: var(--ty-surface);
	color: var(--ty-muted);
	font-family: var(--ty-font-mono);
	font-size: clamp(0.95rem, 2.5vw, 1.25rem);
	font-weight: 500;
}

.ty-pletter.is-learning {
	background: color-mix(in srgb, var(--ty-f) 22%, var(--ty-surface));
	color: var(--ty-ink);
}

.ty-pletter.is-mastered {
	border-color: color-mix(in srgb, var(--ty-f) 70%, #000);
	background: var(--ty-f);
	color: #1a1d2e;
	font-weight: 700;
}

.ty-plegend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.5rem;
	margin: 1rem 0 0;
	padding: 0;
	list-style: none;
	color: var(--ty-muted);
	font-size: 0.9rem;
}

.ty-plegend li {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
}

.ty-plegend__swatch {
	width: 1rem;
	height: 1rem;
	border: 1px solid var(--ty-line);
	border-radius: 4px;
	background: var(--ty-surface);
}

.ty-plegend .is-learning .ty-plegend__swatch {
	background: color-mix(in srgb, var(--ty-f-ri) 22%, var(--ty-surface));
}

.ty-plegend .is-mastered .ty-plegend__swatch {
	background: var(--ty-f-ri);
}

.ty-pfingers {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
	gap: 0.75rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ty-pfinger {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 0.35rem 0.75rem;
	padding: 0.9rem 1rem;
	border: 1px solid var(--ty-line);
	border-left: 5px solid var(--ty-f);
	border-radius: 14px;
	background: var(--ty-surface);
}

.ty-pfinger__who {
	font-weight: 600;
}

.ty-pfinger__keys {
	color: var(--ty-muted);
	font-family: var(--ty-font-mono);
	font-size: 0.85rem;
	text-align: right;
}

.ty-pfinger__meter {
	grid-column: 1 / -1;
	height: 8px;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--ty-f) calc(var(--ty-progress, 0) * 100%), var(--ty-surface-2) 0);
}

.ty-pfinger__value {
	grid-column: 1 / -1;
	color: var(--ty-muted);
	font-size: 0.85rem;
}

.ty-pdata__import {
	position: relative;
}

.ty-pdata__import:focus-within {
	outline: 3px solid var(--ty-focus);
	outline-offset: 2px;
}

.ty-pdata__confirm {
	margin-top: 1rem;
}

.ty-pdata__confirm[hidden],
.ty-pmessage[hidden] {
	display: none;
}

.ty-pdata__danger {
	border-color: var(--ty-bad);
	background: var(--ty-bad);
	box-shadow: none;
}

.ty-pdata__danger:hover {
	box-shadow: none;
}

.ty-pmessage {
	margin-top: 1rem;
}

.ty-psync__row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 1rem;
	margin-top: 1rem;
}

.ty-psync {
	margin: 0;
	color: var(--ty-muted);
}

.ty-psync[data-status="error"],
.ty-psync[data-status="offline"] {
	color: var(--ty-bad);
}

/* The progress page is a set of cards itself, so its app container is not boxed. */
.typingo-app[data-typingo-app="progress"] {
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
}

/* ---------- Practice calendar ---------- */
.ty-cal {
	position: relative;
	display: grid;
	gap: 0.6rem;
	padding: 1rem 1.1rem;
	border: 1px solid var(--ty-line);
	border-radius: 16px;
	background: var(--ty-surface);
}

.ty-cal__stats {
	margin: 0;
	color: var(--ty-muted);
	font-size: 0.92rem;
}

.ty-cal__scroll {
	overflow-x: auto;
	border-radius: 8px;
	scrollbar-width: thin;
}

.ty-cal__scroll:focus-visible {
	outline: 3px solid var(--ty-focus);
	outline-offset: 2px;
}

.ty-cal__svg {
	display: block;
	max-width: none;
	height: auto;
}

.ty-cal__label {
	fill: var(--ty-muted);
	font-family: var(--ty-font-sans);
	font-size: 10px;
}

.ty-cal__day,
.ty-cal__swatch {
	fill: var(--ty-surface-2);
	background: var(--ty-surface-2);
}

.ty-cal__day.is-l1,
.ty-cal__swatch.is-l1 {
	fill: color-mix(in srgb, var(--ty-accent) 30%, var(--ty-surface));
	background: color-mix(in srgb, var(--ty-accent) 30%, var(--ty-surface));
}

.ty-cal__day.is-l2,
.ty-cal__swatch.is-l2 {
	fill: color-mix(in srgb, var(--ty-accent) 55%, var(--ty-surface));
	background: color-mix(in srgb, var(--ty-accent) 55%, var(--ty-surface));
}

.ty-cal__day.is-l3,
.ty-cal__swatch.is-l3 {
	fill: color-mix(in srgb, var(--ty-accent) 80%, var(--ty-surface));
	background: color-mix(in srgb, var(--ty-accent) 80%, var(--ty-surface));
}

.ty-cal__day.is-l4,
.ty-cal__swatch.is-l4 {
	fill: color-mix(in srgb, var(--ty-accent) 85%, #000);
	background: color-mix(in srgb, var(--ty-accent) 85%, #000);
}

.ty-cal__day.is-active {
	stroke: var(--ty-ink);
	stroke-width: 2;
}

.ty-cal__legend {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 4px;
	color: var(--ty-muted);
	font-size: 0.8rem;
}

.ty-cal__swatch {
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 3px;
}

.ty-cal__legend .ty-cal__swatch:first-of-type {
	margin-left: 4px;
}

.ty-cal__legend .ty-cal__swatch:last-of-type {
	margin-right: 4px;
}
