/*
 * The studio's calm look: the system font, a grey window ground with white groups on it,
 * hairlines instead of frames, a translucent bar, tabs as segmented controls and quiet tags.
 * Everything is under html.pd-look-calm, set on every studio page; html.pd-look-sidebar is
 * added for those who chose the areas in a sidebar (users.studio_navigation). Never a narrow column.
 */

html.pd-look-calm {
    --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
}

html.pd-look-calm .fi-body {
    --pd-canvas: #f5f5f7;
    --pd-ground: #f5f5f7;
    --pd-panel: #ffffff;
    --pd-well: #fafafb;
    --pd-line: rgb(0 0 0 / 0.08);
    --pd-line-strong: rgb(0 0 0 / 0.14);
    --pd-soft: rgb(118 118 128 / 0.12);
    --pd-radius: 10px;
    --pd-radius-sm: 7px;
    --pd-radius-window: 12px;
    --pd-shadow: 0 1px 1px rgb(0 0 0 / 0.04), 0 0 0 0.5px rgb(0 0 0 / 0.04);
    --pd-shadow-hover: 0 8px 24px -12px rgb(0 0 0 / 0.25);
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
}

html.pd-look-calm.dark .fi-body {
    --pd-canvas: #1c1c1e;
    --pd-ground: #1c1c1e;
    --pd-panel: #2c2c2e;
    --pd-well: rgb(255 255 255 / 0.03);
    --pd-line: rgb(255 255 255 / 0.09);
    --pd-line-strong: rgb(255 255 255 / 0.16);
    --pd-soft: rgb(118 118 128 / 0.24);
    --pd-shadow: 0 0 0 0.5px rgb(255 255 255 / 0.06);
}

/* The Light Table inside the studio takes the same ground and lines. */
html.pd-look-calm .pw {
    --pw-bg: var(--pd-canvas);
    --pw-surface: var(--pd-panel);
    --pw-line: var(--pd-line);
}

/* Titles: large and heavy, slightly tightened as they grow. */
html.pd-look-calm .fi-header-heading {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.022em;
}

html.pd-look-calm .pd-job__panel h2,
html.pd-look-calm .pd-today__list h2,
html.pd-look-calm .fi-section-header-heading {
    letter-spacing: -0.01em;
}

/* The bar across the top: translucent, the page runs under it. */
html.pd-look-calm .fi-topbar {
    background: color-mix(in srgb, var(--pd-canvas) 78%, transparent);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 0;
    box-shadow: 0 0.5px 0 var(--pd-line-strong);
}

/* The areas keep their symbols over their names, as in the classic studio: found at a glance. */
html.pd-look-calm .fi-topbar-item.fi-active .fi-topbar-item-btn {
    background: var(--pd-soft);
}

/* Buttons: rounded rectangles, as on the Mac. */
html.pd-look-calm .fi-btn {
    border-radius: 8px;
}

/* Tags: quiet, slightly rounded, not pills. */
html.pd-look-calm .fi-badge,
html.pd-look-calm .pd-board__stage {
    border-radius: 5px;
}

/* Tabs as a segmented control: a grey track, the chosen part lifted on it. Too many for the
   column wrap onto a second line instead of scrolling out of sight. */
html.pd-look-calm .fi-tabs:not(.fi-vertical) {
    display: inline-flex;
    flex-wrap: wrap;
    width: auto;
    max-width: 100%;
    gap: 0;
    padding: 2px;
    border: 0;
    border-radius: 9px;
    background: rgb(118 118 128 / 0.12);
    overflow-x: auto;
}

html.pd-look-calm .fi-tabs:not(.fi-vertical) > .fi-tabs-item {
    padding: 0.3125rem 0.875rem;
    border-radius: 7px;
}

html.pd-look-calm .fi-tabs:not(.fi-vertical) > .fi-tabs-item.fi-active {
    background: var(--pd-panel);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.12), 0 0 0 0.5px rgb(0 0 0 / 0.04);
}

html.pd-look-calm.dark .fi-tabs:not(.fi-vertical) > .fi-tabs-item.fi-active {
    background: rgb(118 118 128 / 0.36);
    box-shadow: none;
}

