/*
 * Shared look for the pre-login pages: the login/register page (index.php and
 * the Laravel auth views) and the privacy / terms pages. One file, so the whole
 * set restyles from here - change the tokens and every page, button and popup
 * follows.
 *
 * Look: engraved steel and brass, taken from the Lyrania logo. Cut-corner plates
 * (no rounded boxes), a brushed-steel edge, brass corner brackets and brass for
 * anything active; Barlow Semi Condensed for headings and
 * button labels.
 */

@import url("https://fonts.googleapis.com/css2?family=Barlow+Semi+Condensed:wght@500;600;700&display=swap");

:root {
  color-scheme: dark;

  /* surfaces and text */
  --lyr-bg: #0a0b0d;
  --lyr-panel: #17181b;
  --lyr-panel-alt: #212225;
  --lyr-text: #ebe8e1;
  --lyr-muted: #aaa79f;
  --lyr-line-soft: #3d392f;

  /* the plate edges are antique brass, sampled from the app icon's border (the names are historical: they were steel) */
  --lyr-steel-hi: #e2cb98;
  --lyr-steel: #a38551;
  --lyr-steel-lo: #6e5937;
  --lyr-accent: #d4a24c;
  --lyr-accent-hi: #f0cf8a;
  --lyr-accent-lo: #8a6a2a;
  --lyr-accent-ink: #17110a;
  --lyr-link: #c4ad78;
  --lyr-link-hover: #f0d9a0;

  --lyr-display: "Barlow Semi Condensed", Arial, "Segoe UI", Helvetica, sans-serif;
  /* a brushed-steel sheen that stays light along the whole edge (a dark middle stop made the top and
   * bottom edges of wide plates look missing) */
  --lyr-edge: linear-gradient(135deg, var(--lyr-steel-hi) 0%, var(--lyr-steel) 30%, #c9ad74 55%, #8f7442 78%, var(--lyr-steel-hi) 100%);

  /* layout: fluid, so it fits a phone and a large monitor alike */
  --lyr-page-width: 1080px;
  --lyr-page-gutter: 12px;
  --lyr-window-gap: 10px;
  --lyr-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .055 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  --lyr-bg-image: url("../images/main54/barrichrome_bg.jpg");
}

/* The page scales gently with the window: 15px on phones, up to 18px on big screens. */
html {
  font-size: clamp(15px, 14px + 0.2vw, 18px);
  background-color: var(--lyr-bg);
}

/* Background: the brushed-metal image as a fixed cover layer (works on phones that
 * ignore background-attachment:fixed), with a vignette so the plates stand out. */
body {
  background-color: transparent;
  color: var(--lyr-text);
}

body::before,
body::after {
  content: "";
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -1;
  pointer-events: none;
}

body::before {
  background: var(--lyr-bg) var(--lyr-bg-image) center / cover no-repeat;
}

body::after {
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, 0.7) 100%);
}

/* The cut-corner shape, shared by windows, the popup and buttons. Its straight sides sit 1px OUTSIDE the box
 * and only the two diagonals cut in (they lie on exactly the same lines as a plain cut): a clip that follows the
 * box edge exactly trims the outermost border pixel whenever the box lands on a fractional device pixel
 * (125% display scaling, odd widths), which thinned the right and bottom outline. */
.lyr-window,
dialog.lyr-dialog,
.lyr-btn {
  --lyr-cut-clip: polygon(
    calc(var(--cut) + 1px) -1px,
    calc(100% + 1px) -1px,
    calc(100% + 1px) calc(100% - var(--cut) - 1px),
    calc(100% - var(--cut) - 1px) calc(100% + 1px),
    -1px calc(100% + 1px),
    -1px calc(var(--cut) + 1px)
  );
}

/* ---- Plates (windows) --------------------------------------------------
 * A cut-corner plate. The outline is a REAL 1px border (a gradient border-image), not a second layer
 * peeking out from behind the fill: browsers keep a real border a whole device pixel wide on every side
 * at any size or display scaling, whereas two stacked layers whose edges round differently let a side of
 * the outline thin out or vanish (it showed up as a broken top edge and a clipped button edge). The two
 * cut corners are drawn as their own diagonal strokes, and brass brackets mark the two square corners. */

