/* THE BRAND'S COMPONENTS, shared by the landing page (website/) and the app
   (browser/site/): the Figma file's components (Button, Icon Button, Status
   Tag, the cards, Background/Notebook) as classes. Values come from
   tokens.css, loaded before this file. */

/* THE TEXT STYLES: the design's four, one class each. A size is a token,
   so a phone gets the smaller size the token clamps to. Line heights and
   tracking are the Figma text styles' (H1, H2, H3, Text), as ratios of the
   size so they scale with it. */
.text-display {
  font: 500 var(--size-display)/1.04 var(--font);
  letter-spacing: -0.05em;
}

.text-heading {
  font: 500 var(--size-heading)/1.0625 var(--font);
  letter-spacing: -0.025em;
}

.text-lead {
  font: 500 var(--size-lead)/1.12 var(--font);
  letter-spacing: -0.03em;
}

.text-body {
  font: 500 var(--size-body)/normal var(--font);
  letter-spacing: -0.02em;
}

/* THE NOTEBOOK: the page's Background under a 30px square grid of 1px lines
   in Primary at 12% (Figma "Background/Notebook"). On a body, give it the
   viewport's height (min-height: 100dvh) so the grid reaches the bottom. */
.notebook {
  background-color: var(--background);
  background-image:
    linear-gradient(to right, var(--grid-line) 0.0625rem, transparent 0.0625rem),
    linear-gradient(to bottom, var(--grid-line) 0.0625rem, transparent 0.0625rem);
  background-size: 1.875rem 1.875rem;
}

/* A page's content row: the whole window's width inside the gutter, on a
   large display too (the landing page and the app alike). */
.wrap {
  padding-inline: var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  font: 500 var(--size-logo)/1 var(--font);
  letter-spacing: -0.03em;
  color: var(--primary);
}

/* An icon's size is the design's, in rem as every length here, so it grows
   with the page's rem (tokens.css THE SCALE); the img's width
   and height attributes only reserve its box while it loads. */
.brand img {
  display: block;
  flex-shrink: 0;
  width: 2.125rem;
  height: 2.125rem;
}

/* THE GLYPH: an icon of icons/ drawn in the current text colour, so one file
   serves a filled button (Background on Primary) and an outlined one
   (Primary). `<span class="glyph" data-glyph="edit"></span>`; the URLs are
   set here, beside the mask that reads them, so they resolve against this
   file. */
.glyph {
  display: block;
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  background: currentColor;
  -webkit-mask: var(--glyph) center / contain no-repeat;
  mask: var(--glyph) center / contain no-repeat;
}

[data-glyph="attach"] { --glyph: url("icons/attach.svg"); }
[data-glyph="back"] { --glyph: url("icons/back.svg"); }
[data-glyph="camera"] { --glyph: url("icons/camera.svg"); }
[data-glyph="check"] { --glyph: url("icons/check.svg"); }
[data-glyph="close"] { --glyph: url("icons/close.svg"); }
[data-glyph="copy"] { --glyph: url("icons/copy.svg"); }
[data-glyph="device-desktop"] { --glyph: url("icons/device-desktop.svg"); }
[data-glyph="device-mobile"] { --glyph: url("icons/device-mobile.svg"); }
[data-glyph="edit"] { --glyph: url("icons/edit.svg"); }
[data-glyph="fullscreen"] { --glyph: url("icons/fullscreen.svg"); }
[data-glyph="fullscreen-exit"] { --glyph: url("icons/fullscreen-exit.svg"); }
[data-glyph="google-play"] { --glyph: url("icons/google-play.svg"); }
[data-glyph="more"] { --glyph: url("icons/more.svg"); }
[data-glyph="play"] { --glyph: url("icons/play.svg"); }
[data-glyph="plus"] { --glyph: url("icons/plus.svg"); }
[data-glyph="redo"] { --glyph: url("icons/redo.svg"); }
[data-glyph="send"] { --glyph: url("icons/send.svg"); }
[data-glyph="share"] { --glyph: url("icons/share.svg"); }
/* The platform's share sheet (a box, an arrow out), not quine's Share. */
[data-glyph="share-sheet"] { --glyph: url("icons/share-sheet.svg"); }
[data-glyph="sound-off"] { --glyph: url("icons/sound-off.svg"); }
[data-glyph="sound-on"] { --glyph: url("icons/sound-on.svg"); }
[data-glyph="stop"] { --glyph: url("icons/stop.svg"); }
[data-glyph="sync"] { --glyph: url("icons/sync.svg"); }
[data-glyph="undo"] { --glyph: url("icons/undo.svg"); }
[data-glyph="user"] { --glyph: url("icons/user.svg"); }

/* THE BUTTON (Figma "Button"): a pill in Body. Plain `.button` is the
   Outline style (Play and quiet actions; `.outline` names it); `.primary` is
   the main action, `.secondary` Edit, `.accent` Share. Every style draws the
   same 1.5px border, a filled one in its own fill, so all are one size. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: var(--line) solid var(--primary);
  border-radius: 62.4375rem;
  background: transparent;
  color: var(--primary);
  font: 500 var(--size-body)/normal var(--font);
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.button.primary {
  background: var(--primary);
  color: var(--background);
}

.button.secondary {
  background: var(--secondary);
  border-color: var(--secondary);
}

.button.accent {
  background: var(--secondary);
}

.button:hover {
  opacity: 0.86;
}

/* An outlined button fills on hover, so the pointer sees it react. */
.button:not(.primary, .secondary, .accent):hover {
  opacity: 1;
  background: var(--primary);
  color: var(--background);
}

