/* Knitting tools (pryalka_tools): the pages of the tools, the thickness badge of a yarn, the note in the needle
   categories. The colours are the ones of the pryalka theme, with fallbacks for another theme. */

.ptl {
  --ptl-brand: var(--ph-brand, #f15c28);
  --ptl-brand-rgb: var(--ph-brand-rgb, 241, 92, 40);
  --ptl-tint: var(--ph-tint, #fdece4);
  --ptl-text: var(--ph-text, #2b2b2b);
  --ptl-muted: var(--ph-muted, #6c6c6c);
  --ptl-line: var(--ph-line, #ececec);
  --ptl-soft: var(--ph-soft, #f5f5f5);
  --ptl-radius: var(--ph-radius, 10px);
  padding-bottom: 32px;
}

.ptl h1 {
  margin-bottom: 12px;
}

.ptl-intro {
  max-width: 760px;
  color: var(--ptl-muted);
  font-size: 1.05rem;
  margin-bottom: 24px;
}

.ptl-section {
  margin-top: 40px;
  max-width: 860px;
}

/* The text of the theme is 13px: the reading parts a bit larger */
.ptl-text,
.ptl-faq-item {
  font-size: 15px;
  line-height: 1.6;
}

.ptl-text li {
  margin-bottom: 4px;
}

.ptl-section h2,
.ptl-table-box h2,
.ptl-class h2 {
  font-size: 1.35rem;
  margin-bottom: 14px;
}

/* Cards of the tools */
.ptl-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.ptl-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--ptl-line);
  border-radius: var(--ptl-radius);
  background: #fff;
  color: var(--ptl-text);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.ptl-card:hover,
.ptl-card:focus-visible {
  border-color: var(--ptl-brand);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  color: var(--ptl-text);
  transform: translateY(-1px);
}

.ptl-card-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--ptl-tint);
  color: var(--ptl-brand);
  font-size: 20px;
}

.ptl-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ptl-card-title {
  font-weight: 600;
  font-size: 1.05rem;
}

.ptl-card-text {
  color: var(--ptl-muted);
  font-size: 0.92rem;
}

.ptl-card-arrow {
  margin-left: auto;
  align-self: center;
  color: var(--ptl-brand);
}

.ptl-cards-small .ptl-card {
  padding: 14px;
}

.ptl-cards-small .ptl-card-icon {
  width: 40px;
  height: 40px;
  font-size: 17px;
}

/* A calculator */
.ptl-tool {
  max-width: 860px;
  padding: 20px;
  border: 1px solid var(--ptl-line);
  border-radius: var(--ptl-radius);
  background: #fff;
}

.ptl-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  padding: 4px;
  border-radius: 999px;
  background: var(--ptl-soft);
  width: fit-content;
  max-width: 100%;
}

.ptl-tab {
  border: 0;
  border-radius: 999px;
  padding: 8px 18px;
  background: transparent;
  color: var(--ptl-text);
  font-weight: 500;
}

.ptl-tab.active {
  background: #fff;
  color: var(--ptl-brand);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.ptl-tab:focus-visible {
  outline: 2px solid var(--ptl-brand);
  outline-offset: 1px;
}

.ptl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 20px;
}

.ptl-group {
  min-width: 0;
}

.ptl-group legend {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.ptl-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.ptl-pair label,
.ptl-edge {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
  color: var(--ptl-muted);
}

.ptl-pair .form-control,
.ptl-edge .form-control {
  font-size: 1.1rem;
  color: var(--ptl-text);
}

.ptl-edge {
  max-width: 240px;
  margin-top: 12px;
}

.ptl-help {
  font-size: 0.85rem;
  color: var(--ptl-muted);
  margin: 0;
}

.ptl-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ptl-switch label {
  cursor: pointer;
}

.ptl-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.ptl-switch span {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--ptl-line);
  border-radius: 999px;
  background: #fff;
}

.ptl-switch input:checked + span {
  border-color: var(--ptl-brand);
  background: var(--ptl-tint);
  color: var(--ptl-brand);
  font-weight: 500;
}

.ptl-switch input:focus-visible + span {
  outline: 2px solid var(--ptl-brand);
  outline-offset: 1px;
}

.ptl-result {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: var(--ptl-radius);
  background: var(--ptl-soft);
}

.ptl-result.ready {
  background: var(--ptl-tint);
}

.ptl-line {
  margin: 0 0 6px;
}

.ptl-line:last-child {
  margin-bottom: 0;
}

.ptl-big {
  font-size: 1.15rem;
}

.ptl-big b {
  color: var(--ptl-brand);
  font-size: 1.35rem;
}

.ptl-big small {
  color: var(--ptl-muted);
  font-size: 0.85rem;
}

.ptl-instruction {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.05rem;
  word-break: break-word;
}

.ptl-muted {
  color: var(--ptl-muted);
}

.ptl-warn {
  color: #9a4a00;
  font-size: 0.92rem;
}

.ptl-copy {
  margin-top: 10px;
}

/* The yardage calculator: selects, the swatch block, the purchase */
.ptl-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: var(--ptl-muted);
}

.ptl-field .form-select,
.ptl-field .form-control {
  font-size: 1rem;
  color: var(--ptl-text);
}

.ptl-short {
  max-width: 160px;
}

.ptl-pair.ptl-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ptl-more {
  margin-top: 4px;
  padding: 10px 14px;
  border-radius: var(--ptl-radius);
  background: var(--ptl-soft);
}

.ptl-more summary {
  font-weight: 600;
  cursor: pointer;
  color: var(--ptl-brand);
}

.ptl-more[open] summary {
  margin-bottom: 12px;
}

.ptl-yarn-group {
  margin-top: 18px;
}

.ptl-buy {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--ptl-line);
}

