/* =========================================================================
   CIAPRI site styles
   Loaded after bootstrap.min.css (see templates/head.php).
   ========================================================================= */

/* ---------- Design tokens ---------- */
:root {
    --primary-teal: #006666;
    --teal-dark: #004b4b;
    --teal-tint: #e6f2f1;
    --earthy-sand: #f9f7f2;
    --sand-deep: #f1ece1;
    --accent-terracotta: #b35a38;
    --text-dark: #1f2a2e;
    --text-soft: #4d5a61;
    --line: #e6e1d6;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(16, 42, 42, .04), 0 4px 18px rgba(16, 42, 42, .06);
    --shadow-lg: 0 2px 6px rgba(16, 42, 42, .06), 0 18px 48px rgba(16, 42, 42, .14);
    --ease: cubic-bezier(.2, .7, .2, 1);

    /* Bootstrap overrides */
    --bs-body-color: var(--text-dark);
    --bs-secondary-color: #5f6b72;
    --bs-link-color-rgb: 0, 102, 102;
    --bs-link-hover-color-rgb: 179, 90, 56;
    --bs-border-color: var(--line);
}

/* ---------- Base ---------- */
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 1.0625rem;
    color: var(--text-dark);
    background-color: #fff;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

::selection { background: var(--teal-tint); color: var(--teal-dark); }

h1, h2, h3, h4, h5 {
    font-family: 'Playfair Display', Georgia, serif;
    color: var(--teal-dark);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
}
h2 { font-size: clamp(1.85rem, 1.4rem + 1.5vw, 2.6rem); }
h3 { font-size: clamp(1.3rem, 1.15rem + .5vw, 1.6rem); }
h4 { font-size: 1.2rem; }

a {
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: color .2s var(--ease);
}
p a, li a { overflow-wrap: anywhere; }

img { max-width: 100%; }

:focus-visible {
    outline: 2px solid var(--accent-terracotta);
    outline-offset: 3px;
}

.text-ciapri { color: var(--primary-teal); }

a.link-ciapri {
    color: var(--primary-teal);
    text-decoration: none;
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 0 1px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size .3s var(--ease), color .2s;
}
a.link-ciapri:hover {
    color: var(--accent-terracotta);
    background-size: 100% 1px;
}

.bg-light { background-color: var(--earthy-sand) !important; }