/* THE ICON BUTTON (Figma "Icon Button"): a 44px circle holding one glyph or
   icon. Filled (Primary, the glyph in Background) is the default;
   `.outline` is Background with a Primary ring, `.secondary` Secondary with
   the ring (Share), `.accent` Accent (the dashboard's New app). On Accent the
   glyph is Primary (5.6:1), not the design's Background (1.9:1, below the
   3:1 WCAG asks of a control's icon). */
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0px;
  border: var(--line) solid var(--primary);
  border-radius: 62.4375rem;
  background: var(--primary);
  color: var(--background);
  cursor: pointer;
  text-decoration: none;
}

.icon-button.outline {
  background: var(--background);
  color: var(--primary);
}

.icon-button.secondary {
  background: var(--secondary);
  color: var(--primary);
}

.icon-button.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--primary);
}

.icon-button:hover {
  opacity: 0.86;
}

.icon-button img {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
}

/* THE RING BUTTON: a small 32px outlined circle for a tool beside text
   (undo, redo, close), its glyph 18px. */
.ring-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  padding: 0px;
  border: var(--line) solid var(--primary);
  border-radius: 62.4375rem;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
}

.ring-button .glyph {
  width: 1.125rem;
  height: 1.125rem;
}

.ring-button:hover {
  background: var(--border);
}

.ring-button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* THE TAG (Figma "Status Tag", the game card's genre): a small pill in Body
   that labels, filters or switches. `.accent` is Published, `.secondary`
   Shared, plain is Private or a genre. A tag that is chosen (a pressed
   filter, the current tab) is filled Primary. */
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border: var(--line) solid var(--primary);
  border-radius: 62.4375rem;
  background: transparent;
  color: var(--primary);
  font: 500 var(--size-body)/normal var(--font);
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.tag.secondary {
  background: var(--secondary);
  border-color: var(--secondary);
}

.tag.accent {
  background: var(--accent);
  border-color: var(--accent);
}

:is(button, a).tag {
  cursor: pointer;
}

.tag:is(.active, [aria-pressed="true"], [aria-selected="true"], [aria-current]:not([aria-current="false"])) {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--background);
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  min-height: 1.75rem;
}

.icon-link img {
  display: block;
  width: 1.75rem;
  height: 1.75rem;
}

/* The Google Play mark is drawn smaller than Discord's in the design. */
.icon-link img[src$="google-play.svg"] {
  width: 1.375rem;
  height: 1.375rem;
}

/* THE CARD (Figma "Game Card", "App Card", "Chat Panel"): Background in a
   4px Primary border with round corners and the drop shadow. `.game` is a
   game's card: its picture on top, its body below. */
.card, .game {
  overflow: hidden;
  border: var(--card-border) solid var(--primary);
  border-radius: var(--radius);
  background: var(--background);
  box-shadow: var(--shadow);
  color: var(--primary);
}

.game {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
}

/* UNDER A POINTER a card lifts a little and its shadow falls further, as
   the landing page's sticker does: the landing page's game cards and the
   dashboard's App Cards (a loading skeleton stays put). Only where a pointer
   hovers: a touch screen would leave it lifted after a tap. */
@media (hover: hover) {
  .game {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
  }
  .game:not(.skeleton):hover {
    transform: translateY(-0.375rem);
    box-shadow: 0.5rem 0.875rem 0.75rem var(--shade);
  }
}

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

.game .body {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 1rem 1.25rem;
}

.title {
  font: 500 var(--size-lead)/1.12 var(--font);
  letter-spacing: -0.03em;
}

.bar-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-width: 0px;
}

.bar-divider {
  width: var(--line);
  height: 1.5rem;
  background: var(--primary);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font: 500 var(--size-body)/normal var(--font);
  letter-spacing: -0.02em;
  color: var(--primary);
  text-decoration: none;
}

.back-link img {
  display: block;
}

/* THE FOOTER (Figma "Footer"): White at half strength over the notebook,
   with its shadow up towards the page, on the landing page and in the app. */
.footer {
  background: color-mix(in srgb, var(--white) 50%, transparent);
  box-shadow: 0px -0.125rem 0.25rem var(--shade);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding-block: 3rem 3.5rem;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.footer-links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1.25rem;
}

.footer-row {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.footer-row a:not(.icon-link) {
  text-decoration: none;
  color: inherit;
}

@media (max-width: 600px) {
  .brand img {
    width: 1.875rem;
    height: 1.875rem;
  }
  .game .body {
    padding: 0.875rem 1rem;
  }
  /* A PHONE: one column, flush left. On top the links: the icons side by
     side, the text links one under another, close together so they read as
     one group; below them the logo and the line, the copyright under those.
     `.footer-links` gives up its box so its row and its copyright can take
     their own places in the column. */
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding-block: 2rem 2.5rem;
  }
  .footer-links {
    display: contents;
  }
  .footer-row {
    order: -1;
    flex-wrap: wrap;
    gap: 0px;
    margin-bottom: 0.75rem;
  }
  .footer-row .icon-link {
    justify-content: flex-start;
    min-width: 2.75rem;
    min-height: 2.75rem;
  }
  .footer-row a:not(.icon-link) {
    display: flex;
    flex-basis: 100%;
    align-items: center;
    min-height: 2rem;
  }
}
