/* ═══════════════════════════════════════════════════════════════════════════
   Nautical Ninja — Main Stylesheet
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Custom Properties ─────────────────────────────────────────────────── */
:root {
  /* Nautical Ninja logo palette */
  --navy:        #2d3d4a;   /* dark charcoal — nav, headings */
  --navy-light:  #3d4a56;   /* logo dark charcoal */
  --navy-dark:   #1e2c37;   /* deepest dark */
  --sea:         #4a7fa5;   /* logo deep blue — primary accent */
  --sea-light:   #89b4d4;   /* logo light blue — hover, highlights */
  --sea-pale:    #e8f2f8;   /* pale blue tint — backgrounds */
  --steel:       #7a8999;   /* logo wheel grey — secondary elements */
  --teal:        #1abc9c;
  --teal-dark:   #16a085;
  --sand:        #f5f1eb;
  --sand-dark:   #e8e2d8;
  --coral:       #e74c3c;
  --amber:       #f39c12;
  --white:       #ffffff;
  --gray-50:     #f8f9fa;
  --gray-100:    #f1f3f5;
  --gray-200:    #e9ecef;
  --gray-300:    #dee2e6;
  --gray-400:    #ced4da;
  --gray-500:    #adb5bd;
  --gray-600:    #868e96;
  --gray-700:    #495057;
  --gray-800:    #343a40;
  --gray-900:    #212529;

  /* Semantic */
  --bg:          var(--white);
  --bg-alt:      var(--gray-50);
  --text:        var(--gray-800);
  --text-light:  var(--gray-600);
  --text-heading:var(--navy);
  --accent:      var(--sea);
  --accent-hover:var(--sea-light);
  --success:     var(--teal);
  --warning:     var(--amber);
  --danger:      var(--coral);
  --border:      var(--gray-200);

  /* Layout */
  --topnav-h:    56px;
  --sidebar-w:   280px;
  --content-max: 860px;

  /* Typography */
  --font-body:   'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading:'Georgia', 'Times New Roman', serif;
  --font-mono:   'Consolas', 'Monaco', 'Courier New', monospace;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topnav-h) + 1rem); }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

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

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

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--text-heading);
  line-height: 1.3;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--sea-pale);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: var(--navy);
}

/* ─── Top Navigation ────────────────────────────────────────────────────── */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topnav-h);
  background: var(--navy);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.topnav__logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none !important;
  margin-right: 2rem;
  flex-shrink: 0;
}

.topnav__logo-img {
  height: 38px;
  width: 38px;
  object-fit: contain;
  border-radius: 4px;
}

.topnav__logo-text {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.topnav__links { display: flex; gap: 0; flex: 1; }

.topnav__link {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: rgba(255,255,255,0.8);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 0 1rem;
  height: var(--topnav-h);
  text-decoration: none !important;
  border-bottom: 3px solid transparent;
  transition: all 0.15s;
}

.topnav__link:hover {
  color: var(--white);
  background: rgba(255,255,255,0.06);
  border-bottom-color: var(--sea-light);
}

.topnav__link.active {
  color: var(--white);
  border-bottom-color: var(--sea-light);
  font-weight: 600;
}

.topnav__soon {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--steel);
  color: var(--white);
  padding: 0.1em 0.45em;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.topnav__hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
  margin-left: auto;
}

/* ─── Layout ────────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  margin-top: var(--topnav-h);
  min-height: calc(100vh - var(--topnav-h));
}

/* Full-width layout (home, section landing, coming-soon pages) */
.layout--full .sidebar { display: none; }
.layout--full .main-content { max-width: none; padding: 0; }

