/* ==========================================================================
   03 · LAYOUT — container, sections, header, footer
   ========================================================================== */

.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

/* ---------- Sections ---------- */
.section { position: relative; padding-block: var(--section-y); }

/* Sections flagged as always-dark keep dark tokens in both themes */
[data-theme-section="dark"] {
    --text: var(--dark-text);
    --text-muted: var(--dark-muted);
    --border: var(--dark-border);
    --brand-text: var(--brand-300);
    background: var(--dark-bg);
    color: var(--dark-text);
}

.section-head { max-width: 760px; margin-bottom: clamp(32px, 4vw, 56px); }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head--split {
    max-width: none;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 32px 64px;
    align-items: end;
}
.section-head--split .section-lead { margin-bottom: .4em; }

.kicker {
    display: inline-flex; align-items: center; gap: .5em;
    margin-bottom: 1.2rem;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--brand-text);
}
.kicker::before {
    content: ""; width: 28px; height: 1px; background: currentColor;
}

.section-title { font-size: var(--fs-2xl); max-width: 18ch; }
.section-title--sm { font-size: var(--fs-xl); max-width: none; }
.section-head--center .section-title { margin-inline: auto; }
.section-lead { font-size: var(--fs-lg); color: var(--text-muted); max-width: 60ch; }
.section-head--center .section-lead { margin-inline: auto; }

/* ==========================================================================
   HEADER
   data-tone="dark|light" is set by nav.js depending on the section beneath.
   ========================================================================== */
.site-header {
    position: fixed; inset: 0 0 auto; z-index: 100;
    height: var(--header-h);
    color: var(--white);
    transition: background-color .4s, color .4s, box-shadow .4s, transform .5s var(--ease-out);
}
.site-header.is-scrolled {
    background: var(--glass);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    backdrop-filter: saturate(180%) blur(18px);
    box-shadow: 0 1px 0 var(--border);
}
.site-header[data-tone="light"] { color: var(--text); }
.site-header[data-tone="dark"].is-scrolled { background: color-mix(in srgb, var(--black) 72%, transparent); box-shadow: 0 1px 0 var(--dark-border); }
.site-header.is-hidden { transform: translateY(-100%); }

.header-inner {
    height: 100%;
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
}

.brand { display: block; position: relative; width: 168px; flex-shrink: 0; }
.brand-logo { width: 100%; height: auto; transition: opacity .3s; }
.brand-logo--on-dark { position: absolute; inset: 0; }
.site-header[data-tone="dark"] .brand-logo--on-light,
.site-header:not([data-tone]) .brand-logo--on-light { opacity: 0; }
.site-header[data-tone="light"] .brand-logo--on-dark { opacity: 0; }
:root[data-theme="dark"] .site-header .brand-logo--on-light { opacity: 0; }
:root[data-theme="dark"] .site-header .brand-logo--on-dark { opacity: 1; }

.main-nav { flex: 1; display: flex; justify-content: center; }
.nav-list { display: flex; align-items: center; gap: 4px; }
.nav-link {
    position: relative;
    display: inline-flex; align-items: center; gap: .3em;
    padding: .5rem .85rem;
    font-size: var(--fs-sm); font-weight: 500;
    border-radius: 999px;
    opacity: .85;
    transition: opacity .2s, background-color .2s;
}
.nav-link:hover, .nav-link[aria-expanded="true"] { opacity: 1; background: color-mix(in srgb, currentColor 9%, transparent); }
.nav-link.is-current { opacity: 1; }
.nav-link.is-current::after {
    content: ""; position: absolute; left: 50%; bottom: 2px;
    width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
    transform: translateX(-50%);
}

.header-actions { display: flex; align-items: center; gap: 14px; }

.lang-switch {
    display: flex; padding: 3px; border-radius: 999px;
    border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
    font-family: var(--font-mono); font-size: var(--fs-xs);
}
.lang-switch a { padding: .25rem .6rem; border-radius: 999px; opacity: .7; transition: .2s; }
.lang-switch a:hover { opacity: 1; }
.lang-switch a.is-active { background: var(--brand); color: var(--black); opacity: 1; }

