/* ==========================================================================
   /tools/sleep-norms
   Inherits hero/FAQ/tip base from maternity-bag.css
   ========================================================================== */
@import url("/assets/css/maternity-bag.css");

:root {
  --sn-night: #4a3c7c;
  --sn-night-soft: #6b5cb0;
  --sn-day: #ffd47a;
  --sn-day-soft: #fff0c4;
  --sn-twilight: #b39ddb;
}

/* ---------- Page & Hero ---------- */
.sn-page {
  background: #f7f6fb !important;
}

.sn-hero {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, rgba(214, 207, 240, 0.55) 100%),
    url("/assets/images/sleep-hero-bg.webp") center / cover no-repeat,
    linear-gradient(180deg, #ffffff 0%, #d6cff0 100%) !important;
  border-bottom-color: #c3b8e4 !important;
}

.sn-hero .mb-hero-title span::after {
  background: linear-gradient(90deg, rgba(107, 92, 176, 0.45), rgba(189, 160, 0, 0.4));
}

.sn-form-section {
  margin-bottom: 0 !important;
}

/* ==========================================================================
   FORM
   ========================================================================== */
.sn-form-card {
  background: #fff;
  border: 1px solid #e2deee;
  border-radius: 20px;
  padding: 32px 36px;
  margin: 0 0 12px;
  box-shadow: 0 4px 20px rgba(17, 17, 17, 0.04);
}

.sn-form-title {
  font-family: "Montserrat", sans-serif;
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 24px !important;
  color: var(--main-bg-color);
}

.sn-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.sn-field {
  min-width: 0;
}

.sn-field label {
  display: block;
  font-family: "Montserrat", sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--main-bg-color);
  margin-bottom: 8px;
}

.sn-field input[type="number"],
.sn-field input[type="time"] {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e2deee;
  border-radius: 12px;
  font-family: "Nunito", sans-serif;
  font-size: 16px;
  color: var(--main-bg-color);
  background: #fafbfc;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
  -webkit-appearance: none;
}

.sn-field input:focus {
  outline: none;
  border-color: var(--sn-night-soft);
  box-shadow: 0 0 0 3px rgba(107, 92, 176, 0.18);
}

.sn-age-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 8px;
  align-items: center;
}

.sn-age-row input[type="number"] {
  text-align: center;
  padding: 14px 8px;
}

.sn-age-unit {
  font-size: 14px;
  color: #777;
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
}

.sn-field-hint {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  color: #777;
  line-height: 1.4;
}

.sn-calc-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  background: var(--sn-night);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.sn-calc-btn:hover {
  background: #3a2e62;
}

.sn-calc-btn:active {
  transform: scale(0.99);
}

/* ==========================================================================
   RESULTS
   ========================================================================== */
.sn-results {
  margin: 28px 0 36px;
}

.sn-results-title {
  font-family: "Montserrat", sans-serif;
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 20px !important;
  color: var(--main-bg-color);
}

.sn-results-title span {
  font-weight: 500;
  color: #777;
  font-size: 0.78em;
}

/* ---------- Summary cards ---------- */
.sn-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.sn-summary-card {
  background: #fff;
  border: 1px solid #e2deee;
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: 0 4px 16px rgba(17, 17, 17, 0.04);
}