.lyr-window,
dialog.lyr-dialog {
  --cut: 16px;
  position: relative;
  /* A very light brushed-metal grain on every plate: fine horizontal streaks plus a faint noise, both at a few percent
   * opacity, so the plates read as engraved steel without competing with the text. */
  background:
    linear-gradient(135deg, transparent calc((var(--cut) - 2px) * 0.70711), var(--lyr-steel-hi) calc((var(--cut) - 2px) * 0.70711), var(--lyr-steel-hi) calc((var(--cut) - 2px) * 0.70711 + 1px), transparent calc((var(--cut) - 2px) * 0.70711 + 1px)) top left / calc(var(--cut) + 4px) calc(var(--cut) + 4px) no-repeat,
    linear-gradient(315deg, transparent calc((var(--cut) - 2px) * 0.70711), var(--lyr-steel-hi) calc((var(--cut) - 2px) * 0.70711), var(--lyr-steel-hi) calc((var(--cut) - 2px) * 0.70711 + 1px), transparent calc((var(--cut) - 2px) * 0.70711 + 1px)) bottom right / calc(var(--cut) + 4px) calc(var(--cut) + 4px) no-repeat,
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0) 38%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.016) 0 1px, rgba(255, 255, 255, 0) 1px 3px),
    var(--lyr-grain) 0 0 / 160px 160px,
    var(--lyr-panel);
  color: var(--lyr-text);
  border: 1px solid var(--lyr-steel);
  border-image: var(--lyr-edge) 1;
  border-radius: 0;
  clip-path: var(--lyr-cut-clip);
  overflow-wrap: break-word;
}

.lyr-window {
  margin-bottom: var(--lyr-window-gap);
  padding: 14px clamp(16px, 3vw, 28px);
}

/* A buffer between stacked windows, on a dark tray. Left bare, the gap shows the bright brushed-metal
 * streaks right next to the next window's top edge, which reads as a dotted, broken outline; the tray
 * keeps the gap calm so every window's outline stays crisp. The tray is cut like the windows (top-left
 * and bottom-right corners), so it never shows outside the stack's outline. */
.container,
.legal-wrap {
  position: relative;
  isolation: isolate;
}

.container::before,
.legal-wrap::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--lyr-page-gutter);
  right: var(--lyr-page-gutter);
  z-index: -1;
  background: rgba(5, 6, 8, 0.92);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
}

.legal-wrap::before {
  left: 0;
  right: 0;
}

/* no buffer after the last window, so the tray ends where the stack does */
.lyr-window:last-of-type {
  margin-bottom: 0;
}

/* The diagonal strokes on the two cut corners (and, on windows, the brass brackets). The overlay spans
 * the border box; the stroke starts on the cut line and runs 1px into the plate, so the clip never trims it. */
.lyr-window::after {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  bottom: -1px;
  left: -1px;
  pointer-events: none;
  background:
    linear-gradient(var(--lyr-accent), var(--lyr-accent)) right 7px top 7px / 18px 2px no-repeat,
    linear-gradient(var(--lyr-accent), var(--lyr-accent)) right 7px top 7px / 2px 18px no-repeat,
    linear-gradient(var(--lyr-accent), var(--lyr-accent)) left 7px bottom 7px / 18px 2px no-repeat,
    linear-gradient(var(--lyr-accent), var(--lyr-accent)) left 7px bottom 7px / 2px 18px no-repeat;
}

/* ---- Buttons --------------------------------------------------------------
 * The top row on every page, the tabs, the form's submit buttons and the popup's
 * own controls. Anchors and <button>s look identical in every state. Built like the
 * plates: a real 1px border-image outline plus two diagonal strokes, so the outline
 * is never clipped on any side (each state just swaps a few variables). */

.lyr-btn {
  --cut: 8px;
  --btn-edge: var(--lyr-edge);
  --btn-fill: #1a1d22;
  --btn-text: #e4e1da;
  --btn-diag: var(--lyr-steel-hi);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 10px 20px;
  background:
    linear-gradient(135deg, transparent calc((var(--cut) - 2px) * 0.70711), var(--btn-diag) calc((var(--cut) - 2px) * 0.70711), var(--btn-diag) calc((var(--cut) - 2px) * 0.70711 + 1px), transparent calc((var(--cut) - 2px) * 0.70711 + 1px)) top left / calc(var(--cut) + 4px) calc(var(--cut) + 4px) no-repeat,
    linear-gradient(315deg, transparent calc((var(--cut) - 2px) * 0.70711), var(--btn-diag) calc((var(--cut) - 2px) * 0.70711), var(--btn-diag) calc((var(--cut) - 2px) * 0.70711 + 1px), transparent calc((var(--cut) - 2px) * 0.70711 + 1px)) bottom right / calc(var(--cut) + 4px) calc(var(--cut) + 4px) no-repeat,
    var(--btn-fill);
  border: 1px solid var(--lyr-steel);
  border-image: var(--btn-edge) 1;
  border-radius: 0;
  font-family: var(--lyr-display);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  clip-path: var(--lyr-cut-clip);
  transition: color 0.12s;
}

