/* Icarus Tool Portal — Shared Styles
 *
 * Colour palette (Bootstrap 5.3.3 dark theme — data-bs-theme="dark")
 * All combinations verified against WCAG 2.1 SC 1.4.3 (AA ≥4.5:1 normal text, ≥3:1 large/UI).
 *
 * Foreground            Background          Contrast   WCAG
 * --------------------  ------------------  ---------  ----
 * #dee2e6  (body)        #212529  (bg)        ~10.4:1   AA ✓
 * #adb5bd  (muted)       #212529  (bg)         ~5.9:1   AA ✓
 * #ffc107  (warning)     #212529  (bg)         ~8.1:1   AA ✓
 * #6ea8fe  (link)        #212529  (bg)         ~5.4:1   AA ✓
 * #dee2e6  (body)        #2b3035  (tertiary)   ~9.5:1   AA ✓
 * #000000  (btn text)    #ffc107  (btn bg)     ~8.1:1   AA ✓
 * #fff     (skip-link)   #000000  (skip bg)   ~21.0:1   AA ✓
 */

/* ─── Skip link ─────────────────────────────────────────────────────── */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    z-index: 9999;
    padding: 0.5rem 1rem;
    background: #000;
    color: #fff;
    text-decoration: none;
}
.skip-link:focus {
    top: 0;
}