.sn-summary-card:nth-child(1) {
  background: linear-gradient(135deg, #fff 0%, #ece5fb 100%);
  border-color: #d5cae8;
}

.sn-summary-card:nth-child(2) {
  background: linear-gradient(135deg, #fff 0%, #e8e0f6 100%);
  border-color: #cdc0e5;
}

.sn-summary-card:nth-child(3) {
  background: linear-gradient(135deg, #fff 0%, #fff0c4 100%);
  border-color: #ecd690;
}

.sn-summary-label {
  font-family: "Montserrat", sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.sn-summary-value {
  font-family: "Montserrat", sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--main-bg-color);
  line-height: 1.1;
  margin-bottom: 6px;
}

.sn-summary-hint {
  font-size: 13px;
  color: #555;
}

/* ---------- Timeline ---------- */
.sn-timeline {
  position: relative;
  background: #fff;
  border: 1px solid #e2deee;
  border-radius: 18px;
  padding: 28px 24px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(17, 17, 17, 0.04);
}

.sn-timeline::before {
  content: "";
  position: absolute;
  /* Центр иконки: padding-left (24) + .sn-tl-icon left (36) + width/2 (20) = 80 */
  left: 80px;
  top: 28px;
  bottom: 28px;
  width: 2px;
  background: linear-gradient(180deg, #ffd47a 0%, #b39ddb 50%, #4a3c7c 100%);
  border-radius: 2px;
}

.sn-tl-item {
  position: relative;
  padding-left: 92px;
  padding-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.sn-tl-item:last-child {
  padding-bottom: 0;
}

.sn-tl-icon {
  position: absolute;
  left: 36px;
  top: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--sn-twilight);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
}

.sn-tl-item--wake .sn-tl-icon {
  background: var(--sn-day);
  border-color: #e0b95a;
  color: #7a5a00;
}

.sn-tl-item--nap .sn-tl-icon {
  background: #ece5fb;
  border-color: var(--sn-twilight);
  color: var(--sn-night);
}

.sn-tl-item--bedtime .sn-tl-icon {
  background: var(--sn-night);
  border-color: var(--sn-night);
  color: #fff;
}

.sn-tl-item--awake .sn-tl-icon {
  background: #fff;
  border-color: #d8d3e8;
  color: #888;
  width: 12px;
  height: 12px;
  left: 50px;
  top: 4px;
  border-width: 2px;
}

.sn-tl-content {
  flex: 1;
  min-width: 0;
}

.sn-tl-time {
  font-family: "Montserrat", sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--main-bg-color);
  line-height: 1.2;
  display: inline-block;
  margin-right: 12px;
}

.sn-tl-end {
  font-family: "Montserrat", sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #888;
}

.sn-tl-end::before {
  content: " – ";
  color: #ccc;
}

.sn-tl-label {
  display: block;
  font-family: "Nunito", sans-serif;
  font-size: 14px;
  color: #444;
  margin-top: 2px;
}

.sn-tl-duration {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: #f0eaff;
  color: var(--sn-night);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-family: "Montserrat", sans-serif;
}

.sn-tl-item--bedtime .sn-tl-duration {
  background: #fff0c4;
  color: #7a5a00;
}

.sn-tl-item--awake .sn-tl-label {
  color: #888;
  font-style: italic;
  font-size: 13px;
}

.sn-tl-item--awake .sn-tl-time {
  font-size: 0;
  display: none;
}

/* ---------- Tip card ---------- */
.sn-tip-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 22px;
  background: linear-gradient(135deg, #fff0c4 0%, #ffe5e4 100%);
  border: 1px solid #ecd690;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.6;
  color: #4a3c00;
  margin-bottom: 24px;
}

.sn-tip-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}

/* ==========================================================================
   REFERENCE TABLE
   ========================================================================== */
.sn-ref-section {
  margin: 36px 0;
}

.sn-ref-title {
  font-family: "Montserrat", sans-serif;
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 16px !important;
  color: var(--main-bg-color);
}

.sn-ref-wrap {
  background: #fff;
  border: 1px solid #e2deee;
  border-radius: 16px;
  overflow-x: auto;
  box-shadow: 0 4px 16px rgba(17, 17, 17, 0.04);
}

.sn-ref-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Nunito", sans-serif;
  min-width: 560px;
}

.sn-ref-table th,
.sn-ref-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid #f0ecfa;
  font-size: 14px;
}

.sn-ref-table th {
  font-family: "Montserrat", sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #777;
  background: #f7f4ff;
}

.sn-ref-table tbody tr:last-child td {
  border-bottom: none;
}

.sn-ref-table tbody tr:hover {
  background: #faf8ff;
}

