/**
 * Copyright (c) Enalean, 2024 - Present. All Rights Reserved.
 *
 * This file is a part of Tuleap.
 *
 * Tuleap is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Tuleap is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tuleap. If not, see <http://www.gnu.org/licenses/>.
 */

@use "@/themes/includes/whitespace";

@function compute-header-top-offset-for-edition($header-height, $offset) {
    @return calc(
        #{$add-section-button-container-height} + var(--tlp-medium-spacing) + var(--editor-padding) +
            #{$header-height} + #{$offset}px - var(--tlp-large-spacing)
    );
}

@function compute-header-top-offset-for-readonly($header-height, $offset) {
    @return calc(
        var(--tlp-large-spacing) + var(--tlp-medium-spacing) + #{$header-height} + #{$offset}px - var(--tlp-large-spacing)
    );
}

$add-section-button-size: 26px;
$add-section-button-container-height: calc(
    2 * #{whitespace.$add-section-button-container-vertical-padding} + #{$add-section-button-size}
);
$add-section-button-container-width: calc(
    2 * #{whitespace.$add-section-button-container-horizontal-padding} + #{$add-section-button-size}
);
$document-container-width-ratio: 0.7;
$document-width: 960px;
$header-level-1-title-height: 40px; // line-height of TLP h1
$header-level-1-top-offset-for-edition: compute-header-top-offset-for-edition(
    $header-level-1-title-height,
    0
);
$header-level-1-top-offset-for-readonly: compute-header-top-offset-for-readonly(
    $header-level-1-title-height,
    0
);
$header-level-2-title-height: 36px; // line-height of TLP h2
$header-level-2-top-offset-for-edition: compute-header-top-offset-for-edition(
    $header-level-2-title-height,
    0
);
$header-level-2-magic-value-to-align-level-to-title: -1;
$header-level-2-top-offset-for-readonly: compute-header-top-offset-for-readonly(
    $header-level-2-title-height,
    $header-level-2-magic-value-to-align-level-to-title
);
$header-level-3-title-height: 24px; // line-height of TLP h3
$header-level-3-magic-value-to-align-level-to-title: 2;
$header-level-3-top-offset-for-edition: compute-header-top-offset-for-edition(
    $header-level-3-title-height,
    $header-level-3-magic-value-to-align-level-to-title
);
$header-level-3-top-offset-for-readonly: compute-header-top-offset-for-readonly(
    $header-level-3-title-height,
    $header-level-3-magic-value-to-align-level-to-title
);
$artidoc-title-height: 40px; // line-height of TLP h1

$artidoc-header-title-height: calc(
    $artidoc-title-height + #{whitespace.$header-title-padding-top} + #{whitespace.$header-title-padding-bottom}
);
$drag-and-drop-handle-width: var(--tlp-medium-spacing);
$reorder-arrow-size: 14px;
$fields-selection-display-type-column-width: 115px;
$fields-selection-action-button-column-width: 100px;
