/* The Magentron home page's style sheet: the reference's look, with the cards of its apps; every image it names is a file of this folder */

/* The page colours as variables, light by default; the theme choice (data-theme) or the reader's system picks the dark set */
:root {
  --card-background: #ffffff;
  --card-border: #e0e0e0;
  --card-border-hover: #c9c9c9;
  --heading: #1a1d21;
  --link: #313131;
  --muted: #51585f;
  --page-background: #f5f5f5;
  --rule: #d6d6d6;
  --text: #51585f;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --card-background: #25232a;
  --card-border: #444746;
  --card-border-hover: #6c6f70;
  --heading: #e6e1e5;
  --link: #a8c7fa;
  --muted: #c9c5ca;
  --page-background: #1c1b1f;
  --rule: #444746;
  --text: #c9c5ca;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --card-background: #25232a;
    --card-border: #444746;
    --card-border-hover: #6c6f70;
    --heading: #e6e1e5;
    --link: #a8c7fa;
    --muted: #c9c5ca;
    --page-background: #1c1b1f;
    --rule: #444746;
    --text: #c9c5ca;
    color-scheme: dark;
  }
}

/* The page: the reference's soft grey and Tahoma text, centred, with a top strip that continues the banner */
body {
  background: url(assets/images/background-top-bg.jpg) repeat-x var(--page-background);
  color: var(--text);
  font-family: Tahoma, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
  padding: 0;
  text-align: center;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:focus-visible {
  border-radius: 2px;
  outline: 2px solid #16a34a;
  outline-offset: 3px;
}

/* header-container begin: the same text in style.css and in the home page's home.css, held so by tool/test/website_test.dart */

/* The banner behind the header: the reference's dark strip, centred at the top of the page */
.page-wrapper {
  background: url(assets/images/background-top.jpg) no-repeat center 0;
}

/* The header: the Magentron logo on the left, the subtitle on the right */
.header-container {
  box-sizing: border-box;
  margin: 0 auto;
  max-width: 100%;
  padding: 50px 0 10px 0;
  width: 950px;
}

.header {
  margin: 0 auto;
  padding: 0 0 25px 0;
  position: relative;
  text-align: right;
  width: 100%;
  z-index: 10;
}

/* The logo is positioned by its own image, as on the reference, so the link is drawn around the image */
.header a.logo {
  display: block;
  float: left;
  height: 54px;
  margin: 18px 0 0 24px;
  text-decoration: none;
  width: 0;
}

.header a.logo img {
  display: block;
  height: 54px;
  left: 0;
  position: absolute;
  top: 0;
  width: 229px;
}

.header a.logo:focus-visible {
  outline: none;
}

.header a.logo:focus-visible img {
  outline: 2px solid #16a34a;
  outline-offset: 3px;
}

/* The subtitle keeps the reference's 14px text size, line height and top padding, which place its image 94px down at 1300px wide */
.header .subtitle {
  font-size: 14px;
  line-height: 1.55;
  margin: 0 0 6px;
  padding: 15px 0 0;
  position: absolute;
  right: 30px;
  top: 20px;
}

.header .subtitle img {
  height: 10px;
  max-width: none;
  width: 453px;
}

.header-container::after,
.header::after {
  clear: both;
  content: "";
  display: block;
  height: 0;
}

/* The page is the positioning context of the theme button, which sits in the top right corner of the page itself */
.page {
  position: relative;
}

/* The theme button: one button cycling automatic, light and dark, shown only when the page's script runs */
.theme-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(159, 208, 255, 0.45);
  border-radius: 6px;
  color: #9fd0ff;
  cursor: pointer;
  display: none;
  height: 28px;
  padding: 4px;
  position: absolute;
  right: 30px;
  top: 12px;
  width: 28px;
  z-index: 20;
}

html.js .theme-toggle {
  display: block;
}

.theme-toggle:hover {
  background: rgba(159, 208, 255, 0.2);
}

.theme-toggle:focus-visible {
  outline: 2px solid #16a34a;
  outline-offset: 2px;
}

/* Only the icon of the current state shows: automatic unless the html element says light or dark */
.theme-toggle svg {
  display: none;
  height: 100%;
  width: 100%;
}

.theme-toggle .icon-auto,
html[data-theme="light"] .theme-toggle .icon-light,
html[data-theme="dark"] .theme-toggle .icon-dark {
  display: block;
}

html[data-theme] .theme-toggle .icon-auto {
  display: none;
}

@media all and (max-width: 949px) {
  .header-container {
    overflow-x: hidden;
    width: 100%;
  }

  .header {
    width: 80%;
  }
}

@media all and (max-width: 919px) {
  .header .subtitle {
    left: 24px;
    right: auto;
    top: 64px;
  }

  .header .subtitle img {
    max-width: 100%;
    width: auto;
  }
}

/* header-container end */

/* The page's own footer stays the modest column of the app pages, under the full-width banner */
.page > footer {
  box-sizing: border-box;
  margin-left: auto;
  margin-right: auto;
  max-width: 42rem;
  width: calc(100% - 2rem);
}

/* The owner at the foot of the page, like the footer of the app pages; the cards above it already leave their own space */
footer {
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
  margin-top: 0;
  padding-bottom: 0rem;
  padding-top: 0rem;
  text-align: center;
  line-height: 1.2;
}

/* A short page fills the window and its footer sits at the bottom edge; a long page simply grows */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.page {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

.page > .content {
  width: 100%;
}

.page > footer {
  margin-top: auto;
}

/* Links in the footer stay underlined so they read as links, as on the app pages */
footer a {
  text-decoration: underline;
}

/* The apps: one card each, linking to the app's page */
.content {
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
  margin: 0 auto;
  max-width: 950px;
  padding: 40px 1rem 80px 1rem;
}

.primary-link {
  background: var(--card-background);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  box-sizing: border-box;
  display: block;
  max-width: 100%;
  padding: 40px 60px;
  text-align: center;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
  width: 26rem;
}

.primary-link:hover {
  border-color: var(--card-border-hover);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* The logo, title and tagline of a card, sized as on the reference's Reveal URLs card */
.primary-link .primary-logo {
  border-radius: 1rem;
  display: block;
  height: 5rem;
  margin: 0 auto 1rem;
  width: 5rem;
}

.primary-link .primary-title {
  color: var(--heading);
  display: block;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

.primary-link .primary-subtitle {
  color: var(--muted);
  display: block;
  font-size: 1.1rem;
  font-weight: 400;
  margin: 0;
}

/* Side by side, the cards share their rows, so each logo, title and subtitle starts on the same line however long a title or subtitle is */
@supports (grid-template-rows: subgrid) {
  @media all and (min-width: 920px) {
    .content {
      column-gap: 2rem;
      display: grid;
      grid-template-columns: repeat(2, 26rem);
      row-gap: 0;
    }

    .primary-link {
      display: grid;
      grid-row: span 3;
      grid-template-rows: subgrid;
    }
  }
}

@media all and (max-width: 520px) {
  .primary-link {
    padding: 30px 24px;
  }

  .primary-link .primary-title {
    font-size: 1.6rem;
  }
}

/* The page's one heading is for screen readers only: the cards carry the page */
.visually-hidden {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}
