body {
  margin: 0;
  padding: 0;
  background: #fff;
}

main {
  font-size: clamp(10px, 1.8vw, 18px);
  font-family: Helvetica, Arial, sans-serif;
  max-width: 1000px;
  width: 97%;
  margin: 10px auto;
  box-sizing: border-box;
}

/*-----------------------------------------------------------------*/
/* Header                                                          */
/*-----------------------------------------------------------------*/

.header {
  font-family: Helvetica, Arial, sans-serif;
  background: #ffffffb9;
  display: flex;
  justify-content: space-between;
  align-items: center;

  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  margin: 0 auto;
  max-width: 1400px;
  width: 97%;

  z-index: 1000;
}

.header #name {
  margin: 20px 0;
  font-size: clamp(14px, 2.3vw, 20px);
}

#name a {
  color: inherit;
  text-decoration: none;
}

#name a:visited {
  color: inherit;
}

.subpage {
  background: transparent;
  font-size: clamp(9px, 1.8vw, 18px);
  text-align: left;
  border: none;
  color: #6d6d6d;
}

.nav {
  display: flex;
  gap: clamp(1px, 2vw, 20px);
  align-items: center;
}

.nav .subpage {
  cursor: pointer;
  transition: transform 0.2s;
}

.nav .subpage:hover {
  transform: translateY(3px);
}

.header.hidden {
  transform: translateY(-120%);
}

.header.animate,
.header.animate.hidden {
  transition: transform 1s ease-in-out;
}

/*-----------------------------------------------------------------*/
/* Hero & Intro                                                     */
/*-----------------------------------------------------------------*/

.main-image {
  aspect-ratio: 5 / 2;
  background: #111 url('title.png') no-repeat center center;
  background-size: cover;
  margin-bottom: 20px;
  margin-top: 120px;
}

.title {
  color: black;
  font-size: clamp(20px, 5vw, 50px);
  font-weight: bold;
}

.subtitle {
  color: #888;
  font-size: clamp(12px, 2.2vw, 22px);
  font-weight: normal;
}

.intro {
  margin: 50px 0 80px 0;
  font-size: clamp(12px, 2.1vw, 21px);
  color: #6d6d6d;
}

#open-map {
  display: inline-block;
  color: #0051ff;
  margin: 10px 0 20px 0;
  text-decoration: none;
  font-size: clamp(13px, 2.2vw, 22px);
  border: 1px solid #0051ff;
  padding: clamp(8px, 1.2vw, 14px) clamp(18px, 2.6vw, 34px);
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

#open-map:hover {
  background: #0051ff;
  color: #fff;
}

a:has(#open-map) {
  text-decoration: none;
}

#github {
  color: #0051ff;
  margin: 6px 0 18px 0;
  text-decoration: none;
}

#github:hover {
  color: #333;
}

a:has(#github) {
  text-decoration: none;
}

/*-----------------------------------------------------------------*/
/* Section Titles & Body Text                                       */
/*-----------------------------------------------------------------*/

.section-title {
  font-size: clamp(12px, 2.5vw, 25px);
  font-weight: bold;
  margin: 90px 0 20px 0;
  color: black;
}

.subsection-title {
  font-size: clamp(11px, 2vw, 20px);
  font-weight: bold;
  margin: 44px 0 14px 0;
  color: #222;
}

.text {
  font-size: clamp(10px, 1.6vw, 16px);
  line-height: 1.6;
  color: #636363;
  text-align: justify;
}

.text code, code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.88em;
  background: #f2f2f2;
  padding: 1px 4px;
  border-radius: 2px;
  color: #333;
}

/*-----------------------------------------------------------------*/
/* Formula Blocks                                                   */
/*-----------------------------------------------------------------*/

.formula-block {
  background: #f8f8f8;
  padding: 16px 22px;
  margin: 20px 0;
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(9px, 1.4vw, 13px);
  color: #333;
  line-height: 2;
}

.formula-block .formula-label {
  font-family: Helvetica, Arial, sans-serif;
  font-size: clamp(9px, 1.3vw, 12px);
  font-weight: bold;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 6px;
  display: block;
}

.formula-block .formula-label.label-wrong {
  color: #c0392b;
}

.formula-block .formula-label.label-correct {
  color: #276749;
}

.formula-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0;
}

@media (max-width: 640px) {
  .formula-compare { grid-template-columns: 1fr; }
}

/*-----------------------------------------------------------------*/
/* Process Steps                                                    */
/*-----------------------------------------------------------------*/

.step-list {
  list-style: none;
  margin: 20px 0;
  padding: 0;
  counter-reset: step-counter;
}

.step-list li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
  font-size: clamp(10px, 1.5vw, 14px);
  color: #636363;
  line-height: 1.55;
}

.step-list li:last-child {
  border-bottom: none;
}

.step-num {
  font-weight: bold;
  font-size: clamp(9px, 1.3vw, 12px);
  color: #bbb;
  min-width: 26px;
  padding-top: 1px;
  letter-spacing: 0.04em;
}

.step-text {
  color: #444;
}

/*-----------------------------------------------------------------*/
/* Decision List                                                    */
/*-----------------------------------------------------------------*/

.decision-list {
  list-style: none;
  margin: 20px 0;
  padding: 0;
}

.decision-list li {
  padding: 12px 0 12px 0;
  border-bottom: 1px solid #eee;
  font-size: clamp(10px, 1.5vw, 14px);
  color: #636363;
  line-height: 1.6;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.decision-list li:last-child {
  border-bottom: none;
}

.decision-marker {
  color: #bbb;
  font-weight: bold;
  min-width: 14px;
}

.decision-text {
  color: #444;
}

/*-----------------------------------------------------------------*/
/* Image Grids                                                      */
/*-----------------------------------------------------------------*/

.image-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 24px 0;
}

.image-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 24px 0;
}

@media (max-width: 640px) {
  .image-2col  { grid-template-columns: 1fr; }
  .image-3col  { grid-template-columns: 1fr 1fr; }
}

.img-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.img-card img {
  width: 100%;
  height: auto;
  display: block;
}

.img-label {
  font-size: clamp(9px, 1.2vw, 11px);
  color: #888;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.img-caption {
  font-size: clamp(9px, 1.3vw, 12px);
  color: #aaa;
  text-align: center;
  margin: 4px 0 20px 0;
  font-style: italic;
}

/*-----------------------------------------------------------------*/
/* Single wide image                                               */
/*-----------------------------------------------------------------*/

.image-wide {
  margin: 28px 0;
}

.image-wide img {
  width: 100%;
  height: auto;
  display: block;
}

/*-----------------------------------------------------------------*/
/* Implementation Table                                            */
/*-----------------------------------------------------------------*/

.tech-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: clamp(9px, 1.5vw, 14px);
}

.tech-table tbody tr {
  border-bottom: 1px solid #eee;
}

.tech-table tbody tr:first-child {
  border-top: 2px solid #000;
}

.tech-table td {
  padding: 9px 14px;
  color: #636363;
  vertical-align: top;
  line-height: 1.5;
}

.tech-table td:first-child {
  font-weight: bold;
  color: #333;
  width: 34%;
  white-space: nowrap;
}

/*-----------------------------------------------------------------*/
/* Footer                                                          */
/*-----------------------------------------------------------------*/

.footer {
  font-size: clamp(10px, 1.5vw, 15px);
  line-height: 1.5;
  height: 200px;
  margin: 100px 0 0 0;
  color: #636363;
}