/* ─── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--gray-50);
  border-right: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: var(--topnav-h);
  height: calc(100vh - var(--topnav-h));
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar__group { border-bottom: 1px solid var(--border); }

.sidebar__group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 0.7rem 1rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy);
  cursor: pointer;
}

.sidebar__group-title:hover { background: var(--gray-100); }

.sidebar__chevron { font-size: 0.75rem; color: var(--gray-500); }

.sidebar__group--sub { border-bottom: none; }
.sidebar__group-title--sub {
  padding-left: 1.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--gray-700);
}
.sidebar__subgroups .sidebar__link { padding-left: 2.25rem; }

.sidebar__list { list-style: none; padding: 0 0 0.5rem 0; }

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem 0.4rem 1.5rem;
  font-size: 0.88rem;
  color: var(--text);
  text-decoration: none !important;
  border-left: 3px solid transparent;
  transition: all 0.12s;
}

.sidebar__link:hover {
  background: var(--sea-pale);
  border-left-color: var(--sea-light);
  color: var(--navy);
}

.sidebar__link--active {
  background: var(--sea-pale);
  border-left-color: var(--accent);
  font-weight: 600;
  color: var(--navy);
}

.sidebar__template-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--white);
}

.sidebar__template-badge--lesson         { background: var(--sea); }
.sidebar__template-badge--sailing-lesson { background: var(--sea); }
.sidebar__template-badge--diy-guide      { background: var(--steel); }
.sidebar__template-badge--reference      { background: var(--teal); }
.sidebar__template-badge--quiz           { background: var(--amber); }
.sidebar__template-badge--diagram        { background: var(--coral); }
.sidebar__template-badge--cheatsheet     { background: var(--gray-600); }

.sidebar__coming-soon {
  padding: 1.5rem 1rem;
  color: var(--text-light);
  font-size: 0.9rem;
  text-align: center;
}

/* ─── Main Content ──────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  max-width: var(--content-max);
  padding: 1.5rem 2.5rem 3rem;
  min-width: 0;
}

/* ─── Breadcrumb ────────────────────────────────────────────────────────── */
.breadcrumb {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { color: var(--text); font-weight: 500; }

/* ─── Prev / Next Navigation ────────────────────────────────────────────── */
.prev-next {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.prev-next__link {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  text-decoration: none !important;
  color: var(--accent);
  transition: all 0.15s;
}

.prev-next__link:hover {
  background: var(--sea-pale);
  border-color: var(--accent);
}

/* ─── Footer ────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,0.7);
  padding: 2rem;
  text-align: center;
}

.site-footer a { color: rgba(255,255,255,0.85); }
.site-footer a:hover { color: var(--white); }
.site-footer__links { margin-bottom: 0.5rem; font-size: 0.9rem; }
.site-footer__copy { font-size: 0.8rem; }

/* ─── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2em 0.7em;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.badge--beginner   { background: #d4edda; color: #155724; }
.badge--intermediate { background: #fff3cd; color: #856404; }
.badge--advanced   { background: #f8d7da; color: #721c24; }
.badge--time       { background: var(--gray-100); color: var(--gray-700); }
.badge--quiz       { background: #fff3cd; color: #856404; }
.badge--info       { background: var(--sea-pale); color: var(--navy); }

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border: none;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none !important;
}

.btn--primary { background: var(--accent); color: var(--white); }
.btn--primary:hover { background: var(--sea-light); color: var(--white); }
.btn--secondary { background: var(--gray-200); color: var(--text); }
.btn--secondary:hover { background: var(--gray-300); }

/* ─── Home Page & Section Landings ─────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 4rem 2rem 3rem;
  background: linear-gradient(160deg, var(--navy-dark) 0%, var(--navy) 60%, var(--navy-light) 100%);
  color: var(--white);
}

.hero__icon { font-size: 3rem; display: block; margin-bottom: 0.75rem; }

.hero h1 {
  font-size: 2.6rem;
  color: var(--white);
  margin-bottom: 0.5rem;
}

.hero__tagline {
  font-size: 1.15rem;
  color: var(--sea-light);
  margin-bottom: 0.5rem;
}

.hero__desc {
  font-size: 1rem;
  color: rgba(255,255,255,0.7);
  max-width: 620px;
  margin: 0 auto;
}

/* Top-level section cards on home page */
.home__sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 3rem 2rem 4rem;
  max-width: 1100px;
  margin: 0 auto;
}

.home__section-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 2rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none !important;
  color: var(--text);
  transition: all 0.2s;
  position: relative;
  border-top: 4px solid var(--sea);
}

.home__section-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(74,127,165,0.15);
  border-top-color: var(--sea-light);
  color: var(--text);
}

.home__section-card--soon {
  opacity: 0.75;
  border-top-color: var(--steel);
}

.home__section-card--soon:hover {
  border-top-color: var(--steel);
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.home__section-icon {
  font-size: 2.4rem;
  margin-bottom: 0.75rem;
  display: block;
}

.home__section-card h2 {
  font-size: 1.25rem;
  margin-bottom: 0.4rem;
  color: var(--navy);
}

.home__section-card p {
  font-size: 0.92rem;
  color: var(--text-light);
  line-height: 1.5;
}

.badge--soon {
  margin-top: 0.75rem;
  background: var(--gray-100);
  color: var(--steel);
  font-size: 0.72rem;
}

/* Section landing category grid */
.section-landing__categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  padding: 2.5rem 2rem 4rem;
  max-width: 1100px;
  margin: 0 auto;
}

/* Category cards (inside section landings) */
.home__category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 1.25rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none !important;
  color: var(--text);
  transition: all 0.2s;
}

.home__category-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(74,127,165,0.12);
  border-color: var(--sea);
  color: var(--text);
}

.home__category-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }

.home__category-card h2 {
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
  color: var(--navy);
}

.home__category-card p {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* Coming soon page */
.coming-soon {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-light);
  font-size: 1.1rem;
}

/* ─── Tags ──────────────────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  background: var(--gray-100);
  color: var(--gray-700);
  padding: 0.15em 0.5em;
  border-radius: 4px;
  font-size: 0.78rem;
  margin: 0.15em;
}

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .topnav__links { display: none; }
  .topnav__hamburger { display: block; }

  .sidebar {
    position: fixed;
    left: -100%;
    top: var(--topnav-h);
    width: 85vw;
    max-width: 320px;
    z-index: 999;
    transition: left 0.3s;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  }

  .sidebar.sidebar--open { left: 0; }

  .main-content { padding: 1rem 1.25rem 2rem; }
}

@media print {
  .topnav, .sidebar, .prev-next, .site-footer, .breadcrumb { display: none !important; }
  .main-content { max-width: 100%; padding: 0; }
  .layout { display: block; margin-top: 0; }
}
