/* Rooms surface styles. Product palette, type, mark, ink, and radii come from
   ui/tokens.css, linked first in page.html. This file owns rooms-only tokens
   and pulls in the sheets split along the page's existing sections. */
@import url("controls.css");
@import url("buttons.css");
@import url("marks.css");
@import url("mark.css");
@import url("toggles.css");
@import url("rails.css");
@import url("rail-rows.css");
@import url("rail-captions.css");
@import url("filter.css");
@import url("workarea.css");
@import url("topbar.css");
@import url("session-effect.css");
@import url("members.css");
@import url("composer.css");
@import url("join.css");
@import url("plane.css");
@import url("forms.css");
@import url("entries.css");
@import url("settings.css");
@import url("help.css");
@import url("copy-field.css");
@import url("session-setup.css");
@import url("operations.css");
@import url("operations-irc.css");
@import url("bubbles.css");
@import url("markdown.css");
@import url("link-preview.css");
@import url("irc.css");
@import url("stream.css");
@import url("boot.css");
@import url("overlays.css");
@import url("viewer.css");
@import url("toasts.css");
@import url("kitchen.css");

/* Focusing a control must never scale the application viewport. Under 16px,
   iOS zooms a focused text control and can leave the reader stranded in a
   scaled app whose rails and composer no longer fit. This is a page invariant,
   not a field style: it comes after every component sheet and is important so
   a dense surface cannot silently opt back into viewport zoom.

   The floor follows touch capability rather than width. A phone in landscape
   can be wide, and a tablet with a trackpad still has glass a reader can touch.
   `max()` preserves type already larger than the platform's threshold. Selects
   are included because their focus behavior is engine-dependent. Controls that
   do not accept text have no rendered text for this declaration to resize. */
@media (any-pointer: coarse) {
	input:is([type="text"], [type="search"], [type="url"], [type="email"], [type="password"], [type="tel"], [type="number"], :not([type])),
	textarea,
	select,
	[contenteditable]:not([contenteditable="false"]) {
		/* A browser behavior threshold, not chrome type or a new ramp step. */
		font-size: max(16px, 1em) !important;
	}
}

/* Rooms wears glowcap's own colours (cream paper, cocoa ink, an amber accent,
   a teal flourish) so it looks like part of the project rather than like any
   chat app it borrows ideas from. Those come from ui/tokens.css, linked ahead of
   this file in page.html. What follows is only what rooms means by them.

   One face, with one exception a reader never has to notice. Everything is
   the sans. The mono appears only where a thing is typed or pasted: code, a
   locator or capability in a copy field or the join card, and a command name
   in the list that completes one. Titles, room names, labels, stamps, and
   counts stay in the sans, because a page that changes face at every kind of
   thing asks a reader to learn a code before reading a word. The logotype is
   its own drawing in ui/mark.css and takes the one other face.

   The mono sets a larger eye than the sans at the same nominal size, so a
   rule that takes it steps one ramp step down from the sans it stands beside.
   The inline `code` chip below makes the same correction relatively, because
   it follows whatever prose surrounds it. */
