/* =======================
   Root variables
   ======================= */
:root {
  --main-color: #004080;
  --accent-color: #007acc;
  --bg-color: #f9f9f9;
  --font-family: 'Helvetica Neue', sans-serif;
}

/* =======================
   Base & reset
   ======================= */
* { box-sizing: border-box; }

html {
  max-width: 100vw;
  overflow-x: hidden;
  /* Smooth scroll for in-page anchors */
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: #333;
  line-height: 1.6;
  /* Responsive base font (≈16–18px range) */
  font-size: clamp(15px, 2.2vw, 17.6px);
  max-width: 100vw;
  overflow-x: hidden; /* Prevent accidental horizontal scroll */
}

/* =======================
   Header (hero background)
   ======================= */
header.site-header {
  position: relative;
  color: #fff;
  background: url("../images/risanken_logo_16x9_noname.png") center / cover no-repeat;
  /* Use svh to avoid mobile URL bar jump */
  min-height: 52svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Scalable heading */
header.site-header h1 {
  color: #fff;
  font-weight: bold;
  margin: 0;
  font-size: clamp(1.6rem, 6vw, 3.2rem);
}

/* =======================
   Footer
   ======================= */
footer {
  background-color: var(--main-color);
  color: #fff;
  padding: 1.5em 0;
  text-align: center;
}

/* =======================
   Layout containers & sections
   ======================= */
.container {
  max-width: 1080px; /* Slightly narrower for readability */
  margin: 0 auto;
  padding: 0 1em 1em;  /* top=0, left/right=1em, bottom=1em */
}

/* Add a thin white band between header image and the first section */
header + main.container {
  padding-top: clamp(10px, 1.2vw, 18px);
}

/* Use parent-controlled spacing to avoid margin-collapsing */
main.container {
  display: grid;
  gap: 24px;           /* vertical spacing between sections */
}
main.container > section { margin: 0; }

/* Blue card */
.about {
  background-color: #f0f4f8;
  padding: 1em 1em;            /* inner spacing of the blue card */
  border-radius: 8px;
  overflow: hidden;            /* prevent first-child margin from escaping */
}

h1, h2 { margin-top: 0; }      /* keep headings flush to card top */
.past-meetings h2,.organizers h2 {
  margin-top: 1.5em; /* Adjust spacing above headings */
}

/* Optional card style */
.card {
  background: #fff;
  padding: 1em;
  margin: 1em 0;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* =======================
   Button (single definition)
   ======================= */
.button {
  display: inline-block;
  margin-top: 0.5em;
  padding: 0.6em 1.4em;
  background-color: #fff;      /* White background */
  color: #0066cc;              /* Blue text */
  font-weight: bold;
  font-size: 1.1em;
  text-decoration: none;
  border: 2px solid #0066cc;   /* Blue border */
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: background-color 0.2s, color 0.2s;
}
.button:hover {
  background-color: #f0f8ff;   /* Light blue on hover */
  color: #004080;
}

/* =======================
   Speaker list (responsive)
   ======================= */
.speaker-list {
  display: flex;
  flex-direction: column;
  gap: 1em;
  margin-top: 1em;
}

.speaker {
  display: grid;
  grid-template-columns: 1fr;      /* 1 column on mobile */
  gap: .35rem .9rem;
  padding: 0.8em 0;                /* increased vertical padding */
  margin: 0.4em 0;                 /* extra margin between speakers */
  align-items: start;
  border-bottom: 1px dashed #eee;
}
.speaker:last-of-type { border-bottom: 0; }

.speaker-name,
.speak-title {
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.6;
}

/* Desktop/tablet: aligned start position */
@media (min-width: 768px) {
  .speaker {
    display: table;
    width: 100%;
    border-collapse: collapse;
    margin: 0.5em 0;             /* ensure margin applies in table layout */
    padding: 0.8em 0;
  }
  .speaker-name {
    display: table-cell;
    width: 240px;                /* adjust 240–300px as needed */
    padding-right: 16px;         /* column gap */
    vertical-align: top;
  }
  .speak-title {
    display: table-cell;
    vertical-align: top;
  }
}

/* =======================
   Past meetings link list
   ======================= */
.link-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;   /* 1 column on mobile */
  gap: 8px;
}
.link-list li { margin: 0; }

.link-list a {
  display: inline-block;
  padding: 10px 12px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: #fcfcfc;
  color: var(--main-color);
  text-decoration: none;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.link-list a:hover { text-decoration: underline; }

@media (min-width: 640px) {
  .link-list { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 960px) {
  .link-list { grid-template-columns: 1fr 1fr 1fr; }
}


/* =======================
   Media & MathJax overflow guards
   ======================= */
img, video { max-width: 100%; height: auto; display: block; }

pre, code, kbd, samp {
  white-space: pre-wrap;
  word-break: break-word;
}

.MathJax_Display, .mjx-chtml {
  max-width: 100%;
  overflow-x: auto;
}

/* =======================
   Mobile fine-tuning
   ======================= */
@media (max-width: 600px) {
  body { font-size: 95%; }
  .card { padding: 1em 0.8em; }
  .container { padding: 0 0.9em 1em; }
}

/* =======================
   Mobile-specific tightening (remove big gap above "about")
   ======================= */
@media (max-width: 600px) {
  /* 1) Make the header shorter on phones */
  header.site-header {
    min-height: 32svh; /* was 52svh on global */
  }

  /* 2) Thin the white band between header and first section */
  header + main.container {
    padding-top: 6px; /* was clamp(10px, 1.2vw, 18px) */
  }

  /* 3) Reduce vertical spacing between sections */
  main.container {
    gap: 12px; /* was 24px */
  }

  /* 4) Ensure the first text inside .about does not add extra top gap */
  .about > *:first-child {
    margin-top: 0 !important;
  }
}