/* Goobi-to-go shared design tokens and components.
 *
 * Loaded by the guide (through docs.css), the start page and the file pages, so
 * all three read as one product -- and as part of Goobi: the look is the new
 * Goobi workflow UI's (goobi-ui), which is Tabler 1.6 without a theme of its
 * own. Tabler itself is not loaded; its values are copied below, under the
 * names goobi-ui themes with (--gw-*), so a later theme has one place to go.
 * That means: the system font at 14 px, a light grey page, white cards with a
 * thin border and a faint shadow, 6/8 px radii, one blue for the primary
 * action, status as a tinted badge with a dot.
 *
 * The --doc-* names the pages were written against stay, pointed at the
 * --gw-* tokens. Classes are prefixed `g2g-` to stay clear of main.css, uikit
 * and the guide's own `tm-` vocabulary.
 */

:root {
    /* One duration and one curve for every transition: whatever moves, moves
       alike. */
    --ease: cubic-bezier(.4, 0, .2, 1);
    --dur: 200ms;
    --dur-slow: 400ms;

    /* goobi-ui's packages/ui/src/styles/goobi.css: neutral greys (chroma 0)
       and Tabler's colours. */
    --gw-gray-50: #fafafa;
    --gw-gray-100: #f5f5f5;
    --gw-gray-200: #e5e5e5;
    --gw-gray-300: #d4d4d4;
    --gw-gray-500: #737373;
    --gw-gray-700: #404040;
    --gw-gray-900: #171717;
    /* Tabler's blue, goobi-ui's --gw-primary. White on it is 5.2:1, so it
       carries text in buttons and serves as link colour on white (5.2:1) and
       on the grey page (5.0:1). */
    --gw-primary: #066fd1;
    --gw-primary-hover: #0563bc;
    --gw-primary-lt: #e6f1fa;
    --gw-body-bg: var(--gw-gray-50);
    --gw-surface: #fff;
    --gw-border: var(--gw-gray-200);
    --gw-text: var(--gw-gray-700);
    --gw-heading: var(--gw-gray-900);
    --gw-muted: var(--gw-gray-500);
    /* Status: Tabler green, yellow, red. The *-text values are darkened to
       4.5:1 on the matching *-lt tint, as goobi-ui's --gw-text-* tokens do. */
    --gw-green: #2fb344;
    --gw-green-lt: #eaf7ec;
    --gw-green-text: #1c6e2a;
    --gw-yellow: #f59f00;
    --gw-yellow-lt: #fef5e6;
    --gw-yellow-text: #7a4f00;
    --gw-red: #d63939;
    --gw-red-lt: #fbebeb;
    --gw-red-text: #a82525;
    --gw-radius-sm: 4px;
    --gw-radius: 6px;
    --gw-radius-lg: 8px;
    --gw-shadow: rgba(23, 23, 23, .04) 0 2px 4px 0;
    --gw-shadow-hover: rgba(23, 23, 23, .16) 0 2px 16px 0;
    --gw-font: -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    --gw-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

    /* The names the pages use. */
    --doc-ground: var(--gw-body-bg);
    --doc-ink: var(--gw-text);
    --doc-muted: var(--gw-muted);
    --doc-faint: var(--gw-muted);
    --doc-line: var(--gw-border);
    --doc-surface: var(--gw-surface);
    --doc-surface-2: var(--gw-gray-50);
    --doc-accent: var(--gw-primary);
    --doc-link: var(--gw-primary);
    --topbar-ground: var(--gw-surface);
    --topbar-ink: var(--gw-heading);
    --ok: var(--gw-green);
    --ok-bg: var(--gw-green-lt);
    --ok-ink: var(--gw-green-text);
    --note: var(--gw-yellow);
    --note-bg: var(--gw-yellow-lt);
    --note-ink: var(--gw-yellow-text);
    --danger: var(--gw-red);
    --danger-ink: var(--gw-red-text);
    --danger-bg: var(--gw-red-lt);
    --danger-deep: #8f1f1f;
    --tip: var(--gw-primary);
    --tip-bg: var(--gw-primary-lt);
    --tip-ink: var(--gw-primary);

    --f-head: var(--gw-font);
    --f-body: var(--gw-font);
}


/* ---------- Top bar: white, a line below, like goobi-ui's header ---------- */

.g2g-bar {
    height: 56px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 24px;
    background: var(--topbar-ground);
    color: var(--topbar-ink);
    border-bottom: 1px solid var(--gw-border);
    font-family: var(--gw-font);
    font-size: 14px;
    line-height: 1.4286;
    letter-spacing: normal;
}

/* The lockup: a blue tile with white eyes and the name beside it, both one
   link to the start page. Defined here once: the start page and file pages
   link this file, and docs.css imports it, so all three bars share it. */
.g2g-brand {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 4px 4px;
    border-radius: var(--gw-radius);
    color: var(--gw-heading);
    text-decoration: none;
}

