/* Flagship Walkthrough Trainer — mobile-first stylesheet */

@font-face {
  font-family: "Cormorant Garamond";
  src: url("assets/fonts/CormorantGaramond-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("assets/fonts/CormorantGaramond-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("assets/fonts/Montserrat-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("assets/fonts/Montserrat-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("assets/fonts/Montserrat-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}

:root {
  --primary: #093a4f;
  --accent: #cab37c;
  --bg: #fbf7f0;
  --ink: #1a1a1a;
  --muted: #5a5a5a;
  --border: #e3dccd;
  --good: #2e7d4f;
  --bad: #b3433a;
  --shadow: 0 1px 3px rgba(9, 58, 79, 0.08), 0 1px 2px rgba(9, 58, 79, 0.04);
  font-family: "Montserrat", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--primary); text-decoration: none; }

h1, h2, h3 { font-family: "Cormorant Garamond", "Times New Roman", serif; font-weight: 600; color: var(--primary); margin: 0 0 0.5em; line-height: 1.2; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; font-family: "Montserrat", sans-serif; font-weight: 600; }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--primary);
  color: var(--bg);
  padding-top: calc(0.5rem + env(safe-area-inset-top));
  box-shadow: var(--shadow);
}
.topbar .brand { display: flex; align-items: center; flex: 1; justify-content: center; }
.topbar .brand img { height: 36px; max-width: 70%; object-fit: contain; }
.topbar button {
  background: transparent;
  border: none;
  color: var(--bg);
  font-size: 1.4rem;
  width: 2.4rem;
  height: 2.4rem;
  cursor: pointer;
  padding: 0;
}
.topbar .back[hidden] { visibility: hidden; }

/* Side drawer */
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 75%;
  max-width: 320px;
  background: var(--bg);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.2s ease-out;
  padding: calc(4rem + env(safe-area-inset-top)) 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: -2px 0 12px rgba(0,0,0,0.15);
}
.drawer[aria-hidden="false"] { transform: translateX(0); }
.drawer a {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.05rem;
  font-weight: 500;
}
.drawer hr { border: none; border-top: 1px solid var(--border); margin: 0.5rem 0; }
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(9, 58, 79, 0.45); z-index: 90;
}

/* Main view container */
main {
  padding: 1rem 1rem 4rem;
  max-width: 720px;
  margin: 0 auto;
}

/* Home: boat grid */
.boat-list {
  display: grid;
  gap: 0.75rem;
}
.boat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.boat-card .title { font-family: "Cormorant Garamond", serif; font-weight: 600; font-size: 1.3rem; color: var(--primary); }
.boat-card .meta { font-size: 0.85rem; color: var(--muted); display: flex; gap: 0.75rem; flex-wrap: wrap; }
.boat-card .meta span { display: inline-flex; align-items: center; gap: 0.25rem; }

.searchbar {
  display: flex;
  margin-bottom: 1rem;
}
.searchbar input {
  flex: 1;
  padding: 0.65rem 0.85rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}

/* Boat detail */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0 -1rem 1rem;
  padding: 0 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  position: sticky;
  top: calc(3.4rem + env(safe-area-inset-top));
  z-index: 40;
}
.tabs button {
  background: transparent;
  border: none;
  padding: 0.7rem 0.9rem;
  font: inherit;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.tabs button.active { color: var(--primary); border-bottom-color: var(--accent); }

.stop {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.6rem;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.stop summary {
  list-style: none;
  cursor: pointer;
  padding: 0.85rem 1rem;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.stop summary::-webkit-details-marker { display: none; }
.stop summary::after { content: "+"; font-size: 1.3rem; color: var(--accent); }
.stop[open] summary::after { content: "−"; }
.stop .body { padding: 0 1rem 1rem; }
.stop .body p { margin: 0; line-height: 1.6; }

.section-head { margin: 1.25rem 0 0.5rem; color: var(--primary); }
.subtitle { color: var(--accent); font-style: italic; margin-top: -0.5rem; }

/* Specs table */
.spec-table { width: 100%; border-collapse: collapse; background: white; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); margin-bottom: 1rem; }
.spec-table th, .spec-table td { padding: 0.6rem 0.85rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.spec-table th { background: var(--primary); color: var(--bg); font-weight: 500; }
.spec-table tr:last-child td { border-bottom: none; }
.spec-table td:first-child { font-weight: 500; color: var(--primary); width: 40%; }

.key-points { list-style: none; padding: 0; margin: 0 0 1rem; }
.key-points li {
  background: white;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.4rem;
  line-height: 1.45;
  font-size: 0.95rem;
}

.brokers-take {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.brokers-take p { margin: 0; font-style: italic; color: var(--muted); }

.variant-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
  box-shadow: var(--shadow);
}
.variant-card .marker {
  display: inline-block;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

/* CTA buttons */
.actions { display: grid; gap: 0.5rem; margin: 1rem 0; }
.btn {
  display: inline-block;
  background: var(--primary);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  width: 100%;
}
.btn.secondary { background: white; color: var(--primary); border: 1px solid var(--border); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Quiz */
.quiz-progress {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 1rem;
  overflow: hidden;
}
.quiz-progress > div { height: 100%; background: var(--accent); transition: width 0.2s; }
.quiz-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.85rem; margin-bottom: 0.5rem; }
.quiz-question {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.quiz-question h2 { font-family: "Montserrat", sans-serif; font-size: 1.1rem; font-weight: 600; line-height: 1.4; }
.quiz-options { display: grid; gap: 0.5rem; }
.quiz-option {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: background 0.15s;
}
.quiz-option:hover { background: rgba(202, 179, 124, 0.08); }
.quiz-option.correct { background: rgba(46, 125, 79, 0.12); border-color: var(--good); }
.quiz-option.incorrect { background: rgba(179, 67, 58, 0.12); border-color: var(--bad); }
.quiz-option.locked { cursor: default; opacity: 0.7; }
.quiz-option.locked.correct, .quiz-option.locked.incorrect { opacity: 1; }
.quiz-explain {
  background: rgba(202, 179, 124, 0.12);
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
  font-size: 0.92rem;
  line-height: 1.45;
}
.quiz-result {
  text-align: center;
  padding: 1.5rem 1rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.quiz-result .score { font-family: "Cormorant Garamond", serif; font-size: 3rem; color: var(--primary); margin: 0.5rem 0; }
.quiz-result .pct { color: var(--accent); font-weight: 600; }

/* Compare */
.compare-table { width: 100%; border-collapse: collapse; background: white; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; font-size: 0.85rem; box-shadow: var(--shadow); }
.compare-table th, .compare-table td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border); text-align: left; }
.compare-table th { background: var(--primary); color: var(--bg); font-weight: 500; cursor: pointer; user-select: none; white-space: nowrap; }
.compare-table th.sorted::after { content: " ↓"; }
.compare-table th.sorted.asc::after { content: " ↑"; }
.compare-table td:first-child { font-weight: 600; color: var(--primary); }
.compare-table tr:last-child td { border-bottom: none; }
.compare-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Update banner */
.update-banner {
  position: fixed;
  bottom: 1rem; left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: var(--bg);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(9,58,79,0.3);
  font-size: 0.9rem;
  z-index: 200;
}
.update-banner button {
  background: var(--accent);
  color: var(--primary);
  border: none;
  font: inherit;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  margin-left: 0.5rem;
  cursor: pointer;
}

/* Loading state */
.loading { text-align: center; padding: 3rem 1rem; color: var(--muted); }

.tag {
  display: inline-block;
  background: rgba(9, 58, 79, 0.08);
  color: var(--primary);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-right: 0.25rem;
}
