/* Worksheet / design detail actions (Views/Designs/ProjectTemplate.cshtml, Detail.cshtml).
   One big free download, then edit + print, the worksheet set, and small save/like links. */

.kl-wsd-actions {
  display: grid;
  gap: 10px;
  margin: 18px 0 20px;
}

.kl-wsd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 46px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--kl-border);
  background: var(--kl-surface-2);
  color: var(--kl-text) !important;
  font-weight: 700;
  font-size: .92rem;
  text-decoration: none !important;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.kl-wsd-btn:hover { transform: translateY(-1px); border-color: #4a4a58; }
.kl-wsd-btn i { font-size: 1.1rem; }

.kl-wsd-btn--download {
  justify-content: flex-start;
  min-height: 64px;
  padding: 12px 20px;
  border: 0;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff !important;
  font-size: 1.12rem;
  box-shadow: 0 10px 26px rgba(34, 197, 94, .28);
}

.kl-wsd-btn--download:hover { box-shadow: 0 14px 30px rgba(34, 197, 94, .38); border: 0; }
.kl-wsd-btn--download i { font-size: 1.5rem; }
.kl-wsd-btn--download > span { display: grid; gap: 1px; text-align: left; line-height: 1.2; }
.kl-wsd-btn--download small { font-size: .76rem; font-weight: 600; opacity: .88; }
.kl-wsd-btn--download.is-preparing { opacity: .85; cursor: progress; }

.kl-wsd-actions-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 10px;
}

.kl-wsd-actions-row form { margin: 0; }

.kl-wsd-btn--edit {
  border-color: rgba(228, 69, 255, .55);
  background: rgba(228, 69, 255, .12);
}

.kl-wsd-btn--edit:hover { background: rgba(228, 69, 255, .2); border-color: var(--kl-primary); }
.kl-wsd-btn--ghost { background: transparent; }

/* Worksheet set */
.kl-wsd-set {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px dashed #4b4b5a;
  background: rgba(250, 204, 21, .06);
  color: var(--kl-text) !important;
  text-decoration: none !important;
  transition: border-color .15s ease, background .15s ease;
}

.kl-wsd-set:hover { border-color: #facc15; background: rgba(250, 204, 21, .1); }
.kl-wsd-set.is-preparing { cursor: progress; }

.kl-wsd-set-stack {
  position: relative;
  flex: 0 0 58px;
  height: 56px;
}

.kl-wsd-set-stack img {
  position: absolute;
  top: 2px;
  left: 10px;
  width: 38px;
  height: 50px;
  object-fit: cover;
  object-position: top;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .35);
}

.kl-wsd-set-stack img:nth-child(1) { transform: rotate(-9deg) translateX(-8px); }
.kl-wsd-set-stack img:nth-child(2) { transform: rotate(7deg) translateX(8px); }
.kl-wsd-set-stack img:nth-child(3) { transform: none; z-index: 2; }

.kl-wsd-set-copy { display: grid; gap: 2px; min-width: 0; }
.kl-wsd-set-copy strong { font-size: .95rem; }
.kl-wsd-set-copy strong i { color: #facc15; margin-right: 2px; }
.kl-wsd-set-copy small { color: var(--kl-text-muted); font-size: .78rem; }

/* Save / like as quiet links */
.kl-wsd-social {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding-top: 2px;
}

.kl-wsd-social form { margin: 0; }

.kl-wsd-social button,
.kl-wsd-social a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--kl-text-muted) !important;
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none !important;
  cursor: pointer;
}

.kl-wsd-social button:hover,
.kl-wsd-social a:hover { color: var(--kl-text) !important; }
.kl-wsd-social .is-active { color: #f472b6 !important; }

@media (max-width: 520px) {
  .kl-wsd-actions-row { grid-template-columns: 1fr 1fr; }
  .kl-wsd-btn--download { font-size: 1.02rem; }
}

/* ===== Lower half of the worksheet page (ProjectTemplate.cshtml) ===== */

.kl-wsd-section {
  padding: 40px 0;
  border-top: 1px solid var(--kl-border);
}

.kl-wsd-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.kl-wsd-head > div { min-width: 0; max-width: 760px; }

.kl-wsd-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #c4b5fd;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.kl-wsd-head h2 {
  margin: 6px 0 4px;
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 800;
  line-height: 1.2;
  color: var(--kl-text);
}

.kl-wsd-head p { margin: 0; color: var(--kl-text-muted); font-size: .95rem; line-height: 1.5; }

.kl-wsd-count {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 10px;
  border-radius: 999px;
  background: var(--kl-surface-2);
  color: var(--kl-text-muted);
  font-size: .8rem;
  vertical-align: middle;
}

