/* ========================================
   preCICE Landing Page - Custom Styles
   Exact clone of precice.github.io
   ======================================== */

/* ---- Variables ---- */
:root {
  --precice-blue: #0A76BB;
  --precice-blue-dark: #065a8f;
  --precice-blue-light: #e6f2ff;
  --precice-blue-bg: #d9ecf9;
  --precice-text: #040606;
  --precice-gray: #333;
  --precice-border: #ddd;
  --precice-white: #ffffff;
}

/* ---- Base ---- */
body {
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--precice-text);
  font-size: 15px;
  line-height: 1.6;
}

a {
  color: var(--precice-blue);
}
a:hover {
  color: var(--precice-blue-dark);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--precice-text);
}

/* ========================================
   NAVBAR  — exact copy of precice.github.io rules
   Sources: theme-precice.css, customstyles.css,
            customstyles-precice.css
   ======================================== */

/* Bootstrap 3 .container max-width was 1170px at >=1200px.
   Bootstrap 5 uses 1320px at >=1400px, so we cap it. */
.precice-navbar .container {
  max-width: 1170px;
}

/* theme-precice.css: .navbar-inverse */
.precice-navbar {
  background-color: white;
  border-bottom: 2px solid #0A76BB;
  padding: 0;
  min-height: 50px;
}

/* customstyles-precice.css: a.navbar-brand */
.precice-navbar .navbar-brand {
  padding-top: 12px;
  padding-bottom: 8px;
}

/* customstyles-precice.css: .navbar-brand-icon:before */
.navbar-brand-icon::before {
  width: 25px;
  height: 25px;
  content: '';
  display: inline-block;
  background: url('/images/icon.svg');
  background-size: 25px 25px;
  background-repeat: no-repeat;
  background-position: top left;
  transition: all 400ms;
}
a:hover > .navbar-brand-icon::before {
  transform: rotate(180deg);
}

/* customstyles-precice.css: .navbar-brand-text */
.navbar-brand-text {
  height: 28px;
  padding-left: 1px;
  display: inline;
  vertical-align: top;
}

/* theme-precice.css + customstyles.css: nav link colors */
/* .navbar-inverse .navbar-nav>li>a */
.precice-navbar .nav-link {
  color: #0A76BB !important;
  font-weight: 500;
  font-size: 14px;
  line-height: 20px;
  padding: 4px 10px !important;
  margin-top: 11px;
  margin-left: 10px;
  background-color: transparent;
  text-decoration: none;
}

/* theme-precice.css: hover turns orange */
.precice-navbar .nav-link:hover {
  color: #ED762C !important;
  background-color: transparent;
  text-decoration: none;
}

/* customstyles.css: .navbar-inverse .navbar-nav > .active > a */
.precice-navbar .nav-link.active {
  background-color: #347DBE;
  color: #fff !important;
  border-radius: 4px;
}

/* customstyles-precice.css: .nav > li > a.nav-external (social icons) */
.precice-navbar .nav-link.nav-external {
  font-size: 24px;
  line-height: 20px;
  padding: 2px 0px !important;
  margin-top: 11px;
  text-decoration: none !important;
}

/* customstyles.css: a:not(.no-icon)[href^="http://"]:after — remove external marker */
.precice-navbar a.no-icon::after {
  content: none !important;
  display: none !important;
}

/* ---- Search box (matches Algolia search from original JS) ---- */
/* Original: .ais-search-box { padding: .5em; margin-left: 10px;
   width: 20em; font-size: 0.8em; height: 50px; } */
.search-box {
  position: relative;
  padding: .5em;
  margin-bottom: 0px;
  margin-left: 10px;
  margin-top: 0px;
  width: 20em;
  font-size: 0.8em;
  box-sizing: border-box;
  height: 50px;
  display: flex;
  align-items: center;
}

/* Original: .ais-search-box--input { padding-left: 10px; border-color: #0A76BB; } */
.search-box input {
  border: 1px solid #0A76BB;
  border-radius: 4px;
  font-size: 1em;
  width: 100%;
  padding: 6px 10px 14px 10px;
  background: #fff;
  color: #333;
  outline: none;
  line-height: 1.4;
  height: auto;
}
.search-box input::placeholder {
  color: #999;
}

.search-algolia {
  position: absolute;
  bottom: 10px;
  right: 14px;
  font-size: 9px;
  color: #999;
  pointer-events: none;
}
.search-algolia strong {
  color: #003DFF;
}

