/* KnotInstructions.com — Global Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700;900&family=Source+Sans+3:wght@300;400;600&display=swap');

:root {
  --rope: #C17A3A;
  --rope-dark: #8B5A1F;
  --rope-light: #E8A860;
  --ink: #1A1208;
  --parchment: #FAF6EE;
  --cream: #F5EDD8;
  --muted: #7A6A55;
  --border: #D4C4A8;
  --white: #FFFFFF;
  --success: #4A7C59;
  --warning: #C17A3A;
  --danger: #8B2E2E;
  --easy: #4A7C59;
  --intermediate: #C17A3A;
  --advanced: #8B2E2E;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Source Sans 3', 'Georgia', sans-serif;
  --shadow: 0 2px 16px rgba(26,18,8,0.10);
  --shadow-lg: 0 8px 40px rgba(26,18,8,0.16);
  --radius: 6px;
  --radius-lg: 12px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--parchment);
  color: var(--ink);
  line-height: 1.65;
  font-size: 17px;
}

/* ── Typography ── */
h1,h2,h3,h4 { font-family: var(--font-display); line-height: 1.2; }
h1 { font-size: clamp(1.9rem, 4vw, 3rem); font-weight: 900; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 700; }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.4rem); font-weight: 700; }
p { max-width: 68ch; }
a { color: var(--rope); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.container--narrow { max-width: 780px; margin: 0 auto; padding: 0 20px; }

/* ── Header / Nav ── */
.site-header {
  background: var(--ink);
  border-bottom: 3px solid var(--rope);
  position: sticky; top: 0; z-index: 100;
}
.site-header .inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 62px; max-width: 1100px; margin: 0 auto; padding: 0 20px;
}
.site-logo {
  font-family: var(--font-display);
  font-size: 1.35rem; font-weight: 900;
  color: var(--cream); letter-spacing: -0.01em;
}
.site-logo span { color: var(--rope); }
.site-nav { display: flex; gap: 6px; }
.site-nav a {
  color: #BBA98A; font-size: 0.875rem; font-weight: 600;
  padding: 6px 12px; border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0.03em; text-transform: uppercase;
}
.site-nav a:hover { background: rgba(193,122,58,0.15); color: var(--rope-light); text-decoration: none; }

/* ── Breadcrumb ── */
.breadcrumb {
  padding: 12px 0; font-size: 0.85rem; color: var(--muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--rope); }
.breadcrumb span { margin: 0 6px; }