.kl-wsd-head-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--kl-text-muted) !important;
  font-size: .88rem;
  font-weight: 700;
  text-decoration: none !important;
}

.kl-wsd-head-link:hover { color: var(--kl-text) !important; }

.kl-wsd-head-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(250, 204, 21, .55);
  background: rgba(250, 204, 21, .1);
  color: var(--kl-text) !important;
  font-weight: 800;
  font-size: .9rem;
  text-decoration: none !important;
  white-space: nowrap;
}

.kl-wsd-head-action:hover { background: rgba(250, 204, 21, .18); }
.kl-wsd-head-action i { color: #facc15; }

/* Activity set: versions */
.kl-wsd-variants {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(146px, 1fr));
  gap: 14px;
}

.kl-wsd-variant { position: relative; min-width: 0; }

.kl-wsd-variant-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--kl-border);
  background: var(--kl-surface);
  color: var(--kl-text) !important;
  text-decoration: none !important;
  transition: transform .18s ease, border-color .18s ease;
}

.kl-wsd-variant-link:hover { transform: translateY(-3px); border-color: #4a4a5c; }

.kl-wsd-variant.is-current .kl-wsd-variant-link {
  border-color: var(--kl-primary);
  box-shadow: 0 0 0 2px rgba(228, 69, 255, .35);
}

.kl-wsd-variant-media {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  padding: 10px 12px;
  background: #f3efe6;
}

.kl-wsd-variant-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 4px 12px rgba(30, 20, 10, .18);
}

.kl-wsd-variant-current {
  position: absolute;
  left: 8px;
  top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--kl-primary);
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
}

.kl-wsd-variant-title {
  /* Margin, not padding: the two-line clamp would otherwise show part of a third line in the padding. */
  margin: 8px 10px 10px;
  font-size: .8rem;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kl-wsd-variant-pdf {
  position: absolute;
  right: 8px;
  top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #16a34a;
  color: #fff !important;
  font-size: .72rem;
  font-weight: 800;
  text-decoration: none !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .3);
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity .15s ease, transform .15s ease;
}

.kl-wsd-variant:hover .kl-wsd-variant-pdf,
.kl-wsd-variant-pdf:focus-visible,
.kl-wsd-variant-pdf.is-preparing,
.kl-wsd-variant-pdf.is-downloaded { opacity: 1; transform: none; }

@media (hover: none) {
  .kl-wsd-variant-pdf { opacity: 1; transform: none; }
}

/* Similar worksheets reuse the library cards (designs-browse.css); five in a row inside the 1200px column. */
.kl-wsd-related { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* Teaching notes */
.kl-wsd-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.kl-wsd-skills li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(34, 197, 94, .1);
  border: 1px solid rgba(34, 197, 94, .3);
  color: #bbf7d0;
  font-size: .84rem;
  font-weight: 700;
}

.kl-wsd-skills i { color: #22c55e; }

.kl-wsd-teach-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.kl-wsd-teach-card {
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--kl-border);
  background: var(--kl-surface);
}

.kl-wsd-teach-card h3 { margin: 10px 0 6px; font-size: 1rem; font-weight: 800; }
.kl-wsd-teach-card p { margin: 0 0 6px; color: var(--kl-text-muted); font-size: .9rem; line-height: 1.55; }
.kl-wsd-teach-card p strong { color: var(--kl-text); }
.kl-wsd-teach-card ul { margin: 0; padding-left: 18px; color: var(--kl-text-muted); font-size: .9rem; line-height: 1.6; }

.kl-wsd-teach-icon {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 1.05rem;
}

