/* ============================================================
   Gelato Maestro Help — Shared Stylesheet
   Works in Apple Help Viewer AND standalone browsers.
   ============================================================ */

:root {
    --text-primary:     #1d1d1f;
    --text-secondary:   #6e6e73;
    --bg-page:          #ffffff;
    --bg-card:          #f5f5f7;
    --bg-code:          #f0f0f2;
    --border:           #d2d2d7;
    --accent:           #6f8a39; /* Gelato Maestro olive green */
    --accent-hover:     #5b7330;
    --kbd-bg:           #e8e8ed;
    --kbd-border:       #c6c6cb;
    --kbd-shadow:       #b0b0b5;
    --table-stripe:     #fafafc;
    --callout-bg:       #f0f5e3;
    --callout-border:   #6f8a39;
    --tip-bg:           #e8f1d8;
    --tip-border:       #4f7a1c;
    --warning-bg:       #fff8ee;
    --warning-border:   #ff9500;
}

@media (prefers-color-scheme: dark) {
    :root {
        --text-primary:     #f5f5f7;
        --text-secondary:   #a1a1a6;
        --bg-page:          #1c1c1e;
        --bg-card:          #2c2c2e;
        --bg-code:          #2c2c2e;
        --border:           #3a3a3c;
        --accent:           #b4d264;
        --accent-hover:     #c6df85;
        --kbd-bg:           #3a3a3c;
        --kbd-border:       #545458;
        --kbd-shadow:       #1c1c1e;
        --table-stripe:     #252528;
        --callout-bg:       #2a3318;
        --callout-border:   #b4d264;
        --tip-bg:           #1f2e0f;
        --tip-border:       #a3c14f;
        --warning-bg:       #3a2e1a;
        --warning-border:   #ff9f0a;
    }
}

/* === Base === */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
                 "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.62;
    color: var(--text-primary);
    background-color: var(--bg-page);
    padding: 24px 32px;
    max-width: 760px;
    margin: 0 auto;
    -webkit-font-smoothing: antialiased;
}

/* === Typography === */

h1 {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin-bottom: 12px;
    line-height: 1.2;
}

.subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

h2 {
    font-size: 22px;
    font-weight: 600;
    margin-top: 34px;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 17px;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 6px;
}

h4 {
    font-size: 15px;
    font-weight: 600;
    margin-top: 18px;
    margin-bottom: 4px;
}

p { margin-bottom: 14px; }

/* === Links === */

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* === Lists === */

ul, ol { margin: 8px 0 14px 24px; }
li { margin-bottom: 6px; }

/* === Keyboard Shortcuts === */

kbd {
    display: inline-block;
    padding: 2px 7px;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-primary);
    background: var(--kbd-bg);
    border: 1px solid var(--kbd-border);
    border-radius: 5px;
    box-shadow: 0 1px 0 var(--kbd-shadow);
    white-space: nowrap;
}

/* === Code === */

code {
    font-family: "SF Mono", Menlo, monospace;
    font-size: 13px;
    background: var(--bg-code);
    padding: 2px 6px;
    border-radius: 4px;
}

/* === Tables === */

table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0 20px;
    font-size: 14px;
    table-layout: fixed;
}

th, td {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    overflow-wrap: break-word;
}

th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

tr:nth-child(even) { background: var(--table-stripe); }

/* === Callout boxes === */

.callout {
    background: var(--callout-bg);
    border-left: 3px solid var(--callout-border);
    padding: 12px 16px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
}

.callout.tip {
    background: var(--tip-bg);
    border-left-color: var(--tip-border);
}

.callout.warning {
    background: var(--warning-bg);
    border-left-color: var(--warning-border);
}

.callout strong { display: block; margin-bottom: 4px; }
.callout strong.inline { display: inline; margin: 0; }

.callout::before {
    content: "";
    display: inline-block;
}

.callout.tip strong:first-child::before { content: "💡 "; }
.callout.warning strong:first-child::before { content: "⚠️ "; }

/* === Cards === */

.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px 20px;
    margin: 16px 0;
}

/* === Steps === */

.steps {
    counter-reset: step-counter;
    list-style: none;
    margin-left: 0;
    padding-left: 0;
}

.steps li {
    counter-increment: step-counter;
    padding-left: 36px;
    position: relative;
    margin-bottom: 14px;
}

.steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0; top: 0;
    width: 24px; height: 24px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 600;
    line-height: 24px;
    text-align: center;
}

/* === Topic grid (index page) === */

.topic-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 20px 0;
}

.topic-grid a {
    display: block;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 14px 16px;
    text-decoration: none;
    transition: background 0.15s;
}

.topic-grid a:hover {
    background: var(--kbd-bg);
    text-decoration: none;
}

.topic-grid .topic-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--accent);
    margin-bottom: 4px;
}

.topic-grid .topic-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* === Back button (page nav) === */

.breadcrumb {
    margin-bottom: 18px;
}

.breadcrumb a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px 6px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.breadcrumb a:hover {
    background: var(--kbd-bg);
    color: var(--accent-hover);
    text-decoration: none;
}

.breadcrumb a::before {
    content: "\2039"; /* ‹ */
    font-size: 18px;
    line-height: 1;
    margin-right: 2px;
}

/* === Images === */

img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* === Screenshot figures === */

figure {
    margin: 18px 0;
    text-align: center;
}

figure img {
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    max-width: 100%;
    border: 1px solid var(--border);
}

@media (prefers-color-scheme: dark) {
    figure img {
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    }
}

figcaption {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.shot-sm img { max-width: 320px; }
.shot-md img { max-width: 460px; }
.shot-lg img { max-width: 680px; }

/* === Icon row (for inline KPI/feature explainers) === */

.icon-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-card);
    border-radius: 10px;
    margin: 12px 0;
}

.icon-row img {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 0;
    box-shadow: none;
    flex-shrink: 0;
}

.icon-row .icon-row-body { flex: 1; }
.icon-row .icon-row-body strong { display: block; margin-bottom: 2px; }
.icon-row .icon-row-body p { margin: 0; font-size: 13px; color: var(--text-secondary); }

/* === Inline badges === */

.badge {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    gap: 4px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.badge-mode { background: rgba(111,138,57,0.12); color: var(--accent); border-color: var(--accent); }

/* === Footer === */

.help-footer {
    margin-top: 44px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

/* === Responsive === */

@media (max-width: 720px) {
    body { padding: 18px; max-width: 100%; }
    .topic-grid { grid-template-columns: 1fr; }
    h1 { font-size: 26px; }
    th:first-child, td:first-child { max-width: 40%; }
}