/* The same for the parts of a job's file. */
html.pd-look-calm .pd-file__parts {
    gap: 0;
    padding: 2px;
    border-radius: 9px;
    background: rgb(118 118 128 / 0.12);
}

html.pd-look-calm .pd-file__parts button {
    border: 0;
    border-radius: 7px;
    color: var(--pd-ink);
}

html.pd-look-calm .pd-file__parts button[aria-pressed="true"] {
    color: var(--pd-ink);
    background: var(--pd-panel);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.12), 0 0 0 0.5px rgb(0 0 0 / 0.04);
}

/* Today: each column a group of rows divided by hairlines, its name small above. */
html.pd-look-calm .pd-today__list {
    gap: 0;
    padding: 6px 0;
}

html.pd-look-calm .pd-today__list h2 {
    padding: 4px 14px 8px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--gray-500);
}

html.pd-look-calm .pd-today__item {
    margin: 0 6px;
    padding: 8px;
    border-radius: 8px;
}

html.pd-look-calm .pd-today__item + .pd-today__item {
    box-shadow: 0 -0.5px 0 var(--pd-line);
}

/* More contrast, when the system asks for it: firmer lines in the calm looks too. */
@media (prefers-contrast: more) {
    html.pd-look-calm .fi-body {
        --pd-line: rgb(0 0 0 / 0.3);
        --pd-line-strong: rgb(0 0 0 / 0.45);
    }

    html.pd-look-calm.dark .fi-body {
        --pd-line: rgb(255 255 255 / 0.35);
        --pd-line-strong: rgb(255 255 255 / 0.5);
    }
}

@media (prefers-reduced-transparency: reduce) {
    html.pd-look-calm .fi-topbar,
    /* No bar across the top: what sticks starts at the top of the window. */
html.pd-look-sidebar .fi-body {
    --topbar-height: 0rem;
}

html.pd-look-sidebar .fi-sidebar {
        background: var(--pd-canvas);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}

/*
 * The sidebar look: the areas down the side, translucent; the area one is in shows its parts
 * below it. Those parts replace the area's own tabs on its pages.
 */
html.pd-look-sidebar .fi-sidebar {
    background: color-mix(in srgb, var(--pd-canvas) 82%, transparent);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    backdrop-filter: blur(30px) saturate(180%);
    box-shadow: 0.5px 0 0 var(--pd-line-strong);
}

html.pd-look-sidebar .fi-sidebar-header {
    background: transparent;
}

html.pd-look-sidebar .fi-sidebar-item-btn {
    gap: 0.75rem;
    padding: 0.5rem 0.875rem;
    border-radius: var(--pd-radius-sm);
}

html.pd-look-sidebar .fi-sidebar-item-label {
    font-size: 1rem;
    font-weight: 500;
}

html.pd-look-sidebar .fi-sidebar-item-icon {
    width: 1.375rem;
    height: 1.375rem;
}

/* The parts start under the area's name, not under its symbol. */
html.pd-look-sidebar .fi-sidebar-sub-group-items {
    margin: 1px 0 6px;
    padding-inline-start: 2.125rem;
}

html.pd-look-sidebar .fi-sidebar-sub-group-items .fi-sidebar-item-icon {
    width: 1.125rem;
    height: 1.125rem;
}

html.pd-look-sidebar .fi-sidebar-sub-group-items .fi-sidebar-item-label {
    font-size: 0.9375rem;
    font-weight: 400;
}

html.pd-look-sidebar .fi-sidebar-sub-group-items .fi-sidebar-item.fi-active > .fi-sidebar-item-btn > .fi-sidebar-item-label {
    font-weight: 500;
}

html.pd-look-sidebar .fi-sidebar-item-grouped-border {
    display: none;
}

html.pd-look-sidebar .fi-body:has(.fi-sidebar .fi-sidebar-sub-group-items) :is(.fi-page-sub-navigation-tabs, .fi-page-sub-navigation-dropdown, .fi-page-sub-navigation-sidebar-ctn) {
    display: none;
}
