/* ========================================
   Common CSS for Hashimoto Lab Website
   ======================================== */

/* ========================================
   CSS Reset & Base Styles
   ======================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 120px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #fff;
}

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

a {
  color: #2563eb;
  text-decoration: none;
}

/* ========================================
   Layout Container (Mobile First)
   ======================================== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ========================================
   Header & Navigation (Mobile First)
   ======================================== */
header {
  background: #1e293b;
  color: #fff;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

header h1 a {
  color: inherit;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

nav a {
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

@media (hover: hover) and (pointer: fine) {
  nav a:hover,
  nav a:focus {
    background: rgba(255,255,255,0.1);
    outline: 2px solid #3b82f6;
  }
}

nav a[aria-current="page"] {
  background: #2563eb;        /* was #3b82f6: its white label was 3.68:1, now 5.17:1 */
  box-shadow: inset 0 0 0 1px #60a5fa;   /* the darker pill loses edge against the
                                            #1e293b bar; a light inset ring keeps the
                                            current-page boundary visible */
}

.header-top {
  width: 100%;
  display: flex;
  justify-content: center;
  position: relative;
}

.lang-switcher-header {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  border: 1px solid rgba(255,255,255,0.3);
}

@media (hover: hover) and (pointer: fine) {
  .lang-switcher-header:hover {
    background: rgba(255,255,255,0.1);
  }
}

/* ========================================
   Page Header
   ======================================== */
.page-header {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  padding: 3rem 0 2rem;
  text-align: center;
}

.page-header h2 {
  font-size: 2rem;
  color: #1e293b;
  margin-bottom: 0.5rem;
}

.page-header p {
  font-size: 1rem;
  color: #59687c;             /* was #64748b: 3.86:1 on the #e2e8f0 card -> 4.60:1 */
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ========================================
   Content Section
   ======================================== */
.content-section {
  padding: 3rem 0;
  background: #fff;
}

/* ========================================
   Cards
   ======================================== */
.card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

@media (hover: hover) and (pointer: fine) {
  .card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
  }
}

/* ========================================
   Buttons
   ======================================== */
.btn {
  display: inline-block;
  padding: 0.8rem 1.5rem;
  background: #2563eb;        /* was #3b82f6: white label 3.68:1 -> 5.17:1 */
  color: white;
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.3s ease;
  font-weight: 500;
  min-height: 44px;
  border: none;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    background: #1d4ed8;      /* was #2563eb: identical to base after the AA pass */
  }
}

.btn-primary {
  background: #2563eb;        /* was #3b82f6, see .btn */
  color: white;
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    background: #1d4ed8;      /* was #2563eb, see .btn:hover */
  }
}

/* ========================================
   Back Link
   ======================================== */
.back-link {
  color: #2563eb;
  text-decoration: none;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 3rem;
}

/* ========================================
   Footer
   ======================================== */
footer {
  background: #1e293b;
  color: #cbd5e1;
  padding: 2rem 0;
  text-align: center;
}

footer a {
  color: #93c5fd;
}

footer p {
  margin-bottom: 0.5rem;
}

/* ========================================
   Tablet & Desktop Enhancements (768px+)
   ======================================== */
@media (min-width: 768px) {
  .container {
    padding: 0 2rem;
  }

  .header-content {
    flex-direction: column;
    align-items: center;
  }

  header h1 {
    font-size: 1.5rem;
  }

  nav {
    gap: 1rem;
  }

  nav a {
    font-size: 1rem;
  }

  .page-header {
    padding: 4rem 0 3rem;
  }

  .page-header h2 {
    font-size: 2.5rem;
  }
}

/* ========================================
   Accessibility
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #2563eb;
  color: white;
  padding: 0.5rem 1rem;
  z-index: 1000;
}

.skip-link:focus {
  top: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

/* ========================================
   Grid Layouts
   ======================================== */
.grid {
  display: grid;
  gap: 2rem;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* ========================================
   External Link Indicator
   ======================================== */
.external::after {
  content: " ↗";
  font-size: 0.9em;
}