:root {
	--danger: #b23b2e;
	--ok: var(--teal);
	/* Its own colour, not the accent's. A token defined as another token cannot
	   move when the two meanings part, and these have: amber says "this room is
	   yours" three rows above the dot that was using it to say "something is
	   wrong". A warning that wears the page's most ordinary colour does not read
	   as a warning, it reads as more accent. */
	--warn: #9a6b00;
	--hover: color-mix(in srgb, var(--ink) 6%, transparent);
	/* Your own messages, the Send button, and the pill that marks a mention of
	   you all sit on the product's filled amber, so they share one set of
	   tokens. The pairing itself lives in ui/tokens.css. These names are what
	   rooms means by it. */
	--mine-from: var(--accent-fill);
	--mine-to: var(--accent-fill-deep);
	/* Your own lines. Not the filled amber above: that is a commitment, the
	   thing you are about to do, and a line you already sent is history. Filled,
	   your own words were the loudest thing in the log, and they are the words
	   you least need to read. So a line of yours is the paper warmed a little
	   toward the accent, in the page's own ink, and the one filled amber thing
	   left in the column is Send. The tint is deeper in syrup than on cream
	   because dark paper takes more colour to show the same warmth, and in
	   syrup the bloom from --glow-color sits around it, so your lines read as
	   lit rather than as painted. */
	--said-from: color-mix(in srgb, var(--accent) 12%, var(--paper-raised));
	--said-to: color-mix(in srgb, var(--accent) 22%, var(--paper-raised));
	--said-edge: color-mix(in srgb, var(--accent) 34%, var(--rule));
	--said-ink: var(--ink);
	/* A card resting on its column, as against --shadow below, which is a menu
	   floating over the page. The composer is the one card in the conversation
	   and it rests. It does not float. */
	--lift: 0 6px 20px var(--shadow-color);
	/* An interactive wash inside our own message bubble. The bubble reverses
	   both fill and ink between themes, so a page-surface hover cannot serve it:
	   dark paper under dark on-accent ink would be unreadable. Darken
	   the light theme's deep bubble for cream ink. Lighten the dark theme's
	   bright bubble for cocoa ink. */
	--mine-action-hover: rgba(0, 0, 0, 0.14);
	/* light-dark() returns a colour, so it goes around the colour and not around
	   the whole shadow. Wrapping the whole value parses as a colour function in
	   the wrong place, the declaration is thrown away, and every box-shadow that
	   named these tokens quietly resolved to none. Both spellings look the same
	   in a stylesheet and only one of them draws anything. */
	--shadow-sm-color: color-mix(in srgb, var(--ink) 10%, transparent);
	--shadow-color: color-mix(in srgb, var(--ink) 16%, transparent);
	--shadow-sm: 0 1px 2px var(--shadow-sm-color);
	--shadow: 0 14px 40px var(--shadow-color);
	/* What a field sits on, inside any card: one answer for the join form, the
	   Settings and take forms, and every choice row, so the two themes each
	   say "this is where you act" with the mechanism they own. Dark recesses a
	   field to the ground tone the way it always has. Light lifts it white
	   above the near-white card, and the lift, not a darker ground, is what
	   makes it pop, carried by the hairline and a breath of shadow. */
	--field-fill: #fff;
	--field-lift: 0 1px 2px var(--shadow-sm-color);
	/* The edge of a place to type. A hairline separates two surfaces a reader
	   can already tell apart. A field's fill is nearly its card's, so its edge
	   is the only thing that says where to aim, and it is mixed to stand three
	   to one against both in either theme. */
	--field-rule: color-mix(in srgb, var(--ink-soft) 60%, var(--rule));
	/* The band a control wears while it is the one in play: a field holding
	   focus, a choice that has been made, the panel a name is being typed
	   into. One shape and one strength for all of them, spelled once because a
	   shape written at each site drifts.

	   Named once per hue, rather than as one band plus a hue each site sets.
	   A custom property composed here is substituted here, so a hue set
	   further down arrives after the colour has already been chosen and the
	   band draws the accent. A hue known only on the element, like a directory's, cannot
	   be named up here at all and writes its band out where it stands.

	   Two hues, because two are wanted. A band falls outside the box it
	   belongs to, so what it has to be read against is whatever the box is
	   standing on, and everything here stands on the same paper. */
	--ring: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent);
	--ring-danger: 0 0 0 2px color-mix(in srgb, var(--danger) 28%, transparent);
	/* The light the product is named for. A glowcap makes its own light, and
	   the interface does too, but only at night and only from two places: the
	   field with the caret, which is the lantern you hold, and the lines you
	   have said, which are what it lit. Nothing else glows. A Send button, a
	   primary button, and the bar on the room being read each took the bloom
	   for a while, and four lights are a fairground where one is a lantern. In
	   the light theme the colour is transparent and every shadow that names it
	   draws nothing, so paper keeps its paper shadows and nothing has to be
	   written twice. The colour is the token because a shadow list cannot be
	   switched off with `none` from inside a comma-separated value. A shadow
	   in a colour nobody can see can. */
	--glow-color: transparent;
	/* The field's bloom is the wide one, and wide at full colour was a
	   floodlight under the conversation. It takes a little over half. The
	   lines take a share of that again, and are dimmer than it,
	   because the field with the caret is the lantern and the lines are what
	   it lit. Equal strengths read as every line emitting on its own, and a
	   halo around each of them is the fairground this palette keeps warning
	   about. So the lines come in nearer the paper: less reach, and rather
	   over half of what the lantern spends. */
	--glow-tint: color-mix(in srgb, var(--glow-color) 55%, transparent);
	--glow: 0 0 22px var(--glow-tint);
	--glow-soft: 0 0 10px color-mix(in srgb, var(--glow-tint) 55%, transparent);
}
/* The logotype in rooms wears the lantern's own light: "glowcap" is a faint,
   near-white teal, the colour the mark's windows go when the tube has caught,
   so the word and the mushroom beside it are lit by one thing. By day the
   page is cream and a near-white word would vanish into it, so there the
   word keeps the ink the shared lockup gives it. Rooms only: the site draws
   the same lockup and keeps its own colour. */