/* customstyles-precice.css responsive: @media (max-width: 1200px) .nav-external float */
@media (max-width: 1200px) {
  .precice-navbar .nav-link.nav-external {
    float: left;
  }
}

/* ========================================
   HERO SECTION
   ======================================== */
.section-hero {
  padding: 70px 0 65px;
  background: var(--precice-white);
}

.hero-title {
  font-size: 36px;
  font-weight: 500;
  color: #040606;
  margin-top: 0;
  margin-bottom: 10px;
  font-family: inherit;
  line-height: 1.1;
}

.hero-title span {
  font-weight: 400;
}

.hero-subtitle {
  font-size: 24px;
  font-weight: 400;
  color: #333;
  margin-top: -5px;
  margin-bottom: 20px;
  padding-top: 0;
  line-height: 1.1;
}

.action-buttons {
  margin-bottom: 20px;
}

.action-btn {
  margin-right: 4px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
  border: 1px solid transparent;
  padding: 5px 10px;
  border-radius: 4px;
  display: inline-block;
  text-decoration: none;
}

.action-btn-github, .action-btn-latest {
  color: #333;
  background-color: #fff;
  border-color: #ccc;
}

.action-btn-github:hover, .action-btn-latest:hover {
  color: #333;
  background-color: #e6e6e6;
  border-color: #adadad;
}

.action-btn-primary {
  color: #fff;
  background-color: #0A76BB;
  border-color: #0968a5;
}

.action-btn-primary:hover {
  color: #fff;
  background-color: #085a8f;
  border-color: #074a75;
}

/* Hero diagram subtle animation */
.hero-diagram {
  animation: diagramFadeIn 1s ease-out forwards;
  width: 115%;
  max-width: none;
}

@keyframes diagramFadeIn {
  from {
    opacity: 0.4;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.hero-diagram {
  max-width: 100%;
  max-height: 220px;
}

/* ========================================
   SECTION UTILITIES
   ======================================== */
.section-white {
  padding: 70px 0 65px;
  background: var(--precice-white);
  overflow: hidden;
}

.section-light {
  padding: 70px 0 65px;
  background: #f8f9fa;
  overflow: hidden;
}

.section-light-blue {
  padding: 70px 0 65px;
  background: rgba(10, 118, 187, 0.08);
  border-top: 1px solid rgba(10, 118, 187, 0.1);
  border-bottom: 1px solid rgba(10, 118, 187, 0.1);
  overflow: hidden;
}

.section-light-blue .section-header {
  color: #085E95;
}

.section-blue {
  padding: 70px 0 65px;
  background: var(--precice-blue);
  overflow: hidden;
}

.section-blue-dark {
  padding: 70px 0 65px;
  background: var(--precice-blue);
  overflow: hidden;
}

.section-header {
  font-size: 1.75rem;
  font-weight: 400;
  margin-bottom: 0;
}

.section-blue .section-header,
.section-blue-dark .section-header {
  color: var(--precice-white);
}

.btn-action {
  font-size: 14px;
  padding: 6px 16px;
  border-radius: 4px;
}

.btn-primary {
  background-color: var(--precice-blue);
  border-color: var(--precice-blue);
}

.btn-primary:hover {
  background-color: var(--precice-blue-dark);
  border-color: var(--precice-blue-dark);
}

/* ========================================
   LATEST NEWS
   ======================================== */
#latest-news {
  background-color: var(--precice-blue-light);
  padding: 70px 0;
}

#latest-news .section-header {
  margin-bottom: 40px;
  text-align: center;
  color: var(--precice-blue);
}

.news-card {
  background: white;
  border: 1px solid var(--precice-border);
  border-radius: 6px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
}

.news-card .news-link {
  display: block;
  text-decoration: none;
  color: var(--precice-text);
}

.news-card .news-link:hover {
  text-decoration: none;
}

.news-card h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #000;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.news-card p {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  -webkit-box-orient: vertical;
  font-size: 14px;
}

/* ========================================
   FEATURES / USP CARDS
   ======================================== */
.usp-icon {
  height: 150px;
  width: auto;
}

.usp-card {
  border: 1px solid var(--precice-blue);
  border-radius: 4px;
}

.usp-card .card-title {
  font-size: 1rem;
  margin-bottom: 10px;
}

.usp-list {
  padding-inline-start: 1.75em;
  margin-bottom: 15px;
  font-size: 14px;
}

