/* 01 — Base e variáveis globais */

* {
    box-sizing: border-box;
}

:root {
    color-scheme: dark;
    --bg: #030508;
    --fg: #eef2f6;
    --muted: #9ba9b7;
    --accent: #ffaf77;
    --line: #23303c;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font: 15px/1.5 system-ui,sans-serif;
}

button, a {
    color: inherit;
    font: inherit;
}

button {
    background: none;
    border: 0;
    cursor: pointer;
}

button:focus-visible, a:focus-visible, svg a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

a {
    text-decoration: none;
}

/* 02 — Cabeçalho e navegação */

header {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 4vw;
    gap: 14px;
    border-bottom: 1px solid var(--line);
}

.brand {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -3px;
}

.brand span, h1 span {
    color: var(--accent);
}

.identity, .eyebrow, footer, .detail-top {
    font: 11px/1.5 ui-monospace,monospace;
    letter-spacing: 1.6px;
}

.identity {
    color: var(--muted);
}

nav {
    margin-left: auto;
    display: flex;
    gap: 24px;
}

nav button:hover {
    color: var(--accent);
}

/* 03 — Página inicial e mapa cerebral */

main {
    max-width: 1700px;
    margin: auto;
    padding: 20px 4vw 0;
}

.hero {
    text-align: center;
}

.eyebrow {
    color: var(--accent);
    margin: 0 0 7px;
}

h1 {
    font-size: clamp(38px,5vw,76px);
    letter-spacing: -.07em;
    line-height: 1;
    margin: 0;
    font-weight: 650;
}

.subtitle {
    color: var(--muted);
    margin: 10px 0 12px;
}

.stage {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0,1fr) 235px;
    align-items: center;
    min-height: 0;
}

.brain {
    position: relative;
    width: min(100%,calc((100vh - 285px)*1.74));
    margin: auto;
    isolation: isolate;
}

.brain img {
    width: 100%;
    display: block;
    filter: contrast(1.05);
    mask-image: radial-gradient(ellipse at center,#000 65%,transparent 100%);
}

#regions {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.region {
    fill: #fff0;
    stroke: #9ddfff00;
    stroke-width: 2;
    cursor: pointer;
    transition: fill .2s,stroke .2s;
    outline: none;
}

.region:hover, .region:focus, .region.active {
    fill: #75cfff24;
    stroke: #b4e6ffbb;
    filter: drop-shadow(0 0 12px #61cfff);
}

.marker {
    pointer-events: none;
    fill: #d7f4ff;
    stroke: #70c8ff;
    stroke-width: 2;
    filter: drop-shadow(0 0 8px #78dfff);
}

.markerhalo {
    pointer-events: none;
    fill: none;
    stroke: #b1e6ff66;
    stroke-width: 1.5;
}

.region-label {
    pointer-events: none;
    fill: #fff;
    font: 600 19px system-ui;
    paint-order: stroke;
    stroke: #05090e;
    stroke-width: 5px;
    stroke-linejoin: round;
    opacity: .85;
}

.side {
    border-left: 1px solid var(--line);
    padding-left: 22px;
    min-height: 170px;
}

.side h2 {
    font-size: 29px;
    letter-spacing: -1px;
    line-height: 1.1;
    margin: 12px 0;
}

.side p {
    color: var(--muted);
}

#enter {
    background: var(--fg);
    color: var(--bg);
    padding: 10px 15px;
    font-weight: 650;
}

#tooltip {
    position: absolute;
    pointer-events: none;
    background: #0a1019ef;
    border: 1px solid #7cc9ed;
    padding: 8px 13px;
    transform: translate(-50%,-115%);
    white-space: nowrap;
    z-index: 3;
    font-size: 13px;
    box-shadow: 0 5px 30px #000;
}

/* 04 — Navegação por áreas e rodapé */

.domains {
    display: grid;
    grid-template-columns: repeat(6,1fr);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.domains button {
    min-height: 55px;
    text-align: left;
    padding: 10px;
    border-right: 1px solid var(--line);
    font-size: 13px;
}

.domains button:hover, .domains button:focus-visible {
    background: #12202b;
    color: var(--accent);
}

.domains button span {
    display: block;
    color: var(--muted);
    font: 10px monospace;
    margin-bottom: 3px;
}

footer {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    padding: 14px 0;
    gap: 12px;
}

/* 05 — Estilos de diálogo e ligações */

dialog {
    background: #0b1119;
    color: var(--fg);
    border: 1px solid #344757;
    width: min(850px,95vw);
    max-height: 90vh;
    padding: 30px 42px;
    overflow: auto;
}

dialog::backdrop {
    background: #000c;
    backdrop-filter: blur(10px);
}

.detail-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
}

