/* Composer: the tool is the page. Depends on base.css tokens. */

.app {
  display: grid;
  align-content: center;
  min-height: calc(100vh - var(--nav-height));
  /* Phone browsers shrink the viewport as their toolbars slide away. */
  min-height: calc(100dvh - var(--nav-height));
  padding: 32px 0 56px;
}

.lede {
  max-width: 100%;
  margin: 0 auto 24px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.45;
  text-align: center;
}

.composer__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
}

/*
 * One rule holds the page together: anything tinted is yours to type in, anything
 * white is something the app made. Typing lifts a field to white, so the box you
 * are working in is always the brightest thing on the screen.
 */

.field__input {
  min-height: 400px;
  padding: 18px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.6;
  resize: vertical;
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.field__input:hover {
  border-color: var(--border);
}

.field--notes {
  margin-top: 16px;
}

/*
 * Optional and secondary: an outline where the main panes are solid blocks.
 * Sitting on white rather than grey, the same type reads larger here, so it
 * steps down a little to keep the two panes above it the louder pair.
 */
.field__input--short {
  min-height: 62px;
  padding: 14px 18px;
  border-color: var(--border-strong);
  border-style: dashed;
  background: transparent;
  font-size: 13px;
}

.field__input::placeholder {
  color: var(--text-muted);
}

.field__input:focus {
  outline: none;
  border-color: var(--border-strong);
  border-style: solid;
  background: var(--bg);
  box-shadow: 0 0 0 4px rgba(30, 130, 137, 0.09);
}

.hint {
  margin-top: 10px;
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.7;
}

/* Keyboard shortcuts mean nothing on a phone, so each screen gets its own line. */
.hint--touch {
  display: none;
}

.field__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 10px;
}

.field__meta .hint {
  margin-top: 0;
}

.field__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

