/* Focara Kitchen — tutorial page styles.
   Warm hearth palette shared with the app: linen #F2EAD9, card #FBF6EC,
   terracotta #E8633A, wheat #D4B896, sage #7A9E7E, cast iron #2A1F1A. */

/* Native smooth anchor scrolling — JS never computes scroll positions. */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* Anchor targets stop below the fixed header. */
.tutorial-content section[id],
.tutorial-content [id] {
  scroll-margin-top: 96px;
}

.tutorial-main {
  padding-top: 100px;
  min-height: 100vh;
  background: linear-gradient(180deg, #F2EAD9 0%, #FBF6EC 100%);
}

.tutorial-container {
  display: flex;
  flex-wrap: wrap;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  gap: 40px;
}

/* Mobile controls card - hidden on desktop */
.mobile-language-selector {
  display: none;
  width: 100%;
  padding: 16px;
  background: #FBF6EC;
  border: 1px solid rgba(212, 184, 150, 0.45);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(42, 31, 26, 0.08);
  margin-bottom: 20px;
}

.mobile-control-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-control-row + .mobile-control-row {
  margin-top: 12px;
}

.mobile-language-selector label {
  font-size: 14px;
  font-weight: 700;
  color: #6b5c50;
  min-width: 86px;
}

.mobile-language-selector select {
  flex: 1;
  padding: 10px 14px;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 14px;
  border: 2px solid #E5D8C2;
  border-radius: 10px;
  background: #ffffff;
  color: #2A1F1A;
  cursor: pointer;
  min-width: 0;
}

.mobile-language-selector select:focus {
  outline: none;
  border-color: #E8633A;
  box-shadow: 0 0 0 3px rgba(232, 99, 58, 0.15);
}

/* Sidebar */
.tutorial-sidebar {
  position: sticky;
  top: 100px;
  width: 280px;
  flex-shrink: 0;
  height: fit-content;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 24px;
  background: #FBF6EC;
  border: 1px solid rgba(212, 184, 150, 0.45);
  border-radius: 18px;
  box-shadow: 0 4px 20px rgba(42, 31, 26, 0.08);
}

.language-selector {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #E5D8C2;
}

.language-selector label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: #6b5c50;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.language-selector select {
  width: 100%;
  padding: 10px 14px;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 14px;
  border: 2px solid #E5D8C2;
  border-radius: 10px;
  background: #ffffff;
  color: #2A1F1A;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.language-selector select:hover {
  border-color: #D4B896;
}

.language-selector select:focus {
  outline: none;
  border-color: #E8633A;
  box-shadow: 0 0 0 3px rgba(232, 99, 58, 0.15);
}

/* Platform toggle (iOS / Android screenshots) */
.platform-selector {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #E5D8C2;
}

.platform-toggle {
  display: flex;
  width: 100%;
  background: #EBDFC8;
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.platform-btn {
  flex: 1;
  padding: 8px 12px;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #6b5c50;
  background: transparent;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s;
}

.platform-btn:hover {
  color: #E8633A;
}

.platform-btn:focus-visible {
  outline: 3px solid #E8633A;
  outline-offset: 1px;
}

.platform-btn[aria-pressed="true"] {
  background: #E8633A;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(232, 99, 58, 0.35);
}

/* Platform-specific screenshot visibility */
body.platform-ios .shot-android,
body.platform-android .shot-ios {
  display: none;
}

/* When a figure only has one platform's screenshot, always show it and badge it */
.screenshot.single-platform .shot-ios,
.screenshot.single-platform .shot-android {
  display: inline-block !important;
}

.platform-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #6b5c50;
  background: #EBDFC8;
  border-radius: 999px;
}

/* Table of contents */
.tutorial-toc h3 {
  font-family: 'Fraunces', serif;
  font-size: 14px;
  font-weight: 700;
  color: #6b5c50;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 12px 0;
}

.tutorial-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tutorial-toc li {
  margin-bottom: 2px;
}

.toc-group {
  margin: 14px 0 6px 0;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 11px;
  font-weight: 800;
  color: #a8917c;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding-inline-start: 12px;
}

.toc-link {
  display: block;
  padding: 7px 12px;
  font-size: 14px;
  color: #574a3f;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s;
}

.toc-link:hover {
  color: #E8633A;
  background: #F2EAD9;
}

