/* ============================================
   EDUARDO GARCÍA PORTFOLIO — HEADER
   Top navigation, the side menu (the menu is built by js/main.js
   from the list in js/datos.js) and the cookie notice.
   ============================================ */

/* ---- Navigation ---- */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Same side margin as the columns' content, so logo and menu line up with them */
    padding: 0 28px;
    z-index: 1000;
    background: rgba(242, 239, 233, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    /* Same line as the columns' dividers */
    border-bottom: var(--rule);
    transition: transform 0.5s var(--ease-out-expo);
}

.nav__logo {
    display: inline-flex;
}

/* His signature is the logo (a vector: sharp at any size, also in the intro) */
.nav__logo-img {
    height: 28px;
    width: auto;
    transition: opacity 0.3s ease;
}

.nav__logo-img:hover {
    opacity: 0.7;
}

/* On the home the signature is inline, so js/intro.js can write it */
.nav__firma {
    display: block;
    aspect-ratio: 1920 / 186;
    fill: currentColor;
    color: var(--color-text);
    overflow: visible;
}

.nav__menu {
    display: flex;
    gap: 10px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* Links in the numbers' language: the current page is a black block with
   paper-coloured letters (like the 01, 02, 03 of the columns); hovering
   another one turns it red */
.nav__link {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1;
    text-transform: uppercase;
    color: var(--color-text);
    padding: 7px 10px 6px;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.nav__link:hover {
    background: var(--color-accent);
    color: var(--color-text);
}

.nav__link--active,
.nav__link--active:hover {
    background: var(--color-text);
    color: var(--color-bg);
}

.nav__right {
    display: flex;
    align-items: center;
    gap: 24px;
}

/* Back to Oroi (the studio's site, oroi.design): an outlined pill with an arrow, the
   same height as "Menú"; red on hover, like every other button */
.nav__oroi {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px 9px 12px;
    border: 2px solid var(--color-text);
    border-radius: 999px;
    color: var(--color-text);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.nav__oroi:hover {
    background: var(--color-accent);
    border-color: var(--color-accent);
}

.nav__oroi:focus-visible {
    outline: 2px solid var(--color-text);
    outline-offset: 3px;
}

.nav__oroi-flecha {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    transition: transform 0.4s var(--ease-out-expo);
}

.nav__oroi:hover .nav__oroi-flecha {
    transform: translateX(-3px);
}

/* Menu button: a solid black pill, like the round arrow buttons of the
   columns ("Menú" / "Cerrar" next to the two lines); red on hover */
.nav__menu-button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px 11px 18px;
    border-radius: 999px;
    background: var(--color-text);
    color: var(--color-bg);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    line-height: 1;
    text-transform: uppercase;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.nav__menu-button:hover {
    background: var(--color-accent);
    color: var(--color-text);
}

.nav__menu-button:focus-visible {
    outline: 2px solid var(--color-text);
    outline-offset: 3px;
}

.nav__menu-label {
    min-width: 3.9em;
    text-align: right;
}

.nav__hamburger {
    width: 22px;
    height: 14px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.nav__hamburger span {
    display: block;
    width: 100%;
    height: 3px;
    background: currentColor;
    transition: transform 0.4s var(--ease-out-expo), opacity 0.3s ease;
}

.nav__menu-button:hover .nav__hamburger span:first-child {
    transform: translateY(-1px);
}

.nav__menu-button:hover .nav__hamburger span:last-child {
    transform: translateY(1px);
}

/* The two lines turn into an X while the side menu is open */
.nav__menu-button[aria-expanded="true"] .nav__hamburger span:first-child {
    transform: translateY(5.5px) rotate(45deg);
}

.nav__menu-button[aria-expanded="true"] .nav__hamburger span:last-child {
    transform: translateY(-5.5px) rotate(-45deg);
}

/* ---- Side Menu ---- */
/* Built by js/main.js; sits under the nav so the hamburger stays on top. */
.side-menu {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 999;
    width: min(460px, 100%);
    height: 100%;
    padding: calc(var(--nav-height) + 48px) 28px 40px;
    overflow-y: auto;
    background: var(--color-bg);
    border-left: var(--rule);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.7s var(--ease-out-expo), visibility 0s linear 0.7s;
}

.side-menu.is-open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.7s var(--ease-out-expo), visibility 0s;
}

.side-menu__backdrop {
    position: fixed;
    inset: 0;
    z-index: 998;
    background: rgba(26, 26, 26, 0.18);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0s linear 0.5s;
}

.is-menu-open .side-menu__backdrop {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0s;
}

.is-menu-open body {
    overflow: hidden;
}

/* Same language as the columns: bold label with a thick line, numbers as
   black blocks, sections in the titles' typeface, black rules */
.side-menu__heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text);
}

.side-menu__heading::after {
    content: '';
    flex: 1;
    height: 3px;
    background: var(--color-text);
}

.side-menu__sections {
    list-style: none;
    border-bottom: var(--rule);
}

.side-menu__section {
    border-top: var(--rule);
    opacity: 0;
    transform: translateX(24px);
    transition: opacity 0.5s ease, transform 0.7s var(--ease-out-expo);
}

.side-menu.is-open .side-menu__section {
    opacity: 1;
    transform: translateX(0);
}

.side-menu.is-open .side-menu__section:nth-child(1) { transition-delay: 0.1s; }
.side-menu.is-open .side-menu__section:nth-child(2) { transition-delay: 0.16s; }
.side-menu.is-open .side-menu__section:nth-child(3) { transition-delay: 0.22s; }

.side-menu__toggle {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 18px 0;
    color: var(--color-text);
    text-align: left;
}

.side-menu__toggle:focus-visible,
.side-menu__project:focus-visible,
.side-menu__page:focus-visible {
    outline: 2px solid var(--color-text);
    outline-offset: 3px;
}

.side-menu__number {
    flex: none;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1;
    padding: 4px 6px 3px;
    color: var(--color-bg);
    background: var(--color-text);
}

.side-menu__name {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1;
    transition: transform 0.4s var(--ease-out-expo);
}

.side-menu__toggle:hover .side-menu__name {
    transform: translateX(4px);
}

/* A thick + that turns into − while the section is open */
.side-menu__icon {
    position: relative;
    width: 16px;
    height: 16px;
    margin-left: auto;
}

.side-menu__icon::before,
.side-menu__icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 3px;
    margin-top: -1.5px;
    background: currentColor;
    transition: transform 0.4s var(--ease-out-expo);
}

