/* -------------------------------------------------------------------------
   Styles for the page in index.html and the output ui.js builds into it.
   The --cat-* custom properties are the phoneme-category colour key: ui.js
   sets a cat-<category> class per phoneme and the rules below resolve --cat
   from it.
   ---------------------------------------------------------------------- */

:root
{
	--bg:        #0b0d10;
	--panel:     #111419;
	--rule:      #1e232b;
	--fg:        #e8eaed;
	--dim:       #7d8794;
	--prompt:    #8ab4f8;

	--cat-vowel:  #7cb6ff;
	--cat-stop:   #f0c05a;
	--cat-fric:   #6fd8a4;
	--cat-affr:   #ffa07a;
	--cat-nasal:  #c39bff;
	--cat-approx: #4fd1c5;
	--cat-punc:   #5c6674;

	--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
		"DejaVu Sans Mono", monospace;
}

*
{
	box-sizing: border-box;
}

html, body
{
	height: 100%;
	margin: 0;
}

body
{
	background: var(--bg);
	color: var(--fg);
	font-family: var(--mono);
	font-size: 15px;
	line-height: 1.55;
	display: flex;
	flex-direction: column;
	-webkit-font-smoothing: antialiased;
}

header
{
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 16px;
	border-bottom: 1px solid var(--rule);
	background: var(--panel);
	flex: 0 0 auto;
}

header h1
{
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	margin: 0;
	color: var(--fg);
}

header .sub
{
	font-size: 12px;
	color: var(--dim);
	margin-right: auto;
}

header button
{
	font: inherit;
	font-size: 12px;
	color: var(--dim);
	background: transparent;
	border: 1px solid var(--rule);
	border-radius: 5px;
	padding: 3px 10px;
	cursor: pointer;
}

header button:hover
{
	color: var(--fg);
	border-color: var(--dim);
}

#scroller
{
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px;
}

#output
{
	max-width: 100ch;
	white-space: pre-wrap;
	word-break: break-word;
}

.line
{
	min-height: 1.55em;
}

.line.dim
{
	color: var(--dim);
}

.line.error
{
	color: #ff8a80;
}

.line.echo
{
	color: var(--fg);
	margin-top: 6px;
}

.line .prompt
{
	color: var(--prompt);
}

/* One wrapped row of words; each word sits above its own phonemes. */
.line.pronounced
{
	margin: 4px 0 8px;
	display: flex;
	flex-wrap: wrap;
	gap: 10px 26px;
}

.entry
{
	display: flex;
	flex-direction: column;
}

.entry .word
{
	font-size: 0.82em;
	color: var(--dim);
	cursor: help;
}

/* Blue marks a word taken from the common-word lookup table rather than
   derived by the letter rules. See the /key legend. */
.entry .word.lookup
{
	color: var(--prompt);
}

.entry .word:hover
{
	text-decoration: underline dotted;
	text-underline-offset: 2px;
}

.entry .phonemes
{
	display: flex;
	flex-wrap: wrap;
	gap: 0 6px;
}

.chip
{
	white-space: nowrap;
	cursor: help;
	color: var(--cat);
}

.chip:hover
{
	text-decoration: underline dotted;
	text-underline-offset: 2px;
}

.entry .silent
{
	color: var(--cat-punc);
}

#tooltip
{
	position: fixed;
	z-index: 20;
	max-width: min(300px, calc(100vw - 16px));
	padding: 7px 10px;
	border-radius: 6px;
	background: #1b212a;
	border: 1px solid #2c3542;
	color: var(--fg);
	font-size: 12.5px;
	line-height: 1.45;
	white-space: pre-line;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
	pointer-events: none;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.12s ease;
}

#tooltip.visible
{
	opacity: 1;
	visibility: visible;
}

.cat-vowel
{
	--cat: var(--cat-vowel);
}

.cat-stop
{
	--cat: var(--cat-stop);
}

.cat-fric
{
	--cat: var(--cat-fric);
}

.cat-affr
{
	--cat: var(--cat-affr);
}

.cat-nasal
{
	--cat: var(--cat-nasal);
}

.cat-approx
{
	--cat: var(--cat-approx);
}

.cat-punc
{
	--cat: var(--cat-punc);
}

.phoneme-row .ph, .legend-item .ph
{
	color: var(--cat);
}

.swatch
{
	display: inline-block;
	width: 9px;
	height: 9px;
	border-radius: 2px;
	margin-right: 6px;
	background: var(--cat);
}

.line.legend
{
	display: flex;
	flex-wrap: wrap;
	gap: 4px 18px;
	color: var(--dim);
	margin: 4px 0 8px;
}

.legend-item
{
	display: inline-flex;
	align-items: center;
}

.legend-item span:last-child
{
	color: var(--dim);
}

.line.phoneme-table
{
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
	gap: 0 24px;
	margin: 4px 0 8px;
}

.phoneme-row
{
	display: flex;
	gap: 10px;
}

.phoneme-row .ph
{
	min-width: 2.5em;
}

.phoneme-row .ipa
{
	min-width: 2.5em;
	color: var(--fg);
}

.phoneme-row .desc
{
	color: var(--dim);
}

form
{
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	border-top: 1px solid var(--rule);
	background: var(--panel);
}

form .prompt
{
	color: var(--prompt);
}

#input
{
	flex: 1 1 auto;
	font: inherit;
	color: var(--fg);
	background: transparent;
	border: 0;
	outline: none;
	caret-color: var(--prompt);
	padding: 0;
}

#input::placeholder
{
	color: var(--cat-punc);
}

@media (max-width: 600px)
{
	body
	{
		font-size: 14px;
	}

	header .sub
	{
		display: none;
	}
}
