/* Routine */

.routine__info {
	padding: 14px 16px;
	border: 1px solid var(--line);
	border-radius: 14px;
	background: var(--surface);
	font-size: 13.5px;
	font-weight: 300;
	line-height: 1.5;
	color: var(--ink-soft);
}

.routine__intro {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding-top: 4px;
	text-align: center;
}

.routine__greeting {
	font-family: var(--serif);
	font-size: 19px;
	color: var(--accent-ink);
}

.routine__sub {
	font-size: 13.5px;
	font-weight: 300;
	color: var(--muted);
}

/* ---- Progress ---- */

.progress {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding-top: 6px;
}

.progress__bars {
	display: grid;
	grid-auto-columns: minmax(0, 1fr);
	grid-auto-flow: column;
	gap: 6px;
}

.progress__bars span {
	height: 4px;
	border-radius: 999px;
	background: var(--line-strong);
}

.progress__bars span.is-done {
	background: var(--accent);
}

/* ---- Question ---- */

.question {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.question__label {
	font-family: var(--serif);
	font-size: 20px;
	line-height: 1.4;
}

/* the line under the question ("Today I'll help myself by:"): lighter than the question */
.question__sub {
	margin-top: -4px;
	font-size: 15.5px;
	font-weight: 300;
	line-height: 1.45;
	color: var(--ink-soft);
}

.question__fields {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* Writing field with lines: line height 28px, line on the last pixel of each line */
.lined {
	position: relative;
}

.lined__input {
	display: block;
	width: 100%;
	padding: 12px 34px 12px 16px;
	border: 1px solid var(--line-strong);
	border-radius: 14px;
	resize: none;
	font-size: 15px;
	line-height: 28px;
	color: var(--ink);
	background-color: var(--surface);
	background-image: linear-gradient(to bottom, transparent 27px, var(--rule) 27px, var(--rule) 28px);
	background-size: 100% 28px;
	background-repeat: repeat-y;
	background-origin: content-box;
	background-clip: content-box;
}

.lined__input::placeholder {
	color: var(--placeholder);
}

.lined__input:focus {
	outline: 2px solid var(--accent);
	outline-offset: 1px;
}

.lined__pen {
	position: absolute;
	right: 14px;
	bottom: 14px;
	color: var(--pen);
	pointer-events: none;
}

/* ---- How do you feel? One rating per step, 0 to 10 ---- */

.rating {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.rating__head {
	display: flex;
	flex-direction: column;
	gap: 10px;
	height: 144px;
	overflow: hidden;
}

.rating__eyebrow {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.6px;
	text-transform: uppercase;
	color: var(--accent-ink);
}

.rating__question {
	font-family: var(--serif);
	font-size: 20px;
	font-weight: 400;
	line-height: 1.4;
}

.rating__scale {
	font-size: 13.5px;
	font-weight: 300;
	line-height: 1.5;
	color: var(--muted);
}

/* Large number between minus and plus */
.dial {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 28px;
	padding: 22px 0 6px;
}

.dial__step {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	padding: 0;
	border: 1px solid var(--accent-ink);
	border-radius: 50%;
	background: transparent;
	color: var(--accent-ink);
	cursor: pointer;
}

.dial__step:disabled {
	opacity: 0.35;
	cursor: default;
}

.dial__value {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 104px;
	height: 104px;
	border: 1px solid var(--accent);
	border-radius: 50%;
	font-family: var(--serif);
	font-size: 52px;
	line-height: 1;
	color: var(--accent);
}

.dial__value.is-bump {
	animation: bump 0.25s ease-out;
}

@keyframes bump {
	0% { transform: scale(1); }
	45% { transform: scale(1.08); }
	100% { transform: scale(1); }
}

/* Score line with a face at the current score and the previous feeling marked above it */
.scale {
	--face: 34px;
	--ratio: 0.5;
	--previous-ratio: 0.5;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding-top: 34px;
	position: relative;
}

.scale__line {
	position: relative;
	height: var(--face);
}

.scale__track {
	position: absolute;
	top: 50%;
	left: 0;
	right: 0;
	height: 6px;
	margin-top: -3px;
	border-radius: 999px;
	background: linear-gradient(to right, var(--accent) calc(var(--face) / 2 + (100% - var(--face)) * var(--ratio)), var(--line-strong) 0);
	transition: background 0.2s ease-out;
}

.scale__face {
	position: absolute;
	top: 0;
	left: calc((100% - var(--face)) * var(--ratio));
	display: flex;
	color: var(--accent-ink);
	transition: left 0.2s ease-out;
}

/* invisible native slider on top: dragging, keyboard and screen readers for free */
.scale__input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: grab;
	touch-action: none;
	-webkit-appearance: none;
	appearance: none;
}

.scale__input:active {
	cursor: grabbing;
}

.scale__input::-webkit-slider-thumb {
	width: var(--face);
	height: var(--face);
	-webkit-appearance: none;
	appearance: none;
}

.scale__input::-moz-range-thumb {
	width: var(--face);
	height: var(--face);
	border: 0;
}

.scale__line:has(.scale__input:focus-visible) .scale__face svg {
	border-radius: 50%;
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* while dragging the face follows the finger directly */
.scale__line:has(.scale__input:active) .scale__face {
	transition: none;
}

/* the previous feeling: a faded face on the line, below the current one */
.scale__ghost {
	position: absolute;
	top: 0;
	left: calc((100% - var(--face)) * var(--previous-ratio));
	display: flex;
	color: var(--muted);
	opacity: 0.55;
}

/* the label sits above the faded face */
.scale__previous {
	position: absolute;
	top: 0;
	left: calc(var(--face) / 2 + (100% - var(--face)) * var(--previous-ratio));
	width: 0;
	height: 34px;
	pointer-events: none;
}

/* centred above the marker; near the ends it stays inside the line */
.scale__previous-label {
	position: absolute;
	top: 4px;
	left: 0;
	transform: translateX(-50%);
	padding: 3px 8px;
	border-radius: 999px;
	background: var(--sand);
	font-size: 11.5px;
	white-space: nowrap;
	color: var(--accent-ink);
}

.scale__previous[data-align="start"] .scale__previous-label {
	transform: translateX(calc(var(--face) / -2));
}

.scale__previous[data-align="end"] .scale__previous-label {
	transform: translateX(calc(-100% + var(--face) / 2));
}

.scale__ends {
	display: flex;
	justify-content: space-between;
	font-size: 12px;
	color: var(--muted);
}

/* ---- Feedback after saving ---- */

.done {
	display: flex;
	flex-direction: column;
	gap: 16px;
	flex: 1 1 auto;
}

.done__hero {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	padding: 24px;
	border-radius: 20px;
	background: var(--sand);
	text-align: center;
}

.done__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: var(--accent);
	color: var(--on-accent);
	animation: pop 0.45s ease-out;
}

@keyframes pop {
	0% { transform: scale(0.4); opacity: 0; }
	70% { transform: scale(1.08); opacity: 1; }
	100% { transform: scale(1); }
}

.done__title {
	font-family: var(--serif);
	font-size: 22px;
	font-weight: 400;
	line-height: 1.3;
}

.done__text {
	font-size: 14px;
	font-weight: 300;
	line-height: 1.55;
	color: var(--ink-soft);
}

.done__card {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 18px 18px 8px;
	border: 1px solid var(--line);
	border-radius: 16px;
	background: var(--surface);
}

.done__mood {
	font-family: var(--serif);
	font-size: 15.5px;
	line-height: 1.45;
}

.done__sync {
	font-size: 12.5px;
	font-weight: 300;
	line-height: 1.5;
	color: var(--muted);
}

.done__ratings {
	margin: 0;
	padding: 0;
	list-style: none;
}

.result {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	border-top: 1px solid var(--line);
	font-size: 13.5px;
}

.result__label {
	flex: 1 1 auto;
}

.result__value {
	font-family: var(--serif);
	font-size: 18px;
	color: var(--accent-ink);
}

.result__change {
	flex: none;
	min-width: 112px;
	font-size: 12px;
	text-align: right;
	color: var(--muted);
}

.result__change.is-up {
	color: var(--accent-ink);
	font-weight: 500;
}

.done__actions {
	display: flex;
	flex-direction: column;
	gap: 14px;
	margin-top: auto;
}

.done__actions .primary-button {
	flex: none;
	text-decoration: none;
}

.done__actions .primary-button:hover {
	color: var(--on-accent);
}

.routine__footer {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: auto;
	padding-top: 8px;
}

.routine__flow {
	display: flex;
	flex-direction: column;
	gap: 16px;
	flex: 1 1 auto;
}

/* Asking about reminders (apps only, once) */

.ask {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 20px;
	border: 1px solid var(--line);
	border-radius: 24px;
	background: var(--surface);
}

.ask__title {
	font-family: var(--serif);
	font-size: 18px;
	font-weight: 400;
}

.ask__text,
.ask__note {
	font-size: 14px;
	font-weight: 300;
	line-height: 1.55;
	color: var(--ink-soft);
}

.ask__time {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.ask__label {
	font-size: 15px;
}

.ask__actions {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

/* Outside its hours: when the routine can be filled in */
.routine__closed {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 22px 24px 10px;
	border-radius: 20px;
	background: var(--sand);
	text-align: center;
}

.routine__closed-text {
	font-size: 14.5px;
	font-weight: 300;
	line-height: 1.55;
	color: var(--ink-soft);
}
