/* Inkwell Word Tracker. Everything is scoped under .iwt so the theme is untouched.
   Type comes from the site's theme; the one distinctive element is the ink bar. */

.iwt {
	--iwt-ink: #1f2d52;          /* iron-gall blue-black */
	--iwt-ink-wash: #e7ebf3;     /* the empty track, like ink thinned with water */
	--iwt-rule: #d6dbe5;
	--iwt-muted: #5a6378;
	--iwt-paper: #ffffff;
	--iwt-error: #9b2c2c;
	--iwt-gap: 1.25rem;
	max-width: 46rem;
	margin: 0 auto;
	font-variant-numeric: tabular-nums;
	line-height: 1.5;
}

.iwt *, .iwt *::before, .iwt *::after { box-sizing: border-box; }

.iwt .iwt-panel {
	background: var(--iwt-paper);
	border: 1px solid var(--iwt-rule);
	border-radius: 6px;
	padding: 1.5rem;
	margin: 0 0 var(--iwt-gap);
}
.iwt .iwt-progress { border-color: var(--iwt-ink); }

.iwt .iwt-h { margin: 0 0 .25rem; font-size: 1.25rem; line-height: 1.3; color: var(--iwt-ink); }
.iwt .iwt-sub { margin: 1.5rem 0 .5rem; font-size: 1rem; color: var(--iwt-ink); }
.iwt .iwt-muted { color: var(--iwt-muted); margin: 0 0 .75rem; }
.iwt .iwt-small { font-size: .875rem; margin: 0; }
.iwt .iwt-num { font-variant-numeric: tabular-nums; }

/* Count */
.iwt .iwt-count { margin: 1rem 0 .5rem; color: var(--iwt-ink); }
.iwt .iwt-big { font-size: clamp(2.25rem, 6vw, 3.25rem); font-weight: 700; line-height: 1; letter-spacing: -.01em; }
.iwt .iwt-of { font-size: 1.125rem; color: var(--iwt-muted); }
.iwt .iwt-note { margin: .75rem 0 0; font-weight: 600; color: var(--iwt-ink); }

/* The ink bar: a filled stroke ending in a round nib, with a pace mark. */
.iwt .iwt-ink {
	position: relative;
	height: 14px;
	background: var(--iwt-ink-wash);
	border-radius: 7px;
	margin: .25rem 0;
}
.iwt .iwt-ink-fill {
	position: absolute;
	inset: 0 auto 0 0;
	width: 0;
	background: var(--iwt-ink);
	border-radius: 7px;
	transition: width 900ms cubic-bezier(.2, .7, .2, 1);
}
.iwt .iwt-nib {
	position: absolute;
	right: -4px;
	top: 50%;
	width: 22px;
	height: 22px;
	margin-top: -11px;
	border-radius: 50%;
	background: var(--iwt-ink);
	border: 4px solid var(--iwt-paper);
	box-shadow: 0 0 0 1px var(--iwt-ink);
}
.iwt .iwt-pace {
	position: absolute;
	top: -6px;
	bottom: -6px;
	width: 2px;
	margin-left: -1px;
	background: var(--iwt-muted);
	border-radius: 1px;
}
.iwt-board .iwt-ink { height: 8px; }
.iwt-board .iwt-nib { width: 14px; height: 14px; margin-top: -7px; border-width: 3px; right: -3px; }

/* Stats */
.iwt .iwt-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
	gap: 1rem;
	margin: 1.25rem 0 0;
	padding: 1rem 0 0;
	border-top: 1px solid var(--iwt-rule);
}
.iwt .iwt-stat dt { font-size: .875rem; color: var(--iwt-muted); margin: 0; }
.iwt .iwt-stat dd { margin: 0; font-size: 1.375rem; font-weight: 700; color: var(--iwt-ink); }

/* Forms */
.iwt form { margin: 0; }
.iwt .iwt-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .75rem; }
.iwt .iwt-field { margin: 0 0 .75rem; }
.iwt .iwt-field label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .25rem; }
.iwt input[type="text"], .iwt input[type="number"], .iwt input[type="date"], .iwt select {
	width: 100%;
	min-height: 2.5rem;
	padding: .4rem .6rem;
	border: 1px solid var(--iwt-rule);
	border-radius: 4px;
	background: var(--iwt-paper);
	color: inherit;
	font: inherit;
}
.iwt input[type="number"] { font-size: 1.125rem; }
.iwt .iwt-check { display: flex; gap: .5rem; align-items: baseline; margin: 0 0 .5rem; font-size: .9375rem; cursor: pointer; }
.iwt .iwt-fieldset { border: 0; padding: 0; margin: 0 0 .75rem; }
.iwt .iwt-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-top: .5rem; }