.lyr-btn,
.lyr-btn:link,
.lyr-btn:visited {
  color: var(--btn-text);
  text-decoration: none;
}

.lyr-btn:hover {
  --btn-edge: linear-gradient(135deg, var(--lyr-accent-hi), var(--lyr-accent) 50%, var(--lyr-accent-lo));
  --btn-fill: #262a31;
  --btn-text: #fff;
  --btn-diag: var(--lyr-accent-hi);
}

/* A clipped box would hide an outline, so the focus ring is a second line drawn inside the border. */
.lyr-btn:focus-visible {
  --btn-edge: linear-gradient(var(--lyr-accent-hi), var(--lyr-accent-hi));
  --btn-fill: #262a31;
  --btn-text: #fff;
  --btn-diag: var(--lyr-accent-hi);
  box-shadow: inset 0 0 0 1px var(--lyr-accent-hi);
  outline: none;
}

.lyr-btn:active {
  --btn-fill: #0b0c0e;
  transform: translateY(1px);
}

/* The page you are on / the selected tab. */
.lyr-btn[aria-current="page"],
.lyr-btn[aria-selected="true"],
.lyr-btn.is-active {
  --btn-edge: linear-gradient(135deg, var(--lyr-accent-hi), var(--lyr-accent) 55%, var(--lyr-accent-lo));
  --btn-fill: var(--lyr-accent);
  --btn-text: var(--lyr-accent-ink);
  --btn-diag: var(--lyr-accent-hi);
  cursor: default;
}

.lyr-btn-submit {
  padding: 12px 32px;
  font-size: 0.85rem;
}
/* Top row of buttons (identical markup on the login page and the legal pages). */
.lyr-topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.lyr-topnav li {
  margin: 0;
}

/* Lyrania, Privacy Policy and Terms of Service sit at the left; the New Player Guide sits alone at the right end, on every page. */
.lyr-topnav .lyr-nav-end {
  margin-left: auto;
}

/* ...but not on a phone, where the row wraps and a lone right-aligned button looks lost. */
@media (max-width: 575.98px) {
  .lyr-topnav .lyr-nav-end {
    margin-left: 0;
  }
}

/* ---- Tabs (Login / Register) -------------------------------------------- */

.lyr-tabs {
  display: flex;
  gap: 10px;
  margin: 0 0 14px;
}

.lyr-tabs .lyr-btn {
  flex: 1 1 0;
  padding: 9px 16px;
  font-size: 0.85rem;
}

/* ---- Split plate: login | news and update (one connected window) ----------
 * The window is tall on purpose, so a good amount of news shows without scrolling. */

.lyr-split {
  display: grid;
  grid-template-columns: minmax(300px, 5fr) minmax(0, 6fr);
  padding: 14px 0;
}

.lyr-pane {
  min-width: 0;
  padding: 0 clamp(16px, 3vw, 30px);
}

.lyr-pane-news {
  position: relative;
  padding: 0;
  border-left: 1px solid var(--lyr-line-soft);
}

/* The news scrolls inside its pane instead of stretching the plate, so the plate is as
 * tall as the form (or the minimum above), whichever tab is open. */
.lyr-news-scroll {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: auto;
  padding: 0 clamp(16px, 3vw, 30px);
}

@media (max-width: 759.98px) {
  .lyr-split {
    display: block;
    min-height: 0;
  }

  .lyr-pane-auth {
    padding-bottom: 6px;
  }

  .lyr-pane-news {
    margin-top: 22px;
    padding-top: 18px;
    border-left: 0;
    border-top: 1px solid var(--lyr-line-soft);
  }

  .lyr-news-scroll {
    position: static;
    max-height: 420px;
  }
}

/* ---- Vote window: one card per voting site, side by side along the bottom ---- */

.lyr-vote {
  padding: 12px clamp(16px, 3vw, 28px) 14px;
}

.lyr-vote-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 24px;
  margin: 0 0 10px;
}

.lyr-vote-head h4 {
  margin: 0;
  color: var(--lyr-accent-hi);
  font-size: 0.95rem;
  text-transform: uppercase;
}

.lyr-vote-head p {
  margin: 0;
  color: var(--lyr-muted);
  font-size: 0.85rem;
}

.lyr-vote-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 1.6vw, 16px);
}

/* One ranking card per site, all three in a line; they only stack on a very small screen. */
@media (max-width: 519.98px) {
  .lyr-vote-grid {
    grid-template-columns: 1fr;
  }
}

.lyr-vote-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* top-aligned, so the rank figures line up even when one card's stats wrap */
  gap: 2px;
  min-width: 0;
  padding: 10px clamp(8px, 1.5vw, 14px) 11px;
  background: var(--lyr-panel-alt);
  border: 1px solid var(--lyr-line-soft);
  text-align: center;
}