/* ---------- Navigation ---------- */
.navbar {
    padding: 1.25rem 0 .5rem;
    border-bottom: 1px solid transparent;
    transition: box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.navbar.bg-white {
    background-color: rgba(255, 255, 255, .9) !important;
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
}
.navbar.is-scrolled {
    border-bottom-color: var(--line);
    box-shadow: 0 6px 24px rgba(16, 42, 42, .06);
}
.navbar-toggler {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .4rem .6rem;
}
.navbar-toggler:focus { box-shadow: 0 0 0 3px var(--teal-tint); }

.navbar .nav-link {
    position: relative;
    font-weight: 500;
    font-size: .95rem;
    color: var(--text-dark) !important;
    margin: 0 .15rem;
    padding: .5rem .75rem !important;
    border-radius: 999px;
    transition: color .2s var(--ease), background-color .2s var(--ease);
}
.navbar .nav-link::after {
    content: "";
    position: absolute;
    left: .75rem;
    right: .75rem;
    bottom: .25rem;
    height: 2px;
    border-radius: 2px;
    background: var(--accent-terracotta);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .3s var(--ease);
}
.navbar .nav-link:hover { color: var(--accent-terracotta) !important; }
.navbar .nav-link:hover::after,
.navbar .nav-link.active::after { transform: scaleX(1); }
.navbar .nav-link.active { color: var(--primary-teal) !important; }

/* "Support Us" as a call-to-action pill */
.navbar .nav-link.text-success {
    color: #fff !important;
    background: var(--primary-teal);
    padding: .5rem 1.15rem !important;
    margin-left: .5rem;
    box-shadow: 0 4px 14px rgba(0, 102, 102, .22);
}
.navbar .nav-link.text-success::after { display: none; }
.navbar .nav-link.text-success:hover,
.navbar .nav-link.text-success.active {
    color: #fff !important;
    background: var(--accent-terracotta);
}

/* Language switch as a small outlined pill */
.navbar .nav-link.language-toggle {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .1em;
    color: var(--primary-teal) !important;
    border: 1px solid rgba(0, 102, 102, .35);
    padding: .4rem .9rem !important;
    margin-left: .5rem;
    align-self: center;
}
.navbar .nav-link.language-toggle::after { display: none; }
.navbar .nav-link.language-toggle:hover {
    background: var(--teal-tint);
    color: var(--teal-dark) !important;
}

@media (max-width: 991.98px) {
    .navbar-nav { padding: .75rem 0 .5rem; gap: .15rem; }
    .navbar .nav-link::after { display: none; }
    .navbar .nav-link:hover,
    .navbar .nav-link.active { background: var(--earthy-sand); }
    .navbar .nav-link.text-success,
    .navbar .nav-link.language-toggle {
        align-self: flex-start;
        margin: .35rem 0 0;
    }
}

/* Logo: size unchanged */
.logo {
    height: 6rem;
    margin-right: 1rem;
}

/* ---------- Hero ---------- */
.hero-section {
    position: relative;
    overflow: hidden;
    padding: clamp(56px, 8vw, 112px) 0;
    background:
        radial-gradient(900px 520px at 92% -10%, rgba(0, 102, 102, .10), transparent 62%),
        radial-gradient(760px 460px at -8% 110%, rgba(179, 90, 56, .10), transparent 62%),
        var(--earthy-sand);
    border-bottom: 1px solid var(--line);
}
.hero-section h1 {
    font-size: clamp(2.2rem, 1.5rem + 2.6vw, 3.6rem);
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: var(--teal-dark);
}
.hero-section h1::before {
    content: "";
    display: block;
    width: 56px;
    height: 4px;
    border-radius: 4px;
    margin-bottom: 1.75rem;
    background: linear-gradient(90deg, var(--accent-terracotta), #d58a63);
}
.hero-section .lead {
    font-size: clamp(1.02rem, .98rem + .2vw, 1.125rem);
    font-weight: 400;
    line-height: 1.8;
    color: var(--text-soft);
    max-width: 62ch;
}

@media (prefers-reduced-motion: no-preference) {
    .hero-section .col-lg-7 > * {
        animation: fade-up .8s var(--ease) both;
    }
    .hero-section .col-lg-7 > :nth-child(2) { animation-delay: .08s; }
    .hero-section .col-lg-7 > :nth-child(3) { animation-delay: .16s; }
    .hero-section .col-lg-5 { animation: fade-in 1.1s var(--ease) .2s both; }
}
@keyframes fade-up {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
}
@keyframes fade-in {
    from { opacity: 0; transform: scale(.98); }
    to   { opacity: 1; transform: none; }
}

/* ---------- Front page rotating gallery ---------- */
.gallery-carousel {
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    outline: 1px solid rgba(0, 102, 102, .18);
    outline-offset: 10px;
    isolation: isolate;
}
.gallery-carousel .carousel-item img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center;
}
.gallery-carousel .carousel-indicators {
    margin-bottom: 1.1rem;
    gap: .35rem;
}
.gallery-carousel .carousel-indicators [data-bs-target] {
    width: 22px;
    height: 4px;
    border: 0;
    margin: 0;
    border-radius: 4px;
    background-color: #fff;
    opacity: .55;
    transition: width .3s var(--ease), opacity .3s var(--ease);
}
.gallery-carousel .carousel-indicators .active {
    width: 36px;
    opacity: 1;
}
.gallery-carousel .carousel-control-prev,
.gallery-carousel .carousel-control-next {
    width: 56px;
    opacity: 0;
    transition: opacity .3s var(--ease);
}
.gallery-carousel:hover .carousel-control-prev,
.gallery-carousel:hover .carousel-control-next,
.gallery-carousel .carousel-control-prev:focus-visible,
.gallery-carousel .carousel-control-next:focus-visible { opacity: 1; }
.gallery-carousel .carousel-control-prev-icon,
.gallery-carousel .carousel-control-next-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, .35);
    background-size: 45%;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

/* ---------- Sections & section titles ---------- */
section.py-5 {
    padding-top: clamp(3.5rem, 6vw, 6rem) !important;
    padding-bottom: clamp(3.5rem, 6vw, 6rem) !important;
}
section.py-5 + section.py-5:not(.bg-light) { padding-top: 0 !important; }

h2 + hr {
    border: 0;
    height: 3px !important;
    width: 56px;
    border-radius: 3px;
    opacity: 1;
    margin-top: 1.1rem;
    background: linear-gradient(90deg, var(--accent-terracotta), #d58a63);
}
h2.text-left + hr { margin-left: 0 !important; }

/* ---------- Content panels ---------- */
section .p-4.shadow-sm,
section .p-3.rounded,
section .p-4.rounded {
    background-color: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-sm) !important;
}
section .p-4.shadow-sm { padding: clamp(1.5rem, 3vw, 2.5rem) !important; }
section .bg-light.p-4,
section .bg-light.p-3 {
    background-color: var(--earthy-sand) !important;
    box-shadow: none !important;
}
section .p-4.shadow-sm + .p-4.shadow-sm { margin-top: 1.75rem; }
section .p-4.shadow-sm > :last-child { margin-bottom: 0; }