.ptl-buy-title {
  font-size: 1.15rem;
  margin-bottom: 10px;
}

.ptl-buy-name {
  font-weight: 600;
  color: var(--ptl-text);
}

.ptl-colours {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
  margin: 6px 0 14px;
  padding: 2px;
}

.ptl-colour {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border: 1px solid var(--ptl-line);
  border-radius: 8px;
  background: #fff;
  color: var(--ptl-text);
  font-size: 0.78rem;
  line-height: 1.2;
  text-align: center;
}

.ptl-colour img,
.ptl-colour-img {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--ptl-soft);
}

.ptl-colour-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.ptl-colour:hover:not(:disabled) {
  border-color: var(--ptl-brand);
}

.ptl-colour.active {
  border-color: var(--ptl-brand);
  box-shadow: inset 0 0 0 1px var(--ptl-brand);
  background: var(--ptl-tint);
}

.ptl-colour:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ptl-colour:focus-visible {
  outline: 2px solid var(--ptl-brand);
  outline-offset: 1px;
}

.ptl-colour-stock {
  color: var(--ptl-muted);
  font-size: 0.72rem;
}

.ptl-buy-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.ptl-success {
  margin-top: 10px;
  color: #23734a;
}

.ptl-small {
  font-size: 0.85rem;
}

/* Yarn substitutes: the page, the cards with why they fit, the block of the yarn page */
.ptl-tool-wide {
  max-width: none;
}

.ptl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.ptl-chips label {
  cursor: pointer;
}

.ptl-chips input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.ptl-chips span {
  display: inline-block;
  padding: 5px 12px;
  border: 1px solid var(--ptl-line);
  border-radius: 999px;
  background: #fff;
  font-size: 0.9rem;
}

.ptl-chips input:checked + span {
  border-color: var(--ptl-brand);
  background: var(--ptl-tint);
  color: var(--ptl-brand);
  font-weight: 500;
}

.ptl-chips input:focus-visible + span {
  outline: 2px solid var(--ptl-brand);
  outline-offset: 1px;
}

.ptl-subs-result {
  margin-top: 20px;
  transition: opacity 0.15s;
}

.ptl-subs-result.ptl-loading {
  opacity: 0.5;
}

.ptl-subs-empty {
  padding: 16px 18px;
  border-radius: var(--ptl-radius);
  background: var(--ptl-soft);
}

.ptl-sub {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ptl-sub-why {
  list-style: none;
  margin: 6px 2px 0;
  padding: 0;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--ph-muted, #6c6c6c);
}

.ptl-sub-why li + li {
  margin-top: 2px;
}

.ptl-sub-analogue {
  color: var(--ph-brand, #f15c28);
  font-weight: 600;
}

.ptl-sub-block {
  margin-top: 28px;
  padding-bottom: 0;
}

.ptl-sub-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 16px;
  margin-bottom: 14px;
}

.ptl-sub-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

.ptl-sub-more {
  color: var(--ph-brand, #f15c28);
  font-weight: 500;
  white-space: nowrap;
}

/* The way from the page of a yarn to the calculator */
.ptl-calc-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  width: fit-content;
  margin: -6px 0 12px;
  font-size: 0.9rem;
  color: var(--ph-brand, #f15c28);
}

/* Tables */
.ptl-table {
  margin: 0;
}

.ptl-table th,
.ptl-table td {
  vertical-align: middle;
}

.ptl-table thead th {
  font-size: 0.85rem;
  color: var(--ptl-muted);
  font-weight: 500;
  white-space: nowrap;
}

.ptl-nowrap {
  white-space: nowrap;
}

.ptl-tables {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 28px;
  margin-top: 20px;
}

.ptl-table-box tbody tr.ptl-hit td {
  background: var(--ptl-tint);
}

.ptl-find {
  max-width: 360px;
}

.ptl-find-empty {
  margin-top: 8px;
  color: var(--ptl-muted);
}

.ptl-links {
  margin-top: 10px;
  font-size: 0.92rem;
}

.ptl-scroll {
  margin-bottom: 8px;
}

.ptl-classes th[scope="row"] {
  font-weight: 400;
  min-width: 190px;
}

.ptl-class-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ptl-text);
  text-decoration: none;
}