/* Hamburger (mobile only) */
.nav-toggle { display: none; width: 42px; height: 42px; position: relative; border-radius: 50%; }
.nav-toggle span {
    position: absolute; left: 11px; right: 11px; height: 1.6px; background: currentColor;
    transition: transform .4s var(--ease-out), top .4s var(--ease-out);
}
.nav-toggle span:first-child { top: 16px; }
.nav-toggle span:last-child  { top: 25px; }
.nav-toggle[aria-expanded="true"] span:first-child { top: 20px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child  { top: 20px; transform: rotate(-45deg); }

/* ---------- Applications dropdown ---------- */
.has-dropdown { position: relative; }
.dropdown-toggle .icon { transition: transform .3s; }
.dropdown-toggle[aria-expanded="true"] .icon { transform: rotate(180deg); }
.dropdown {
    position: absolute; top: calc(100% + 14px); left: 50%;
    width: 340px; padding: 14px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden;
    transform: translate(-50%, 8px) scale(.98);
    transform-origin: top center;
    transition: opacity .25s, transform .35s var(--ease-out), visibility .25s;
}
:root:not([data-theme="dark"]) .dropdown { --text: var(--black); --text-muted: var(--grey-700); --border: rgb(0 0 0 / .08); --brand-text: var(--brand-600); }
.dropdown::before { /* hover bridge */
    content: ""; position: absolute; inset: -16px 0 auto; height: 16px;
}
.has-dropdown.is-open .dropdown {
    opacity: 1; visibility: visible; transform: translate(-50%, 0) scale(1);
}
.dropdown-hint {
    margin: 4px 10px 10px; font-family: var(--font-mono); font-size: var(--fs-xs);
    letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted);
}
.dropdown-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px; border-radius: 12px;
    transition: background-color .2s;
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item strong { display: block; font-size: var(--fs-sm); }
.dropdown-item small { display: block; font-size: var(--fs-xs); color: var(--text-muted); }
.dropdown-icon {
    display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
    background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand-text);
}
.dropdown-ext { margin-left: auto; opacity: 0; transform: translateX(-4px); transition: .25s; }
.dropdown-item:hover .dropdown-ext { opacity: .7; transform: none; }

