/*
 * Hydrograf shell chrome, shared by the map and the guide (instrukcja):
 * shell grid, top bar, theme switch (segmented control) and navigation rail.
 * Page stylesheets load after it. Colours and sizes from tokens.css.
 */

.shell {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    grid-template-rows: var(--header-height) minmax(0, 1fr);
    height: 100%;
}

.topbar {
    grid-column: 1 / -1;
    display: flex; align-items: center; gap: var(--space-4);
    padding: 0 var(--space-4) 0 14px;
    min-width: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    z-index: 5;
}
.brand { display: flex; align-items: center; gap: var(--space-2); text-decoration: none; flex: none; }
.brand img { width: 24px; height: 24px; display: block; }
.brand .name { color: var(--tool-hydrograf); font-weight: var(--weight-bold); font-size: var(--text-md); letter-spacing: -0.01em; }
.crumbs { display: flex; align-items: center; gap: var(--space-2); min-width: 0; color: var(--text-3); font-size: var(--text-sm); }
.crumbs .sep { color: var(--line-2); }
.crumbs strong { color: var(--text); font-weight: var(--weight-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); flex: none; }

/* Segmented control (theme switch; map mode toolbar) */
.seg {
    display: inline-flex; gap: 2px; padding: 3px;
    background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-md);
}
.seg button {
    display: inline-flex; align-items: center; gap: 6px;
    height: var(--control-sm); padding: 0 var(--space-3);
    border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-2);
    font: var(--weight-medium) var(--text-sm)/1 var(--font-sans); white-space: nowrap; cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.seg button:hover { color: var(--text); }
.seg button.on, .seg button[aria-pressed="true"], .seg button[aria-checked="true"] {
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
}
.icon-svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.rail {
    grid-row: 2; grid-column: 1;
    display: flex; flex-direction: column; align-items: center; gap: var(--space-1);
    padding: 10px 0;
    min-height: 0; overflow-y: auto; scrollbar-width: none;
    background: var(--rail-bg);
}
.rail-item {
    width: 54px; padding: 9px 0 7px;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    border-radius: var(--radius-md);
    color: var(--rail-ink); text-decoration: none;
    font-size: 10.5px; font-weight: var(--weight-medium); line-height: 1.15; text-align: center;
    transition: background var(--transition), color var(--transition);
}
.rail-item svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rail-item:hover { background: var(--rail-hover); color: var(--rail-ink-active); }
.rail-item.active { background: var(--rail-active); color: var(--rail-ink-active); }
/* The regulamin of a public deployment (DEV-15.7): a small, quiet link at the rail's bottom */
.rail-terms {
    margin-top: auto; padding: var(--space-1) 0;
    color: var(--rail-ink); text-decoration: none;
    font-size: 10.5px; line-height: 1.15;
}
.rail-terms:hover { color: var(--rail-ink-active); text-decoration: underline; }

.main { grid-row: 2; grid-column: 2; min-width: 0; min-height: 0; overflow-y: auto; }

/* ---------- Phone: rail becomes a bottom bar ---------- */
@media (max-width: 860px) {
    .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: 48px minmax(0, 1fr) 58px; }
    .topbar { gap: 10px; padding: 0 10px; }
    .crumbs, .top-actions .label { display: none; }
    .top-actions { gap: var(--space-1); }
    .top-actions .seg button { padding: 0 var(--space-2); }

    .rail {
        grid-row: 3; grid-column: 1;
        flex-direction: row; justify-content: space-around; align-items: center;
        padding: 0 var(--space-1); overflow: visible;
        background: var(--surface); border-top: 1px solid var(--line);
        z-index: 35;
    }
    .rail-item { color: var(--text-2); padding: 6px 0 4px; }
    .rail-item:hover { background: transparent; color: var(--text); }
    .rail-item.active { background: transparent; color: var(--accent); font-weight: var(--weight-bold); }
    .rail-terms { margin-top: 0; color: var(--text-3); }
    .rail-terms:hover { color: var(--text); }
    .main { grid-row: 2; grid-column: 1; }
}