.ptl-class-link small {
  display: block;
  color: var(--ptl-muted);
}

/* The thickness scale: eight bars, the class filled */
.ptl-scale {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
  flex: none;
  vertical-align: middle;
}

.ptl-scale span {
  width: 4px;
  border-radius: 1px;
  background: #ddd;
}

.ptl-scale span:nth-child(1) { height: 4px; }
.ptl-scale span:nth-child(2) { height: 5.5px; }
.ptl-scale span:nth-child(3) { height: 7px; }
.ptl-scale span:nth-child(4) { height: 8.5px; }
.ptl-scale span:nth-child(5) { height: 10px; }
.ptl-scale span:nth-child(6) { height: 12px; }
.ptl-scale span:nth-child(7) { height: 14px; }
.ptl-scale span:nth-child(8) { height: 16px; }

.ptl-scale span.on {
  background: var(--ph-brand, #f15c28);
}

/* The yarn of a class */
.ptl-class {
  margin-top: 36px;
  scroll-margin-top: 90px;
}

.ptl-class h2 small {
  color: var(--ptl-muted);
  font-size: 0.9rem;
  font-weight: 400;
}

.ptl-class:target h2 {
  color: var(--ptl-brand);
}

.ptl-class-use {
  color: var(--ptl-muted);
}

.ptl-yarns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.ptl-yarn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--ptl-line);
  border-radius: 8px;
  color: var(--ptl-text);
  text-decoration: none;
  background: #fff;
}

.ptl-yarn:hover {
  border-color: var(--ptl-brand);
  color: var(--ptl-text);
}

.ptl-yarn img,
.ptl-yarn-img {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--ptl-soft);
}

.ptl-yarn-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ptl-yarn-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ptl-yarn-ball {
  font-size: 0.82rem;
  color: var(--ptl-muted);
}

/* Questions */
.ptl-faq-item {
  border-bottom: 1px solid var(--ptl-line);
}

.ptl-faq-item summary {
  padding: 12px 28px 12px 0;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  position: relative;
}

.ptl-faq-item summary::-webkit-details-marker {
  display: none;
}

.ptl-faq-item summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 8px;
  font-size: 1.4rem;
  color: var(--ptl-brand);
  line-height: 1.2;
}

.ptl-faq-item[open] summary::after {
  content: "−";
}

.ptl-faq-item p {
  color: var(--ptl-muted);
  margin-bottom: 14px;
}

/* The badge on the page of a yarn */
.ptl-badge {
  display: inline-flex;
  align-self: flex-start;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  margin: -4px 0 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--ph-tint, #fdece4);
  color: var(--ph-text, #2b2b2b);
  font-size: 0.9rem;
  text-decoration: none;
}

.ptl-badge:hover,
.ptl-badge:focus-within {
  box-shadow: inset 0 0 0 1px var(--ph-brand, #f15c28);
}

/* The class leads to the category by thickness, the "i" to the chart */
a.ptl-badge-text {
  color: inherit;
  text-decoration: none;
}

a.ptl-badge-text:hover strong {
  color: var(--ph-accent, #d94a12);
  text-decoration: underline;
}

.ptl-badge-info {
  display: inline-flex;
  padding: 2px;
  margin: -2px;
}

.ptl-class-category {
  white-space: nowrap;
}

.ptl-badge .fa-circle-info {
  color: var(--ph-brand, #f15c28);
}

.ptl-badge-en {
  color: var(--ph-muted, #6c6c6c);
}

/* The note in the needle and hook categories */
.ptl-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 8px 14px;
  border-radius: var(--ph-radius, 10px);
  background: var(--ph-soft, #f5f5f5);
  color: var(--ph-text, #2b2b2b);
  font-size: 0.92rem;
  text-decoration: none;
}

.ptl-note:hover {
  color: var(--ph-brand, #f15c28);
}

.ptl-note i {
  color: var(--ph-brand, #f15c28);
}

@media (max-width: 575.98px) {
  .ptl-tool {
    padding: 14px;
    margin-left: -4px;
    margin-right: -4px;
  }

  .ptl-tabs {
    width: 100%;
  }

  .ptl-tab {
    flex: 1;
    padding: 8px 10px;
  }

  .ptl-badge-en {
    display: none;
  }
}

/* An example in a field must not look like a value */
.ptl .form-control::placeholder {
  color: #bdbdbd;
  opacity: 1;
}

.ptl-badge-text {
  min-width: 0;
}