.iwt .iwt-btn {
	display: inline-block;
	padding: .6rem 1.1rem;
	border: 1px solid var(--iwt-ink);
	border-radius: 4px;
	background: var(--iwt-ink);
	color: #fff;
	font: inherit;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}
.iwt .iwt-btn:hover { background: #2c3e6e; border-color: #2c3e6e; color: #fff; }
.iwt .iwt-btn-quiet { background: transparent; color: var(--iwt-ink); }
.iwt .iwt-btn-quiet:hover { background: var(--iwt-ink-wash); color: var(--iwt-ink); }
.iwt .iwt-btn:disabled { opacity: .6; cursor: wait; }

.iwt :focus-visible { outline: 3px solid #4a6bd0; outline-offset: 2px; }

.iwt .iwt-status { margin: 0; font-size: .9375rem; color: var(--iwt-ink); }
.iwt .iwt-status.is-error, .iwt .iwt-error { color: var(--iwt-error); }

.iwt .iwt-edit { margin-top: 1.25rem; }
.iwt .iwt-edit summary { cursor: pointer; color: var(--iwt-ink); font-weight: 600; }
.iwt .iwt-edit[open] summary { margin-bottom: 1rem; }

/* Recent days */
.iwt .iwt-recent { list-style: none; margin: 0; padding: 0; }
.iwt .iwt-recent li {
	display: flex;
	justify-content: space-between;
	padding: .4rem 0;
	border-bottom: 1px solid var(--iwt-rule);
}
.iwt .iwt-recent li:last-child { border-bottom: 0; }

/* Board */
.iwt .iwt-board-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: .75rem; margin-bottom: .5rem; }
.iwt .iwt-board-head .iwt-field { min-width: 11rem; margin: 0; }
.iwt .iwt-notice { background: var(--iwt-ink-wash); padding: .6rem .8rem; border-radius: 4px; font-size: .9375rem; margin: .5rem 0 1rem; }
.iwt .iwt-board-ol { list-style: none; margin: 0; padding: 0; }
.iwt .iwt-board-row {
	display: grid;
	grid-template-columns: 40px 1fr auto;
	gap: .9rem;
	align-items: center;
	padding: .9rem 0;
	border-bottom: 1px solid var(--iwt-rule);
}
.iwt .iwt-board-row:last-child { border-bottom: 0; }
.iwt .iwt-board-row.is-me { background: linear-gradient(90deg, var(--iwt-ink-wash), transparent); margin: 0 -.75rem; padding-left: .75rem; padding-right: .75rem; border-radius: 4px; }
.iwt .iwt-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--iwt-ink-wash); }
.iwt .iwt-board-main { min-width: 0; }
.iwt .iwt-board-main .iwt-ink { margin-top: .5rem; }
.iwt .iwt-board-name { margin: 0; font-weight: 600; }
.iwt .iwt-board-name a { color: var(--iwt-ink); }
.iwt .iwt-you { font-weight: 400; color: var(--iwt-muted); }
.iwt .iwt-board-pct { text-align: right; display: flex; flex-direction: column; }
.iwt .iwt-board-pct .iwt-num { font-size: 1.25rem; font-weight: 700; color: var(--iwt-ink); }

/* Public total */
.iwt .iwt-total-box { text-align: center; padding: 1rem 0; }
.iwt .iwt-total-figure { margin: 0; color: var(--iwt-ink); }
.iwt .iwt-total-num { display: block; font-size: clamp(2.75rem, 9vw, 4.5rem); font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.iwt .iwt-total-unit { display: block; font-size: 1.125rem; margin-top: .35rem; }
.iwt .iwt-total-line { max-width: 32rem; margin: .75rem auto 1.25rem; color: var(--iwt-muted); }

.iwt .iwt-visually-hidden {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

@media (max-width: 480px) {
	.iwt .iwt-panel { padding: 1.1rem; }
	.iwt .iwt-board-row { grid-template-columns: 32px 1fr auto; gap: .6rem; }
	.iwt .iwt-avatar { width: 32px; height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
	.iwt .iwt-ink-fill { transition: none; }
}
