/* UK Trade Website Planner — styles.css
   Mobile-first, no external fonts, no framework. */

:root {
  --ink: #16232e;
  --ink-soft: #3d4c58;
  --hint: #4b5a66;
  --paper: #f4f6f4;
  --card: #ffffff;
  --line: #cfd8dc;
  --brand: #0e4a5c;
  --brand-dark: #0a3948;
  --brand-tint: #e6f0f3;
  --focus: #b45309;
  --error: #8c1d1d;
  --error-bg: #fdecea;
  --error-line: #c44a4a;
  --warn-bg: #fff8e7;
  --warn-line: #9a6b00;
  --notice-bg: #f0f4f6;
  --notice-line: #0e4a5c;
  --ok: #1e6b3f;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}

h1, h2, h3 {
  line-height: 1.25;
  margin: 0 0 0.5em;
}

h1 {
  font-size: 1.6rem;
}

h2 {
  font-size: 1.3rem;
}

h3 {
  font-size: 1.05rem;
}

p {
  margin: 0 0 1em;
}

ul, ol {
  padding-left: 1.25rem;
}

a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--brand-dark);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  z-index: 10;
  background: var(--brand);
  color: #ffffff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius) var(--radius);
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
.site-header {
  background: var(--brand);
  color: #ffffff;
  border-bottom: 4px solid var(--brand-dark);
}

.site-header__inner,
.site-header .wrap {
  padding: 0 1rem;
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0;
  padding: 0.75rem 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.site-header__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: #ffffff;
  color: var(--brand);
  font-weight: 800;
  flex: none;
}

.site-header__name {
  letter-spacing: 0.01em;
}

.site-header__by {
  display: block;
  width: 100%;
  font-size: 0.85rem;
  font-weight: 400;
  color: #d7e6ea;
}

.site-header__by a {
  color: #ffffff;
}

/* Cards and intro */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1rem 0;
  box-shadow: 0 1px 3px rgba(22, 35, 46, 0.08);
}

.intro__title {
  margin-bottom: 0.4rem;
}

.lead {
  font-size: 1.08rem;
  color: var(--ink-soft);
}

.intro__facts {
  margin: 1rem 0;
}

.intro__facts li {
  margin-bottom: 0.35rem;
}

.intro__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.25rem 0;
}

.intro__guide {
  margin: 0;
  font-size: 0.92rem;
}

/* Buttons */
.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 0.65rem 1.1rem;
  min-height: 44px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn--primary {
  background: var(--brand);
  color: #ffffff;
}

.btn--primary:hover {
  background: var(--brand-dark);
}

.btn--secondary {
  background: #ffffff;
  color: var(--brand-dark);
  border-color: var(--brand);
}

.btn--secondary:hover {
  background: var(--brand-tint);
}

.btn--danger {
  background: #ffffff;
  color: var(--error);
  border-color: var(--error-line);
}

.btn--danger:hover {
  background: var(--error-bg);
}

.link-btn {
  font: inherit;
  color: var(--brand);
  background: none;
  border: 0;
  padding: 0.35rem 0;
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--brand-dark);
}

/* Notices */
.notice {
  background: var(--notice-bg);
  border-left: 4px solid var(--notice-line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin: 1.1rem 0;
}

.notice--warning {
  background: var(--warn-bg);
  border-left-color: var(--warn-line);
}

.notice p:last-child,
.notice ul:last-child {
  margin-bottom: 0;
}

.notice__title {
  font-size: 1rem;
  margin: 0 0 0.4em;
}

/* Progress steps */
.steps {
  margin: 1rem 0 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.steps__list {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0.25rem 0.25rem 0.5rem;
  min-width: max-content;
}

.steps__btn {
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  min-width: 104px;
  min-height: 68px;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease,
    color 0.15s ease, box-shadow 0.15s ease;
}

.steps__btn:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand);
  box-shadow: 0 1px 4px rgba(22, 35, 46, 0.12);
}

.steps__btn:disabled {
  cursor: default;
  opacity: 0.55;
}

.steps__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.9rem;
}

.steps__label {
  font-size: 0.9rem;
  line-height: 1.25;
}