/* ---------- Responsive header ---------- */
@media (max-width: 1080px) {
    .header-actions .header-cta { display: none; }
}
@media (max-width: 960px) {
    .nav-toggle { display: block; }
    .main-nav {
        position: fixed; inset: 0; z-index: -1;
        display: flex; align-items: center; justify-content: flex-start;
        padding: calc(var(--header-h) + 20px) var(--gutter) 40px;
        background: var(--black); color: var(--white);
        overflow-y: auto;
        /* circle(0) is ignored by some Safari versions, which then paints
           this black layer over the whole page and blocks every tap.
           visibility + pointer-events keep it inert until it is opened. */
        -webkit-clip-path: circle(0px at calc(100% - 40px) 38px);
        clip-path: circle(0px at calc(100% - 40px) 38px);
        visibility: hidden;
        pointer-events: none;
        transition: clip-path .7s var(--ease-in-out), -webkit-clip-path .7s var(--ease-in-out), visibility 0s linear .7s;
    }
    .main-nav.is-open {
        -webkit-clip-path: circle(150% at calc(100% - 40px) 38px);
        clip-path: circle(150% at calc(100% - 40px) 38px);
        visibility: visible;
        pointer-events: auto;
        transition: clip-path .7s var(--ease-in-out), -webkit-clip-path .7s var(--ease-in-out), visibility 0s linear 0s;
    }
    .nav-list { flex-direction: column; align-items: flex-start; gap: 6px; width: 100%; }
    .nav-list > li { width: 100%; }
    .nav-link { font-family: var(--font-display); font-size: 2rem; padding: .3rem 0; border-radius: 0; background: none !important; }
    .dropdown {
        position: static; width: 100%; transform: none; opacity: 1; visibility: visible;
        background: transparent; border: 0; box-shadow: none; padding: 0 0 0 4px;
        display: none; --text: var(--white); --text-muted: var(--dark-muted); color: var(--white);
    }
    .has-dropdown.is-open .dropdown { display: block; transform: none; }
    .dropdown-item:hover { background: rgb(255 255 255 / .06); }
    .site-header.menu-open { color: var(--white); background: transparent !important; box-shadow: none !important; }
    .site-header.menu-open .brand-logo--on-light { opacity: 0; }
    .site-header.menu-open .brand-logo--on-dark { opacity: 1; }
}
@media (max-width: 520px) {
    .brand { width: 136px; }
    .section-head--split { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
    .section-head--split { grid-template-columns: 1fr; }
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
    position: relative; overflow: hidden;
    padding: clamp(64px, 8vw, 110px) 0 32px;
    font-size: var(--fs-sm);
    line-height: 1.25;
    border-top: 1px solid var(--dark-border);
}
.footer-glow {
    position: absolute; left: 50%; top: -260px; width: 900px; height: 500px;
    transform: translateX(-50%);
    background: radial-gradient(closest-side, var(--brand-glow), transparent);
    opacity: .5; pointer-events: none;
}
.footer-grid {
    position: relative;
    display: grid;
    /* Brand column takes every free pixel so the two seals stay on one line.
       Contacts is capped; social and legal only take the width of their text. */
    grid-template-columns: minmax(0, 1fr) minmax(11rem, 15rem) max-content max-content;
    gap: 48px;
    padding-bottom: 56px;
    border-bottom: 1px solid var(--dark-border);
}
.footer-logo img { width: 220px; margin: -14px 0 6px -2px; }
.footer-brand p { color: var(--dark-muted); max-width: 32ch; line-height: 1.25; }
/* Green Hosting badge on top, the two pills side by side underneath */
.footer-badges { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-top: 22px; }
.footer-pills { display: flex; flex-wrap: nowrap; gap: 8px; }
/* Green Hosting badge and Website Carbon result on the same line, same height */
.footer-seals { display: flex; flex-wrap: nowrap; align-items: stretch; gap: 10px; }
.footer-seals > img { height: 76px; width: auto; flex-shrink: 0; }
.footer-seals .carbon-badge { flex-shrink: 0; min-height: 76px; }
@media (max-width: 560px) {   /* phones: compact both seals so they stay side by side */
    .footer-seals { flex-wrap: nowrap; gap: 8px; }
    .footer-seals > img { height: 64px; }
    .footer-seals .carbon-badge { min-height: 64px; gap: 8px; padding: 6px 10px 6px 6px; min-width: 0; }
    .carbon-rating { width: 32px; height: 32px; font-size: 15px; border-radius: 8px; }
    .carbon-body strong { font-size: 13px; }
    .carbon-body, .carbon-body strong small { font-size: 10px; }
}

/* Website Carbon result (footer, under the Green Hosting badge) */
.carbon-badge {
    display: inline-flex; align-items: center; gap: 12px;
    padding: 8px 14px 8px 8px; border-radius: 12px;
    background: rgb(255 255 255 / .04); border: 1px solid var(--dark-border);
    color: var(--dark-muted); font-size: 11px; line-height: 1.25;
    transition: border-color .3s, background-color .3s;
}
.carbon-badge:hover { border-color: color-mix(in srgb, var(--brand) 55%, transparent); background: rgb(255 255 255 / .07); }
.carbon-rating {
    display: grid; place-items: center; flex-shrink: 0;
    width: 40px; height: 40px; border-radius: 10px;
    background: #3FB950; color: #0B0F10;              /* green = good rating */
    font-family: var(--font-display); font-size: 17px; font-weight: 700;
}
.carbon-body { display: flex; flex-direction: column; gap: 3px; }
.carbon-body strong { color: var(--white); font-family: var(--font-display); font-size: 15px; }
.carbon-body strong small { font-family: var(--font-body); font-size: 11px; font-weight: 400; color: var(--dark-muted); }
.carbon-body em { font-style: normal; display: inline-flex; align-items: center; gap: 4px; color: var(--brand-300); }
.footer-pills .badge-pill { white-space: nowrap; }
.footer-badges img { width: 160px; border-radius: 8px; }
.badge-pill {
    display: inline-flex; align-items: center; gap: .45em;
    padding: .35rem .75rem; border-radius: 999px;
    font-size: var(--fs-xs); font-weight: 500;
    border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent);
    color: var(--brand-300);
}
.badge-pill--accent { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }

.footer-col h3 {
    margin-bottom: 1.1rem;
    font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 500;
    letter-spacing: .14em; text-transform: uppercase; color: var(--brand-300);
}
.footer-col .footer-sub { margin-top: 1.8rem; }
.footer-col li { margin-bottom: .2rem; line-height: 1.25; color: var(--dark-muted); }
.footer-col a { position: relative; color: var(--dark-muted); transition: color .2s; }
.footer-col a:hover { color: var(--white); }
.footer-col a::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px;
    background: var(--accent); transform: scaleX(0); transform-origin: right; transition: transform .35s var(--ease-out);
}
.footer-col a:hover::after { transform: scaleX(1); transform-origin: left; }

.social-list { display: flex; gap: 10px; }
.social-list a {
    display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
    border: 1px solid var(--dark-border); transition: .25s;
}
.social-list a::after { display: none; }
.social-list a:hover { background: var(--brand); color: var(--black); border-color: var(--brand); }

/* Bottom line — fixed to the bottom of the viewport on every page.
   Its real height is exposed as --footer-bar-h (footer-bar.js) and used to
   reserve space for the page, the back-to-top button and the cookie banner. */
.footer-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
    background: color-mix(in srgb, var(--black) 86%, transparent);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    backdrop-filter: saturate(160%) blur(14px);
    border-top: 1px solid var(--dark-border);
    padding-bottom: env(safe-area-inset-bottom);   /* iPhone home indicator */
}
.footer-bottom {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px;
    padding-block: 10px; color: var(--dark-muted); font-size: var(--fs-xs);
}
.copyright { margin: 0; }
.copyright a { color: var(--white); }
.copyright a:hover { color: var(--brand); }
.copyright-icon { width: 16px; height: 16px; border-radius: 4px; display: inline-block; vertical-align: -3px; margin: 0 .15em; }
.footer-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.footer-tools .sep { opacity: .35; }
.link-btn { display: inline-flex; align-items: center; gap: .4em; color: var(--dark-muted); transition: color .2s; }
.link-btn:hover { color: var(--white); }
.theme-switch { display: inline-flex; align-items: center; gap: 6px; }
.theme-switch button { color: var(--dark-muted); transition: color .2s; }
.theme-switch button:hover { color: var(--white); }
.theme-switch button[aria-pressed="true"] { color: var(--brand); font-weight: 600; }
.version { font-family: var(--font-mono); color: var(--brand-300); }

.to-top {
    position: fixed; right: 22px; bottom: calc(var(--footer-bar-h, 44px) + 16px); z-index: 90;
    display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
    background: var(--brand); color: var(--black);
    box-shadow: 0 10px 30px -8px var(--brand-glow);
    opacity: 0; transform: translateY(16px) scale(.9); pointer-events: none;
    transition: opacity .35s, transform .45s var(--ease-out), background-color .2s;
}
.to-top .icon { transform: rotate(-90deg); }
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--accent); }

/* Desktop: Contactos, Redes sociais and Legal columns aligned to the right.
   Below 1120px the brand column would be too narrow for both seals on one line,
   so the brand spans the full row and the other columns sit underneath. */
@media (min-width: 1121px) {
    .footer-col { text-align: right; justify-self: end; }
    .footer-col .social-list { justify-content: flex-end; }
}

@media (max-width: 1120px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
    .footer-grid { grid-template-columns: 1fr; gap: 36px; }
    .footer-bottom { flex-direction: column; align-items: flex-start; gap: 3px; padding-block: 7px; font-size: 10.5px; line-height: 1.25; }
    .footer-tools { flex-wrap: nowrap; gap: 10px; white-space: nowrap; }
    .footer-tools .sep { display: none; }
}