.usp-list li {
  margin-bottom: 0.5em;
}

.learn-more-link {
  color: var(--precice-blue);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.learn-more-link:hover {
  color: var(--precice-blue-dark);
  text-decoration: none;
}

/* ========================================
   SOLVERS / ADAPTERS
   ======================================== */
.adapter-card {
  text-decoration: none;
  color: var(--precice-text);
  border: 1px solid rgba(10, 118, 187, 0.8);
  border-radius: 6px;
  padding: 15px 10px;
  transition: background 0.2s;
}

.adapter-card:hover {
  background-color: rgba(10, 118, 187, 0.08);
  color: var(--precice-text);
  text-decoration: none;
}

.adapter-img-wrap {
  height: 125px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.adapter-logo {
  max-height: 125px;
  max-width: 125px;
  object-fit: contain;
  transition: transform 0.4s;
}

.adapter-logo:hover {
  transform: scale(1.10);
}

.adapter-card p {
  margin-top: 10px;
  margin-bottom: 0;
  font-size: 14px;
  font-weight: 500;
}

/* ========================================
   TESTIMONIALS
   ======================================== */
.testimonial-card {
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 25px;
  display: flex;
  flex-direction: column;
}

.quote-text {
  font-size: 17px;
  font-weight: 400;
  color: var(--precice-gray);
  flex-grow: 1;
}

.quote-text .text-muted {
  color: darkgrey !important;
}

.testimonial-author {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 15px;
}

.testimonial-img {
  border-radius: 50%;
  border: 1px solid var(--precice-border);
  width: 80px;
  height: 80px;
  object-fit: cover;
}

.testimonial-author span {
  font-size: 13px;
  color: var(--precice-gray);
}

/* ========================================
   ACADEMIC SECTION
   ======================================== */
.uni-logo {
  max-width: 100px;
  max-height: 100px;
}

.uni-link {
  text-decoration: none;
  color: var(--precice-gray);
}

.uni-link:hover {
  text-decoration: none;
  color: var(--precice-gray);
}

.citation-block {
  margin-top: 10px;
}

.paper-mockup {
  width: 120px;
  height: 160px;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 3px 3px 10px rgba(0,0,0,0.1);
  transform: rotate(-5deg);
  padding: 15px;
}

.paper-lines {
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 8px,
    #e0e0e0 8px,
    #e0e0e0 9px
  );
}

/* ========================================
   COMMUNITY SECTION
   ======================================== */
.community-list {
  font-size: 15px;
}

.community-list a {
  text-decoration: underline;
}

.newsletter-box {
  background: rgba(255,255,255,0.95);
  border-radius: 8px;
  padding: 25px;
  color: var(--precice-text);
}

/* ========================================
   SUPPORT SECTION
   ======================================== */
.support-img-wrap {
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 20px;
}

.support-img {
  max-height: 200px;
}

/* ========================================
   FAQ SECTION
   ======================================== */
.faq-card {
  background: white;
  border: 1px solid var(--precice-border);
  border-radius: 6px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.faq-card h5 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.faq-card p {
  font-size: 14px;
}

/* ========================================
   LOGO WALL
   ======================================== */
.logo-wall .logo-item {
  text-decoration: none;
  color: var(--precice-gray);
  opacity: 0.5;
  filter: grayscale(100%);
  transition: all 0.2s;
  padding: 8px 4px;
}

.logo-wall .logo-item:hover {
  opacity: 1;
  filter: grayscale(0%);
  text-decoration: none;
}

.logo-wall .logo-item:hover .logo-holder {
  transform: scale(1.05);
}

.logo-holder {
  height: 75px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.logo-holder img {
  max-height: 75px;
  max-width: 100%;
  object-fit: contain;
}

.logo-item .institution {
  font-size: 0.8em;
  font-weight: 400;
  line-height: 1.2em;
  margin-top: 0.5em;
  margin-bottom: 0;
}

.logo-item .country {
  font-size: 0.8em;
  font-weight: 700;
  margin-bottom: 1em;
}

@media (max-width: 992px) {
  .logo-wall .logo-item {
    opacity: 1;
    filter: grayscale(0%);
  }
}

/* ========================================
   DEMO / TERMINAL
   ======================================== */
.demo-terminal {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  max-width: 100%;
}

.terminal-header {
  background: #e0e0e0;
  padding: 8px 12px;
  display: flex;
  gap: 6px;
}

.terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.terminal-dot.red { background: #ff5f57; }
.terminal-dot.yellow { background: #febc2e; }
.terminal-dot.green { background: #28c840; }

.terminal-body {
  background: #1e1e2e;
  padding: 20px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
}

.terminal-text {
  margin: 0;
}

.t-cyan { color: #56b6c2; }
.t-white { color: #dcdcdc; }
.t-gray { color: #7f8c8d; }
.t-green { color: #98c379; }

.t-blink {
  animation: blink-cursor 1s step-end infinite;
  color: #dcdcdc;
}

@keyframes blink-cursor {
  from, to { opacity: 1; }
  50% { opacity: 0; }
}

/* ========================================
   FOOTER
   ======================================== */
.precice-footer {
  background: #3a3f44;
  color: #ccc;
  padding: 40px 0 20px;
}

.footer-link {
  color: #ccc;
  text-decoration: none;
  font-size: 14px;
  line-height: 2;
}

.footer-link:hover {
  color: white;
  text-decoration: underline;
}

.footer-dates {
  font-size: 12px;
  color: #999;
  margin-top: 8px;
}

.footer-content-row {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 60px;
}

.no-cookies {
  font-size: 13px;
  color: #999;
  margin-bottom: 0;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 992px) {
  .hero-title {
    font-size: 1.7rem;
  }
  .hero-subtitle {
    font-size: 1.1rem;
  }
  .section-header {
    font-size: 1.4rem;
  }
  .usp-icon {
    height: 100px;
  }
}

@media (max-width: 768px) {
  .section-hero,
  .section-white,
  .section-light,
  .section-light-blue,
  .section-blue,
  .section-blue-dark {
    padding: 40px 0 35px;
  }

  #latest-news {
    padding: 40px 0;
  }

  .hero-title {
    font-size: 1.4rem;
  }
  
  .action-buttons {
    flex-direction: column;
    align-items: flex-start;
  }

}

/* ========================================
   THEME TOGGLE BUTTON
   ======================================== */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px !important;
  color: #0A76BB !important;
  padding: 2px 4px !important;
  transition: transform 0.3s ease;
}
.theme-toggle:hover {
  transform: rotate(20deg);
  color: #ED762C !important;
}

/* ========================================
   DARK THEME
   ======================================== */

/* Smooth transition for theme change */
body, .precice-navbar, .section-hero, .section-white, .section-light,
.section-light-blue, .section-blue, .section-blue-dark,
#latest-news, .news-card, .usp-card, .faq-card, .testimonial-card,
.newsletter-box, .adapter-card, .citation-block, .demo-terminal,
.search-box input, footer, .contributors-section {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Body */
body.dark-theme {
  background-color: #1a1a2e;
  color: #e0e0e0;
}

/* Navbar */
body.dark-theme .precice-navbar {
  background-color: #16213e !important;
  border-bottom-color: #0A76BB;
}
body.dark-theme .precice-navbar .nav-link {
  color: #8ab4f8 !important;
}
body.dark-theme .precice-navbar .nav-link:hover {
  color: #ED762C !important;
}
body.dark-theme .precice-navbar .nav-link.nav-external {
  color: #8ab4f8 !important;
}
body.dark-theme .theme-toggle {
  color: #ffd93d !important;
}

/* Search box */
body.dark-theme .search-box input {
  background: #1a1a2e;
  border-color: #4a90d9;
  color: #e0e0e0;
}
body.dark-theme .search-box input::placeholder {
  color: #777;
}
body.dark-theme .search-box input:focus {
  border-color: #4a90d9;
}

/* Hero */
body.dark-theme .section-hero {
  background-color: #1a1a2e;
}
body.dark-theme .hero-title,
body.dark-theme .hero-subtitle {
  color: #e0e0e0;
}

/* White sections → dark */
body.dark-theme .section-white,
body.dark-theme .section-hero {
  background-color: #1a1a2e;
}

/* Light sections → slightly lighter dark */
body.dark-theme .section-light,
body.dark-theme .section-light-blue {
  background-color: #16213e;
}

/* Latest news */
body.dark-theme #latest-news {
  background-color: #16213e;
}

/* Blue sections stay blue-ish but darker */
body.dark-theme .section-blue {
  background-color: #0f3460;
}
body.dark-theme .section-blue-dark {
  background-color: #0a1628;
}

/* Cards */
body.dark-theme .news-card {
  background-color: #1e2a47;
  border-color: #2a3a5c;
}
body.dark-theme .news-card h4 {
  color: #8ab4f8;
}
body.dark-theme .news-card p {
  color: #bbb;
}
body.dark-theme .news-link {
  color: #e0e0e0;
}

body.dark-theme .usp-card {
  background-color: #1e2a47;
  border-color: #2a3a5c;
}
body.dark-theme .usp-card .card-title {
  color: #e0e0e0;
}
body.dark-theme .usp-card .usp-list li {
  color: #bbb;
}

body.dark-theme .faq-card {
  background-color: #1e2a47;
  border-color: #2a3a5c;
}
body.dark-theme .faq-card h5 {
  color: #e0e0e0;
}
body.dark-theme .faq-card p {
  color: #bbb;
}

/* Adapter cards */
body.dark-theme .adapter-card {
  background-color: #1e2a47;
  border-color: #2a3a5c;
}
body.dark-theme .adapter-card p {
  color: #8ab4f8;
}

/* Testimonials */
body.dark-theme .testimonial-card {
  background-color: #1e2a47;
}
body.dark-theme .quote-text {
  color: #ccc;
}

/* Citation */
body.dark-theme .citation-block .border {
  background-color: #1e2a47;
  border-color: #2a3a5c !important;
}
body.dark-theme .citation-block h5,
body.dark-theme .citation-block p {
  color: #e0e0e0;
}

/* Newsletter */
body.dark-theme .newsletter-box {
  background-color: #1e2a47;
  border-color: #2a3a5c;
}

/* Links */
body.dark-theme a {
  color: #8ab4f8;
}
body.dark-theme a:hover {
  color: #ED762C;
}

/* Headings */
body.dark-theme h1, body.dark-theme h2,
body.dark-theme h3, body.dark-theme h4,
body.dark-theme h5, body.dark-theme h6 {
  color: #e0e0e0;
}
body.dark-theme .section-header {
  color: #e0e0e0;
}

/* Buttons */
body.dark-theme .btn-outline-secondary {
  color: #8ab4f8;
  border-color: #4a6a9a;
}
body.dark-theme .btn-outline-secondary:hover {
  background-color: #2a3a5c;
  color: #fff;
}

/* Terminal */
body.dark-theme .demo-terminal {
  border-color: #2a3a5c;
}

/* Logo wall */
body.dark-theme .logo-item {
  background-color: #1e2a47;
  border-color: #2a3a5c;
}
body.dark-theme .logo-item .institution {
  color: #bbb;
}

/* Footer */
body.dark-theme footer {
  background-color: #0a1628 !important;
}
body.dark-theme footer,
body.dark-theme footer a,
body.dark-theme footer p {
  color: #999;
}

/* Learn more links */
body.dark-theme .learn-more-link {
  color: #8ab4f8;
}

/* Form controls */
body.dark-theme .form-control {
  background-color: #1a1a2e;
  border-color: #4a6a9a;
  color: #e0e0e0;
}

/* ========================================
   CONTRIBUTORS SECTION
   ======================================== */
.contributors-section {
  background-color: #f4f7f9;
  padding: 40px 0 50px;
}

.contributors-title {
  color: #0A76BB;
  font-weight: 700;
  text-align: center;
  margin-bottom: 30px;
}

.contributors-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  max-width: 1000px;
  margin: 0 auto 30px auto;
}

.contributor-avatar {
  display: inline-block;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border-radius: 50%;
}

.contributor-avatar img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background-color: #fff;
  border: 1px solid #ddd;
}

.contributor-avatar:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* Dark mode for contributors section */
body.dark-theme .contributors-section {
  background-color: #121a2f;
}

body.dark-theme .contributors-title {
  color: #e0e0e0;
}

body.dark-theme .contributor-avatar img {
  border-color: #3a4a6a;
  background-color: #1e2a47;
}

body.dark-theme .contributor-avatar:hover {
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

/* Action buttons in dark mode */
body.dark-theme .action-btn-github, body.dark-theme .action-btn-latest {
  background-color: #1a1a2e;
  border-color: #4a6a9a;
  color: #e0e0e0;
}

body.dark-theme .action-btn-github:hover, body.dark-theme .action-btn-latest:hover {
  background-color: #2a2a3e;
  border-color: #5a7aaa;
  color: #fff;
}
