/* ==========================================================================
   Utilith — Builder pages (Resume, Cover Letter, Invoice)
   Loaded only on the three builder tool pages so the rest of the site
   keeps exactly the same weight it had before.
   ========================================================================== */

/* ------------------------------------------------------------- Layout -- */

.wb-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

@media (min-width: 1000px) {
  .wb-col--sticky {
    position: sticky;
    top: calc(var(--header-h) + 1rem);
  }
}

/* -------------------------------------------------- Repeatable rows -- */

.repeat {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.repeat__row {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.repeat__row[hidden] { display: none; }

.repeat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.repeat__label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
}

.repeat__row .field:last-child { margin-bottom: 0; }

.logo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.logo-row__name {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----------------------------------------------------- Design options -- */

.template-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.template-chip {
  display: block;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.template-chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.template-chip.is-active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.swatch {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: transparent;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.swatch:hover { transform: scale(1.08); }

.swatch.is-active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* --------------------------------------------------------- Paper view -- */

.paper {
  background: #ffffff;
  color: #1a1a1a;
  border-radius: 8px;
  padding: 26px 24px;
  box-shadow: 0 10px 34px -14px rgba(0, 0, 0, 0.55);
  font-size: 0.78rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.paper:empty { min-height: 180px; }

/* -------------------------------------------------------------- Resume -- */

.resume {
  --accent: #1f2937;
  --ink: #111827;
  --ink-soft: #5a6070;
  --ink-faint: #6e7482;
  color: var(--ink);
}

.resume--empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  color: #9aa0ad;
  font-style: italic;
  text-align: center;
}

.resume__head {
  margin-bottom: 14px;
}

.resume__head--centred {
  text-align: center;
}

.resume__name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: #111111;
}

.resume__title {
  margin: 2px 0 0;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.resume__contact {
  margin: 4px 0 0;
  font-size: 0.74rem;
  color: var(--ink-faint);
}

.resume__section + .resume__section { margin-top: 13px; }

.resume__heading {
  margin: 0 0 5px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  padding-bottom: 3px;
  border-bottom: 1px solid #dfe3ea;
}

.resume__text {
  margin: 0;
  font-size: 0.78rem;
  color: #282c34;
}

.resume__entry + .resume__entry { margin-top: 9px; }

.resume__entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.6rem;
}

.resume__entry-title {
  font-weight: 700;
  font-size: 0.81rem;
  color: #111111;
}

.resume__entry-org {
  font-size: 0.76rem;
  color: var(--ink-soft);
}

.resume__entry-date {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--ink-faint);
  white-space: nowrap;
}

.resume__meta {
  margin: 1px 0 0;
  font-size: 0.76rem;
  color: var(--ink-soft);
}

.resume__level { color: var(--ink-faint); }

.resume ul {
  margin: 4px 0 0;
  padding-left: 1.05rem;
}

.resume li {
  font-size: 0.78rem;
  color: #282c34;
}

.resume li::marker { color: var(--ink-faint); }

/* Template variants — they mirror what the PDF draws. */

.resume[data-template="classic"] .resume__heading {
  color: #1f2937;
  border-bottom-color: #c9ced8;
}

.resume[data-template="modern"] .resume__heading {
  color: var(--accent);
  border-bottom-color: transparent;
  padding-bottom: 0;
}

.resume[data-template="compact"] {
  font-size: 0.72rem;
}

.resume[data-template="compact"] .resume__name { font-size: 1.2rem; }
.resume[data-template="compact"] .resume__title { font-size: 0.8rem; }
.resume[data-template="compact"] .resume__contact { font-size: 0.68rem; }
.resume[data-template="compact"] .resume__heading {
  color: var(--accent);
  border-bottom-color: #dfe3ea;
  margin-bottom: 3px;
}
.resume[data-template="compact"] .resume__section + .resume__section { margin-top: 9px; }
.resume[data-template="compact"] .resume__entry + .resume__entry { margin-top: 6px; }
.resume[data-template="compact"] .resume__text,
.resume[data-template="compact"] li { font-size: 0.72rem; }

.resume[data-template="ats"] .resume__heading {
  color: #000000;
  border-bottom-color: transparent;
  padding-bottom: 0;
  font-weight: 700;
}

.resume[data-template="ats"] .resume__name { font-size: 1.25rem; }

.resume[data-template="ats"] .resume__title,
.resume[data-template="ats"] .resume__contact,
.resume[data-template="ats"] .resume__meta {
  color: #1a1a1a;
}

/* ------------------------------------------------------------- Invoice -- */

.invoice { color: #1a1a1a; }

.invoice__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 13px;
  border-bottom: 2px solid #111111;
}

.invoice__brand {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
}

.invoice__logo {
  width: 50px;
  height: 50px;
  flex: none;
  object-fit: contain;
  border-radius: 6px;
}

.invoice__business {
  margin: 0 0 3px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.invoice__title { text-align: right; }

.invoice__title h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.invoice__muted {
  margin: 0;
  font-size: 0.74rem;
  color: #6b7280;
  line-height: 1.45;
}

.invoice__parties {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.4rem;
  margin: 16px 0;
}

.invoice__label {
  display: block;
  margin-bottom: 3px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6b7280;
}

.invoice__client {
  margin: 0;
  font-weight: 700;
}

.invoice__meta {
  display: grid;
  gap: 2px;
  margin: 0;
  min-width: 140px;
}

.invoice__meta > div {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  font-size: 0.74rem;
}

.invoice__meta dt { color: #6b7280; }

.invoice__meta dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.invoice__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.invoice__table th {
  padding: 6px 6px;
  border-bottom: 1px solid #c9ced8;
  text-align: left;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #6b7280;
}

.invoice__table td {
  padding: 7px 6px;
  border-bottom: 1px solid #eceff3;
  vertical-align: top;
}

.invoice__table .is-num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.invoice__empty {
  text-align: center;
  color: #9aa0ad;
  padding: 14px 6px;
}

.invoice__totals {
  width: min(290px, 100%);
  margin: 16px 0 0 auto;
}

.invoice__totals > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 3px 0;
  font-size: 0.79rem;
  color: #3f4652;
}

.invoice__totals b {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #1a1a1a;
}

.invoice__grand {
  margin-top: 5px;
  padding-top: 7px;
  border-top: 2px solid #111111;
  font-size: 0.95rem !important;
  font-weight: 700;
}

.invoice__grand b {
  font-size: 1.05rem;
  font-weight: 700;
}

.invoice__notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.1rem;
  margin-top: 20px;
  padding-top: 13px;
  border-top: 1px solid #e3e7ed;
  font-size: 0.77rem;
}

.invoice__notes p {
  margin: 0;
  color: #3f4652;
  line-height: 1.5;
}

.invoice__foot {
  margin-top: 16px;
  font-size: 0.68rem;
  color: #9aa0ad;
}

/* ------------------------------------------------------- Narrow screen -- */

@media (max-width: 560px) {
  .paper { padding: 18px 15px; font-size: 0.74rem; }
  .invoice__parties { grid-template-columns: minmax(0, 1fr); }
  .invoice__title { text-align: left; }
  .invoice__meta > div { justify-content: space-between; }
  .template-list { grid-template-columns: minmax(0, 1fr); }
}