/* uikit's `a:hover` would recolour the name. */
.g2g-brand:hover,
.g2g-brand:focus-visible { color: var(--gw-heading); text-decoration: none; }
.g2g-brand:hover { background: var(--gw-gray-100); }
.g2g-brand:focus-visible { outline: 2px solid var(--gw-primary); outline-offset: 2px; }

.g2g-brand-tile {
    flex: none;
    box-sizing: border-box;
    width: 40px;
    height: 28px;
    border-radius: var(--gw-radius);
    background: var(--gw-primary);
    display: grid;
    place-items: center;
}

/* The eyes are a mask, not an image: the file pages may load only img/*.png
   through __g2g, and inline SVG would copy the long path into every template.
   `#`, `<` and `>` are percent-encoded. Held in one property so the prefixed
   and the plain mask share a single copy. */
.g2g-brand-tile { --g2g-eyes: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 169 98'%3E%3Cpath transform='translate(-580.38 55.21)' d='M668.137-20.166a88.893,88.893,0,0,1,6-11.875,43.97,43.97,0,0,1,7.96-9.787,34.134,34.134,0,0,1,10.44-6.526,36.763,36.763,0,0,1,13.7-2.348,41.466,41.466,0,0,1,14.747,2.61,33.174,33.174,0,0,1,12.136,7.96,37.792,37.792,0,0,1,8.222,13.442,55.688,55.688,0,0,1,3,19.314,52.839,52.839,0,0,1-3.394,19.705,42.8,42.8,0,0,1-9,14.225,36.646,36.646,0,0,1-12.92,8.613,41.707,41.707,0,0,1-15.4,2.871q-14.356,0-24.013-7.309T660.567,6.979q-2.874,6.006-6.132,11.614a48.21,48.21,0,0,1-7.57,9.918,34.434,34.434,0,0,1-9.918,6.917,30.978,30.978,0,0,1-13.18,2.61,41.382,41.382,0,0,1-14.746-2.61,33.8,33.8,0,0,1-12.137-7.83,37.6,37.6,0,0,1-8.353-13.442,55.4,55.4,0,0,1-3.132-19.7,53.569,53.569,0,0,1,3.394-19.967,41.308,41.308,0,0,1,9-14.094,35.928,35.928,0,0,1,12.92-8.352,42.754,42.754,0,0,1,15.137-2.74A45.33,45.33,0,0,1,639.3-48.875a36.422,36.422,0,0,1,10.832,5.48,44.17,44.17,0,0,1,9.266,9.527A140.685,140.685,0,0,1,668.137-20.166ZM655.608-.59q-9.395-16.18-16.7-23.491a23.87,23.87,0,0,0-17.486-7.307q-10.443,0-17.356,6.394T597.145-7.637a27.637,27.637,0,0,0,2.218,11.614A23.924,23.924,0,0,0,605.5,12.2a24.472,24.472,0,0,0,9.135,4.959,37.931,37.931,0,0,0,10.962,1.566q11.481,0,18.139-5.09A46.772,46.772,0,0,0,655.608-.59ZM672.835-12.6q4.954,7.572,8.873,13.441a69.83,69.83,0,0,0,7.7,9.788,29.415,29.415,0,0,0,7.96,6,20.677,20.677,0,0,0,9.4,2.088,28.175,28.175,0,0,0,9.657-1.7,27.994,27.994,0,0,0,8.351-4.7,23.4,23.4,0,0,0,5.873-7.177,19.736,19.736,0,0,0,2.218-9.4,29.486,29.486,0,0,0-2.348-12.4,23.52,23.52,0,0,0-6.265-8.352,25.733,25.733,0,0,0-9-4.828,36.654,36.654,0,0,0-10.832-1.566q-11.224,0-18.661,4.828A41.967,41.967,0,0,0,672.835-12.6Z'/%3E%3C/svg%3E"); }

.g2g-brand-tile::before {
    content: "";
    width: 28px;
    height: 17px;
    background: #fff;
    -webkit-mask: var(--g2g-eyes) center / contain no-repeat;
    mask: var(--g2g-eyes) center / contain no-repeat;
}

.g2g-brand-name {
    font-family: var(--gw-font);
    font-weight: 600;
    font-size: 16px;
    line-height: 1.2;
    white-space: nowrap;
}

/* Forced colours drop backgrounds and masks' colour: keep the tile findable and
   the eyes visible. */
@media (forced-colors: active) {
    .g2g-brand-tile { border: 1px solid CanvasText; }
    .g2g-brand-tile::before { background: CanvasText; }
}

/* Tabler's horizontal navbar: grey links, the current one blue with a line
   along the bottom edge of the bar. */
.g2g-bar-nav { margin-left: auto; align-self: stretch; display: flex; align-items: stretch; gap: 0; }

/* Start alone is no choice: a package built without guide, samples and import
   folder, and the file pages, show no links at all. */
.g2g-bar-nav:not(:has(a ~ a)) { display: none; }

.g2g-bar-nav a {
    display: flex;
    align-items: center;
    box-sizing: border-box;
    padding: 0 12px;
    border-bottom: 2px solid transparent;
    color: var(--gw-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
}

.g2g-bar-nav a:hover { color: var(--gw-heading); text-decoration: none; }
.g2g-bar-nav a[aria-current] { color: var(--gw-primary); border-bottom-color: var(--gw-primary); }

/* A tab whose service is down (start.js): faded, and not followed. */
.g2g-bar-nav a[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.g2g-bar-nav a[aria-disabled="true"]:hover { color: var(--gw-muted); }

.g2g-bar-nav a:focus-visible { outline: 2px solid var(--gw-primary); outline-offset: -2px; }

/* On a phone the links scroll inside the bar, not the page. */
@media (max-width: 700px) {
    .g2g-bar { padding: 0 16px; gap: 12px; }
    .g2g-brand-name { font-size: 15px; }
    .g2g-bar-nav { min-width: 0; overflow-x: auto; }
    .g2g-bar-nav a { padding: 0 8px; white-space: nowrap; }
}

/* ---------- Buttons: Tabler's btn-primary and btn ---------- */

.g2g-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    min-height: 36px;
    padding: 0 16px;
    background: var(--gw-primary);
    color: #fff;
    text-decoration: none;
    font-family: var(--gw-font);
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4286;
    border: 1px solid transparent;
    border-radius: var(--gw-radius);
    box-shadow: var(--gw-shadow);
    cursor: pointer;
}

.g2g-btn:hover { background: var(--gw-primary-hover); color: #fff; text-decoration: none; }
.g2g-btn[aria-disabled="true"] {
    background: var(--gw-gray-100);
    border-color: var(--gw-border);
    color: var(--gw-muted);
    box-shadow: none;
    cursor: not-allowed;
}

.g2g-btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    min-height: 36px;
    padding: 0 16px;
    background: var(--gw-surface);
    color: var(--gw-text);
    text-decoration: none;
    font-family: var(--gw-font);
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4286;
    border: 1px solid var(--gw-border);
    border-radius: var(--gw-radius);
    box-shadow: var(--gw-shadow);
    cursor: pointer;
}

.g2g-btn-ghost:hover { border-color: var(--gw-gray-300); background: var(--gw-gray-50); color: var(--gw-heading); text-decoration: none; }
.g2g-btn-ghost[aria-expanded="true"] { border-color: var(--gw-primary); color: var(--gw-primary); }

.g2g-btn:focus-visible,
.g2g-btn-ghost:focus-visible,
.g2g-pill:focus-visible,
.g2g-copy:focus-visible {
    outline: 2px solid var(--gw-primary);
    outline-offset: 2px;
}

/* ---------- Status: a dot and a muted word ---------- */

.g2g-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    color: var(--gw-muted);
}

.g2g-status::before {
    content: "";
    flex: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gw-gray-500);
}

