/* FILE: CSS/org_chart.css */
/* Dynamic org charts for about_sections.php (rendered by includes/org_chart.php) */

/* ---------- 1. Base + tokens ---------- */
.oc {
    --oc-line: #1f2937;          /* connector lines */
    --oc-lw: 3px;                /* connector line thickness */
    --oc-vs: 1;                  /* vertical breathing room multiplier -- the fit script raises it to fill the frame's height */
    --oc-gap: calc(26px * var(--oc-vs));   /* vertical space taken by connectors between rows */
    --oc-vgap: calc(14px * var(--oc-vs));  /* space above each box in a stacked (vertical) list */
    --oc-photo: 76px;            /* photo circle size */
    --oc-ph-off: 8px;            /* photo pokes this far above the name bar */
    --oc-card-w: 330px;
    --oc-indent: 72px;           /* how far vertical-layout children hang to the right */
    --oc-from: #22508a;          /* default (blue) theme */
    --oc-to: #5a9ad8;
    --oc-ring: #3f6fa3;
    --oc-title: #0b4a8b;

    font-family: 'Nunito', Arial, sans-serif;
    padding: 20px 12px 40px;
    overflow-x: auto;            /* fallback only -- the fit script normally shrinks wide charts to fit */
    position: relative;
    isolation: isolate;          /* keeps the background logo behind the chart only */
}

/* Faded NIR seal behind the chart (like the Affinity versions) */
.oc::before {
    content: '';
    position: absolute;
    inset: 0;                                     /* was 6% 4% -- size is now set below */
    z-index: -1;
    background: url('../Images/DepEd%20NIR%20Logo.png') 50% 58% / auto 80% no-repeat;
    opacity: 0.15;                                /* was 0.14 */
    filter: blur(2px);                            /* was 5px */
    pointer-events: none;
}
.darkmode .oc::before,
.dark-mode .oc::before { opacity: 0.06; }

/* ---------- Side bubbles: Programs + Website ----------
   Round bubbles lined up with the RD's box near the right edge (the script sets --oc-side-top).
   Hovering the Programs bubble shows a small glass card of programs and blurs the chart.
   Touch screens: tap the bubble. Phones: the list and website link sit under the chart. */
.oc { --oc-side-top: 90px; --oc-bubble: 74px; }

.oc-bubble {
    position: absolute;
    right: 22px;
    z-index: 6;
    width: var(--oc-bubble);
    height: var(--oc-bubble);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 3px solid rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    background: linear-gradient(180deg, var(--oc-from), var(--oc-to));
    color: #fff !important;
    fill: #fff;
    text-decoration: none !important;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.oc-bubble:hover,
.oc-prog-wrap:hover .oc-prog-bubble { transform: scale(1.04); box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28); }
.oc-bubble:focus-visible { outline: 2px solid #fff27a; outline-offset: 3px; }
.oc-bubble-cap {
    font-family: 'Nunito', Arial, sans-serif;
    font-size: calc(var(--oc-bubble) * 0.135);   /* text scales with the bubble */
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
    line-height: 1;
}

/* Positions: Programs on the RD's line; Website under it (or on the RD's line if there are no programs) */
.oc-prog-wrap { position: absolute; top: var(--oc-side-top); right: 0; z-index: 6; }
.oc-prog-bubble { top: 0; }
.oc-web-bubble { top: var(--oc-side-top); }
.oc-has-programs .oc-web-bubble { top: calc(var(--oc-side-top) + var(--oc-bubble) + 14px); }

/* Website label: slides out to the left on hover */
.oc-web-label {
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    padding: 7px 14px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--oc-from), var(--oc-to));
    color: #fff;
    font-family: 'Nunito', Arial, sans-serif;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translate(8px, -50%);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    pointer-events: none;
}
.oc-web-bubble:hover .oc-web-label,
.oc-web-bubble:focus-visible .oc-web-label { opacity: 1; visibility: visible; transform: translate(0, -50%); }

/* Programs card: to the left of the bubble, top-aligned with it */
.oc-programs {
    position: absolute;
    top: var(--oc-card-dy, -4px);      /* script: lines up with the top of the RD's box */
    right: calc(22px + var(--oc-bubble) + 14px);
    width: 280px;
    max-height: 420px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateX(12px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}
.oc-programs::after {                 /* invisible bridge over the gap, so moving bubble -> card doesn't close it */
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 100%;
    width: 16px;
}
.darkmode .oc-programs,
.dark-mode .oc-programs { background: rgba(40, 42, 54, 0.75); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4); }

