/* ============================================================
   Opsalis Learn — Shared Stylesheet
   Light theme: white #ffffff, dark slate #1e293b, teal #00b894
   Pure CSS, no dependencies
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary:   #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card:      #ffffff;
  --bg-code:      #f1f5f9;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted:   #94a3b8;
  --accent:       #00b894;
  --accent-hover: #00a381;
  --accent-dim:   rgba(0, 184, 148, 0.06);
  --border:       #e2e8f0;
  --border-accent: rgba(0, 184, 148, 0.25);
  --radius:       8px;
  --radius-lg:    12px;
  --max-width:    960px;
  --font-sans:    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                  Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', Arial, sans-serif;
  --font-mono:    'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono',
                  Menlo, Consolas, 'Courier New', monospace;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  line-height: 1.3;
  font-weight: 700;
  color: var(--text-primary);
}

h1 {
  font-size: 2.25rem;
  margin-bottom: 0.75rem;
}

h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
}

h3 {
  font-size: 1.15rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

strong {
  color: var(--text-primary);
  font-weight: 600;
}

ul, ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}

li {
  margin-bottom: 0.35rem;
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main {
  flex: 1;
  padding: 2rem 0 4rem;
}

/* --- Header / Navigation --- */
.site-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-logo:hover {
  color: var(--accent);
  text-decoration: none;
}

.site-logo .logo-mark {
  color: var(--accent);
  font-weight: 800;
}

.header-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.header-links a {
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: color 0.15s;
}

.header-links a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* --- Breadcrumb --- */
.breadcrumb {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.breadcrumb a {
  color: var(--text-muted);
}

.breadcrumb a:hover {
  color: var(--accent);
}

.breadcrumb .sep {
  color: var(--text-muted);
  user-select: none;
}

.breadcrumb .current {
  color: var(--text-secondary);
}

/* --- Hero (index page) --- */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
}

.hero h1 {
  font-size: 2.5rem;
}

.hero .subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0.75rem auto 0;
  line-height: 1.7;
}

/* --- Protocol Cards Grid --- */
.protocol-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 2.5rem;
}

.protocol-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.protocol-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  text-decoration: none;
  color: var(--text-primary);
}

.protocol-card .card-icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.protocol-card .card-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.protocol-card .card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.protocol-card .card-link {
  margin-top: auto;
  padding-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* --- Detail Page Header --- */
.page-header {
  margin-bottom: 2rem;
}

.page-header .protocol-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  display: block;
}

.page-header h1 {
  margin-bottom: 0.25rem;
}

.page-header .lead {
  font-size: 1.05rem;
  color: var(--text-secondary);
}

/* --- Content Sections --- */
.content-section {
  margin-bottom: 2.5rem;
}

.content-section h2 {
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

/* --- Info Box --- */
.info-box {
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

.info-box p {
  color: var(--text-secondary);
  margin-bottom: 0;
}

.info-box strong {
  color: var(--accent);
}

/* --- How It Works Steps --- */
.steps {
  list-style: none;
  padding-left: 0;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1em;
  width: 1.6rem;
  height: 1.6rem;
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

/* --- Code Blocks --- */
.code-block {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  position: relative;
}

.code-block code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  color: #334155;
  white-space: pre;
  display: block;
}

.code-block .comment {
  color: var(--text-muted);
}

.code-block .string {
  color: #0369a1;
}

.code-block .keyword {
  color: var(--accent);
}

.code-block .url {
  color: #b45309;
}

.code-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* Inline code */
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: #f1f5f9;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: #0f766e;
  border: 1px solid #e2e8f0;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  cursor: pointer;
  border: none;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border-accent);
}

.btn-outline:hover {
  background: var(--accent-dim);
  color: var(--accent-hover);
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

/* --- Table --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
}

th, td {
  text-align: left;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

td {
  color: var(--text-secondary);
}

/* --- Footer --- */
.site-footer {
  background: #f1f5f9;
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  text-align: center;
}

.site-footer p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.site-footer a {
  color: var(--accent);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .protocol-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  .container {
    padding: 0 1rem;
  }

  .btn-group {
    flex-direction: column;
  }

  .btn {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .protocol-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 2rem 0 1.5rem;
  }

  .site-header .container {
    flex-direction: column;
    gap: 0.75rem;
  }

  .header-links {
    gap: 1rem;
  }

  .code-block {
    padding: 1rem;
  }

  .code-block code {
    font-size: 0.8rem;
  }
}