.steps__btn[data-complete="true"] {
  border-color: var(--brand);
  color: var(--brand);
}

.steps__btn[data-complete="true"] .steps__num {
  background: var(--brand);
  border-color: var(--brand);
  color: transparent;
  font-size: 0;
}

.steps__btn[data-complete="true"] .steps__num::before {
  content: "✓";
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
}

.steps__btn[aria-current="step"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(14, 74, 92, 0.28);
}

.steps__btn[aria-current="step"] .steps__num {
  background: #ffffff;
  border-color: #ffffff;
  color: var(--brand);
}

.steps__btn[aria-current="step"][data-complete="true"] .steps__num {
  color: transparent;
  font-size: 0;
}

.steps__btn[aria-current="step"][data-complete="true"] .steps__num::before {
  color: var(--brand);
}

/* Save status */
.save-status {
  font-size: 0.85rem;
  color: var(--hint);
  margin: 0.25rem 0 0.75rem;
  min-height: 1.2em;
}

/* Form */
.form-card {
  padding: 1.25rem 1.25rem 1.5rem;
}

.step__title {
  font-size: 1.3rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
}

.step__title:focus {
  outline: none;
}

.field {
  margin: 1.25rem 0;
  border: 0;
  padding: 0;
}

.field__label {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.35rem;
  color: var(--ink);
}

.optional {
  font-weight: 400;
  color: var(--hint);
  font-size: 0.9rem;
}

.field__hint {
  font-size: 0.88rem;
  color: var(--hint);
  margin: 0.35rem 0 0;
}

.field__error {
  color: var(--error);
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0.4rem 0 0;
}

.field__input {
  font: inherit;
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.65rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
}

textarea.field__input {
  resize: vertical;
}

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

.field__input[aria-invalid="true"] {
  border-color: var(--error-line);
}

/* Choices (radios and checkboxes) */
.choice {
  display: grid;
  gap: 0.25rem;
}

.choice__label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0.4rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.choice__label:hover {
  background: var(--brand-tint);
}

.choice__label input[type="radio"],
.choice__label input[type="checkbox"] {
  flex: none;
  width: 1.35rem;
  height: 1.35rem;
  margin: 0.2rem 0 0;
  accent-color: var(--brand);
}

/* Add row */
.add-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.add-row .field__input {
  flex: 1;
}

/* Suggestions */
.suggestions {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.suggestions li {
  margin: 0;
}

.suggestions__btn {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink-soft);
  padding: 0.4rem 0.85rem;
  min-height: 44px;
  cursor: pointer;
}

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

.suggestions__btn[aria-pressed="true"],
.suggestions__btn:disabled {
  background: var(--brand-tint);
  color: var(--hint);
  border-color: var(--line);
  cursor: default;
  text-decoration: line-through;
}

/* Service list */
.service-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.service-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 0.6rem 0.7rem;
}

.service-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.service-item__name {
  font-weight: 600;
}

.service-item__actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.service-item__btn {
  font: inherit;
  font-size: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink-soft);
  min-height: 40px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
}

.service-item__btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.service-item__btn--remove {
  color: var(--error);
  border-color: var(--error-line);
}

.service-item__btn--remove:hover {
  background: var(--error-bg);
}

.service-item__bottom {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.5rem;
}

.service-item__sector,
.service-item__priority {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.service-item__sector select {
  font: inherit;
  min-height: 40px;
  padding: 0.25rem 0.4rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.service-item__priority input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--brand);
}

.service-list__empty {
  color: var(--hint);
  font-style: italic;
  padding: 0.5rem 0;
}

/* Error summary */
.error-summary {
  background: var(--error-bg);
  border: 2px solid var(--error-line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin: 0 0 1rem;
}

.error-summary__title {
  color: var(--error);
  margin: 0 0 0.4em;
}

.error-summary ul {
  margin: 0;
  padding-left: 1.1rem;
}

.error-summary a {
  color: var(--error);
}

/* Form navigation */
.form-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

/* Results */
.results__title {
  font-size: 1.6rem;
  margin-bottom: 0.25rem;
}

.results__meta {
  background: var(--brand-tint);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin: 0.75rem 0;
}

.results__meta p {
  margin: 0 0 0.25rem;
}

.results__unanswered {
  margin-top: 0.5rem;
}

.results__unanswered h3 {
  font-size: 0.95rem;
  margin: 0.5rem 0 0.25rem;
}

.results__unanswered ul {
  margin: 0;
  padding-left: 1.1rem;
}

.results__toolbar {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin: 1rem 0;
}

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

.results__toolbar-row--danger {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--line);
}