.sn-ref-table tbody tr.is-active {
  background: linear-gradient(90deg, #fff0c4 0%, #ece5fb 100%);
}

.sn-ref-table tbody tr.is-active td:first-child {
  position: relative;
}

.sn-ref-table tbody tr.is-active td:first-child::before {
  content: "▸";
  position: absolute;
  left: 4px;
  color: var(--sn-night);
  font-weight: 800;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
  .sn-form-card {
    padding: 22px 18px;
  }
  .sn-form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .sn-summary {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .sn-summary-value {
    font-size: 24px;
  }
  .sn-timeline {
    padding: 22px 16px;
  }
  .sn-timeline::before {
    /* mobile: padding-left (16) + .sn-tl-icon left (18) + width/2 (20) = 54 */
    left: 54px;
  }
  .sn-tl-item {
    padding-left: 72px;
  }
  .sn-tl-icon {
    left: 18px;
  }
  .sn-tl-item--awake .sn-tl-icon {
    left: 32px;
  }
}

@media (max-width: 576px) {
  .sn-form-card {
    padding: 18px 14px;
  }
  .sn-form-title {
    font-size: 19px;
  }
  .sn-summary-card {
    padding: 16px 18px;
  }
  .sn-summary-value {
    font-size: 22px;
  }
  .sn-age-row {
    grid-template-columns: 1fr auto 1fr auto;
    gap: 6px;
  }
  .sn-age-unit {
    font-size: 13px;
  }
  .sn-tl-time {
    font-size: 16px;
  }
  .sn-tl-end {
    font-size: 14px;
  }
}

/* ==========================================================================
   SOURCES — academic references block (shared pattern)
   ========================================================================== */
.sr-sources-block {
  margin: 32px 0 8px;
  padding: 26px 30px 22px !important;
  background: linear-gradient(180deg, #ffffff 0%, #faf8f1 100%);
  border: 1px solid #ece5cf;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(189, 160, 0, 0.05);
}

.sr-sources-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px dashed #e3dcc2;
}

.sr-sources-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--gold-color);
  color: #fff;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(189, 160, 0, 0.25);
}

.sr-sources-head h2 {
  font-family: "Montserrat", sans-serif;
  font-size: 20px !important;
  font-weight: 800 !important;
  margin: 0 !important;
  letter-spacing: -0.02em;
  color: var(--main-bg-color);
}

.sr-sources {
  counter-reset: sr-source;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 13.5px !important;
  line-height: 1.6 !important;
  color: var(--main-bg-color);
}

.sr-sources li {
  position: relative;
  counter-increment: sr-source;
  padding: 10px 12px 10px 42px !important;
  margin: 0 !important;
  border-radius: 10px;
  transition: background 0.2s ease;
}

.sr-sources li:hover {
  background: rgba(189, 160, 0, 0.04);
}

.sr-sources li::before {
  content: counter(sr-source);
  position: absolute;
  left: 8px;
  top: 9px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1.5px solid #e3dcc2;
  border-radius: 50%;
  font-family: "Montserrat", sans-serif;
  font-size: 11px;
  font-weight: 800;
  color: var(--gold-color);
}

.sr-sources-authors {
  font-weight: 700;
  color: var(--main-bg-color);
  margin-right: 4px;
}

.sr-sources cite {
  font-style: italic;
  color: var(--main-bg-color);
}

.sr-sources a {
  color: var(--main-bg-color);
  text-decoration: underline;
  text-decoration-color: rgba(189, 160, 0, 0.5);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
  transition: text-decoration-color 0.2s, color 0.2s;
}

.sr-sources a:hover {
  color: #8a7600;
  text-decoration-color: var(--gold-color);
}

.sr-sources a[target="_blank"]::after {
  content: "\2197";
  display: inline-block;
  margin-left: 3px;
  font-size: 0.85em;
  color: var(--gold-color);
  text-decoration: none;
  vertical-align: middle;
}

.sr-sources-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  background: rgba(189, 160, 0, 0.12);
  color: #8a7600;
  border-radius: 999px;
  font-family: "Montserrat", sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
  white-space: nowrap;
}

.sr-sources-note {
  margin: 16px 0 0 !important;
  padding: 10px 14px !important;
  background: rgba(255, 255, 255, 0.6);
  border-left: 3px solid var(--gold-color);
  border-radius: 8px;
  font-size: 12.5px !important;
  line-height: 1.5 !important;
  color: #444;
  font-style: italic;
}

@media (max-width: 700px) {
  .sr-sources-block {
    padding: 22px 18px 18px !important;
  }
  .sr-sources-head {
    gap: 10px;
  }
  .sr-sources-head h2 {
    font-size: 18px !important;
  }
  .sr-sources li {
    padding: 10px 8px 10px 38px !important;
    font-size: 13px !important;
  }
  .sr-sources li::before {
    left: 4px;
    top: 10px;
    width: 22px;
    height: 22px;
  }
}

/* ==========================================================================
   WIDGET (embedded in articles)
   ========================================================================== */
.tool-widget-sn {
  background: linear-gradient(135deg, #ece5fb 0%, #fff0c4 100%);
  border: 1px solid #cdc0e5;
}

.tool-widget-sn .tool-widget-tag {
  background: var(--sn-night);
  color: #fff;
}

.tool-widget-sn .tool-widget-bag em {
  color: #4a3c7c;
}
