/* ===================================================================
   Expressing Opinions Tutorial — Styles
   Purple/blue gradient theme with white cards, dark code blocks,
   CSS Grid + Flexbox, responsive at 768px / 480px
   =================================================================== */

/* ---------- CSS Variables ---------- */
:root {
  --gradient-start: #667eea;
  --gradient-end: #764ba2;
  --gradient-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --card-bg: #ffffff;
  --card-radius: 15px;
  --card-shadow: 0 4px 24px rgba(102, 126, 234, 0.15);
  --card-shadow-hover: 0 8px 36px rgba(102, 126, 234, 0.25);
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #7b7b9a;
  --code-bg: #2c3e50;
  --code-text: #e0e0e0;
  --accent-purple: #764ba2;
  --accent-blue: #667eea;
  --badge-tentative: #e8a838;
  --badge-apologetic: #e05757;
  --badge-unnatural: #5b9bd5;
  --badge-verbose: #9b6b9e;
  --good-green: #27ae60;
  --border-light: #e8e8f0;
  --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --transition-speed: 0.3s;
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--gradient-bg);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 4rem;
}

/* ---------- Back Link ---------- */
.back-link {
  display: inline-block;
  padding: 1rem 2rem 0;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition-speed);
}

.back-link:hover {
  color: #ffffff;
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 3rem 2rem 2rem;
  color: #ffffff;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.15rem);
  max-width: 640px;
  margin: 0 auto;
  opacity: 0.9;
  font-weight: 400;
}

/* ---------- Tab Navigation ---------- */
.tab-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 1.5rem 1.5rem;
  max-width: 960px;
  margin: 0 auto;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition-speed);
  font-family: var(--font-sans);
  white-space: nowrap;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
}

.tab-btn.active {
  background: #ffffff;
  color: var(--accent-purple);
  border-color: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.tab-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  font-size: 0.75rem;
  font-weight: 700;
}

.tab-btn.active .tab-number {
  background: var(--accent-purple);
  color: #ffffff;
}

/* ---------- Main Content Area ---------- */
main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.tab-content {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.tab-content.active {
  display: block;
}

/* ---------- Section Headers ---------- */
.section-title {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  color: #ffffff;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.section-intro {
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 2rem;
  font-size: 1.05rem;
  max-width: 700px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: box-shadow var(--transition-speed), transform var(--transition-speed);
}

.card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}

.card-header {
  padding: 1.5rem 1.5rem 0.75rem;
}

.card-body {
  padding: 0.75rem 1.5rem 1.5rem;
}

/* ---------- Mistake Grid (Section 1) ---------- */
.mistake-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 1.5rem;
}