.results__edit {
  margin-top: 0.75rem;
}

.results__edit summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 600;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.results__edit-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  padding: 0.5rem 0;
}

.results__section {
  margin: 1.5rem 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.results__section:first-of-type {
  border-top: 0;
  padding-top: 0.5rem;
}

.results__section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.results__section-head h2,
.results__section-head h3 {
  margin: 0 0 0.5em;
}

.results__copy {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink-soft);
  min-height: 40px;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
  flex: none;
}

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

.results__section ul {
  margin: 0 0 0.75em;
}

.results__section li {
  margin-bottom: 0.4rem;
}

.results__section p:last-child,
.results__section ul:last-child {
  margin-bottom: 0;
}

.results__status-item {
  list-style: none;
  margin-left: -1.25rem;
  padding-left: 1.6rem;
  position: relative;
}

.results__status-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.4em;
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid var(--line);
  border-radius: 2px;
}

.results__status-item--done::before {
  background: var(--ok);
  border-color: var(--ok);
}

.results__status-item--done::after {
  content: "✓";
  position: absolute;
  left: 0.1rem;
  top: 0.05em;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
}

.results__footer-note {
  font-size: 0.88rem;
  color: var(--hint);
  margin-top: 1.25rem;
}

/* Footer */
.site-footer {
  background: #22313d;
  color: #d9e2e8;
  margin-top: 2rem;
  padding: 1.5rem 0;
  font-size: 0.92rem;
}

.site-footer a {
  color: #ffffff;
}

.site-footer__brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: #ffffff;
  margin-bottom: 0.25rem;
}

.site-footer__cols {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.site-footer__links ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer__links li {
  margin-bottom: 0.4rem;
}

.site-footer__legal {
  border-top: 1px solid #3d4e5c;
  padding-top: 1rem;
  font-size: 0.82rem;
  color: #b9c7d0;
}

.site-footer .btn--secondary {
  background: transparent;
  border-color: #ffffff;
  color: #ffffff;
}

.site-footer .btn--secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Wider screens */
@media (min-width: 48rem) {
  h1 {
    font-size: 2rem;
  }

  .wrap {
    max-width: 58rem;
  }

  .card {
    padding: 1.75rem;
  }

  /* Sidebar layout: vertical stepper on the left, form or brief on the right */
  .app__layout {
    display: grid;
    grid-template-columns: 15.5rem minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
  }

  .app__sidebar {
    position: sticky;
    top: 1rem;
  }

  .steps {
    overflow-x: visible;
    margin: 0 0 0.5rem;
  }

  .steps__list {
    min-width: 0;
    flex-direction: column;
    gap: 0.45rem;
  }

  .steps__btn {
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
    width: 100%;
    min-width: 0;
    min-height: 46px;
    max-width: none;
    padding: 0.45rem 0.75rem;
    gap: 0.75rem;
  }

  .steps__num {
    min-width: 1.8rem;
    height: 1.8rem;
    font-size: 0.85rem;
  }

  .steps__label {
    font-size: 0.92rem;
  }

  .site-footer__cols {
    grid-template-columns: 1fr 1fr;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Print: only the generated brief */
@media print {
  body {
    background: #ffffff;
    color: #000000;
    font-size: 11pt;
  }

  .site-header,
  .intro,
  .app__sidebar,
  #planner-form,
  #storage-banner,
  .site-footer,
  .skip-link,
  #announcer,
  .results__toolbar,
  .results__copy,
  .results__meta {
    display: none !important;
  }

  #results {
    display: none;
  }

  body.app-started #results {
    display: block !important;
  }

  .wrap {
    max-width: none;
    padding: 0;
  }

  .card {
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .results__section {
    break-inside: avoid;
    border-top-color: #999999;
  }

  a {
    color: #000000;
    text-decoration: none;
  }
}