#close {
    font-size: 30px;
}

#body h2 {
    font-size: clamp(30px,5vw,55px);
    line-height: 1.05;
    letter-spacing: -.045em;
    margin: 15px 0;
}

#body p {
    color: var(--muted);
}

.project {
    border-top: 1px solid var(--line);
    padding: 18px 0;
}

.project h3 {
    margin: 0;
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.links a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 5px;
}

.index {
    color: var(--accent);
    font: 12px monospace;
    letter-spacing: 1px;
}

@media(max-width: 850px) {
    header {
        gap: 8px;
        padding: 0 3vw;
    }
    .identity {
        display: none;
    }
    nav {
        gap: 8px;
    }
    nav button {
        font-size: 12px;
    }
    .stage {
        grid-template-columns: 1fr;
    }
    .brain {
        width: 100%;
    }
    .side {
        border-left: 0;
        border-top: 1px solid var(--line);
        padding: 12px 0;
        min-height: 0;
    }
    .side h2 {
        font-size: 23px;
        margin: 5px 0;
    }
    .side p {
        margin: 5px 0;
    }
    .domains {
        grid-template-columns: repeat(3,1fr);
    }
    footer {
        font-size: 9px;
    }
    .region-label {
        font-size: 24px;
    }
    dialog {
        padding: 20px;
    }
    .subtitle {
        font-size: 13px;
    }
}

@media(prefers-reduced-motion: reduce) {
    * {
        transition: none!important;
    }
}

/* Personal identity and academic affiliation */

/* 06 — Identidade pessoal e académica */

.hero h1 {
    font-size: clamp(36px, 4.8vw, 76px);
    font-weight: 750;
    letter-spacing: -0.045em;
    line-height: 1.04;
    color: #f5f8fc;
}

.hero h1 .surname {
    color: #d8eaff;
}

.concept {
    font-size: 19px;
    font-weight: 600;
    letter-spacing: .24em;
    margin-bottom: 12px;
}

.academic {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 12px auto 8px;
    flex-wrap: wrap;
}

.academic .subtitle {
    margin: 0;
    color: #b8c5d0;
    font-size: 14px;
}

.ist-link {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    border-left: 3px solid #009de0;
    padding: 5px 12px;
    text-align: left;
    background: linear-gradient(90deg,#009de015,transparent);
    transition: background .25s,box-shadow .25s,transform .25s;
}

.ist-wordmark strong {
    display: block;
    color: #62caff;
    font-size: 15px;
    font-weight: 650;
    line-height: 1.3;
}

.ist-wordmark small {
    display: block;
    color: #a6b8c9;
    font-size: 11px;
    letter-spacing: .08em;
}

.ist-arrow {
    color: #62caff;
    font-size: 18px;
}

.ist-link:hover, .ist-link:focus-visible {
    background: #009de023;
    box-shadow: 0 0 25px #009de022;
    transform: translateY(-2px);
}

.brain {
    width: min(100%,max(400px,calc((100svh - 320px)*1.74)));
}

@media(max-width: 850px) {
    .hero h1 {
        font-size: clamp(36px, 6vw, 60px);
    }
    .academic {
        gap: 9px;
        flex-direction: column;
    }
    .brain {
        width: 100%;
    }
    .concept {
        font-size: clamp(12px, 2vw, 16px);
        letter-spacing: .12em;
    }
}

/* 07 — Páginas interiores e transições */

[hidden] {
    display: none!important;
}

#interior {
    max-width: 1500px;
    margin: auto;
    padding: 0 5vw 6vw;
}

#body:focus {
    outline: none;
}

.crumb {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    color: #91a0b0;
    font: 11px ui-monospace,monospace;
    letter-spacing: 1px;
}

.back {
    padding: 9px 0;
    color: #d9e8f4;
    font-size: 13px;
    text-align: left;
}

.back:hover {
    color: var(--accent);
}

.chamber-hero {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    align-items: center;
    min-height: 460px;
    isolation: isolate;
    border-bottom: 1px solid var(--line);
    overflow: hidden;
}

.chamber-copy {
    position: relative;
    z-index: 2;
    padding: 35px 0;
}

