/* ===== About page: management structure (org chart) =====
   Top position, a trunk with any assistants hanging off its side, then one
   column per department; everything below a department is a nested tree.
   Colours come from the theme variables so dark mode follows on its own. */
.org-section {
    --org-line: rgba(119, 0, 27, 0.25);
    --org-gap: 24px;
    position: relative;
    padding: 90px 0 100px;
    background:
        radial-gradient(circle at 50% 0, rgba(119, 0, 27, 0.06), transparent 55%),
        linear-gradient(180deg, #fbf8f5 0%, #f5efe9 100%);
    overflow: hidden;
}

.org-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(93, 72, 58, 0.12) 1px, transparent 1px);
    background-size: 22px 22px;
    -webkit-mask-image: linear-gradient(180deg, #000, transparent 70%);
    mask-image: linear-gradient(180deg, #000, transparent 70%);
    pointer-events: none;
}

.org-section .container { position: relative; }

.org-header {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 56px;
}

.org-header h2 {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-color);
    margin-bottom: 12px;
}

.org-header p {
    color: var(--text-light);
    font-size: 16px;
    line-height: 1.8;
    margin: 0;
}

/* ── Node (shared by every position) ── */
.org-node {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-card, #fff);
    border: 1px solid rgba(93, 72, 58, 0.12);
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(71, 4, 25, 0.06);
    text-align: start;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.org-node__icon {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(119, 0, 27, 0.08);
    color: var(--primary-color);
    font-size: 16px;
}

.org-node__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.org-node__title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.5;
    color: var(--text-color);
}

.org-node__name {
    font-size: 13px;
    color: var(--therd-color-light);
    font-weight: 600;
    margin-top: 2px;
}

.org-node--section:hover,
.org-node--role:hover,
.org-node--assistant:hover {
    transform: translateY(-2px);
    border-color: rgba(119, 0, 27, 0.3);
    box-shadow: 0 10px 24px rgba(71, 4, 25, 0.1);
}

/* ── Top position ── */
.org-top {
    display: flex;
    justify-content: center;
}

.org-node--root {
    min-width: 320px;
    justify-content: center;
    gap: 16px;
    padding: 22px 34px;
    border: none;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
    box-shadow: 0 18px 44px rgba(119, 0, 27, 0.3), 0 0 0 6px rgba(119, 0, 27, 0.08);
}

.org-node--root .org-node__icon {
    flex-basis: 58px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 23px;
}

.org-node--root .org-node__title {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
}

.org-node--root .org-node__name { color: rgba(255, 255, 255, 0.8); }

/* ── Trunk and assistants ── */
.org-trunk {
    display: grid;
    grid-template-columns: 1fr 2px 1fr;
    min-height: 46px;
}

.org-trunk__line {
    grid-column: 2;
    grid-row: 1;
    background: var(--org-line);
}

.org-trunk--end .org-trunk__line {
    height: 50%;
}

.org-assistants {
    grid-column: 3;
    grid-row: 1;
    justify-self: start;
    align-self: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 0;
    padding-inline-start: 40px;
    max-width: 320px;
}

.org-assistants .org-node::before {
    content: "";
    position: absolute;
    top: 50%;
    inset-inline-start: -41px;
    width: 40px;
    border-top: 2px dashed var(--org-line);
}

.org-node--assistant {
    border-style: dashed;
    border-color: rgba(119, 0, 27, 0.3);
}

.org-node--assistant .org-node__icon {
    background: rgba(93, 72, 58, 0.1);
    color: var(--therd-color-light);
}

.org-node--inline-assistant {
    margin: 12px 16px 0;
}

.org-branch .org-node--inline-assistant {
    margin: 8px 0 0;
    margin-inline-start: 24px;
}

/* ── Departments ── */
.org-departments {
    display: grid;
    grid-template-columns: repeat(var(--org-cols, 3), minmax(0, 1fr));
    gap: var(--org-gap);
    align-items: start;
}

.org-dept {
    position: relative;
    padding-top: 34px;
}

/* Horizontal rail joining the columns, and the drop into each one. */
.org-dept::before {
    content: "";
    position: absolute;
    top: 0;
    height: 2px;
    inset-inline: calc(var(--org-gap) / -2);
    background: var(--org-line);
}

.org-dept:first-child::before { inset-inline-start: 50%; }
.org-dept:last-child::before { inset-inline-end: 50%; }
.org-dept:only-child::before,
.org-departments--wrap .org-dept::before { display: none; }

.org-dept::after {
    content: "";
    position: absolute;
    top: 0;
    inset-inline-start: calc(50% - 1px);
    width: 2px;
    height: 34px;
    background: var(--org-line);
}

