/*
+------------------------------------------------------+
|  MODULE:   SEO STACK / LANDING                       |
|  LOADS:    landing/index.html, the apex's one page   |
|  CONTAINS: layer order, the fonts and tokens the     |
|            page uses (copied from the app's base.css |
|            value for value, held level by a test),   |
|            reset, grain, topbar, brand, pill, button,|
|            the frame, the hero, the three check      |
|            cards with the app's boards as images,    |
|            the join block, the footer                |
|  LOOK:     the app at my.seostack.app, token for     |
|            token; the dark theme only                |
|  RULES:    pvc-css-rules, references/house-rules.md  |
+------------------------------------------------------+
*/

/* The order of the layers. A later layer wins over an earlier one,
   whatever the selectors are. Every rule below sits inside a layer. */
@layer tokens, base, components, utilities;

/*
  BREAKPOINTS: mobile first, min-width, in rem, the app's.
    narrow    38rem      608px, the frame gets its border and shadow
    row       42rem      672px, a check is a row: the drawing beside its words
    three     60rem      960px, the three checks across
*/

/* +------------------------------------------------------+ */
/* |  FONTS: self-hosted from fonts/, no font CDN         | */
/* |  IBM Plex Sans and JetBrains Mono, both SIL Open     | */
/* |  Font License (OFL.txt beside them)                  | */
/* +------------------------------------------------------+ */
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/IBMPlexSans-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/IBMPlexSans-Bold.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-v24-latin_latin-ext-500.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-v24-latin_latin-ext-700.woff2") format("woff2");
}

/* +------------------------------------------------------+ */
/* |  LAYER: TOKENS (the app's values, the ones in use)   | */
/* +------------------------------------------------------+ */
@layer tokens {
  :root {
    color-scheme: dark;

    /* Primitives: the five PVC stripe colours. */
    --color-orange: #e8752a;
    --color-amber: #dfa05d;
    --color-teal: #3aafa9;
    --color-green: #658761;
    --color-coral: #ac5045;
    --color-blue: #7aa2f7; /* the terminal's blue, the x of max; the O of SEO */
    --color-lime: #d5ff3f; /* the quota board's Unlimited ring; a perfect score */
    --color-leaf: #9ece6a; /* the quota board's theme green; a good score, 90 to 99 */
    /* the three letters of SEO, the terminal's colours of "max" */
    --brand-s: var(--color-coral);
    --brand-e: var(--color-amber);
    --brand-o: var(--color-blue);

    /* Roles. The names stay the same on every PVC project. */
    --bg-primary: #0a0a0a;
    --bg-surface: #141414;
    --bg-card: #1a1a1a;
    --bg-elevated: #222222;

    --text-primary: #f0e6d3;
    --text-secondary: #8a8278;
    --text-muted: #5a5650;
    --text-on-accent: #0a0a0a;

    --border-color: #2a2a2a;
    --border-hover: #3a3a3a;

    --accent: var(--color-orange);
    --accent-hover: #ed874c;

    --font-heading: "IBM Plex Sans", system-ui, sans-serif;
    --font-body: "IBM Plex Sans", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

    /* Type scale, the documentation assistant's steps. */
    --fs-xs: 0.75rem;
    --fs-sm: 0.8125rem;
    --fs-base: 0.875rem;
    --fs-md: 1rem;
    --fs-lg: 1.125rem;
    --fs-xl: 1.375rem;
    --fs-2xl: 1.75rem;

    --r-sm: 0.375rem;
    --r-md: 0.625rem;
    --r-lg: 0.875rem;
    --r-xl: 1.375rem;

    --container: 100rem;
    --container-padding: 1.75rem;
    --header-h: 4.25rem;

    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --transition: 0.2s var(--ease);

    --z-below: -1;
    --z-header: 40;
    --z-toast: 300;

    /* Project tokens, after the house list. */
    --r-pill: 62.4375rem;
    --frame-w: 58rem;
    --gutter: 1rem;

    --text-accent: #e8752a;
    --accent-strong: #e8752a;
    --on-orange: #0a0a0a;
    --shine: rgba(255, 255, 255, 0.32);

    /* the mixed colours as literal values */
    --topbar-bg: rgba(10, 10, 10, 0.85);
    --frame-ring: rgba(232, 117, 42, 0.1);
    --frame-shadow: 0 2.5rem 5rem -1rem rgba(0, 0, 0, 0.7);
    --page-glow: rgba(232, 117, 42, 0.06);
    --grain-opacity: 0.09;
  }
}