section .p-4.shadow-sm h3:not(:first-child) { margin-top: 2.25rem; }
section .p-4.shadow-sm .rc-publication-image + h3 { margin-top: 0; }

/* Space between cards that sit in consecutive rows */
section .container > .row.g-4 + .row.g-4 { margin-top: 1rem; }
section .p-4.shadow-sm h3 { margin-bottom: .75rem; }
section .p-4.shadow-sm h4 { color: var(--text-dark); }

section ul:not(.list-unstyled):not(.nav):not(.navbar-nav) li { margin-bottom: .4rem; }
section ul:not(.list-unstyled):not(.nav):not(.navbar-nav) li::marker { color: var(--accent-terracotta); }

section figure img,
section .figure-img { border-radius: var(--radius-sm); }
.figure-caption { font-size: .875rem; color: var(--bs-secondary-color); }

/* Lists of lectures / presentations on research-cluster pages */
section .row > .col-12.shadow-sm {
    width: calc(100% - var(--bs-gutter-x));
    margin-left: calc(var(--bs-gutter-x) * .5);
    margin-right: calc(var(--bs-gutter-x) * .5);
    padding: 1.25rem 1.5rem;
    background: #fff;
    border: 1px solid var(--line);
    border-left: 3px solid var(--primary-teal);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm) !important;
    transition: border-color .25s var(--ease), transform .6s var(--ease), opacity .7s var(--ease);
}
section .row > .col-12.shadow-sm:hover {
    border-left-color: var(--accent-terracotta);
    transform: translateX(3px);
}
section .row > .col-12.shadow-sm > br:first-child { display: none; }
section .row > .col-12.shadow-sm > p:last-child { margin-bottom: 0; }

.rc-publication-image {
    display: block;
    max-width: 110px;
    float: right;
    margin-left: 1rem;
    margin-bottom: 1rem;
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
}

/* ---------- Buttons ---------- */
.btn-primary {
    --bs-btn-bg: var(--primary-teal);
    --bs-btn-border-color: var(--primary-teal);
    --bs-btn-hover-bg: var(--accent-terracotta);
    --bs-btn-hover-border-color: var(--accent-terracotta);
    --bs-btn-active-bg: var(--accent-terracotta);
    --bs-btn-active-border-color: var(--accent-terracotta);
    --bs-btn-disabled-bg: var(--primary-teal);
    --bs-btn-disabled-border-color: var(--primary-teal);
    --bs-btn-focus-shadow-rgb: 0, 102, 102;
    font-weight: 600;
    padding: .75rem 1.6rem;
    border-radius: 999px;
    box-shadow: 0 6px 18px rgba(0, 102, 102, .22);
    transition: background-color .25s var(--ease), border-color .25s var(--ease),
                transform .25s var(--ease), box-shadow .25s var(--ease);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(179, 90, 56, .28);
}
.btn-primary.btn-lg { padding: .9rem 2rem; font-size: 1.05rem; }

/* Buttons attached to a search field keep a straight left edge */
.input-group > .btn-primary {
    padding: .375rem 1.1rem;
    border-radius: 0 var(--bs-border-radius) var(--bs-border-radius) 0;
    box-shadow: none;
    transform: none;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(0, 102, 102, .5);
    box-shadow: 0 0 0 .2rem var(--teal-tint);
}

/* ---------- Research cluster cards ---------- */
a.rc-menu-link {
    display: block;
    height: 100%;
    text-decoration: none;
    color: inherit;
}
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background-color: #fff;
}
.card.rc-menu {
    position: relative;
    overflow: hidden;
    padding-bottom: 3.75rem !important;
    box-shadow: var(--shadow-sm) !important;
    transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s var(--ease);
}
.card.rc-menu::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-teal), var(--accent-terracotta));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .45s var(--ease);
}
.card.rc-menu::after {
    content: "→";
    position: absolute;
    right: 1.5rem;
    bottom: 1.25rem;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: var(--primary-teal);
    background: var(--teal-tint);
    transition: transform .35s var(--ease), background-color .35s var(--ease), color .35s var(--ease);
}
.card.rc-menu h3 { font-size: 1.35rem; margin-bottom: .6rem; }
.card.rc-menu p { color: var(--bs-secondary-color); margin-bottom: 0; }
a.rc-menu-link:hover .card.rc-menu,
a.rc-menu-link:focus-visible .card.rc-menu {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg) !important;
    border-color: transparent;
}
a.rc-menu-link:hover .card.rc-menu::before,
a.rc-menu-link:focus-visible .card.rc-menu::before { transform: scaleX(1); }
a.rc-menu-link:hover .card.rc-menu::after,
a.rc-menu-link:focus-visible .card.rc-menu::after {
    transform: translateX(4px);
    background: var(--accent-terracotta);
    color: #fff;
}