.kl-wsd-teach-icon--steps { background: rgba(56, 189, 248, .14); color: #7dd3fc; }
.kl-wsd-teach-icon--adjust { background: rgba(250, 204, 21, .14); color: #fde047; }
.kl-wsd-teach-icon--prep { background: rgba(228, 69, 255, .14); color: #f0abfc; }

.kl-wsd-more { margin-top: 12px; }

.kl-wsd-more summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  color: #c4b5fd;
  font-size: .9rem;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.kl-wsd-more summary::-webkit-details-marker { display: none; }
.kl-wsd-more summary i { transition: transform .15s ease; }
.kl-wsd-more[open] summary i { transform: rotate(180deg); }
.kl-wsd-more .kl-wsd-more-open { display: none; }
.kl-wsd-more[open] .kl-wsd-more-open { display: inline; }
.kl-wsd-more[open] .kl-wsd-more-closed { display: none; }

.kl-wsd-more-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 28px;
  padding: 14px 0 0;
}

.kl-wsd-more-body h3 { margin: 0 0 6px; font-size: .95rem; font-weight: 800; }
.kl-wsd-more-body p { margin: 0; color: var(--kl-text-muted); font-size: .9rem; line-height: 1.6; }
.kl-wsd-article { grid-column: 1 / -1; }

/* Guides: compact rows */
.kl-wsd-guides {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.kl-wsd-guide {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--kl-border);
  background: var(--kl-surface);
  color: var(--kl-text) !important;
  text-decoration: none !important;
  transition: border-color .15s ease, transform .15s ease;
}

.kl-wsd-guide:hover { border-color: #4a4a5c; transform: translateY(-2px); }

.kl-wsd-guide-icon {
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(196, 181, 253, .14);
  color: #c4b5fd;
  font-size: 1.3rem;
}

.kl-wsd-guide-icon img { width: 100%; height: 100%; object-fit: cover; }
.kl-wsd-guide--mint .kl-wsd-guide-icon { background: rgba(52, 211, 153, .14); color: #6ee7b7; }
.kl-wsd-guide--amber .kl-wsd-guide-icon { background: rgba(251, 191, 36, .14); color: #fcd34d; }
.kl-wsd-guide--sky .kl-wsd-guide-icon { background: rgba(56, 189, 248, .14); color: #7dd3fc; }
.kl-wsd-guide--coral .kl-wsd-guide-icon { background: rgba(251, 113, 133, .14); color: #fda4af; }
.kl-wsd-guide--lilac .kl-wsd-guide-icon { background: rgba(196, 181, 253, .14); color: #c4b5fd; }
.kl-wsd-guide--rose .kl-wsd-guide-icon { background: rgba(244, 114, 182, .14); color: #f9a8d4; }

.kl-wsd-guide-copy { display: grid; gap: 3px; min-width: 0; }
.kl-wsd-guide-copy small { color: var(--kl-text-muted); font-size: .74rem; font-weight: 700; }
.kl-wsd-guide-copy strong { font-size: .92rem; line-height: 1.3; }
.kl-wsd-guide-arrow { margin-left: auto; color: var(--kl-text-muted); }

/* Comments */
.kl-wsd-comment-bar {
  border-radius: 14px;
  border: 1px dashed #3d3d4b;
  background: var(--kl-surface);
}

.kl-wsd-comment-bar summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
}

.kl-wsd-comment-bar summary::-webkit-details-marker { display: none; }
.kl-wsd-comment-bar summary > span:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.kl-wsd-comment-bar summary strong { font-size: .95rem; }
.kl-wsd-comment-bar summary small { color: var(--kl-text-muted); font-size: .84rem; }

.kl-wsd-comment-icon {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(244, 114, 182, .14);
  color: #f9a8d4;
  font-size: 1.1rem;
}

.kl-wsd-comment-cta {
  margin-left: auto;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--kl-border);
  background: var(--kl-surface-2);
  font-size: .86rem;
  font-weight: 800;
  white-space: nowrap;
}

.kl-wsd-comment-bar[open] .kl-wsd-comment-cta { display: none; }
.kl-wsd-comment-bar > form,
.kl-wsd-comment-bar > .kl-comment-signin { margin: 0 18px 18px; }

/* Sticky download bar (phones) */
.kl-wsd-sticky {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1030;
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(20, 20, 24, .96);
  border-top: 1px solid var(--kl-border);
  backdrop-filter: blur(8px);
  transform: translateY(110%);
  transition: transform .2s ease;
}

.kl-wsd-sticky.is-visible { transform: none; }

.kl-wsd-sticky-title {
  flex: 1;
  min-width: 0;
  color: var(--kl-text);
  font-size: .85rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kl-wsd-sticky .kl-wsd-sticky-btn {
  width: auto;
  min-height: 44px;
  padding: 8px 18px;
  font-size: .95rem;
  justify-content: center;
}

.kl-wsd-sticky .kl-wsd-sticky-btn i { font-size: 1.1rem; }

@media (max-width: 1100px) {
  .kl-wsd-related { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kl-wsd-guides { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .kl-wsd-teach-grid { grid-template-columns: 1fr; }
  .kl-wsd-more-body { grid-template-columns: 1fr; }
  .kl-wsd-related { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .kl-wsd-sticky { display: flex; }
  /* Room under the footer so the bar never hides the last links. */
  body:has(.kl-wsd-sticky) { padding-bottom: 72px; }
}

@media (max-width: 640px) {
  .kl-wsd-section { padding: 28px 0; }
  .kl-wsd-variants { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .kl-wsd-related { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kl-wsd-head-action { width: 100%; justify-content: center; }
  .kl-wsd-comment-bar summary { flex-wrap: wrap; }
  .kl-wsd-comment-cta { margin-left: 54px; }
}
