:root{
  --header: #BAF0C0;
  --main: #E5F4DB;
  --footer: #FFFADF;
  --white: #FFFFFF;
  --text: #000000;
  --border: #000000;
}

*{ box-sizing: border-box; }

html, body{
  margin: 0;
  padding: 0;
  height: 100%;
}

/* ===== Sticky footer + global base ===== */
body{
  min-height: 100vh;
  display: flex;
  flex-direction: column;

  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background: var(--main);
  line-height: 1.4;

  /* stop horizontal scrolling on mobile */
  overflow-x: hidden;
}

main{
  flex: 1;
}

img{
  max-width: 100%;
  height: auto;
  display: block;
}

/* ===== Accessibility helpers ===== */
.skip-link{
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--white);
  color: var(--text);
  padding: 10px 12px;
  border: 2px solid var(--border);
}
.skip-link:focus{
  left: 10px;
  top: 10px;
  z-index: 9999;
}

/* FIX: replace deprecated clip warning by using clip-path */
.sr-only{
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  white-space: nowrap;
  border: 0;

  clip-path: inset(50%);
  clip: rect(0 0 0 0); /* fallback */
}

/* ===== Header / Navigation ===== */
.site-header{
  background: var(--header);
  border-bottom: 2px solid var(--border);
  width: 100%;
}