.wordmark span {
	color: var(--ink);
}
@supports (color: light-dark(#000, #fff)) {
	.wordmark span {
		color: light-dark(var(--ink), color-mix(in srgb, var(--teal) 22%, #fff));
	}
}
/* The brand lockup: the mark standing over the logotype, one drawn unit. Two
   screens carry it, the opening screen in page.html and the session chooser's
   header, and the second is what the first fades into. A difference between
   them reads as the page redrawing rather than as one screen becoming the
   next. Each home separately naming the column and its fit is how the opening
   screen came to hold its logotype three pixels closer than the chooser did:
   the air the mark's light needs was taken back out of the layout slightly too
   far, and no rule stood over both to notice. The mark's own box is still
   named at each home, because one is markup and the other a component's prop.
   What stands between the mark and the word is settled here. */
.brand-lockup {
	display: flex;
	flex-direction: column;
	align-items: center;
	/* Not one of the spacing steps above: this is the lockup's own fit,
	   measured against the mark at the size it is set at, the way the
	   wordmark's letterfit was (mark.css). It moves when the drawing moves,
	   not when the layout ramp does. */
	gap: 17.5px;
}
/* The scrollbars belong to the page, not to the platform: thin, in the page's
   own ink, with no track. Both properties inherit, so the root is the one
   place to say it, and the log, the rails, and every card that scrolls follow. */
:root {
	scrollbar-width: thin;
	scrollbar-color: color-mix(in srgb, var(--ink) 22%, transparent) transparent;
}
/* Inline code: one chip wherever a sentence names a flag, a verb, or an
   address: the mono a step under the prose, a breath of ink behind it, and
   the corner radius of a small thing. The message bubbles taught this shape.
   Every surface now says it the same way. A code block, and any column that
   is code throughout, resets the chip and keeps the mono. */
code {
	font-family: var(--font-mono);
	/* Relative, and not a ramp step. A monospace face sets a larger eye than
	   the sans beside it at the same size, so this is the correction that makes
	   the two read as one line of text. It has to follow whatever the prose
	   around it is set in rather than name a size of its own. */
	font-size: .9em;
	background: color-mix(in srgb, var(--ink) 9%, transparent);
	padding: 1px 5px;
	border-radius: 5px;
	/* A long token may wrap. Cloning the decoration keeps each fragment a
	   chip instead of leaving the second line bare. */
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
}
/* Inside a block, the block is the surface and the code is the whole of it:
   the chip would break wrapped source into a pill per line and an empty pill
   per blank one. Size follows the block, which sets its own. */
pre > code {
	display: block;
	padding: 0;
	border-radius: 0;
	background: transparent;
	font-size: inherit;
}
:root {
	/* Avatar tints. A fixed ramp of ten that does not follow the theme, because
	   the chip carries white initials and every tint has to clear 4.5:1 against
	   them. --avatar-2 and --avatar-4 are the light arm of --teal and
	   --teal-deep, so `var()` would read correctly here and then flip to a dark
	   arm that misses the bar (2.48 and 3.47 against white). The ramp is
	   therefore written out, and it is the one place in rooms allowed to spell a
	   core value. The ui/tokens.css sheet owns every other colour. */
	--avatar-1: #ae6115;
	--avatar-2: #257f88;
	--avatar-3: #a4560c;
	--avatar-4: #1b5f66;
	--avatar-5: #956e27;
	--avatar-6: #557f58;
	--avatar-7: #9c4a2f;
	--avatar-8: #3a7d8c;
	--avatar-9: #7a5c34;
	--avatar-10: #2f6f78;
	/* IRC's origin color. The badge carries it consistently while the avatar
	   keeps the person's name-derived tint. Origin and identity answer different
	   questions and should not erase one another. */
	--irc: #6b5fa8;
	/* Which directory a room or a direct line belongs to. Handed out in order,
	   one per directory this tab holds, and never derived from a name.

	   These follow the theme where the avatar ramp above does not, because the
	   two marks sit on different grounds: an avatar chip carries white initials
	   and must stay dark in both, while a directory mark is ink on the rail and
	   has to flip with the paper.

	   Amber, teal, and red are already spent (commitment, the quiet way out,
	   and refusal) so what is left is one green and the blue-to-magenta arc.
	   Five is what that arc holds at this separation. A sixth would have to sit
	   inside a semantic band or inside another tone, and two directories wearing
	   one colour claims a sameness that is not there. Where two are close in hue they
	   are held apart in lightness instead.

	   Colour is never the only channel: every row that wears one also names its
	   directory in words. */
	--dir-mark-1: #145200;
	--dir-mark-2: #0269bd;
	--dir-mark-3: #870b60;
	--dir-mark-4: #552d9d;
	--dir-mark-5: #9546ac;
	/* Icon controls have three named sizes and no caller-owned geometry. Small
	   belongs to a row of content, normal to application chrome, and large to the
	   touch-primary composer controls. Text inputs and title chips still share
	   --control-h because they are not icon buttons. */
	--icon-button-small: 26px;
	--icon-button-normal: 36px;
	--icon-button-large: 42px;
	/* The progress ring's side, wherever a control waits. It is even, like the
	   icon buttons and control heights the ring stands in, so the ring centers
	   on a whole pixel in each. An odd side leaves it half a pixel to one side. */
	--progress-ring: 14px;
	--control-h: 36px;
	/* The touch-primary height: a single-line field on the card plane, the
	   button beside one, and a card's own commitment. In-row buttons stay at
	   --control-h. forms.css says which control takes which. */
	--field-h: 44px;
	/* The composer's own text line. The padding that centres a single line in the
	   input is derived from these two, so raising the control height for touch
	   moves the padding with it. Held apart, the phone's taller control kept the
	   desktop's padding and left the line sitting at the top of it. */
	--composer-line: 20px;
	/* One height for both column headers, the topbar and the sidebar workspace, so
	   their bottom borders line up across the grid regardless of their very different
	   content (the topbar sizes to its 36px buttons, the workspace to its 18px title).
	   It is the topbar's natural height: the 36px buttons plus 12px+12px padding, the
	   accent line, and the 1px border. Keep in step with --control-h if that changes. */
	--header-h: 64px;
	/* What the sticky chrome occupies, which is the header plus
	   whatever the device keeps above it. Anything that pins below the topbar
	   reads this rather than restating the sum, because the phone query grows
	   the bar by the safe-area inset and a second copy of that arithmetic is a
	   bar that parts company with the one above it on exactly the screens that
	   have an inset to grow by. */
	--header-total: var(--header-h);
	/* How far apart two things stand, by what they are to each other. Five
	   steps, and a surface names the one its relationship asks for.

	   Nineteen values were doing this work across the cards and the operations
	   panes, and nine of them sat inside ten pixels of each other: three
	   different distances for "one group from the next", which is three
	   authors' eyes rather than a decision. Named, the question at a new rule
	   is which relationship this is, and the answer is the same everywhere
	   that relationship appears.

	   line     within one line: a mark and its word, a chip beside a name.
	   tight    parts of one thing: a name and the sentence under it, a label
	            and the field it names.
	   row      one row or control to the next inside a group.
	   group    one group to the next inside a card.
	   section  one section to the next down a page.

	   A column gap is its own step, because side by side needs more air than
	   stacked to read as two columns rather than one wrapped line. */
	/* Rows of a list that reads as one surface: a menu's items, a rail's
	   rooms. Below this a list becomes a block of text. Above it the rows stop
	   being one thing. */
	--gap-hair: 2px;
	--gap-line: 4px;
	--gap-tight: 6px;
	--gap-row: 8px;
	--gap-group: 12px;
	--gap-section: 20px;
	--gap-column: 16px;
	/* How wide a card stands, by what it holds rather than by who drew it.
	   A card that names its own number invites near-misses, two widths twenty
	   pixels apart that no reader can take as a decision.

	   Four steps, far enough apart to be read as chosen. A card names the step
	   its contents ask for and nothing else, so the question at a new card is
	   "which of these is it", not "how wide should this be".

	   ask    one question and its answer.
	   panel  grouped answers, a short form, a card about one thing. The
	          default: a card that names no step is this one.
	   rows   rows carrying a name and the act that takes it, which fold the
	          act under the name in anything narrower.
	   pair   two subjects side by side, each with a wide row of its own.

	   Every step collapses the same way, through `min(step, 100%)` inside the
	   backdrop's own inset, so the phone answer is one answer and no card has
	   its own version of it to get wrong. */
	--card-ask: 400px;
	--card-panel: 480px;
	--card-rows: 600px;
	--card-pair: 880px;
	/* Shared cap for the centered conversation card. 40px is the same inset a
	   message row uses, so the intro and a long system pill share an edge. */
	--card-cap: 760px;
	--card-max: min(var(--card-cap), calc(100% - 40px));
	/* Spoken lines, ordinary bubbles and a system line that never left this
	   tab, share one measure, so a local notice cannot grow wider than a
	   message just because it is a pill. */
	--bubble-max: min(560px, 76%);
	/* The two rails that flank the conversation (the rooms and direct-message
	   list on the left, the roster on the right) are the same kind of surface, so
	   they take one width, one inset, and one fill. A matched pair that drifts
	   apart by a few pixels on each measure does not read as two considered
	   choices. It reads as a mistake nobody can name. --rail-pad insets a row pill
	   from the panel edge and --row-pad insets the row's contents from the pill, so
	   a section label and the names under it start on the same vertical line in
	   both rails. */
	--rail-w: 264px;
	--rail-pad: 12px;
	--row-pad: 8px;
	/* Space between a #, lock, or directory mark and the name it labels: the
	   title chip, the welcome heading, the rails, and the directory card. One
	   number, because a gutter that only the rail remembered is how those
	   headings drifted apart. A person chip is a larger mark and wears a
	   directory rim that sits outside its box, so it takes a wider gutter. */
	--mark-gap: 4px;
	--avatar-gap: 8px;
	/* The space between the band's top edge and the field's own. Three things
	   measure from it: the band's top padding is it, the log reserves the band
	   minus it so a resting message stops just clear of the field, and the fade
	   in workarea.css reaches full paper at its far end. */
	--composer-clear: 12px;
	/* The band's bottom padding, which is the room under the field. It is the
	   status line plus a hair either side rather than a number of its own,
	   because holding that line is the only reason the room is there, and a
	   floor sized apart from what stands in it drifts the first time the line's
	   own height moves. */
	--composer-floor: calc(var(--composer-status-h) + 4px + env(safe-area-inset-bottom));
	/* The reserved line under the field, which is also its own line box, so a
	   caption in it has room for its descenders. Named rather than written into
	   the one rule that sizes it, because the floor above is measured from it and
	   the completion list is anchored past it. */
	--composer-status-h: 16px;
	/* What the log holds clear at the bottom for the band to float over. The
	   observer in Composer.tsx measures the band and keeps --composer-h accurate.
	   This is only the first paint before it has run, and a short conversation is
	   pinned to the bottom, so under-reserving puts the last message behind the
	   field for that frame. Measured at the band's resting height and rounded up,
	   because erring high leaves a hair of paper and erring low hides a line. */
	--composer-h-rest: 118px;
	/* How much of the two full-height columns is paper. The rest lets the
	   mycelium under the page show faintly through them. */
	--rail-solid: 50%;
	/* The flat tone the columns read as over the page, for what can only take
	   a colour, such as the ring a box-shadow draws. */
	--rail-tone: color-mix(in srgb, var(--paper-raised) var(--rail-solid), var(--paper));
	/* Mirrors the page ground so the two full-height columns cool with it, at
	   half the depth: a narrow strip shows a gradient more strongly than the
	   wide field beside it, because its edges hand the eye a reference, so an
	   equal journey here read stronger than the page's. */
	--rail-fill: linear-gradient(180deg, color-mix(in srgb, var(--paper-raised)
		var(--rail-solid), transparent), color-mix(in srgb, color-mix(in srgb, var(--accent) 5%,
		var(--paper-raised)) var(--rail-solid), transparent) 55%, color-mix(in srgb,
		color-mix(in srgb, var(--paper-raised) 92%, var(--raised-foot)) var(--rail-solid),
		transparent) 78%, color-mix(in srgb, color-mix(in srgb, var(--paper-raised)
		80%, var(--raised-foot)) var(--rail-solid), transparent) 94%);
}
/* "Syrup": the same warmth turned down to a dark roast, and the face this
   app wears. One arm, mirroring ui/tokens.css: a page nobody has stamped and
   a page stamped `dark` are the same page, and `data-theme="light"` is the
   only thing that turns it off. Guarded like the token pairs, so a browser
   without `light-dark()` keeps light native controls on its light-locked
   palette. */
@supports (color: light-dark(#000, #fff)) {
	html:not([data-theme="light"]) {
		color-scheme: dark;
	}
}
* {
	box-sizing: border-box;
}

/* A browser without light-dark() drops the whole palette to invalid
   custom properties, so the plain declarations above carry the light
   arms and this block restores the pair where the function exists.
   Without it, the page keeps its light face everywhere. */
@supports (color: light-dark(#000, #fff)) {
	:root {
		--danger: light-dark(#b23b2e, #e07a5f);
		--warn: light-dark(#9a6b00, #f0b429);
		--hover: light-dark(color-mix(in srgb, var(--ink) 6%, transparent), color-mix(in srgb, #ffffff 7%, transparent));
		--mine-action-hover: light-dark(rgba(0, 0, 0, 0.14), rgba(255, 255, 255, 0.18));
		--shadow-sm-color: light-dark(color-mix(in srgb, var(--ink) 10%, transparent), rgba(0,0,0,.4));
		--shadow-color: light-dark(color-mix(in srgb, var(--ink) 16%, transparent), rgba(0,0,0,.5));
		--field-fill: light-dark(#fff, var(--paper));
		--field-lift: light-dark(0 1px 2px var(--shadow-sm-color), none);
		--glow-color: light-dark(transparent, color-mix(in srgb, var(--accent) 55%, transparent));
		--said-from: light-dark(
			color-mix(in srgb, var(--accent) 12%, var(--paper-raised)),
			color-mix(in srgb, var(--accent) 22%, var(--paper-raised))
		);
		--said-to: light-dark(
			color-mix(in srgb, var(--accent) 22%, var(--paper-raised)),
			color-mix(in srgb, var(--accent) 32%, var(--paper-raised))
		);
	}
	:root {
		--dir-mark-1: light-dark(#145200, #6ab759);
		--dir-mark-2: light-dark(#0269bd, #99c9ff);
		--dir-mark-3: light-dark(#870b60, #ed81bf);
		--dir-mark-4: light-dark(#552d9d, #af94fd);
		--dir-mark-5: light-dark(#9546ac, #ecaffe);
	}
}