.mistake-badge {
  display: inline-block;
  padding: 0.2rem 0.75rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.mistake-tentative { background: #fff3e0; color: var(--badge-tentative); }
.mistake-apologetic { background: #ffebee; color: var(--badge-apologetic); }
.mistake-unnatural { background: #e3f2fd; color: var(--badge-unnatural); }
.mistake-verbose { background: #f3e5f5; color: var(--badge-verbose); }

.mistake-card .card-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 0.25rem;
}

.example-bad,
.example-good {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin: 0.5rem 0;
}

.example-bad {
  background: #fef2f2;
  border-left: 4px solid var(--badge-apologetic);
}

.example-good {
  background: #f0fdf4;
  border-left: 4px solid var(--good-green);
}

.example-bad .label {
  color: var(--badge-apologetic);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.example-good .label {
  color: var(--good-green);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.example-bad blockquote,
.example-good blockquote {
  margin-top: 0.4rem;
  font-style: italic;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.arrow {
  text-align: center;
  color: var(--text-muted);
  font-size: 1.2rem;
  margin: 0.25rem 0;
}

.problem-box {
  background: #f8f8fc;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

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

/* ---------- Frameworks Grid (Section 2) ---------- */
.frameworks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
}

.framework-number {
  display: inline-block;
  padding: 0.2rem 0.75rem;
  border-radius: 50px;
  background: linear-gradient(135deg, #667eea15, #764ba215);
  color: var(--accent-purple);
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.framework-card .card-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

/* Pattern / Code Block */
.pattern-block {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  margin-top: 0.75rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.pattern-block .placeholder {
  color: #f7c873;
  font-style: italic;
}

/* Example Details */
.example-details {
  margin: 0.75rem 0;
}

.example-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent-purple);
  font-size: 0.9rem;
  padding: 0.3rem 0;
}

.example-quote {
  background: #f8f4fc;
  border-left: 4px solid var(--accent-purple);
  padding: 0.75rem 1rem;
  border-radius: 0 8px 8px 0;
  margin: 0.5rem 0 0;
  font-style: italic;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Try It Box */
.try-it-box {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

.try-it-box label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.try-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-light);
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text-primary);
  resize: vertical;
  transition: border-color var(--transition-speed);
  line-height: 1.6;
}

.try-input:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(118, 75, 162, 0.1);
}

.try-hint {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.55rem 1.2rem;
  border: none;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-speed);
  margin-top: 0.5rem;
  margin-right: 0.5rem;
}

.btn-primary {
  background: var(--gradient-bg);
  color: #ffffff;
  box-shadow: 0 3px 12px rgba(102, 126, 234, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.45);
}

.btn-secondary {
  background: #f0f0f6;
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background: #e4e4ee;
}

/* ---------- Scenarios (Section 3) ---------- */
.scenarios-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.scenario-number {
  display: inline-block;
  padding: 0.2rem 0.75rem;
  border-radius: 50px;
  background: linear-gradient(135deg, #667eea20, #764ba220);
  color: var(--accent-purple);
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.scenario-card .card-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0.25rem 0;
}

.scenario-context {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 0.5rem;
}

/* Framework Picker */
.framework-picker {
  margin-bottom: 1.25rem;
}

.picker-label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.picker-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.picker-btn {
  padding: 0.4rem 0.9rem;
  border: 2px solid var(--border-light);
  border-radius: 50px;
  background: #ffffff;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.picker-btn:hover {
  border-color: var(--accent-purple);
  color: var(--accent-purple);
}

.picker-btn.selected {
  background: var(--accent-purple);
  color: #ffffff;
  border-color: var(--accent-purple);
}

.framework-feedback {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  min-height: 1.2em;
}

.framework-feedback.correct {
  color: var(--good-green);
}

.framework-feedback.incorrect {
  color: var(--badge-apologetic);
}

/* Compose Box */
.compose-box {
  margin-top: 0.5rem;
}

.compose-box label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

/* Model Answer */
.model-answer {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: #f8f4fc;
  border-radius: 10px;
  border-left: 4px solid var(--accent-purple);
  animation: slideIn 0.35s ease forwards;
}

.model-answer h4 {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--accent-purple);
}

.framework-tag {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.model-answer blockquote {
  font-style: italic;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ---------- Principles Grid (Section 4) ---------- */
.principles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.5rem;
}

.principle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-bg);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.principle-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.principle-card > p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.principle-example {
  background: #f8f8fc;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
}

.mini-label {
  display: block;
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 0.4rem 0 0.2rem;
}

.mini-label:first-child {
  margin-top: 0;
}

.principle-example q {
  display: block;
  color: var(--text-primary);
  font-style: italic;
  margin-bottom: 0.2rem;
}

/* ---------- Confidence Checklist ---------- */
.confidence-checklist {
  max-width: 1000px;
  margin: 3rem auto 2rem;
  padding: 2rem 1.5rem;
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
}

.checklist-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.checklist-intro {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.checklist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition-speed);
  position: relative;
}

.checklist-item:hover {
  background: #f8f8fc;
}

.checklist-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkmark {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 2px solid #ccc;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed);
  margin-top: 1px;
}

.checklist-item input:checked + .checkmark {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
}

.checklist-item input:checked + .checkmark::after {
  content: '';
  display: block;
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

.check-text {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.4;
}

/* Score Display */
.score-display {
  text-align: center;
}

.score-bar-container {
  width: 100%;
  height: 10px;
  background: #e8e8f0;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.score-bar {
  height: 100%;
  background: var(--gradient-bg);
  border-radius: 10px;
  width: 0%;
  transition: width 0.5s ease;
}

.score-text {
  font-size: 1rem;
  color: var(--text-secondary);
}

.score-text strong {
  color: var(--accent-purple);
  font-size: 1.2rem;
}

.score-message {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  min-height: 1.4em;
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 2rem 1.5rem 1rem;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.85rem;
  max-width: 1000px;
  margin: 0 auto;
}

/* ---------- Scroll Animations ---------- */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Keyframes ---------- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ---------- Responsive: 768px ---------- */
@media (max-width: 768px) {
  .hero {
    padding: 2rem 1.5rem 1.5rem;
  }

  .tab-nav {
    gap: 0.4rem;
    padding: 0 1rem 1.5rem;
  }

  .tab-btn {
    padding: 0.55rem 0.9rem;
    font-size: 0.8rem;
  }

  .tab-number {
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
  }

  .tab-label {
    display: none;
  }

  main {
    padding: 0 1rem;
  }

  .mistake-grid,
  .frameworks-grid,
  .principles-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .card-header {
    padding: 1.2rem 1.2rem 0.5rem;
  }

  .card-body {
    padding: 0.5rem 1.2rem 1.2rem;
  }

  .picker-buttons {
    flex-direction: column;
    gap: 0.3rem;
  }

  .picker-btn {
    text-align: center;
  }

  .checklist-grid {
    grid-template-columns: 1fr;
  }

  .confidence-checklist {
    margin: 2rem 1rem;
    padding: 1.5rem 1.2rem;
  }
}

/* ---------- Responsive: 480px ---------- */
@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.4rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
  }

  .tab-nav {
    gap: 0.3rem;
  }

  .tab-btn {
    padding: 0.45rem 0.7rem;
    font-size: 0.7rem;
  }

  .section-title {
    font-size: 1.2rem;
  }

  .pattern-block {
    font-size: 0.78rem;
    padding: 0.75rem 0.9rem;
  }

  .btn {
    width: 100%;
    margin-right: 0;
    text-align: center;
  }

  .try-input {
    font-size: 0.85rem;
  }
}