.header-inner{
  width: 100%;
  padding: 12px 26px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

.brand{
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand-logo{
  width: 90px;
  background: var(--white);
  border: 2px solid var(--border);
  padding: 8px;
}

/* Navigation */
.site-nav{
  width: 100%;
}

.nav-toggle{
  display: none;
  font: inherit;
  background: var(--white);
  border: 2px solid var(--border);
  padding: 8px 10px;
  border-radius: 10px;
}

.nav-list{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  width: 100%;
}

.nav-link{
  color: var(--text);
  text-decoration: none;
  font-size: 22px;
}

.nav-link:hover,
.nav-link:focus{
  text-decoration: underline;
}

.nav-link.is-active{
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Header right side */
.header-actions{
  display: flex;
  align-items: center;
  gap: 14px;
}

.search input{
  font: inherit;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  width: 180px;
}

.profile-icon{
  width: 42px;
  height: 42px;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 6px;
}

/* ===== Page title ===== */
.page-title{
  text-align: center;
  font-size: 40px;
  font-weight: 500;
  margin: 22px 0 12px;
}

/* ===== Home page cards ===== */
.cards{
  width: 100%;
  padding: 18px 26px 22px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}

.card{
  background: var(--main);
  border: 3px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  min-height: 170px;
}

.card-title{
  text-align: center;
  font-size: 18px;
  margin: 0 0 12px;
}

.card-split{
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 12px;
  align-items: center;
}

.card-illustration{
  max-width: 120px;
  margin-left: auto;
}

.card-hero{
  display: grid;
  place-items: center;
}

.hero-text{
  font-size: 36px;
  font-weight: 500;
  text-align: center;
  margin: 0;
}

.fact-list{
  padding-left: 18px;
  margin: 0;
  display: grid;
  gap: 8px;
  font-size: 14px;
}

/* ===== Home stats section ===== */
.stats{
  width: 100%;
  background: var(--footer);
  border-top: 2px solid var(--border);
  padding: 20px 26px 0;

  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}

.stats-left{
  display: grid;
  grid-template-rows: auto auto;
  gap: 18px;
}

.stats-intro-row{
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 24px;
  align-items: start;

  padding-right: 140px;
}

.stats-intro-text{
  min-width: 0;
}

.stats-lead{
  font-size: 18px;
  margin: 0 0 10px;
}

.stats-list{
  padding-left: 18px;
  margin: 0;
}

.chart--intro{
  justify-self: end;
  max-width: 220px;
}

.impact-table{
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 2px solid var(--border);
  margin-bottom: 0;
}

.impact-table caption{
  text-align: left;
  padding: 10px;
  font-weight: 600;
}

.impact-table th,
.impact-table td{
  border: 1px solid var(--border);
  padding: 10px;
}

.stats-right{
  display: grid;
  align-items: start;
  max-width: 360px;
}

.chart{
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}

.chart--table{
  margin-top: 0;
}

.case-study{
  grid-column: 1 / -1;
  text-align: center;
  padding: 12px 0 18px;
}

.case-title{
  font-size: 18px;
  margin: 8px 0 10px;
}

.case-list{
  display: inline-block;
  text-align: left;
  padding-left: 18px;
  margin: 0;
}

/* ===== Footer ===== */
.site-footer{
  background: var(--footer);
  border-top: 2px solid var(--border);
  padding: 12px 26px;
  overflow-x: hidden;
}

.footer-text{
  text-align: center;
  margin: 0;

  /* FIX: no deprecated word-break value */
  overflow-wrap: anywhere;
}

/* ===== Responsive (Global) ===== */
@media (max-width: 980px){
  .header-inner{
    grid-template-columns: auto 1fr;
  }

  .site-nav{
    grid-column: 1 / -1;
  }

  .nav-toggle{
    display: inline-flex;
    margin: 8px 0;
  }

  .nav-list{
    display: none;
    flex-direction: column;
    gap: 10px;
  }

  .nav-list.is-open{
    display: flex;
  }

  .cards{
    grid-template-columns: 1fr;
  }

  .stats{
    grid-template-columns: 1fr;
  }

  .stats-right{
    max-width: 100%;
  }

  .stats-intro-row{
    grid-template-columns: 1fr;
    padding-right: 0;
  }

  .chart--intro{
    justify-self: start;
    max-width: 260px;
  }
}

/* ===== News page panels ===== */
.news-panels{
  width: 100%;
  padding: 18px 26px 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
}

.panel{
  background: var(--main);
  border: 3px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  min-height: 260px;
}

.panel-title{
  text-align: center;
  font-size: 18px;
  margin: 0 0 12px;
}

.panel-split{
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  align-items: center;
}

.panel-text p{
  margin: 0 0 10px;
}

.panel-list{
  margin: 0;
  padding-left: 18px;
}

.panel-image{
  max-width: 220px;
  margin-left: auto;
}

.hl-green{ color: #00a651; font-weight: 700; }
.hl-red{ color: #c0392b; font-weight: 700; }
.hl-yellow{ color: #f1c40f; font-weight: 700; }
.hl-black{ color: #000000; font-weight: 700; }
.hl-purple{ color: #8e44ad; font-weight: 700; }

.resources-footer{
  width: 100%;
  background: var(--footer);
  border-top: 2px solid var(--border);
  padding: 22px 26px;
  margin-top: 20px;
  overflow-x: hidden;
}

.resources-text{
  margin: 0;
  font-size: 28px;

  /* FIX: no deprecated word-break value */
  overflow-wrap: anywhere;
}

@media (max-width: 980px){
  .news-panels{
    grid-template-columns: 1fr;
  }

  .panel-split{
    grid-template-columns: 1fr;
  }

  .panel-image{
    margin: 12px 0 0;
    max-width: 260px;
  }

  .resources-text{
    font-size: 20px;
  }
}

/* ===== Mathematical tools page ===== */
.tools-grid{
  width: 100%;
  padding: 18px 26px 26px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}

.tool-link{
  display: block;
  text-decoration: none;
  color: inherit;
}

.tool{
  background: var(--main);
  border: 3px solid var(--border);
  border-radius: 22px;
  padding: 16px;
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 220px;
  transition: background 0.2s ease;
}

.tool img{
  max-width: 160px;
}

.tool-title{
  margin: 12px 0 0;
  font-size: 16px;
  font-weight: 500;
}

.tool-info{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.tool-info-text{
  font-size: 14px;
  line-height: 1.5;
}

.tool-link:hover .tool,
.tool-link:focus-visible .tool{
  background: var(--white);
  cursor: pointer;
}

.tool-link:focus-visible{
  outline: 3px solid var(--border);
  outline-offset: 4px;
}

@media (max-width: 980px){
  .tools-grid{
    grid-template-columns: 1fr;
  }

  .tool img{
    max-width: 220px;
  }

  .tool-info{
    flex-direction: column;
  }
}

/* ===== About page ===== */
.about-panels{
  width: 100%;
  padding: 18px 26px 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
}

.about-panel{
  background: var(--main);
  border: 3px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  min-height: 320px;
}

.about-title{
  text-align: center;
  font-size: 18px;
  margin: 0 0 12px;
}

.about-text{
  text-align: center;
  margin: 0 0 14px;
}

.help-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.help-col{
  display: grid;
  gap: 12px;
  align-items: center;
}

.help-text{
  text-align: center;
  margin: 0;
}

.help-icon{
  max-width: 160px;
  margin: 0 auto;
}

.about-footer{
  width: 100%;
  background: var(--footer);
  border-top: 2px solid var(--border);
  padding: 22px 26px;
  margin-top: 20px;
  overflow-x: hidden;
}

.about-footer-text{
  margin: 0 0 16px;
  font-size: 28px;
  overflow-wrap: anywhere;
}

.about-footer-social{
  margin: 0 0 16px;
  font-size: 28px;
  text-align: center;
  overflow-wrap: anywhere;
}

@media (max-width: 980px){
  .about-panels{
    grid-template-columns: 1fr;
  }

  .help-grid{
    grid-template-columns: 1fr;
  }

  .about-footer-text,
  .about-footer-social{
    font-size: 20px;
  }
}

/* ===== References page ===== */
.refs-layout{
  width: 100%;
  padding: 18px 26px 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

.refs-intro{
  font-size: 34px;
  margin: 0 0 26px;
  line-height: 1.15;
}

.refs-block{
  font-size: 18px;
}

.refs-block p{
  margin: 0 0 22px;
}

.refs-block a{
  color: var(--text);
  text-decoration: underline;

  /* FIX: no deprecated word-break value */
  overflow-wrap: anywhere;
}

@media (max-width: 980px){
  .refs-layout{
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .refs-intro{
    font-size: 26px;
  }

  .refs-block{
    font-size: 16px;
  }
}

/* ===== Contact page ===== */
.contact-layout{
  width: 100%;
  padding: 18px 26px 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: start;
}

.contact-box{
  background: var(--white);
  border: 2px solid var(--border);
  padding: 26px;
  width: 78%;
  margin-top: 22px;
}

.contact-box p{
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.contact-links{
  margin-top: 70px;
  padding-left: 120px;
}

.contact-links p{
  margin: 10px 0;
  font-size: 28px;

  /* FIX: long email/handles wrap */
  overflow-wrap: anywhere;
}

.contact-form{
  width: 100%;
  display: grid;
  gap: 26px;
  justify-items: center;
  margin-top: 22px;
}

.contact-form input{
  width: 70%;
  padding: 16px 18px;
  font: inherit;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--white);
  text-align: center;
  font-size: 22px;
}

.contact-form textarea{
  width: 70%;
  padding: 22px 18px;
  font: inherit;
  border: 2px solid var(--border);
  border-radius: 0;
  background: var(--white);
  text-align: center;
  font-size: 26px;
  resize: none;
}

.contact-btn{
  width: 55%;
  padding: 16px 18px;
  font: inherit;
  font-size: 26px;
  border: 2px solid #555;
  border-radius: 14px;
  background: #555;
  color: #fff;
}

.contact-btn:hover,
.contact-btn:focus{
  filter: brightness(0.95);
  cursor: pointer;
}

@media (max-width: 980px){
  .contact-layout{
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .contact-box{
    width: 100%;
  }

  .contact-links{
    padding-left: 0;
    text-align: center;
    margin-top: 30px;
  }

  .contact-form input,
  .contact-form textarea{
    width: 100%;
  }

  .contact-btn{
    width: 70%;
  }
}