/* An alternative to pasting, offered at the weight of a footnote. */
.upload {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.upload:hover {
  border-color: var(--text-muted);
  background: var(--surface);
  color: var(--text);
}

.upload--busy {
  opacity: 0.6;
  pointer-events: none;
}

.upload__glyph {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.field__note {
  margin-top: 8px;
  padding: 0 4px;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.6;
}

.remember {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 4px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.remember input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

kbd {
  display: inline-block;
  min-width: 20px;
  margin: 0 1px;
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11.5px;
  line-height: 1.5;
  text-align: center;
}

/* Toolbar */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
}

.seg button {
  padding: 7px 14px;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.seg button:hover {
  color: var(--text);
}

.seg button[aria-pressed="true"] {
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.seg__unit {
  padding: 0 12px 0 6px;
  color: var(--text-muted);
  font-size: 13.5px;
}

.seg--multi button[aria-pressed="false"] {
  opacity: 0.55;
}

/* Question shown when the job description is missing something we need. */

.ask {
  max-width: 460px;
  margin: 18px auto 0;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.ask__question {
  display: block;
  margin-bottom: 10px;
  color: var(--text-secondary);
  font-size: 14.5px;
}

.ask__row {
  display: flex;
  gap: 8px;
}

.ask__row .input {
  margin-bottom: 0;
  height: 36px;
  font-size: 14px;
}

.ask__row .btn {
  flex: none;
}

.pro-tag {
  margin-left: 6px;
  color: var(--text-muted);
  font-size: 13px;
}

.status {
  min-height: 20px;
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 13.5px;
  text-align: center;
}

.progress {
  width: min(420px, 100%);
  margin: 12px auto 0;
}

.progress__track {
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--surface-alt);
}

.progress__fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1e8289, #163a4a);
  transition: width 0.35s ease;
}

.progress__meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12.5px;
}

.usage {
  color: var(--text-muted);
  font-size: 13.5px;
}

.nav__link.is-active {
  color: var(--text);
  font-weight: 500;
}

/* Result list */

.result {
  max-width: 720px;
  margin: 28px auto 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  box-shadow: var(--shadow);
}

/*
 * What we make of the job. It is the only opinion on the page, so it is set
 * like prose someone wrote, not like a system message: no panel, no label, no
 * icon. A hairline is enough to say where it ends.
 */
.take {
  padding: 4px 4px 16px;
  border-bottom: 1px solid var(--border);
}

.take__text {
  margin: 0;
  color: var(--text);
  /* Same size as the checklist under it: two asides, one voice. */
  font-size: 12.5px;
  line-height: 1.6;
}

/* A posting that gates on clearance or citizenship. Said in words, not colour. */
.take--gate .take__text::before {
  content: "Worth checking first. ";
  font-weight: 600;
}

/* The list of things to look at before sending. Small, grey, out of the way. */
.advice {
  padding: 14px 4px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.6;
}

.advice strong {
  color: var(--text);
  font-weight: 600;
}

.advice ul {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.advice li + li {
  margin-top: 3px;
}

/*
 * One row, one job: name the application and file it. The fields carry no
 * boxes of their own, so the row reads as a single control.
 */
.save-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 14px 0;
  padding: 5px 5px 5px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg);
}

.save-bar__fields {
  display: flex;
  flex: 1 1 300px;
  align-items: center;
  min-width: 0;
}

.save-bar__input {
  flex: 1 1 120px;
  min-width: 0;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}

/* An employer name is longer than a job title far more often than not. */
.save-bar__input--company {
  flex: 1.35 1 150px;
  border-right: 1px solid var(--border);
  border-radius: 0;
}

.save-bar__input:focus {
  outline: none;
  background: var(--surface);
}

.save-bar__input::placeholder {
  color: var(--text-muted);
}


.doc {
  padding: 18px 20px 20px;
}

.doc + .doc {
  border-top: 1px solid var(--border);
}

.doc__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.doc__name {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/*
 * PDF and DOCX are one decision, not two, so they sit inside a single hairline
 * shell behind the word that says what they are. Nothing here competes with the
 * document: the page is the thing worth looking at.
 */
.doc__get {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px 3px 3px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg);
}

.doc__get-label {
  margin-right: 7px;
  color: var(--text-muted);
  font-size: 12px;
}

.doc__fmt {
  padding: 5px 11px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.doc__fmt:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.doc__fmt:active {
  background: var(--accent-soft);
  color: var(--accent);
}

/*
 * The finished document, on paper rather than in a grey input well. It is the
 * thing the applicant came for, so it is set to be read: page-white, a hairline
 * frame, and the looser leading of a document instead of a form field.
 */
.doc__paper {
  position: relative;
  border-radius: var(--radius);
  background: var(--bg);
}

.doc__text {
  display: block;
  position: relative;
  width: 100%;
  /* Tall enough to read like a page instead of a slot you scroll a CV through. */
  min-height: 420px;
  padding: 26px 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* Transparent, so the marks underneath show through the words. */
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.65;
  resize: vertical;
  scrollbar-gutter: stable;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

/*
 * The same text as the box in front of it, set to the same metrics so every
 * line breaks in the same place, and painted out except where a mark sits.
 * Any change to the padding, font, or leading above has to be made here too,
 * or the highlight drifts off the words it belongs to.
 */
.doc__marks {
  position: absolute;
  inset: 0;
  overflow: hidden;
  padding: 26px 28px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: transparent;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  scrollbar-gutter: stable;
  pointer-events: none;
  user-select: none;
}

/* What the AI wrote, still visible an hour later. */
.doc__mark {
  border-radius: 3px;
  background: var(--accent-soft);
  color: transparent;
}

/* A document that runs past the box should not grow a system scrollbar down it. */
.doc__text {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.doc__text::-webkit-scrollbar {
  width: 10px;
}

.doc__text::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  background-clip: content-box;
}

.doc__text::-webkit-scrollbar-track {
  background: transparent;
}

.doc__text:hover {
  border-color: var(--border-strong);
}

.doc__text:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(30, 130, 137, 0.09);
}

/* Selecting is how the rewrite is reached, so a selection looks like the tool. */
.doc__text::selection {
  background: var(--accent-soft);
  color: var(--text);
}

/* How anyone finds out the rewrite exists: said once, under both documents. */
.doc__tip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0;
  padding: 0 20px 22px;
  color: var(--text-muted);
  font-size: 12.5px;
}

.doc__spark {
  flex: none;
  width: 13px;
  height: 13px;
  fill: var(--accent);
}

.stream {
  max-height: 240px;
  margin: 14px 0 0;
  padding: 14px 16px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/*
 * The rewrite chip. One pill, not a box holding another box: the chip itself is
 * the frame, so the field inside it needs no border of its own.
 */
.rewrite {
  position: fixed;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 5px 5px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--bg);
  box-shadow: var(--shadow);
}

.rewrite__spark {
  flex: none;
  width: 14px;
  height: 14px;
  fill: var(--accent);
}

.rewrite__input {
  width: 200px;
  padding: 5px 0;
  border: 0;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
}

.rewrite__input::placeholder {
  color: var(--text-muted);
}

.rewrite__input:focus {
  outline: none;
}

.rewrite .btn {
  border-radius: var(--radius-pill);
}

/* Paywall */

.paywall {
  width: min(400px, calc(100vw - 32px));
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow);
  text-align: center;
}