.oc-prog-wrap:hover .oc-programs,
.oc-prog-bubble:focus-visible + .oc-programs,
.oc-open .oc-programs { opacity: 1; visibility: visible; transform: none; }

.oc-programs-title {                 /* solid gradient header bar */
    flex-shrink: 0;
    margin: 0;
    padding: 12px 16px;
    background: linear-gradient(180deg, var(--oc-from), var(--oc-to));
    color: #fff;
    text-align: center;
    font-family: 'Nunito', Arial, sans-serif;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0.5px;
}
.oc .oc-programs-list { list-style: none; margin: 0; padding: 12px 22px 14px; overflow-y: auto; }
.oc .oc-programs-list li {
    position: relative;
    margin: 6px 0;                        /* margin, not padding: padding would show a sliver of the 3rd line */
    padding: 0 0 0 18px;
    color: var(--oc-title);
    font-family: 'Nunito', Arial, sans-serif;
    font-weight: 700;
    font-size: 16px;
    line-height: 1.25;
    display: -webkit-box;                 /* long names: 2 lines max, then "..." */
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}
.oc .oc-programs-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.45em;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(180deg, var(--oc-from), var(--oc-to));
}
.darkmode .oc .oc-programs-list li, .dark-mode .oc .oc-programs-list li { color: var(--oc-to); }

