@font-face {
  font-family: "Alegreya";
  src: url("assets/fonts/Alegreya-VariableFont_wght.ttf") format("truetype");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("assets/fonts/Manrope-VariableFont_wght.ttf") format("truetype");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #19201c;
  --muted: #657069;
  --paper: #faf7ef;
  --surface: #fffdf7;
  --line: #ded6c4;
  --green: #214f46;
  --green-2: #7aa394;
  --rose: #c15b5f;
  --rose-2: #f1b6ae;
  --blue: #4e6f92;
  --yellow: #d59d39;
  --shadow: 0 22px 70px rgba(25, 32, 28, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(33, 79, 70, 0.08), transparent 42%),
    radial-gradient(circle at 88% 14%, rgba(193, 91, 95, 0.17), transparent 25%),
    var(--paper);
  color: var(--ink);
  font-family: "Manrope", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.hero {
  display: block;
  min-height: 44vh;
  padding: clamp(28px, 6vw, 72px);
  color: #fffdf7;
  background:
    linear-gradient(90deg, rgba(20, 42, 38, 0.92), rgba(20, 42, 38, 0.48)),
    url("assets/header.avif") center/cover;
}

.hero__content {
  max-width: 820px;
}

.eyebrow,
.section-title p {
  margin: 0 0 8px;
  color: currentColor;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  opacity: 0.76;
}

h1,
h2 {
  margin: 0;
  font-family: "Alegreya", serif;
  letter-spacing: 0;
}

h1 {
  max-width: 780px;
  font-size: clamp(2.7rem, 6vw, 6rem);
  line-height: 0.93;
}

h2 {
  font-size: clamp(1.55rem, 2vw, 2.15rem);
  line-height: 1.02;
}

.hero p {
  max-width: 640px;
  font-size: 1.1rem;
  line-height: 1.65;
}

.app-shell {
  width: min(1540px, calc(100% - 28px));
  margin: -28px auto 64px;
}

.controls,
.planner-panel,
.timeline-card,
.sources {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.92);
  box-shadow: var(--shadow);
}

.controls,
.planner-panel,
.timeline-card,
.sources {
  padding: clamp(18px, 3vw, 30px);
}

.section-title {
  margin-bottom: 20px;
}

.section-title p {
  color: var(--rose);
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: grid;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-height: 34px;
  border: 0;
  background: transparent;
  padding: 0;
  accent-color: var(--blue);
  cursor: grab;
}

input[type="range"]:active {
  cursor: grabbing;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(78, 111, 146, 0.34), rgba(33, 79, 70, 0.22));
}

input[type="range"]::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: -7px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 6px 18px rgba(25, 32, 28, 0.24);
  appearance: none;
}

input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(78, 111, 146, 0.34), rgba(33, 79, 70, 0.22));
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 6px 18px rgba(25, 32, 28, 0.24);
}

.field output {
  color: var(--ink);
  font-weight: 800;
}

.check-field {
  grid-template-columns: 20px 1fr;
  align-items: center;
  min-height: 68px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: rgba(33, 79, 70, 0.05);
}

.check-field input {
  min-height: auto;
  accent-color: var(--green);
}

.check-field span {
  color: var(--ink);
  font-weight: 800;
}

.check-field small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.45;
}

.csn-control {
  background: rgba(78, 111, 146, 0.07);
}

.csn-field {
  gap: 8px;
}

.csn-field > span {
  color: var(--ink);
}

.csn-field small {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.45;
}

.csn-subgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.csn-check {
  grid-template-columns: 20px 1fr;
  min-height: auto;
  background: rgba(255, 253, 247, 0.82);
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.summary-band article {
  min-width: 0;
  padding: 18px;
  border-radius: 8px;
  background: var(--green);
  color: #fffdf7;
}

.summary-band article:nth-child(2) {
  background: var(--rose);
}

.summary-band article:nth-child(3) {
  background: var(--blue);
}

.summary-band article:nth-child(4) {
  background: #6b5522;
}

.summary-band span,
.summary-band small {
  display: block;
  color: rgba(255, 253, 247, 0.78);
  font-size: 0.82rem;
}

.summary-band strong {
  display: block;
  margin: 8px 0;
  font-family: "Alegreya", serif;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
}

.planner-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.period-controls {
  display: grid;
  gap: 14px;
}

.period-control {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.period-control__head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.period-control h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.period-control p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.period-control strong {
  flex: 0 0 auto;
  color: var(--green);
  font-size: 0.9rem;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.paid-leave-group {
  background: rgba(213, 157, 57, 0.1);
}

.paid-leave-list {
  display: grid;
  gap: 12px;
}

.paid-leave-row {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(213, 157, 57, 0.42);
  border-radius: 8px;
  background: #fffdf7;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  max-width: 34px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  line-height: 1;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.timeline-card {
  margin-top: 16px;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
}

.timeline-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--ink);
  color: #fffdf7;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--green);
}

.timeline {
  display: grid;
  gap: 16px;
  overflow-x: auto;
  margin-top: -76px;
  padding-top: 76px;
  padding-bottom: 12px;
  scrollbar-color: var(--blue) rgba(25, 32, 28, 0.08);
}

.timeline-scale,
.timeline-row {
  position: relative;
  min-width: 1180px;
}

.timeline-scale {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.timeline-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  align-items: center;
}

.timeline-row__label {
  font-weight: 800;
}

.timeline-track {
  position: relative;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0 calc(var(--timeline-month-step, 7.65%) - 0.1%),
      rgba(25, 32, 28, 0.05) calc(var(--timeline-month-step, 7.65%) - 0.1%) var(--timeline-month-step, 7.65%)
    ),
    rgba(250, 247, 239, 0.72);
}