.kicker {
    color: var(--tone,var(--accent));
    font: 11px/1.5 ui-monospace,monospace;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.chamber-title {
    font-size: clamp(42px,6.1vw,96px);
    line-height: .98;
    font-weight: 650;
    letter-spacing: -.065em;
    margin: 20px 0;
    color: #f2f5f8;
    max-width: 850px;
}

.lead {
    font-size: clamp(16px,1.4vw,21px);
    line-height: 1.6;
    color: #b5c3d0;
    max-width: 780px;
}

.chamber-art {
    position: relative;
    min-width: 0;
}

.chamber-art img {
    width: 100%;
    display: block;
    mask-image: radial-gradient(ellipse at center,#000 45%,transparent 78%);
}

.art-id {
    position: absolute;
    right: 5%;
    bottom: 8%;
    color: var(--tone);
    font: 10px monospace;
    letter-spacing: 2px;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 26px 0;
}

.action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 12px 18px;
    background: #eef4f7;
    color: #091019;
    font-size: 13px;
    font-weight: 650;
    border: 1px solid #eef4f7;
    transition: background .2s,color .2s;
}

.action:hover {
    background: var(--tone,var(--accent));
    border-color: var(--tone,var(--accent));
}

.action.secondary {
    background: transparent;
    color: #dae6ef;
    border-color: #374553;
}

.action.secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.work-section, .topic-section {
    padding: 52px 0;
    border-bottom: 1px solid var(--line);
}

.section-title {
    font-size: clamp(27px,3.8vw,52px);
    line-height: 1.1;
    letter-spacing: -.04em;
    margin: 14px 0 25px;
}

.muted {
    color: var(--muted);
    max-width: 850px;
}

.feature-row {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: clamp(20px,5vw,70px);
    align-items: center;
    border-top: 1px solid var(--line);
    padding: 26px 0;
    margin-top: 25px;
}

.feature-row>img {
    width: 100%;
    aspect-ratio: 1.65;
    object-fit: cover;
    border: 1px solid #293744;
}

.feature-copy h3 {
    font-size: clamp(25px,3.4vw,46px);
    letter-spacing: -.045em;
    line-height: 1.1;
    margin: 13px 0;
}

.feature-copy p {
    line-height: 1.7;
}

.techline {
    font: 13px/1.7 ui-monospace,monospace;
    color: #9bd7ef;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tags span {
    border: 1px solid #334453;
    padding: 9px 14px;
    color: #c5d5e0;
    font-size: 13px;
}

.next-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 30px 0;
}

/* 08 — Fichas de projeto e galerias */

.case-hero {
    padding: 20px 0 30px;
}

.case-cover {
    display: block;
    width: 100%;
    max-height: 620px;
    object-fit: cover;
    margin: 32px 0;
}

.case-details {
    max-width: 1050px;
    margin: 0 auto;
}

.case-details h2 {
    font-size: 32px;
    letter-spacing: -.03em;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(2,1fr);
    gap: 20px;
}

.gallery figure {
    margin: 0;
}

.gallery img {
    width: 100%;
    display: block;
}

.gallery figcaption {
    color: var(--muted);
    padding: 10px 0;
}

/* 09 — Experiências interativas e transição neural */

.lab-panel {
    border: 1px solid #283845;
    background: #080e17;
    padding: 20px;
    margin-top: 30px;
}

.lab-canvas {
    display: block;
    width: 100%;
    max-height: 480px;
    object-fit: contain;
    background: #03070c;
}

.range-label {
    display: flex;
    align-items: center;
    gap: 14px;
    color: #dbe5ed;
}

.range-label input {
    accent-color: var(--tone);
    max-width: 150px;
}

#dive {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #03060b;
    pointer-events: none;
}

#tunnel {
    width: 100%;
    height: 100%;
    display: block;
}

.dive-caption {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    text-align: center;
    gap: 15px;
    text-shadow: 0 3px 20px #000;
}

.dive-caption span {
    font: 12px monospace;
    letter-spacing: 4px;
    color: #c4e6f4;
}

.dive-caption strong {
    font-size: clamp(24px,5vw,60px);
    letter-spacing: -.04em;
}

.chamber-copy, .feature-row, .case-hero {
    animation: arrival .45s ease both;
}

@keyframes arrival {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media(max-width: 850px) {
    .chamber-hero, .feature-row {
        grid-template-columns: 1fr;
        min-height: 0;
    }
    .chamber-copy {
        padding: 15px 0;
    }
    .chamber-art {
        max-height: 300px;
        overflow: hidden;
    }
    .chamber-art img {
        max-height: 300px;
        object-fit: contain;
    }
    .feature-row {
        gap: 15px;
    }
    .gallery {
        grid-template-columns: 1fr;
    }
    .next-row .action {
        font-size: 11px;
    }
    .work-section, .topic-section {
        padding: 30px 0;
    }
    .lab-panel {
        padding: 10px;
    }
}

@media(prefers-reduced-motion: reduce) {
    * {
        animation: none!important;
        scroll-behavior: auto!important;
    }
}

/* Ajustes para telemóveis pequenos */

@media (max-width: 600px) {
    .concept {
        font-size: 12px;
    }
    .hero h1 {
        font-size: 42px;
    }
}