.paywall::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(2px);
}

.paywall__title {
  font-size: 21px;
}

.paywall__text {
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 15px;
}

.plan {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin: 22px 0 18px;
}

.paywall__list {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
  color: var(--text-secondary);
  font-size: 14px;
  text-align: left;
}

.paywall__list li {
  position: relative;
  padding-left: 20px;
}

.paywall__list li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.plan__price {
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.plan__period {
  color: var(--text-muted);
  font-size: 14px;
}

.paywall__actions {
  display: grid;
  gap: 6px;
}

.paywall__note {
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 12.5px;
}

@media (max-width: 820px) {
  .composer__grid {
    grid-template-columns: 1fr;
  }

  .field__input {
    min-height: 240px;
  }

  .field__input--short {
    min-height: 0;
  }
}

@media (max-width: 720px) {
  .app {
    padding: 24px 0 48px;
  }

  .lede {
    margin-bottom: 20px;
    font-size: 18px;
    text-wrap: balance;
  }

  .hint--keys {
    display: none;
  }

  .hint--touch {
    display: block;
  }

  .field__input {
    min-height: 190px;
    padding: 16px 16px;
    font-size: 16px;
  }

  .field__input--short {
    min-height: 0;
    padding: 13px 15px;
    /* Still 16px on a phone: anything smaller and iOS zooms on focus. */
    font-size: 16px;
  }

  /* Thumbs, not cursors: the segments share a row and Generate takes its own. */
  .seg button {
    padding: 9px 15px;
  }

  .toolbar .btn--primary {
    flex: 1 0 100%;
  }

  .ask__row {
    flex-wrap: wrap;
  }

  .ask__row .input,
  .ask__row .btn {
    flex: 1 0 100%;
  }

  .result {
    margin-top: 22px;
  }

  .result {
    padding: 12px;
  }

  /* A pill row cannot hold two fields and a button on a phone: stack them. */
  .save-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px;
    border-radius: var(--radius);
  }

  .save-bar__fields {
    flex-direction: column;
    gap: 6px;
  }

  .save-bar__input {
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
  }

  .save-bar__input--company {
    border-radius: var(--radius-sm);
  }

  .save-bar .btn {
    width: 100%;
  }

  .doc {
    padding: 16px 16px 18px;
  }

  .doc__head {
    gap: 10px;
  }

  .doc__get {
    flex: none;
    padding-left: 10px;
  }

  .doc__text,
  .doc__marks {
    min-height: 340px;
    padding: 18px 16px;
    font-size: 16px;
  }

  .stream {
    max-height: 180px;
    font-size: 14px;
  }

  /*
   * A floating chip beside a selection is a mouse idea. On a phone the rewrite
   * box sits at the bottom of the screen, above the keyboard, so the override
   * has to beat the inline position the script sets for the desktop chip.
   */
  .rewrite {
    left: 12px !important;
    right: 12px;
    top: auto !important;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
    padding: 6px 6px 6px 14px;
  }

  .rewrite__input {
    flex: 1;
    width: auto;
    min-width: 0;
    padding: 9px 12px;
    font-size: 16px;
  }

  .paywall {
    padding: 26px 22px;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
  }
}
