/* ------------------------------
   RESET + BASE
------------------------------ */
:root {
    --primary-color: #5083b7;
    --secondary-color: #910191;
    --primary-font: "Bellota Text", sans-serif;
    --bg: #f7f7f7;
    --text-color: #222;
    --header-bg: #d4e3f5;
    --header-smooth: #fff;
    --toggle-bg: #a7d1fa;
    --header-text: #5083b7;
    --panel-bg: #fff;
    --accent: #0078ff;
    --samp: #0c790c;
    --tab: #fff3d6;
    --quote: #ebffdc;
    --header-height: 80px;
    --panel-width: 301px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --secondary-color: #c0769b;
        --bg: #1a1a1a;
        --text: #eaeaea;
        --header-bg: #111;
        --header-smooth: #272727;
        --toggle-bg: #a7d1fa;
        --header-text: #fff;
        --panel-bg: #111;
        --accent: #4da3ff;
        --samp: #7ab87a;
        --tab: #0b1c2c;
        --quote: #013437;
    }
}

:root[data-theme="dark"] {
    --secondary-color: #c0769b;
    --bg: #1a1a1a;
    --text: #eaeaea;
    --header-bg: #111;
    --header-smooth: #272727;
    --toggle-bg: #a7d1fa;
    --header-text: #fff;
    --panel-bg: #111;
    --accent: #4da3ff;
    --samp: #7ab87a;
    --tab: #0b1c2c;
    --quote: #013437;
}

::selection {
    color: #5083b7;
    background-color: #d4e3f5;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--primary-font);
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

body:has(.nav-toggle:checked):before {
    content: "";
    background: rgba(0, 0, 0, 0.3);
    display: block;
    width: 100%;
    height: 100vh;
    position: fixed;
}

/* Center page on large screens */
.wrapper {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: flex;
}

/* ------------------------------
   DIV LAYOUT
------------------------------ */

p, a, li, .font-bellota {
  font-family: var(--primary-font);
  font-weight: 300;
  font-style: normal;
  line-height: 1.5;
}

h1, h2, h3, h4, h1 a,
.font-bellota-bold {
  font-family: var(--primary-font);
  font-weight: 700;
  font-style: normal;
  color: var(--primary-color);
}

.d-flex {
    display: flex;
    align-items: flex-start;
}

.d-flex-around {
    display: flex;
    justify-content: space-around;
    d-flex
}

p {
    font-size: 1.1rem;
}

p.center {
    text-align: center;
}

.mb-2 {
    margin-bottom: 4px;
}

.lg-hide {
    display: none;
}

a {
    color: var(--secondary-color); /*#bf568b;*/
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #0078ff;
    color: var(--accent);
}

a.linked:before {
    content: "";
    display: inline-block;
    background: transparent url(../icons/link.svg) no-repeat top right;
    background-size: 14px;
    opacity: 0.7;
    width: 20px;
    height: 14px;
    margin-right: 5px;
}

img.next {
    width: 20px;
    margin-bottom: -3px;
    margin: 0 5px -3px 5px;
    opacity: 0.6;
}

/* ------------------------------
   HEADER AND MENU (mobile first)
------------------------------ */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--header-bg);
    color: var(--header-text);
    position: fixed;
    height: var(--header-height);
    width: 100%;
    z-index: 100;
}

header:before {
    content: "";
    display: block;
    width: 100%;
    background: linear-gradient(180deg, var(--header-smooth), transparent);
    height: var(--header-height);
    position: absolute;
    top: 5rem;
    z-index: -1;
}

header h1 {
    padding-left: 20px;
}

.menu-panel {
    flex-grow: 1;
}

.menu-panel ul {
    list-style: none;
}

.menu {
    display: flex; 
    font-size: 1.3rem;
    gap: 2rem;
}

.nav-toggle { 
    display: none; 
}
/*.wrapper { display: flex; }*/

.submenu {
    position: fixed;
    top: 7rem;;
    left: 1rem;
    overflow-y: auto;
    width: 12rem;
    padding: 1rem;
}

.submenu li {
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.submenu a.active {
    font-weight: bold;
}

p:has(.theme-toggle) {
    position: absolute;
    top: 17px;
    right: 50px;
}

.theme-toggle {
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--header-text);
    width: 34px;
    height: 24px;
    margin-left: 10px;
}

.theme-toggle,
html[data-theme="light"] .theme-toggle {
    background: transparent url(../icons/toggle-light.svg) no-repeat center center;
    background-size: 34px;
}
html[data-theme="dark"] .theme-toggle {
    background-image: url(../icons/toggle-dark.svg);
}

main {
    flex: 1;
    padding: 7rem 2rem 2rem 15rem;
    max-width: 1100px;
}

footer {
    padding: var(--space-md);
    text-align: center;
    opacity: .6;
}