.toc-link.active {
  color: #ffffff;
  background: #E8633A;
  font-weight: 700;
}

/* Main Content */
.tutorial-content {
  flex: 1;
  min-width: 0;
  padding-bottom: 60px;
}

.tutorial-content h1 {
  font-family: 'Fraunces', serif;
  font-size: 38px;
  font-weight: 700;
  color: #2A1F1A;
  margin: 0 0 12px 0;
}

.tutorial-intro {
  font-size: 18px;
  color: #6b5c50;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 2px solid #E5D8C2;
}

.tutorial-content section {
  margin-bottom: 48px;
  padding-top: 24px;
}

.tutorial-content h2 {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  font-weight: 600;
  color: #2A1F1A;
  margin: 0 0 16px 0;
  padding-bottom: 12px;
  border-bottom: 2px solid #E8633A;
}

.tutorial-content h3 {
  font-family: 'Nunito Sans', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: #3d3229;
  margin: 24px 0 12px 0;
}

.tutorial-content p {
  font-size: 16px;
  line-height: 1.7;
  color: #574a3f;
  margin: 0 0 16px 0;
}

.tutorial-content ul,
.tutorial-content ol {
  margin: 0 0 16px 0;
  padding-inline-start: 24px;
}

.tutorial-content li {
  font-size: 16px;
  line-height: 1.7;
  color: #574a3f;
  margin-bottom: 8px;
}

.tutorial-content code {
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 14px;
  background: #EBDFC8;
  padding: 2px 6px;
  border-radius: 4px;
  color: #2A1F1A;
}

/* Platform-specific paragraphs */
body.platform-ios .only-android,
body.platform-android .only-ios {
  display: none;
}

/* Screenshots */
.screenshot {
  margin: 20px 0;
  text-align: center;
}

.screenshot img {
  max-width: 300px;
  width: 100%;
  height: auto;
  border-radius: 24px;
  box-shadow: 0 8px 40px rgba(42, 31, 26, 0.22);
  /* High-res source images scale down crisp on retina displays */
}

.screenshot-row {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 20px 0;
}

.screenshot-row .screenshot {
  margin: 0;
}

.screenshot-row .screenshot img {
  max-width: 220px;
}

/* Tips and Notes */
.tip,
.note {
  padding: 16px 20px;
  border-radius: 12px;
  margin: 16px 0;
  font-size: 14px;
}

.tip {
  background: #E4E6D8;
  border-inline-start: 4px solid #7A9E7E;
  color: #3c4f3e;
}

.note {
  background: #F4E4C8;
  border-inline-start: 4px solid #D4A55C;
  color: #6e5427;
}

/* Table */
.format-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(42, 31, 26, 0.08);
}

.format-table th,
.format-table td {
  padding: 12px 16px;
  text-align: start;
  font-size: 14px;
}

.format-table th {
  background: #2A1F1A;
  color: #F2EAD9;
  font-weight: 700;
}

.format-table td {
  background: #FBF6EC;
  border-bottom: 1px solid #E5D8C2;
  color: #574a3f;
}

.format-table tr:last-child td {
  border-bottom: none;
}

/* Footer */
.tutorial-footer {
  margin-top: 60px;
  padding-top: 24px;
  border-top: 2px solid #E5D8C2;
  text-align: center;
}

.tutorial-footer p {
  color: #a8917c;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 991px) {
  .tutorial-container {
    flex-direction: column;
  }

  .mobile-language-selector {
    display: block;
  }

  /* Hide sidebar on mobile - the mobile controls card replaces it */
  .tutorial-sidebar {
    display: none;
  }

  .tutorial-content h1 {
    font-size: 28px;
  }

  .tutorial-content h2 {
    font-size: 22px;
  }
}

@media (max-width: 600px) {
  .tutorial-main {
    padding-top: 80px;
  }

  .tutorial-container {
    padding: 0 16px;
  }

  .tutorial-content h1 {
    font-size: 24px;
  }

  .mobile-language-selector label {
    min-width: 80px;
    font-size: 13px;
  }

  .screenshot img {
    max-width: 240px;
    border-radius: 20px;
  }

  .screenshot-row .screenshot img {
    max-width: 160px;
  }

  .format-table th,
  .format-table td {
    padding: 10px 12px;
    font-size: 13px;
  }
}