/* ---------- Country cards ---------- */
.country-card {
    height: 100%;
    overflow: hidden;
    border-radius: var(--radius) !important;
    border-color: var(--line) !important;
    box-shadow: var(--shadow-sm) !important;
    transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.country-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg) !important;
}
.country-card .country-thumbnail {
    width: calc(100% + 3rem);
    max-width: none;
    height: 12rem;
    margin: -1.5rem -1.5rem 1.25rem;
    object-fit: cover;
    object-position: center;
    border: 0;
    transition: filter .5s var(--ease);
    filter: saturate(.95);
}
.country-card:hover .country-thumbnail { filter: saturate(1.1) brightness(1.03); }
.country-card h4 { font-size: 1.35rem; }
.country-thumbnail {
    width: 100%;
    height: 10rem;
    object-fit: cover;
    object-position: center;
    margin-bottom: 1rem;
}

/* ---------- Team ---------- */
.people {
    display: block;
    width: 60%;
    margin-left: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    outline: 1px solid rgba(0, 102, 102, .2);
    outline-offset: 6px;
}

/* ---------- Tabs, tables, lists (HPICA archive) ---------- */
.nav-tabs {
    border-bottom: 1px solid var(--line);
    gap: .25rem;
}
.nav-tabs .nav-link {
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--bs-secondary-color);
    font-weight: 500;
    background: none;
}
.nav-tabs .nav-link:hover { color: var(--accent-terracotta); border-bottom-color: var(--line); }
.nav-tabs .nav-link.active {
    color: var(--primary-teal);
    border-bottom-color: var(--primary-teal);
    background: none;
}
.table { --bs-table-hover-bg: var(--teal-tint); }
.table thead th {
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--teal-dark);
    background: var(--earthy-sand);
    border-bottom: 1px solid var(--line);
}
.list-group { --bs-list-group-border-color: var(--line); }
.list-group-item { transition: background-color .2s var(--ease); }
.list-group-item:hover { background-color: var(--earthy-sand); }

/* ---------- Footer ---------- */
footer {
    background:
        radial-gradient(700px 300px at 100% 0, rgba(255, 255, 255, .06), transparent 70%),
        linear-gradient(160deg, #006262 0%, #003f3f 100%);
    color: #fff;
    padding: 72px 0 32px;
}
footer h5 {
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}
footer .border-top { border-color: rgba(255, 255, 255, .14) !important; }
.footer-link {
    color: rgba(255, 255, 255, .75);
    text-decoration: none;
    transition: color .2s var(--ease);
}
.footer-link:hover { color: #fff; text-decoration: underline; }

/* ---------- Cookie banner ---------- */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 640px;
    background-color: rgba(255, 255, 255, .94);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    color: var(--text-dark);
    padding: 18px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
}
@media (prefers-reduced-motion: no-preference) {
    .cookie-banner { animation: banner-in .6s var(--ease) .6s both; }
}
@keyframes banner-in {
    from { opacity: 0; transform: translate(-50%, 24px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}
.cookie-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}
.cookie-content p {
    margin: 0;
    font-size: .875rem;
    line-height: 1.55;
    color: var(--text-soft);
}
.cookie-content a { color: var(--primary-teal); text-decoration: none; }
.cookie-buttons {
    display: flex;
    gap: 10px;
    white-space: nowrap;
}
.cookie-buttons button { padding: .6rem 1.4rem; font-weight: 600; }

/* ---------- Misc ---------- */
.pub-date {
    font-size: .85rem;
    color: var(--accent-terracotta);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Scroll reveal (only active when JavaScript adds .reveal; see templates/scripts.php) */
.reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* ---------- Small screens ---------- */
@media (max-width: 600px) {
    .cookie-content {
        flex-direction: column;
        text-align: center;
    }
    .cookie-buttons {
        width: 100%;
        justify-content: center;
    }
    .rc-publication-image { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
    html { scroll-behavior: auto; }
}