/* keyframes sit outside the layers; the checker leaves them alone */
@keyframes frame-spring {
  0% {
    opacity: 0;
    transform: translateY(1.25rem) scale(0.985);
  }

  60% {
    opacity: 1;
    transform: translateY(-0.125rem) scale(1.003);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* +------------------------------------------------------+ */
/* |  LAYER: BASE (reset and elements, the app's)         | */
/* +------------------------------------------------------+ */
@layer base {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  html {
    font-size: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
  }

  /* the page background stays on body, never on html, so it keeps propagating
     to the canvas under the grain */
  body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: var(--fs-md);
    line-height: 1.55;
    overflow-wrap: break-word;
    font-variant-ligatures: none;
    -webkit-font-smoothing: antialiased;
  }

  /* film grain, under the content */
  body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: var(--z-below);
    pointer-events: none;
    opacity: var(--grain-opacity);
    background-image: url("data:image/svg+xml,%3Csvg width='240' height='240' viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 15rem 15rem;
  }

  main {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  h1,
  h2 {
    line-height: 1.25;
    font-weight: 700;
  }

  p {
    margin: 0;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  /* the accent word of a title keeps its colour and drops the slant: the page
     serves no italic face, and a browser-made slant is not a typeface */
  em {
    font-style: normal;
    color: var(--accent-strong);
  }

  svg {
    max-width: 100%;
  }

  :focus-visible {
    outline: 0.125rem solid var(--accent-strong);
    outline-offset: 0.125rem;
  }
}

/* +------------------------------------------------------+ */
/* |  LAYER: COMPONENTS                                   | */
/* +------------------------------------------------------+ */
@layer components {
  /* ---- small parts ---- */
  .skip-link {
    position: absolute;
    top: -6.25rem;
    left: var(--gutter);
    z-index: var(--z-toast);
    padding: 0.5rem 0.75rem;
    border-radius: var(--r-sm);
    background: var(--bg-elevated);
    color: var(--text-accent);
    font-size: var(--fs-base);
  }

  .skip-link:focus {
    top: 0.5rem;
  }

  /* ---- the topbar, the app's ---- */
  .topbar {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    height: var(--header-h);
    background: var(--topbar-bg);
    backdrop-filter: saturate(160%) blur(0.875rem);
    -webkit-backdrop-filter: saturate(160%) blur(0.875rem);
    border-bottom: 0.0625rem solid var(--border-color);
    overflow-x: clip;
  }

  .topbar__inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    height: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--gutter);
  }

  .topbar__inner > * {
    min-width: 0;
  }

  .topbar__middle {
    min-height: 0.0625rem;
  }

  /* the Log in pill at the bar's end */
  .topbar__login {
    justify-self: end;
  }

  .brand {
    display: inline-flex;
    align-items: center;
    gap: 0.875rem;
    justify-self: start;
    border-radius: var(--r-sm);
  }

  .brand__mark {
    display: block;
    height: 1.375rem;
    width: auto;
    flex: none;
  }

  /* the quarter pixel up on the mark and the half pixel down on the name that read level
     at seven zooms in the app (the note in base.css) */
  .topbar .brand__mark {
    position: relative;
    top: -0.015625rem;
  }

  /* the three letters of SEO in the terminal's three colours of "max": coral, amber, blue */
  .brand__s {
    color: var(--brand-s);
  }

  .brand__e {
    color: var(--brand-e);
  }

  .brand__o {
    color: var(--brand-o);
  }

  .brand__name {
    font-family: var(--font-mono);
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.08em;
    word-spacing: -0.2em;
    text-transform: uppercase;
    color: var(--text-secondary);
    white-space: nowrap;
  }

  .topbar .brand__name {
    position: relative;
    top: 0.03125rem;
  }

  /* ---- the pill, the app's ---- */
  .pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2rem;
    padding: 0.375rem 0.875rem;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 0.0625rem solid var(--border-color);
    border-radius: 999rem;
    cursor: pointer;
    transition: color 150ms var(--ease), border-color 150ms var(--ease), background 150ms var(--ease);
  }

  .pill:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
  }

  /* ---- the primary button, the app's ---- */
  .button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.75rem 1.125rem;
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.04em;
    color: var(--on-orange);
    background: var(--color-orange);
    border: 0.0625rem solid var(--color-orange);
    border-radius: var(--r-sm);
    transition: background 150ms var(--ease), transform 100ms var(--ease);
  }

  .button:hover {
    background: var(--accent-hover);
  }

  .button:active {
    transform: translateY(0.0625rem);
  }

  /* the shine belongs to the primary button only */
  .button::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, transparent 0%, var(--shine) 50%, transparent 100%);
    transform: skewX(-20deg);
    transition: left 450ms ease-in-out;
    pointer-events: none;
  }

  .button:hover::before {
    left: 100%;
  }

  /* ---- the frame: one framed column, the app's ---- */
  .app-wrap {
    position: relative;
    padding: 0.5rem 0 2rem;
    overflow-x: clip;
  }

  /* a faint orange glow behind the frame's top */
  .app-wrap::before {
    content: "";
    position: absolute;
    inset: -2rem -2.5rem;
    pointer-events: none;
    background: radial-gradient(55rem 36rem at 50% -8%, var(--page-glow), transparent 60%);
    opacity: 0.6;
  }

  .app-frame {
    position: relative;
    max-width: var(--frame-w);
    margin: 0 auto;
    background: var(--bg-surface);
    border: 0;
    border-radius: 0;
    animation: frame-spring 0.42s var(--ease) both;
  }

  .app-body {
    display: flex;
    flex-direction: column;
    padding: 1rem var(--gutter);
  }

  /* the landing frame is wider than the app's (three boards across at a readable size) and sits
     centred in the room between the bar and the footer (auto margins on the flex column, which
     fall to zero when a short screen cannot hold it, so nothing is cut), so on a desktop screen
     the whole page shows without a scroll */
  .app-frame--landing {
    max-width: 76rem;
  }

  .app-wrap--landing {
    margin-top: auto;
    margin-bottom: auto;
  }

  .page-title {
    margin-bottom: 0;
    font-family: var(--font-heading);
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text-primary);
  }

  /* ---- the hero: the title with its one orange word, one line under it, centred ---- */
  .hero {
    margin: 0.25rem 0 1.25rem;
    text-align: center;
  }

  .hero__title {
    font-size: clamp(2rem, 4.5vw, 3rem);
  }

  .hero__line {
    max-width: 60rem;
    margin: 0.75rem auto 0;
    font-size: var(--fs-lg);
    line-height: 1.55;
    color: var(--text-secondary);
  }

  /* ---- the three checks: a card each with its drawing, its name and two lines ---- */
  .checks {
    display: grid;
    gap: 1.25rem;
    padding-left: 0;
    list-style: none;
  }

  .check {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-card);
    border: 0.0625rem solid var(--border-color);
    border-radius: var(--r-xl);
  }

  /* the board's picture fills the card's top (a 800 by 700 shot of the app's own board, so the
     card's colour behind it is the board's); the image keeps its shape at any width */
  .check__figure {
    margin: 0;
    overflow: hidden;
    background: var(--bg-card);
    border-bottom: 0.0625rem solid var(--border-color);
  }

  .check__image {
    display: block;
    width: 100%;
    height: auto;
  }

  .check__words {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.875rem 1.125rem 1.125rem;
  }

  .check__title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: var(--fs-xl);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
  }

  .check__text {
    margin: 0;
    font-size: var(--fs-base);
    line-height: 1.5;
    color: var(--text-secondary);
  }

  /* ---- the join block: one line and the one button, centred ---- */
  .join {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 0.75rem 1.5rem;
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    text-align: center;
    background: var(--bg-card);
    border: 0.0625rem solid var(--border-color);
    border-radius: var(--r-xl);
  }

  .join__line {
    margin: 0;
    line-height: 1.55;
    color: var(--text-secondary);
  }

  .join__button {
    min-height: 3rem;
    padding: 0.875rem 1.5rem;
    font-size: var(--fs-base);
  }

  /* ---- the footer, in the mono face, as the mails end ---- */
  .foot {
    padding: 0 var(--gutter) 2rem;
    text-align: center;
  }

  .foot__line {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
  }

  /* ---- wider screens ---- */
  @media (min-width: 38rem) {
    .topbar__inner {
      gap: 1.75rem;
      padding: 0 var(--container-padding);
    }

    .app-wrap--landing {
      padding: 2.5rem 1.25rem;
    }

    .app-frame {
      border: 0.0625rem solid var(--border-hover);
      border-radius: 1.875rem;
      box-shadow: var(--frame-shadow), 0 0 0 0.0625rem var(--frame-ring);
    }

    .app-body {
      padding: 1.25rem 1.375rem 1.625rem;
    }

    .hero {
      margin: 0.5rem 0 1.5rem;
    }
  }

  /* from 42rem each check is a row: the drawing on the left half, the name and its line centred
     on it at the right */
  @media (min-width: 42rem) {
    .check {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      align-items: center;
    }

    .check__figure {
      align-self: stretch;
      border-right: 0.0625rem solid var(--border-color);
      border-bottom: 0;
    }

    .check__words {
      padding: 1rem 1.25rem;
    }
  }

  /* three across from 60rem, where the frame is wide enough for three drawings of a readable
     size, so the page fits one desktop screen; the checks go back to columns */
  @media (min-width: 60rem) {
    .checks {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .check {
      display: flex;
      align-items: stretch;
    }

    .check__figure {
      border-right: 0;
      border-bottom: 0.0625rem solid var(--border-color);
    }

    .check__words {
      padding: 0.875rem 1.125rem 1.125rem;
    }
  }
}

/* +------------------------------------------------------+ */
/* |  LAYER: UTILITIES (win over components)              | */
/* +------------------------------------------------------+ */
@layer utilities {
  [hidden] {
    display: none;
  }
}