.g2g-status.is-ok::before { background: var(--gw-green); }
.g2g-status.is-wait::before { background: var(--gw-yellow); }
.g2g-status.is-down { color: var(--gw-red-text); }
.g2g-status.is-down::before { background: var(--gw-red); }

/* ---------- Pill: one choice of a few, Tabler's small button ---------- */

.g2g-pill {
    padding: 2px 8px;
    background: var(--gw-surface);
    color: var(--gw-text);
    font: inherit;
    font-weight: 500;
    font-size: 12px;
    line-height: 20px;
    border: 1px solid var(--gw-border);
    border-radius: var(--gw-radius);
    cursor: pointer;
}

.g2g-pill:hover { background: var(--gw-gray-50); border-color: var(--gw-gray-300); }

.g2g-pill[aria-pressed="true"] {
    background: var(--gw-primary-lt);
    color: var(--gw-primary);
    border-color: var(--gw-primary);
}

/* ---------- Field: a label above a read-only, flat input with a copy button ---------- */

.g2g-field { display: grid; gap: 6px; min-width: 0; }

.g2g-field label { font-size: 14px; font-weight: 500; color: var(--gw-heading); }

.g2g-field-value {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    height: 36px;
    box-sizing: border-box;
    padding: 0 4px 0 12px;
    background: var(--gw-gray-50);
    border: 1px solid var(--gw-border);
    border-radius: var(--gw-radius);
}

.g2g-field-value code {
    flex: 1;
    min-width: 0;
    font-family: var(--gw-mono);
    font-size: 13px;
    color: var(--gw-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.g2g-copy {
    flex: none;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: var(--gw-radius);
    background: transparent;
    color: var(--gw-muted);
    cursor: pointer;
}

.g2g-copy:hover { background: var(--gw-gray-100); color: var(--gw-heading); }
.g2g-copy.is-done { color: var(--gw-green-text); }
.g2g-copy svg { width: 16px; height: 16px; }