/* ─── Tool cards (landing page) ─────────────────────────────────────── */
.tool-card {
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.tool-card:hover {
    border-color: var(--bs-primary) !important;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}
.tool-card:focus-within {
    border-color: var(--bs-primary) !important;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

/* ─── Hosting payment mount (hosting_pay.js) ────────────────────────── */
/* The PayPal buttons render in a cross-origin iframe whose document is light. The dark
 * theme sets color-scheme: dark on the page, and a browser paints an iframe whose scheme
 * differs from its embedding element's on an opaque white canvas. A light scheme on the
 * mount matches the iframe's, so its canvas stays transparent and the mount's own dark
 * background shows through. */
[data-hosting-pay] {
    color-scheme: light;
    background-color: var(--bs-body-bg);
    border: var(--bs-border-width) solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    padding: 0.75rem;
}
/* Nothing shows before the SDK renders, or when it fails to load (the status line says why). */
[data-hosting-pay]:empty {
    padding: 0;
    border: 0;
}

/* ─── Pay by card (pay_by_card.js, #405) ────────────────────────────── */
/* The hosted card fields under a checkout's PayPal buttons: name and number one to a row,
 * expiry and CVV side by side, then our own button. The field iframes keep PayPal's own input
 * style; the color-scheme rule below keeps their canvas transparent. */
.pay-by-card {
    margin-top: 0.75rem;
}
.pay-by-card .pay-by-card-pair {
    display: flex;
    gap: 0.5rem;
}
.pay-by-card .pay-by-card-pair > .pay-by-card-field {
    flex: 1 1 0;
    min-width: 0;
}
/* The card notice under the "or pay by card" heading (NOTICE in pay_by_card.js): three
 * sentences, so left aligned, where the one-line heading above it is centred; centred lines
 * of uneven length are hard to follow in the narrow premium windows. Small and muted from its
 * classes, as the heading is. */
.pay-by-card .pay-by-card-notice {
    text-align: left;
}
/* PayPal paints its iframes' canvas from the page's color-scheme, a white slab on the dark
 * theme; a light color-scheme keeps it transparent, as [data-hosting-pay] does (#401): the
 * premium places' button containers and each card field. A wallet's button too: Google's
 * personalized button (the buyer's card and its last digits) carries an iframe of its own. */
#paypal-premium-container,
#paypal-button-container,
#gh-paypal-container,
#geomancy-paypal-container,
.pay-by-card .pay-by-card-field,
.pay-by-wallet .pay-by-wallet-button {
    color-scheme: light;
}

/* ─── Pay by wallet (pay_by_wallet.js, #406) ────────────────────────── */
/* Google Pay (and Apple Pay) between a checkout's PayPal buttons and the card block: one
 * full-width button to a row, at the page's button height (set on each row by the script),
 * a small gap between two. A button is dimmed and takes no clicks while its payment is under
 * way, since Google's button has no disabled state. */
.pay-by-wallet {
    margin-top: 0.75rem;
}
.pay-by-wallet:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.pay-by-wallet .pay-by-wallet-button {
    width: 100%;
}
.pay-by-wallet .pay-by-wallet-off {
    opacity: 0.5;
    pointer-events: none;
}
/* Apple Pay's button is Safari's own (no Apple script), white with the black mark, filling the
 * row. Hidden where the browser has no such button; the script makes it in Safari alone. */
.pay-by-wallet .pay-by-wallet-apple {
    display: none;
}
@supports (-webkit-appearance: -apple-pay-button) {
    .pay-by-wallet .pay-by-wallet-apple {
        display: block;
        width: 100%;
        height: 100%;
        -webkit-appearance: -apple-pay-button;
        -apple-pay-button-type: plain;
        -apple-pay-button-style: white;
    }
}

/* ─── Show / Hide for a secret (hosting overview and settings, #418) ── */
/* Masked until its Show button is pressed, and masked again on every load. The Overview's join
 * password is a <details> and needs no script: open shows the value. A Settings password is a
 * type="password" field in an .input-group; its button's script flips the field to text and
 * sets data-revealed on the group, and the same Show and Hide spans follow. */
.hosting-reveal > summary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    cursor: pointer;
}
.hosting-reveal > summary::-webkit-details-marker {
    display: none;
}
.hosting-reveal[open] .hosting-reveal-mask,
.hosting-reveal[open] .hosting-reveal-show,
.hosting-reveal[data-revealed] .hosting-reveal-show,
.hosting-reveal:not([open]):not([data-revealed]) .hosting-reveal-hide {
    display: none;
}

/* ─── RTFM tab (hosting/rtfm.html, #414) ────────────────────────────── */
/* A mod's manual, rendered from its markdown: the headings a few sizes down from the page's
 * own (h1 at h3's size), the tables as .table .table-sm, code blocks as the console's, and the
 * !!! admonitions a box with a coloured left edge. Bootstrap's variables, so dark mode holds. */
.rtfm h1 {
    font-size: calc(1.3rem + 0.6vw);
}
.rtfm h2 {
    font-size: calc(1.275rem + 0.3vw);
}
@media (min-width: 1200px) {
    .rtfm h1 {
        font-size: 1.75rem;
    }
    .rtfm h2 {
        font-size: 1.5rem;
    }
}
.rtfm h3 {
    font-size: 1.25rem;
}
.rtfm h4 {
    font-size: 1rem;
}
.rtfm h2,
.rtfm h3,
.rtfm h4 {
    margin-top: 1.5rem;
}
.rtfm table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}
.rtfm th,
.rtfm td {
    padding: 0.25rem;
    border-bottom: var(--bs-border-width) solid var(--bs-border-color);
    vertical-align: top;
}
.rtfm pre {
    padding: 0.5rem;
    background-color: var(--bs-tertiary-bg);
    border: var(--bs-border-width) solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    overflow-x: auto;
}
.rtfm code {
    padding: 0.1rem 0.25rem;
    background-color: var(--bs-tertiary-bg);
    border-radius: var(--bs-border-radius-sm);
}
.rtfm pre code {
    padding: 0;
    background-color: transparent;
    border-radius: 0;
}
/* The server's replies the manual quotes. */
.rtfm blockquote {
    padding-left: 0.75rem;
    border-left: 0.25rem solid var(--bs-border-color);
    color: var(--bs-secondary-color);
}
.rtfm .admonition {
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    border: var(--bs-border-width) solid var(--bs-border-color);
    border-left: 0.25rem solid var(--bs-secondary-color);
    border-radius: var(--bs-border-radius);
}
.rtfm .admonition.note {
    border-left-color: var(--bs-info);
}
.rtfm .admonition.tip {
    border-left-color: var(--bs-success);
}
.rtfm .admonition.warning {
    border-left-color: var(--bs-warning);
}
.rtfm .admonition-title {
    margin-bottom: 0.25rem;
    font-weight: 600;
}
.rtfm blockquote > :last-child,
.rtfm .admonition > :last-child {
    margin-bottom: 0;
}

/* A part that fills in after the page is up (hosting/_async.html, portal #419) and its slots
   lay their contents out as if the wrapper were not there, so a part can stand in a grid row
   or a description list. */
[data-async-part] {
    display: contents;
}

/* In a .row the wrapper (a part's or a slot's: both carry data-async-part) is the row's child,
   so what it holds misses Bootstrap's ".row > *" and loses the gutter: the Overview's Power,
   Memory, CPU and Uptime sat 12 px left of Players and Paid through. Its children get the same
   gutter padding and top margin a direct child gets, from the row's own gutter variables. */
.row > [data-async-part] > * {
    padding-right: calc(var(--bs-gutter-x) * .5);
    padding-left: calc(var(--bs-gutter-x) * .5);
    margin-top: var(--bs-gutter-y);
}

/* And the rest of ".row > *" at no weight at all, so a column class (col-sm-4, col-lg-6) still
   sets the width, as it does for a direct child. */
:where(.row > [data-async-part] > *) {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
}