/* ── Hero (home) ── */
.home-hero {
  background: var(--ink);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(193,122,58,0.03) 0px, rgba(193,122,58,0.03) 1px,
    transparent 1px, transparent 12px
  );
  padding: 72px 20px 60px;
  text-align: center;
  border-bottom: 3px solid var(--rope);
}
.home-hero h1 { color: var(--cream); margin-bottom: 16px; }
.home-hero p { color: #BBA98A; font-size: 1.1rem; margin: 0 auto 32px; max-width: 56ch; }

.search-bar {
  display: flex; max-width: 520px; margin: 0 auto;
  background: var(--cream); border-radius: 50px;
  border: 2px solid var(--rope); overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}
.search-bar input {
  flex: 1; padding: 14px 22px; border: none; background: transparent;
  font-family: var(--font-body); font-size: 1rem; color: var(--ink);
  outline: none;
}
.search-bar button {
  background: var(--rope); color: var(--white); border: none;
  padding: 14px 26px; cursor: pointer; font-weight: 600;
  font-family: var(--font-body); font-size: 0.95rem;
  transition: background 0.15s;
}
.search-bar button:hover { background: var(--rope-dark); }

/* ── Category Grid ── */
.categories-section { padding: 56px 0 40px; }
.categories-section h2 { margin-bottom: 28px; }
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.category-card {
  background: var(--white); border: 2px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px 16px 22px;
  text-align: center; text-decoration: none; color: var(--ink);
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  display: block;
}
.category-card:hover {
  transform: translateY(-3px); border-color: var(--rope);
  box-shadow: var(--shadow-lg); text-decoration: none; color: var(--ink);
}
.category-card .icon { font-size: 2.4rem; margin-bottom: 10px; display: block; }
.category-card .label { font-family: var(--font-display); font-weight: 700; font-size: 1rem; }
.category-card .count { color: var(--muted); font-size: 0.8rem; margin-top: 4px; }

/* ── Featured Knots ── */
.featured-section { padding: 40px 0 56px; }
.featured-section h2 { margin-bottom: 28px; }
.knot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.knot-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  text-decoration: none; color: var(--ink);
  transition: transform 0.18s, box-shadow 0.18s;
  display: block;
}
.knot-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); text-decoration: none; color: var(--ink); }
.knot-card-thumb {
  height: 130px; background: var(--cream);
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.knot-card-thumb svg { max-width: 100%; max-height: 100%; }
.knot-card-body { padding: 16px 18px 18px; }
.knot-card-body h3 { font-size: 1.05rem; margin-bottom: 6px; }
.knot-card-body p { font-size: 0.875rem; color: var(--muted); line-height: 1.5; }

/* ── Difficulty Badge ── */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 50px;
  font-size: 0.775rem; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase;
}
.badge--easy { background: #E8F3EC; color: var(--easy); border: 1px solid #C2DECA; }
.badge--intermediate { background: #FEF0E0; color: var(--intermediate); border: 1px solid #F0CFA0; }
.badge--advanced { background: #FAEBEB; color: var(--danger); border: 1px solid #E8C0C0; }

/* ── Knot Page Layout ── */
.knot-page-header {
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.knot-meta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 14px 0 18px; }
.knot-use-case { font-size: 1.05rem; color: var(--muted); font-style: italic; }

.activity-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.activity-tag {
  background: var(--cream); border: 1px solid var(--border);
  border-radius: 50px; padding: 4px 14px;
  font-size: 0.82rem; color: var(--muted); font-weight: 600;
}

/* ── Diagram Player ── */
.diagram-section { margin-bottom: 48px; }
.diagram-section h2 { margin-bottom: 20px; }

.diagram-player {
  background: var(--white); border: 2px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow);
}
.diagram-stage {
  display: flex; align-items: stretch;
  min-height: 320px;
}
.diagram-svg-area {
  flex: 0 0 55%; background: var(--cream);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; border-right: 1px solid var(--border);
  position: relative; min-height: 280px;
}
.diagram-svg-area svg {
  max-width: 100%; max-height: 260px; width: 100%;
}
.diagram-step-info {
  flex: 1; padding: 28px 28px 28px;
  display: flex; flex-direction: column; justify-content: center;
}
.step-counter {
  font-size: 0.8rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.step-title {
  font-family: var(--font-display); font-size: 1.25rem;
  font-weight: 700; margin-bottom: 12px; color: var(--ink);
}
.step-text { font-size: 0.95rem; line-height: 1.65; color: var(--ink); flex: 1; }

.diagram-controls {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: var(--cream);
  border-top: 1px solid var(--border);
}
.diagram-controls .step-dots {
  display: flex; gap: 6px; align-items: center;
}
.step-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border); transition: background 0.2s, transform 0.2s;
  cursor: pointer;
}
.step-dot.active { background: var(--rope); transform: scale(1.35); }
.btn-step {
  background: var(--ink); color: var(--white);
  border: none; border-radius: var(--radius);
  padding: 9px 20px; cursor: pointer;
  font-family: var(--font-body); font-weight: 600; font-size: 0.9rem;
  transition: background 0.15s;
  display: flex; align-items: center; gap: 6px;
}
.btn-step:hover { background: var(--rope); }
.btn-step:disabled { background: var(--border); color: var(--muted); cursor: default; }

/* Mobile diagram stacks */
@media (max-width: 600px) {
  .diagram-stage { flex-direction: column; }
  .diagram-svg-area { flex: none; border-right: none; border-bottom: 1px solid var(--border); }
  .diagram-step-info { padding: 20px; }
}

/* ── Written Instructions ── */
.instructions-section { margin-bottom: 48px; }
.instructions-section h2 { margin-bottom: 20px; }
.step-list { list-style: none; counter-reset: steps; }
.step-list li {
  counter-increment: steps;
  padding: 16px 0 16px 56px;
  position: relative;
  border-bottom: 1px solid var(--border);
  font-size: 0.975rem;
}
.step-list li:last-child { border-bottom: none; }
.step-list li::before {
  content: counter(steps);
  position: absolute; left: 0; top: 14px;
  width: 34px; height: 34px;
  background: var(--ink); color: var(--cream);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem;
}
.step-list li strong { display: block; font-weight: 600; margin-bottom: 4px; }

/* ── Tips Section ── */
.tips-section {
  background: var(--cream); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px 32px;
  margin-bottom: 48px;
}
.tips-section h2 { margin-bottom: 16px; }
.tips-list { list-style: none; }
.tips-list li {
  padding: 10px 0 10px 28px; position: relative;
  border-bottom: 1px solid var(--border); font-size: 0.95rem;
}
.tips-list li:last-child { border-bottom: none; }
.tips-list li::before {
  content: "✓"; position: absolute; left: 0;
  color: var(--rope); font-weight: 700;
}

/* ── Related Knots ── */
.related-section { margin-bottom: 56px; }
.related-section h2 { margin-bottom: 20px; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.related-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
  text-decoration: none; color: var(--ink);
  transition: transform 0.15s, border-color 0.15s;
  display: block;
}
.related-card:hover { transform: translateY(-2px); border-color: var(--rope); text-decoration: none; color: var(--ink); }
.related-card h3 { font-size: 1rem; margin-bottom: 4px; }
.related-card p { font-size: 0.85rem; color: var(--muted); }

/* ── Ad Units ── */
.ad-unit {
  background: var(--cream); border: 1px dashed var(--border);
  border-radius: var(--radius); padding: 18px;
  text-align: center; margin: 32px 0;
}
.ad-unit-horizontal { min-height: 90px; }
.ad-placeholder { font-size: 0.8rem; color: var(--muted); font-style: italic; }

/* ── Footer ── */
.site-footer {
  background: var(--ink); color: #BBA98A;
  padding: 48px 20px 32px; margin-top: 64px;
  border-top: 3px solid var(--rope);
}
.site-footer .footer-inner {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 32px; margin-bottom: 32px;
}
.site-footer h4 { color: var(--cream); font-family: var(--font-display); margin-bottom: 14px; }
.site-footer ul { list-style: none; }
.site-footer ul li { margin-bottom: 8px; }
.site-footer ul a { color: #BBA98A; font-size: 0.9rem; }
.site-footer ul a:hover { color: var(--rope-light); }
.footer-bottom {
  max-width: 1100px; margin: 0 auto;
  padding-top: 24px; border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
  font-size: 0.85rem;
}
.footer-logo { font-family: var(--font-display); font-weight: 900; color: var(--cream); font-size: 1.1rem; }
.footer-logo span { color: var(--rope); }

/* ── Utility ── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.mt-0 { margin-top: 0; }
.section-divider { border: none; border-top: 1px solid var(--border); margin: 48px 0; }

/* ── Animations ── */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.diagram-svg-area svg { animation: fadeSlideIn 0.25s ease; }