.lyr-vote-card h5 {
  margin: 0;
  font-family: var(--lyr-display);
  font-size: clamp(0.7rem, 1.8vw, 0.85rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* the rank and what it is a rank of share one line: "#2  OF 100 LISTED" */
.lyr-rank {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0 8px;
  line-height: 1.15;
}

.lyr-rank-num {
  color: var(--lyr-accent-hi);
  font-family: var(--lyr-display);
  font-size: clamp(1.6rem, 3.6vw, 2.1rem);
  font-weight: 700;
}

.lyr-rank-scope {
  color: var(--lyr-muted);
  font-size: clamp(0.64rem, 1.3vw, 0.76rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lyr-rank-stats {
  min-height: 1.2em;
  margin: 0;
  color: var(--lyr-text);
  font-size: clamp(0.74rem, 1.5vw, 0.84rem);
}

.lyr-vote-card.is-stale .lyr-rank-num {
  opacity: 0.7;
}
/* ---- Header (logo row) ------------------------------------------------- */

.lyr-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.lyr-social,
.lyr-logo,
.lyr-online {
  flex: 1 1 0;
  min-width: 0;
}

.lyr-social {
  display: flex;
  gap: 14px;
  font-size: 1.75rem;
  line-height: 1;
}

.lyr-logo {
  text-align: center;
}

.lyr-logo img {
  max-width: 100%;
  width: auto;
  /* the image carries a few px of padding for its dark outline: a taller box with negative margins keeps the letters
   * the same size and the header row the same height as before */
  height: 56px;
  margin: -3px 0;
}

.lyr-online {
  font-family: var(--lyr-display);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-align: right;
  text-transform: uppercase;
}

@media (max-width: 575.98px) {
  .lyr-head {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .lyr-social,
  .lyr-logo,
  .lyr-online {
    flex: 0 0 auto;
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .lyr-logo {
    order: -1;
  }
}

/* ---- Headings inside plates --------------------------------------------- */

.lyr-window h1,
.lyr-window h2,
.lyr-window h3,
.lyr-window h4,
dialog.lyr-dialog h2,
dialog.lyr-dialog h3 {
  font-family: var(--lyr-display);
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* ---- Guide popup (lyr-guide.js) ------------------------------------------ */

dialog.lyr-dialog {
  width: min(780px, calc(100vw - 24px));
  /* a fixed height so the popup does not resize when switching between Guide and Full wiki */
  height: min(740px, calc(100vh - 24px));
  height: min(740px, calc(100dvh - 24px));
  max-height: none;
  padding: 0;
  overflow: hidden;
}

dialog.lyr-dialog[open] {
  display: flex;
  flex-direction: column;
}

dialog.lyr-dialog::backdrop {
  background: rgba(0, 0, 0, 0.78);
}

.lyr-dialog-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--lyr-line-soft);
}

.lyr-dialog-title {
  flex: 1 1 auto;
  margin: 0;
  font-size: 1.15rem;
  text-transform: uppercase;
}

.lyr-dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 18px clamp(16px, 3vw, 28px) 22px;
  -webkit-overflow-scrolling: touch;
}

.lyr-dialog-body h3 {
  margin: 1.5em 0 0.45em;
  padding-bottom: 0.25em;
  border-bottom: 1px solid var(--lyr-line-soft);
  font-size: 1rem;
  text-transform: uppercase;
  color: var(--lyr-accent-hi);
}

.lyr-dialog-body h3:first-child {
  margin-top: 0;
}

.lyr-dialog-body p,
.lyr-dialog-body ul {
  margin: 0 0 0.9em;
}

.lyr-dialog-body ul {
  padding-left: 1.3em;
}

.lyr-dialog-body li {
  margin-bottom: 0.4em;
}

.lyr-dialog-body a {
  color: var(--lyr-link);
  text-decoration: underline;
}

.lyr-dialog-body a:hover {
  color: var(--lyr-link-hover);
}

.lyr-dialog-wiki {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 60vh;
  border: 0;
  background: #fff;
}

.lyr-dialog-body.is-wiki {
  padding: 0;
  overflow: hidden;
}

.lyr-dialog-wikilink {
  margin: 0;
  padding: 10px 20px;
  border-top: 1px solid var(--lyr-line-soft);
  font-size: 0.85rem;
  text-align: right;
}

.lyr-dialog-wikilink a {
  color: var(--lyr-link);
}

@media print {
  body::before,
  body::after,
  dialog.lyr-dialog {
    display: none;
  }
}