@media (max-width: 768px) {
    .oc { display: flex; flex-direction: column; }
    .oc-prog-bubble { display: none; }
    .oc-prog-wrap, .oc-web-bubble { order: 5; }               /* under the chart */
    .oc-prog-wrap { position: static; }
    .oc-programs {
        position: static;
        width: auto;
        max-height: none;
        margin-top: 24px;
        padding: 18px 8px 8px;
        border-top: 2px dashed rgba(128, 128, 128, 0.35);
        border-radius: 0;
        background: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        box-shadow: none;
        transform: none;
        opacity: 1;
        visibility: visible;
    }
    .oc-programs::after { display: none; }
    .oc-programs { border-top: 0; padding: 0; overflow: visible; }
    .oc-programs-title { border-radius: 12px; }
    .oc .oc-programs-list { padding: 12px 8px 4px; overflow: visible; }
    .oc .oc-programs-list li { -webkit-line-clamp: unset; line-clamp: unset; display: block; }
    /* Website bubble becomes a normal pill button */
    .oc-web-bubble, .oc-has-programs .oc-web-bubble {
        position: static;
        align-self: center;
        width: auto;
        height: auto;
        margin-top: 16px;
        flex-direction: row;
        gap: 8px;
        padding: 9px 18px;
        border-radius: 999px;
        transform: none !important;
    }
    .oc-web-bubble .oc-bubble-cap { display: none; }
    .oc-web-label { position: static; opacity: 1; visibility: visible; transform: none; padding: 0; background: none; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
    .oc-programs, .oc-bubble, .oc-web-label { transition: none; }
}

/* Dashed frame on the public page (same look as the old image boxes) */
.tab-content > .oc {
    margin: 20px 0;
    border: 2px dashed #c3c7cd;
    border-radius: 12px;
    background-color: #f6f7f9;

    /* Same shape as the NIR overview image box. about_sections.php measures that box and sets
       --oc-frame-ratio; 4 / 3 (the Affinity canvas) is the fallback. Taller charts make the frame grow. */
    box-sizing: border-box;
    aspect-ratio: var(--oc-frame-ratio, 4 / 3);
    overflow: visible;
    display: flex;
    flex-direction: column;
}
.tab-content > .oc > .oc-root { margin-top: auto; margin-bottom: auto; }  /* smaller charts sit in the middle */
.darkmode .tab-content > .oc {
    border-color: rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.03);
}
.darkmode .oc,
.dark-mode .oc { --oc-line: #cbd5e1; }   /* .darkmode = public site, .dark-mode = operator preview */

/* ---------- 2. Themes (match the NIR overview chart colors) ---------- */
.oc-theme-blue   { --oc-from: #22508a; --oc-to: #5a9ad8; --oc-ring: #3f6fa3; --oc-title: #0b4a8b; }
.oc-theme-red    { --oc-from: #a3241b; --oc-to: #ef4a37; --oc-ring: #e2412f; --oc-title: #b3261e; }
.oc-theme-orange { --oc-from: #c2561c; --oc-to: #f7a05a; --oc-ring: #f2914a; --oc-title: #f26b12; }
.oc-theme-indigo { --oc-from: #2f3fa8; --oc-to: #4f6cf0; --oc-ring: #4a5fd6; --oc-title: #2f3fa8; }
.oc-theme-purple { --oc-from: #4b2a9e; --oc-to: #7c4fe6; --oc-ring: #6a42d0; --oc-title: #4b2a9e; }
.oc-theme-yellow { --oc-from: #b68a12; --oc-to: #f2c94c; --oc-ring: #d9a91f; --oc-title: #a77c0a; }
.oc-theme-green  { --oc-from: #1f7a3a; --oc-to: #4cc46a; --oc-ring: #36a956; --oc-title: #1f7a3a; }
.oc-theme-gray   { --oc-from: #555b63; --oc-to: #9aa0a6; --oc-ring: #7a8088; --oc-title: #4b5058; }
.oc-theme-pink   { --oc-from: #c2266f; --oc-to: #f06bb0; --oc-ring: #e2479a; --oc-title: #c2266f; }

.oc-title {
    text-align: center;
    color: var(--oc-title);
    font-weight: 700;
    font-size: clamp(22px, 3vw, 40px);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 30px;
}
.darkmode .oc-title,
.dark-mode .oc-title { color: var(--oc-to); }

.oc-list { margin: 0; padding: 0; }
/* Stronger reset against general page ul styles -- only the sides the connectors don't use */
.oc .oc-list { list-style: none; margin-top: 0; margin-bottom: 0; padding-left: 0; padding-right: 0; }
.oc-root { display: flex; justify-content: center; min-width: max-content; }

/* ---------- 3. Boxes ---------- */
.oc-branch { display: flex; flex-direction: column; align-items: center; }

.oc-card {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    width: var(--oc-card-w);
    text-align: left;
}
.oc-photo {
    position: relative;
    z-index: 2;
    flex: 0 0 var(--oc-photo);
    width: var(--oc-photo);
    height: var(--oc-photo);
    margin-top: calc(var(--oc-ph-off) * -1);
    border-radius: 50%;
    border: 4px solid var(--oc-ring);
    background: #fff;
    overflow: hidden;
    box-sizing: border-box;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}
.oc-photo img { width: 100%; height: 100%; object-fit: cover; display: block; font-size: 0; color: transparent; } /* no alt text spill if a photo is missing */

.oc-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(var(--oc-photo) - var(--oc-ph-off) * 2);
    margin-left: calc(var(--oc-photo) * -0.3);
    padding: 8px 12px 8px calc(var(--oc-photo) * 0.3 + 10px);
    box-sizing: border-box;
    background: linear-gradient(180deg, var(--oc-from), var(--oc-to));
    border-radius: 8px;
    color: #fff;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
}
.oc-name { font-weight: 800; font-size: 14px; line-height: 1.25; text-transform: uppercase; white-space: nowrap; } /* one line; the fit script widens the boxes */
.oc-pos  { font-style: italic; font-size: 14px; line-height: 1.25; color: #fff27a; white-space: nowrap; }
.oc-prog { font-style: italic; font-size: 12px; line-height: 1.25; color: #fff27a; opacity: 0.95; white-space: nowrap; }
.oc-tag {
    align-self: flex-start;
    margin-bottom: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    background: #fde68a;
    color: #3f3f46;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* Sticker (e.g. Karl Karabaw): stands on the right end of the name bar and pokes out the top */
.oc-has-sticker { min-width: max-content; }           /* never let the sticker cover the name */
.oc-has-sticker .oc-text { padding-right: 96px; }
.oc-sticker {
    position: absolute;
    right: 2px;
    bottom: -7px; /* para manaog gamay */
    height: calc(100% + 24px);
    width: auto;
    max-width: 110px;
    object-fit: contain;
    object-position: bottom right;
    pointer-events: none;
    transform-origin: 50% 50%;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.25));
}
.oc-sticker.oc-wiggle { animation: ocWiggle 0.6s ease-in-out; }   /* added by the script on hover; plays to the end */
@keyframes ocWiggle {
    0%, 100% { transform: rotate(0deg); }
    25%      { transform: rotate(-7deg); }
    50%      { transform: rotate(5deg); }
    75%      { transform: rotate(-3deg); }
}
@media (max-width: 768px) {                        /* phones: no room beside the text, so Karl peeks over the top corner */
    .oc .oc-has-sticker { min-width: 0; }
    .oc .oc-has-sticker .oc-text { padding-right: 12px; }
    .oc-sticker { height: 46px; max-width: 56px; bottom: calc(100% - 6px); right: 6px; }
}
@media (prefers-reduced-motion: reduce) {
        .oc-sticker.oc-wiggle { animation: none; }
}

/* Bullet points: hidden until the card is hovered (or tapped / focused on phones and keyboards).
   They drop down as a panel under the name bar, floating over whatever is below,
   so the rest of the chart never shifts. */
.oc-text { position: relative; }
.oc .oc-bullets {
    position: absolute;
    top: calc(100% - 6px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 12px 12px 8px calc(var(--oc-photo) * 0.3 + 26px);
    list-style: disc;
    background: var(--oc-from);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 14px rgba(0, 0, 0, 0.22);
    color: #fff;
    font-size: 12px;
    font-style: normal;
    line-height: 1.3;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    z-index: -1;                                /* tucks under the name bar */
}
.oc .oc-bullets li { margin: 1px 0; padding: 0; }
/* Open on mouse hover, on keyboard focus (Tab key), or on tap for touch screens.
   A mouse CLICK alone doesn't keep it open, so moving to another card closes it. */
.oc-card:hover .oc-bullets,
.oc-has-bullets:focus-visible .oc-bullets {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
@media (hover: none) {
    .oc-has-bullets:focus .oc-bullets { opacity: 1; visibility: visible; transform: translateY(0); }
    .oc-has-bullets:focus { transform: scale(1.05); z-index: 5; }
}
.oc-has-bullets { cursor: pointer; }
.oc-has-bullets:focus { outline: none; }
.oc-has-bullets:focus-visible .oc-text { outline: 2px solid #fff27a; outline-offset: 2px; }

/* Hover: the box lifts and zooms a little */
.oc-card,
.oc-unit { transition: transform 0.18s ease, filter 0.18s ease; }
.oc-card:hover,
.oc-has-bullets:focus-visible,
.oc-unit:hover {
    transform: scale(1.05);
    z-index: 5;                                 /* above its neighbors while zoomed */
    filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.18));
}
@media (prefers-reduced-motion: reduce) {
    .oc-card, .oc-unit { transition: none; }
    .oc-card:hover, .oc-unit:hover { transform: none; }
}

/* The top box (Regional Director) stays ORD blue on every division chart, like the Affinity versions */
.oc-root > li > .oc-branch > .oc-card { --oc-from: #22508a; --oc-to: #5a9ad8; --oc-ring: #3f6fa3; }

/* ...and is bigger than everyone else */
.oc { --oc-photo-rd: 104px; --oc-photo-chief: 90px; }
.oc-root > li > .oc-branch > .oc-card {
    --oc-photo: var(--oc-photo-rd);
    --oc-ph-off: 10px;
    width: calc(var(--oc-card-w) * 1.18);
    min-width: max-content;                     /* never cut the RD's name, even if it's the longest */
}
.oc-root > li > .oc-branch > .oc-card .oc-name { font-size: 17px; }
.oc-root > li > .oc-branch > .oc-card .oc-pos  { font-size: 16px; }

/* The chief (the main box right under the RD, not the side staff) is in between */
.oc-root > li > .oc-branch > .oc-list:not(.oc-staff) > li > .oc-branch > .oc-card {
    --oc-photo: var(--oc-photo-chief);
    --oc-ph-off: 9px;
    width: calc(var(--oc-card-w) * 1.08);
    min-width: max-content;
}
.oc-root > li > .oc-branch > .oc-list:not(.oc-staff) > li > .oc-branch > .oc-card .oc-name { font-size: 15.5px; }
.oc-root > li > .oc-branch > .oc-list:not(.oc-staff) > li > .oc-branch > .oc-card .oc-pos  { font-size: 15px; }

/* If the RD or chief ever uses the stacked (vertical) layout, start the rail under their bigger photo */
.oc-root > li.oc-lay-v > .oc-branch > .oc-v { margin-left: calc(var(--oc-photo-rd) / 2 - var(--oc-lw) / 2); }
.oc-root > li > .oc-branch > .oc-list:not(.oc-staff) > li.oc-lay-v > .oc-branch > .oc-v { margin-left: calc(var(--oc-photo-chief) / 2 - var(--oc-lw) / 2); }

/* Gray unit header (LEGAL UNIT, ICT UNIT ...) */
.oc-unit {
    position: relative;
    z-index: 1;
    width: var(--oc-card-w);
    padding: 14px 16px;
    box-sizing: border-box;
    border-radius: 14px;
    background: linear-gradient(180deg, #5f6368, #a5a8ad);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    line-height: 1.3;
    text-align: center;
    text-transform: uppercase;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
}

/* ---------- 4. Horizontal layout (children side by side) ---------- */
.oc-h { display: flex; justify-content: center; position: relative; padding-top: var(--oc-gap); }
.oc-h::before {                       /* stub down from the parent */
    content: '';
    position: absolute;
    top: -24px;                       /* reaches up behind the parent box so there's never a gap */
    left: calc(50% - var(--oc-lw) / 2);
    height: calc(var(--oc-gap) + 24px);
    border-left: var(--oc-lw) solid var(--oc-line);
}
.oc-h > li {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--oc-gap) 10px 0;
}
.oc-h > li::before,
.oc-h > li::after {                   /* horizontal bar + drop into each child */
    content: '';
    position: absolute;
    top: 0;
    left: -2px;                       /* left half: overlaps the neighbor by 2px so joins never show a gap */
    right: 50%;
    height: var(--oc-gap);
    border-top: var(--oc-lw) solid var(--oc-line);
}
.oc-h > li::after {                   /* right half + the drop into this child */
    left: calc(50% - var(--oc-lw) / 2);
    right: -2px;
    border-left: var(--oc-lw) solid var(--oc-line);
}
.oc-h > li:first-child::before,
.oc-h > li:last-child::after { border: 0 none; }
.oc-h > li:last-child::before { right: calc(50% - var(--oc-lw) / 2); border-right: var(--oc-lw) solid var(--oc-line); }
.oc-h > li:only-child::before { border: 0 none; }                    /* single child: straight drop, */
.oc-h > li:only-child::after  { border: 0 none; border-left: var(--oc-lw) solid var(--oc-line); } /* lined up with the stub */
/* A single box under its boss: no second connector gap (the stub already reaches it). Desktop only. */
@media (min-width: 769px) {
    .oc-h > li:only-child { padding-top: 0; }
    .oc-h > li:only-child::after { display: none; }
}

/* Staff row: main line keeps running down through it */
.oc-staff.oc-spine::after {
    content: '';
    position: absolute;
    left: calc(50% - var(--oc-lw) / 2);
    top: var(--oc-gap);
    bottom: 0;
    border-left: var(--oc-lw) solid var(--oc-line);
    z-index: 0;
}

/* ---------- 5. Vertical layout (children stacked on a left rail) ---------- */
/* Shift the box right so it stays centered over its own connector */
.oc-h > li.oc-lay-v.oc-has-kids > .oc-branch { padding-left: var(--oc-indent); }
.oc-lay-v > .oc-branch,
.oc-v > li > .oc-branch { align-items: flex-start; }   /* stacked boxes line up on the left */

/* Rail from under the parent's photo */
.oc-lay-v.oc-has-kids > .oc-branch > .oc-card::after,
.oc-lay-v.oc-has-kids > .oc-branch > .oc-unit::after {
    content: '';
    position: absolute;
    z-index: -1;
    left: calc(var(--oc-photo) / 2 - var(--oc-lw) / 2);
    top: calc(var(--oc-photo) / 2 - var(--oc-ph-off));
    bottom: 0;
    border-left: var(--oc-lw) solid var(--oc-line);
}
/* Units have no photo -- their list starts right at the box's bottom edge, so no rail is needed (it would draw over the gray box) */
.oc .oc-branch > .oc-unit::after { display: none !important; }
.oc-v { position: relative; margin-left: calc(var(--oc-photo) / 2 - var(--oc-lw) / 2); }
.oc-v > li { position: relative; padding: var(--oc-vgap) 0 0 calc(var(--oc-indent) - var(--oc-photo) / 2); }
.oc-v > li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-left: var(--oc-lw) solid var(--oc-line);
}
.oc-v > li:last-child::before { bottom: auto; height: calc(var(--oc-vgap) + var(--oc-photo) / 2 - var(--oc-ph-off)); }
.oc-v > li::after {
    content: '';
    position: absolute;
    left: 0;
    top: calc(var(--oc-vgap) + var(--oc-photo) / 2 - var(--oc-ph-off));
    width: calc(var(--oc-indent) - var(--oc-photo) / 2);
    border-top: var(--oc-lw) solid var(--oc-line);
}

/* ---------- 5b. Two-column grid (children on both sides of a center spine) ---------- */
/* Desktop only -- phones fall back to the rail list in section 6 */
@media (min-width: 769px) {
    .oc {
        --oc-gcol: 70px;             /* space between the two columns (spine runs down the middle) */
        --oc-grow: calc(22px * var(--oc-vs));   /* space between rows */
        --oc-gelbow: calc(var(--oc-photo) / 2 - var(--oc-ph-off));  /* y of a card's photo center */
    }
    .oc-g {
        position: relative;
        display: grid;
        grid-template-columns: 1fr 1fr;   /* equal columns keep the spine dead center under the parent */
        width: max-content;
        column-gap: var(--oc-gcol);
        row-gap: var(--oc-grow);
        padding-top: var(--oc-gap);
    }
    .oc-g::before {                       /* stub down from the parent */
        content: '';
        position: absolute;
        top: -24px;
        left: calc(50% - var(--oc-lw) / 2);
        height: calc(var(--oc-gap) + 24px);
        border-left: var(--oc-lw) solid var(--oc-line);
    }
    .oc-g > li { position: relative; }
    /* Left column hugs the center spine, so a wide right-side box (e.g. one with people under it)
       doesn't stretch every left-side connector line */
    .oc-g > li:nth-child(odd) { justify-self: end; }
    .oc-g > li > .oc-branch { align-items: flex-start; }

    /* Left column: elbow from the card's right edge to the spine, and the spine itself */
    .oc-g > li:nth-child(odd)::after {
        content: '';
        position: absolute;
        top: var(--oc-gelbow);
        left: var(--oc-card-w);
        right: calc(var(--oc-gcol) / -2);
        border-top: var(--oc-lw) solid var(--oc-line);
    }
    .oc-g > li:nth-child(odd)::before {
        content: '';
        position: absolute;
        left: calc(100% + var(--oc-gcol) / 2 - var(--oc-lw) / 2);
        top: calc(var(--oc-grow) * -1);
        bottom: 0;
        border-left: var(--oc-lw) solid var(--oc-line);
    }
    .oc-g > li:first-child::before { top: 0; }
    .oc-g > li:nth-child(odd):nth-last-child(-n+2)::before {          /* last row: spine stops at the elbow */
        bottom: auto;
        height: calc(var(--oc-grow) + var(--oc-gelbow));
    }
    .oc-g > li:first-child:nth-last-child(-n+2)::before { height: var(--oc-gelbow); }

    /* Odd number of people: the last one sits centered at the bottom, the spine runs straight into it */
    .oc-g > li:last-child:nth-child(odd) {
        grid-column: 1 / -1;
        justify-self: center;
    }
    .oc-g > li:last-child:nth-child(odd) > .oc-branch { align-items: center; }
    .oc-g > li:last-child:nth-child(odd)::after { display: none; }
    .oc-g > li:last-child:nth-child(odd)::before {
        left: calc(50% - var(--oc-lw) / 2);
        top: calc(var(--oc-grow) * -1);
        bottom: auto;
        height: var(--oc-grow);
    }

    /* Right column: elbow from the spine to the card's left edge */
    .oc-g > li:nth-child(even)::after {
        content: '';
        position: absolute;
        top: var(--oc-gelbow);
        left: calc(var(--oc-gcol) / -2);
        width: calc(var(--oc-gcol) / 2);
        border-top: var(--oc-lw) solid var(--oc-line);
    }
}

/* ---------- 6. Phones: everything becomes one indented list ---------- */
@media (max-width: 768px) {
    .oc {
        --oc-vs: 1 !important;       /* phones: normal spacing */
        --oc-photo: 54px;
        --oc-indent: 40px;
        --oc-card-w: 100%;
        overflow-x: visible;
        padding: 12px 4px 30px;
    }
    .oc-root { display: block; min-width: 0; }
    .oc-branch,
    .oc-lay-v > .oc-branch { align-items: stretch; }
    .oc-h > li.oc-lay-v.oc-has-kids > .oc-branch { padding-left: 0; }
    .oc-name { font-size: 13px; white-space: normal; }
    .oc-pos  { font-size: 13px; white-space: normal; }
    .oc-prog { white-space: normal; }

    /* Horizontal lists turn into rails too */
    .oc-h { display: block; padding-top: 0; margin-left: calc(var(--oc-photo) / 2 - var(--oc-lw) / 2); }
    .oc-h::before { display: none; }
    .oc-h > li {
        display: block;
        padding: 14px 0 0 calc(var(--oc-indent) - var(--oc-photo) / 2);
    }
    .oc-h > li::before,
    .oc-h > li:first-child::before,
    .oc-h > li:last-child::before {
        right: auto;
        left: 0;
        top: 0;
        bottom: 0;
        width: 0;
        height: auto;
        border: 0 none;
        border-left: var(--oc-lw) solid var(--oc-line);
    }
    .oc-h > li:last-child::before { bottom: auto; height: calc(14px + var(--oc-photo) / 2 - var(--oc-ph-off)); }
    .oc-staff.oc-spine > li:last-child::before { bottom: 0; height: auto; } /* rail continues to the main list */
    .oc-h > li::after,
    .oc-h > li:first-child::after,
    .oc-h > li:last-child::after {
        left: 0;
        right: auto;
        top: calc(14px + var(--oc-photo) / 2 - var(--oc-ph-off));
        width: calc(var(--oc-indent) - var(--oc-photo) / 2);
        height: 0;
        border: 0 none;
        border-top: var(--oc-lw) solid var(--oc-line);
    }
    .oc-staff.oc-spine::after { display: none; }

    /* Two-column grid becomes a plain rail list (same as section 5) */
    .oc-g { position: relative; margin-left: calc(var(--oc-photo) / 2 - var(--oc-lw) / 2); }
    .oc-g > li { position: relative; padding: 14px 0 0 calc(var(--oc-indent) - var(--oc-photo) / 2); }
    .oc-g > li::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        border-left: var(--oc-lw) solid var(--oc-line);
    }
    .oc-g > li:last-child::before { bottom: auto; height: calc(14px + var(--oc-photo) / 2 - var(--oc-ph-off)); }
    .oc-g > li::after {
        content: '';
        position: absolute;
        left: 0;
        top: calc(14px + var(--oc-photo) / 2 - var(--oc-ph-off));
        width: calc(var(--oc-indent) - var(--oc-photo) / 2);
        border-top: var(--oc-lw) solid var(--oc-line);
    }

    /* Every parent gets a rail under its photo */
    .oc-has-kids > .oc-branch > .oc-card::after,
    .oc-has-kids > .oc-branch > .oc-unit::after {
        content: '';
        position: absolute;
        z-index: -1;
        left: calc(var(--oc-photo) / 2 - var(--oc-lw) / 2);
        top: calc(var(--oc-photo) / 2 - var(--oc-ph-off));
        bottom: 0;
        border-left: var(--oc-lw) solid var(--oc-line);
    }
    .oc { --oc-photo-rd: 70px; --oc-photo-chief: 62px; }
    .oc-root > li > .oc-branch > .oc-card { width: 100%; min-width: 0; }
    .oc-root > li > .oc-branch > .oc-list:not(.oc-staff) > li > .oc-branch > .oc-card { width: 100%; min-width: 0; }
    .oc-root > li > .oc-branch > .oc-list:not(.oc-staff) > li > .oc-branch > .oc-card .oc-name { font-size: 14px; }
    .oc-root > li > .oc-branch > .oc-list:not(.oc-staff) > li > .oc-branch > .oc-card .oc-pos  { font-size: 13.5px; }
    /* rails under the bigger RD / chief photos */
    .oc .oc-root > li > .oc-branch > .oc-list { margin-left: calc(var(--oc-photo-rd) / 2 - var(--oc-lw) / 2); }
    .oc .oc-root > li > .oc-branch > .oc-list:not(.oc-staff) > li > .oc-branch > .oc-list { margin-left: calc(var(--oc-photo-chief) / 2 - var(--oc-lw) / 2); }
    .oc .oc-root > li > .oc-branch > .oc-list:not(.oc-staff) > li::after { top: calc(14px + var(--oc-photo-chief) / 2 - 9px); }
    .oc .oc-root > li > .oc-branch > .oc-list:not(.oc-staff) > li:last-child::before { height: calc(14px + var(--oc-photo-chief) / 2 - 9px); }
    .oc-root > li > .oc-branch > .oc-card .oc-name { font-size: 15px; }
    .oc-root > li > .oc-branch > .oc-card .oc-pos  { font-size: 14px; }
    .oc-unit { justify-content: flex-start; text-align: left; font-size: 14px; padding: 12px 14px; min-height: 0; }
}

/* FILE: CSS/org_chart.css  (paste this block at the very END of the file) */

/* ---------- Big charts: readable zoom + panning ----------
   Charts that would shrink below the readable zoom (MIN_ZOOM in includes/org_chart.php) stay
   readable instead. The script then adds:
     .oc-zoomable  -> shows the magnifier (readable zoom <-> whole chart)
     .oc-pannable  -> the frame clips the chart, and hover zones on the 4 sides pan it
     .oc-can-l/r/t/b -> which sides still have hidden chart (only those zones work) */
.oc-zoom-btn,
.oc-edge { display: none; }

.oc-zoomable .oc-zoom-btn {
    display: flex;
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 7;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 3px solid rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    background: linear-gradient(180deg, var(--oc-from), var(--oc-to));
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
    transition: transform 0.18s ease;
}
.oc-zoom-btn:hover { transform: scale(1.08); }
.oc-zoom-btn:focus-visible { outline: 2px solid #fff27a; outline-offset: 3px; }
.oc-zoom-plus { display: none; }                  /* magnifier with "-" = see whole chart */
.oc-fitall .oc-zoom-plus { display: inline; }     /* magnifier with "+" = back to readable zoom */

.oc-pannable,
.tab-content > .oc.oc-pannable { overflow: hidden; cursor: grab; touch-action: none; }   /* clip at the dotted frame */
.oc-pannable.oc-dragging { cursor: grabbing; user-select: none; }
.tab-content > .oc.oc-pannable > .oc-root { flex-shrink: 0; margin-top: 0; margin-bottom: auto; }

/* Hover zones: a soft band with a rounded triangle, only visible while hovered */
.oc-pannable .oc-edge {
    display: flex;
    position: absolute;
    z-index: 5;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: rgba(20, 25, 35, 0.12);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    cursor: default;
}
.oc-pannable.oc-can-l .oc-edge-l,
.oc-pannable.oc-can-r .oc-edge-r,
.oc-pannable.oc-can-t .oc-edge-t,
.oc-pannable.oc-can-b .oc-edge-b { pointer-events: auto; }
.oc-pannable .oc-edge:hover { opacity: 1; }
.oc-dragging .oc-edge { pointer-events: none !important; opacity: 0 !important; }

.oc-edge-l { left: 10px;  top: var(--oc-view-top, 90px); bottom: 12px; width: 90px; }
.oc-edge-r { right: 10px; top: var(--oc-view-top, 90px); bottom: 12px; width: 90px; }
.oc-edge-t { top: var(--oc-view-top, 90px); left: 110px; right: 110px; height: 80px; }
.oc-edge-b { bottom: 12px; left: 110px; right: 110px; height: 80px; }

.oc-edge svg {
    fill: #fff;
    stroke: #fff;
    stroke-width: 6;
    stroke-linejoin: round;                       /* rounded triangle corners */
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.25));
}
.oc-edge-b svg { transform: rotate(180deg); }
.oc-edge-l svg { transform: rotate(-90deg); }
.oc-edge-r svg { transform: rotate(90deg); }
.darkmode .oc-pannable .oc-edge,
.dark-mode .oc-pannable .oc-edge { background: rgba(255, 255, 255, 0.10); }

@media (max-width: 768px) {                       /* phones: stacked list, nothing to pan */
    .oc-zoom-btn, .oc-edge { display: none !important; }
    .oc-pannable { overflow: visible; cursor: auto; touch-action: auto; }
}
@media (prefers-reduced-motion: reduce) {
    .oc-edge, .oc-zoom-btn { transition: none; }
}