.period-bar {
  position: absolute;
  top: 8px;
  height: 34px;
  min-width: 8px;
  border-radius: 6px;
  color: #fff;
  padding: 8px 10px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.76rem;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(25, 32, 28, 0.16);
}

.period-bar.is-draggable {
  cursor: grab;
  touch-action: none;
}

.period-bar.is-draggable::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 14px;
  margin-right: 7px;
  border-left: 2px dotted currentColor;
  border-right: 2px dotted currentColor;
  vertical-align: -2px;
  opacity: 0.72;
}

.period-bar:hover {
  z-index: 8;
  overflow: visible;
}

.period-bar.is-truncated:hover {
  color: transparent;
}

.period-bar:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 20;
  left: 0;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: min(460px, 72vw);
  white-space: normal;
  border: 1px solid rgba(25, 32, 28, 0.18);
  border-radius: 6px;
  background: rgba(255, 253, 247, 0.98);
  color: var(--ink);
  padding: 8px 10px;
  box-shadow: 0 14px 34px rgba(25, 32, 28, 0.18);
  font-size: 0.78rem;
  line-height: 1.35;
}

.period-bar.is-draggable:active {
  cursor: grabbing;
}

.mother {
  background: var(--rose);
}

.father {
  background: var(--green);
}

.family {
  background: var(--blue);
}

.neutral {
  background: var(--yellow);
  color: var(--ink);
}

.period-bar.paid {
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.22) 0 6px, transparent 6px 12px),
    var(--yellow);
  color: var(--ink);
}

.warnings {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.optimization-note {
  margin-top: 14px;
}

.optimization-note article {
  border: 1px solid rgba(78, 111, 146, 0.22);
  border-radius: 8px;
  background: rgba(78, 111, 146, 0.09);
  padding: 16px;
}

.optimization-note h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.optimization-note ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.warning {
  border-left: 4px solid var(--yellow);
  border-radius: 6px;
  background: rgba(213, 157, 57, 0.12);
  padding: 10px 12px;
  color: #5e4717;
  font-size: 0.9rem;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.source-grid a {
  display: flex;
  align-items: center;
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--green);
  padding: 12px;
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
}

.source-grid a:hover {
  border-color: var(--green);
}

.sources {
  margin-top: 16px;
}

.feedback-section {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.92);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 30px);
}

.feedback-form {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(220px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.feedback-message {
  grid-row: span 2;
}

.feedback-form textarea {
  width: 100%;
  min-height: 148px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  line-height: 1.45;
}

.feedback-form textarea:focus,
.feedback-form input:focus {
  outline: 3px solid rgba(78, 111, 146, 0.2);
  border-color: var(--blue);
}

.feedback-actions {
  display: grid;
  gap: 10px;
}

.feedback-actions button {
  width: 100%;
}

.feedback-status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.sources > p {
  max-width: 860px;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 900px) {
  .hero {
    min-height: auto;
    padding: 28px 18px 74px;
  }

  .control-grid,
  .summary-band,
  .planner-grid,
  .source-grid {
    grid-template-columns: 1fr;
  }

  .mini-grid,
  .csn-subgrid {
    grid-template-columns: 1fr;
  }

  .timeline-card {
    display: grid;
    grid-template-areas:
      "timeline-title"
      "timeline-body"
      "timeline-note"
      "timeline-action"
      "timeline-warnings";
  }

  .timeline-header {
    display: contents;
  }

  .timeline-header > div {
    grid-area: timeline-title;
    margin-bottom: 20px;
  }

  .timeline {
    grid-area: timeline-body;
  }

  .optimization-note {
    grid-area: timeline-note;
  }

  .timeline-header button {
    grid-area: timeline-action;
    width: 100%;
    margin-top: 12px;
  }

  .warnings {
    grid-area: timeline-warnings;
  }

  .app-shell {
    width: min(100% - 20px, 1540px);
    margin-top: -48px;
  }

  .period-control__head {
    align-items: stretch;
    flex-direction: column;
  }

  .period-control__head button:not(.icon-button) {
    width: 100%;
  }

  .period-control__head .icon-button {
    align-self: flex-end;
  }

  .feedback-form {
    grid-template-columns: 1fr;
  }

  .feedback-message {
    grid-row: auto;
  }

  h1 {
    font-size: clamp(2.35rem, 13vw, 3.6rem);
  }
}