@media (min-width: 1500px) {
    main {
        margin: auto;
    }
}

/* ------------------------------
   MOBILE LAYOUT
------------------------------ */
@media (max-width: 960px) {
    main {
        padding: 1rem;
        margin: 0;
    }

    header {
        position: relative;
        padding: 0;
    }

    header:has(.nav-toggle:checked) {
        background: transparent;
    }

    header .logo {
        font-size: 1.4rem;
        font-weight: bold;
    }

    main {
        padding: 1rem;
    }

    p:has(.theme-toggle) {
        position: unset;
    }

    ul {
        margin-bottom: 2rem;
    }

    .submenu {
        display: block;
        position: unset;
        padding: 0;
    }

    .submenu li {
        margin-bottom: 0;
    }

    .lg-hide {
        display: block;
    }

    .burger {
        width: 28px;
        height: 22px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        cursor: pointer;
        margin-right: 10px;
    }

    .burger span {
        display: block;
        height: 3px;
        background: var(--header-text);
        border-radius: 3px;
        transition: 0.3s;
        margin: 0;
    }

    .menu-panel {
        position: fixed;
        top: 0;
        left: calc(-1 * var(--panel-width));
        width: var(--panel-width);
        height: 100%;
        background: var(--panel-bg);
        box-shadow: 2px 0 10px rgba(0,0,0,0.2);
        padding: 2rem;
        transition: left 0.3s ease;
        z-index: 1000;
        box-sizing: border-box;
    }

    .menu-panel.open {
        left: 0;
    }

    .menu-panel ul {
        display: block !important;
        padding: 0;
    }

    .menu-panel a {
        font-size: 1.1rem;
    }

    .nav-toggle:checked + .burger {
        position: fixed;
        top: 12px;
        right: 0;
        padding: 8px 0px 8px 10px;
        border-radius: 20px;
        background: var(--toggle-bg);
    }

    .nav-toggle:checked ~ .menu-panel {
        left: 0;
    }
    .nav-toggle:checked + .burger span{
        margin-left: 2px;
    }
    .nav-toggle:checked + .burger span:nth-child(1) {
        transform: rotate(45deg) translateY(8px);
        margin-top: 3px;
    }
    .nav-toggle:checked + .burger span:nth-child(2) {
        opacity: 0;
    }
    .nav-toggle:checked + .burger span:nth-child(3) {
        transform: rotate(-45deg) translateY(-8px);
        margin-bottom: 4px;
    }
}


/* ------------------------------
   TABS LAYOUT
------------------------------ */

.tabs ul { 
    list-style: none; 
    padding-left: 0;
    margin: 0 0 -1px 0;
}

.tabs li {
    display: inline-block;
    padding: 10px;
    border: 1px solid #d4e3f5;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
}

.tabs li:not(.active) {
    cursor: pointer;
}

.tabs li.active {
    border-left: 1px solid #ffce55;
    border-top: 2px solid #ffb000;
    border-right: 1px solid #ffce55;
    border-bottom: none;
    background: var(--tab);
    color: #bc2d00;
}

.tab:not(.active) {
    display: none;
}

.tab {
    position: relative;
}

legend {
    padding: 5px;
    border-radius: 5px;
}

.tab legend {
    position: absolute;
    top: 3px;
    right: 3px;
    z-index: 10;
    cursor: pointer;
}

.tab legend:after {
    content: "";
    display: inline-block;
    background: transparent url(../icons/copy.svg) no-repeat top left;
    background-size: 18px;
    width: 20px;
    height: 18px;
    margin: 0 0 -3px 5px;
}

legend.danger { 
    background: #ffd7d7;
    color: #ba0101;
}

legend.warning { 
    background: #ffeea9;
    color: #a76d03;
}

legend.success { 
    background: #d2f9de; 
    color: green;
}

legend.info { 
    background: #d6ebff; 
    color: blue;
}

pre:has(code) {
    white-space: normal;
    position: relative;
    margin-top: 0;
}

pre code {
    white-space: pre;
    padding-top: 22px!important;
}

/* ------------------------------
   ELEMENTS LAYOUT
------------------------------ */

samp {
    display: inline-block;
    font-size: large;
    color: var(--samp);
    margin: 0;
}

mark {
    color: red;
}

div.card {
    position: relative;
    border: 1px solid #d4e3f5;
    border-radius: 15px;
    padding: 20px;
    background: rgb(223 233 245 / 50%);
    width: 100%;
    margin: 10px;
}

quote {
    font-style: italic;
    border-left: 3px solid green;
    display: block;
    padding: 10px 0 10px 45px;
    border-radius: 5px;
    background: var(--quote) url(../icons/comment.svg) no-repeat;
    background-size: 25px 25px;
    background-position: 12px 12px;
    margin-bottom: 15px;
}