.org-dept__card {
    background: var(--bg-card, #fff);
    border: 1px solid rgba(93, 72, 58, 0.1);
    border-radius: 20px;
    box-shadow: 0 14px 36px rgba(71, 4, 25, 0.08);
    overflow: hidden;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.org-dept__card:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 44px rgba(71, 4, 25, 0.13);
}

.org-node--dept {
    justify-content: center;
    padding: 18px 20px;
    border: none;
    border-bottom: 3px solid var(--therd-color-light);
    border-radius: 0;
    box-shadow: none;
    background: linear-gradient(135deg, var(--therd-color), #3d2f26);
}

.org-node--dept .org-node__icon {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.org-node--dept .org-node__title {
    font-size: 17px;
    font-weight: 800;
    color: #fff;
}

.org-node--dept .org-node__name { color: rgba(255, 255, 255, 0.75); }

.org-dept__body {
    padding: 20px 18px 22px;
}

/* ── Tree below a department ── */
.org-branch {
    list-style: none;
    margin: 0;
    padding: 0;
}

.org-branch__item { position: relative; }
.org-branch__item + .org-branch__item { margin-top: 12px; }

.org-node--section {
    background: rgba(119, 0, 27, 0.03);
    box-shadow: none;
}

/* Accent bar; a thick border would bend round the corner radius. */
.org-node--section::before {
    content: "";
    position: absolute;
    inset-block: 12px;
    inset-inline-start: -1px;
    width: 3px;
    border-radius: 3px;
    background: var(--primary-color);
}

.org-node--role {
    padding: 9px 12px;
    border-radius: 12px;
}

.org-node--role .org-node__icon {
    flex-basis: 32px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    font-size: 13px;
    background: rgba(93, 72, 58, 0.1);
    color: var(--therd-color);
}

.org-node--role .org-node__title {
    font-size: 14px;
    font-weight: 600;
}

/* Elbow connectors: a spine from the parent, a short arm into each child. */
.org-branch .org-branch {
    margin-top: 12px;
    padding-inline-start: 44px;
}

.org-branch .org-branch > .org-branch__item::before {
    content: "";
    position: absolute;
    top: -12px;
    inset-inline-start: -16px;
    height: calc(100% + 12px);
    border-inline-start: 2px solid var(--org-line);
}

.org-branch .org-branch > .org-branch__item:last-child::before {
    height: 37px;
}

.org-branch .org-branch > .org-branch__item::after {
    content: "";
    position: absolute;
    top: 24px;
    inset-inline-start: -16px;
    width: 16px;
    border-top: 2px solid var(--org-line);
}

/* ── Dark mode ── */
[data-theme="dark"] .org-section {
    --org-line: rgba(172, 134, 109, 0.4);
    background: transparent;
}

[data-theme="dark"] .org-section::before { opacity: 0.4; }

[data-theme="dark"] .org-node,
[data-theme="dark"] .org-dept__card { border-color: var(--border-color); }

[data-theme="dark"] .org-node__icon {
    background: rgba(255, 255, 255, 0.08);
    color: var(--therd-color-light);
}

[data-theme="dark"] .org-node--section { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .org-node--section::before { background: var(--therd-color-light); }

[data-theme="dark"] .org-node--dept { background: linear-gradient(135deg, #3d2f26, #25201e); }

[data-theme="dark"] .org-node--root .org-node__icon,
[data-theme="dark"] .org-node--dept .org-node__icon { color: #fff; }

/* ── Smaller screens: departments stack, the trunk runs straight down ── */
@media (max-width: 991px) {
    .org-section { padding: 70px 0 80px; }

    .org-departments {
        grid-template-columns: 1fr;
        max-width: 560px;
        margin: 0 auto;
        gap: 0;
    }

    .org-dept::before { display: none; }
    .org-dept { padding-top: 30px; }
    .org-dept::after { height: 30px; }
}

@media (max-width: 600px) {
    .org-header { margin-bottom: 40px; }
    .org-header h2 { font-size: 28px; }

    .org-node--root {
        min-width: 0;
        width: 100%;
        padding: 18px 20px;
    }

    .org-node--root .org-node__title { font-size: 19px; }

    .org-trunk {
        display: flex;
        flex-direction: column;
        align-items: center;
        min-height: 0;
    }

    .org-trunk__line {
        width: 2px;
        height: 26px;
    }

    .org-trunk--end .org-trunk__line { height: 26px; }

    .org-assistants {
        align-self: stretch;
        align-items: center;
        max-width: none;
        padding: 0;
    }

    .org-assistants .org-node::before { display: none; }

    .org-dept__body { padding: 16px 14px 18px; }
    .org-branch .org-branch { padding-inline-start: 34px; }

    .org-branch .org-branch > .org-branch__item::before,
    .org-branch .org-branch > .org-branch__item::after { inset-inline-start: -14px; }

    .org-branch .org-branch > .org-branch__item::after { width: 14px; }
}