.side-menu__icon::after {
    transform: rotate(90deg);
}

.side-menu__toggle[aria-expanded="true"] .side-menu__icon::after {
    transform: rotate(0deg);
}

.side-menu__projects {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.5s var(--ease-out-expo);
}

.side-menu__toggle[aria-expanded="true"] + .side-menu__projects {
    grid-template-rows: 1fr;
}

.side-menu__projects ul {
    min-height: 0;
    overflow: hidden;
    list-style: none;
}

.side-menu__projects li:last-child {
    padding-bottom: 16px;
}

/* Projects and pages like the nav links: red on hover, a black block for
   the one shown on this page */
.side-menu__project,
.side-menu__page {
    display: flex;
    width: fit-content;
    padding: 8px 10px 7px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-transform: uppercase;
    color: var(--color-text);
    transition: background-color 0.25s ease, color 0.25s ease;
}

.side-menu__project {
    margin-left: 30px;
}

.side-menu__project:hover,
.side-menu__page:hover {
    background: var(--color-accent);
    color: var(--color-text);
}

.side-menu__project[aria-current="page"],
.side-menu__page[aria-current="page"] {
    background: var(--color-text);
    color: var(--color-bg);
}

/* Back to Oroi, at the end of the side menu (on small phones it is the only way back) */
.side-menu__oroi {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
    padding: 11px 16px;
    border-radius: 999px;
    background: var(--color-text);
    color: var(--color-bg);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    line-height: 1;
    text-transform: uppercase;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.side-menu__oroi:hover {
    background: var(--color-accent);
    color: var(--color-text);
}

/* Main pages: only on tablet and mobile, where the nav links are hidden */
.side-menu__pages {
    display: none;
    margin-top: 32px;
    list-style: none;
}

.side-menu__page {
    font-size: 0.8rem;
}

/* ---- Cookie notice ---- */
/* Built by js/main.js. A small sheet in the corner, under the side menu,
   framed with the site's black rule. Accept and reject look the same:
   neither is pushed on the visitor. */
.cookie-notice {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 997;
    width: min(380px, calc(100% - 32px));
    padding: 24px;
    background: var(--color-bg);
    border: var(--rule);
    opacity: 0;
    translate: 0 16px;
    filter: blur(6px);
    visibility: hidden;
    transition: opacity 0.4s ease, translate 0.7s var(--ease-out-expo), filter 0.4s ease, visibility 0s linear 0.7s;
}

.cookie-notice.is-open {
    opacity: 1;
    translate: 0 0;
    filter: none;
    visibility: visible;
    transition: opacity 0.5s ease, translate 0.9s var(--ease-out-expo), filter 0.5s ease, visibility 0s;
}

/* Same heading as the side menu's (label and a thick line), after the
   site's red cross */
.cookie-notice__label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    line-height: 1;
    text-transform: uppercase;
    color: var(--color-text);
}

.cookie-notice__label::before {
    content: '';
    flex: none;
    width: 12px;
    height: 12px;
    background:
        linear-gradient(var(--color-accent), var(--color-accent)) center / 100% 4px no-repeat,
        linear-gradient(var(--color-accent), var(--color-accent)) center / 4px 100% no-repeat;
}

.cookie-notice__label::after {
    content: '';
    flex: 1;
    height: 3px;
    margin-left: 2px;
    background: var(--color-text);
}

.cookie-notice__text {
    margin-top: 16px;
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--color-text);
}

.cookie-notice__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}

.cookie-notice__button {
    padding: 12px 16px;
    border: 2px solid var(--color-text);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.cookie-notice__button:hover {
    background: var(--color-text);
    color: var(--color-bg);
}

.cookie-notice__button:focus-visible,
.cookie-notice__link:focus-visible {
    outline: 2px solid var(--color-text);
    outline-offset: 3px;
}

.cookie-notice__link {
    display: inline-block;
    margin-top: 16px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    transition: text-decoration-color 0.3s ease;
}

.cookie-notice__link:hover {
    text-decoration-color: var(--color-accent);
}

/* Link to the policy in the footers: underlined, red on hover */
.page-footer a,
.footer-copy a {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
    transition: text-decoration-color 0.3s ease;
}

.page-footer a:hover,
.footer-copy a:hover {
    text-decoration-color: var(--color-accent);
}
