:root {
  /* Color */
  --ink: #14181f;
  --ink-soft: #1c222b;
  --paper: #f4f0e6;
  --paper-dim: #e7e1d1;
  --brass: #c9a15a;
  --brass-bright: #ddb96f;
  --slate: #8b93a0;
  --thread-red: #9c5040;

  /* Type */
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* {
  box-sizing: border-box;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  line-height: 1.5;
  position: relative;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Ambient drifting stitch lines */
.stitch-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.drift-line {
  position: absolute;
  height: 1px;
  width: 160%;
  left: -30%;
  background-image: repeating-linear-gradient(
    to right,
    var(--brass) 0px,
    var(--brass) 7px,
    transparent 7px,
    transparent 15px
  );
  opacity: 0.16;
}

.line-1 {
  top: 12%;
  transform: rotate(-6deg);
  animation: drift-right 46s linear infinite;
}

.line-2 {
  top: 34%;
  transform: rotate(4deg);
  opacity: 0.1;
  animation: drift-left 58s linear infinite;
}

.line-3 {
  top: 64%;
  transform: rotate(-3deg);
  animation: drift-right 64s linear infinite;
}

.line-4 {
  top: 85%;
  transform: rotate(5deg);
  opacity: 0.09;
  animation: drift-left 50s linear infinite;
}

@keyframes drift-right {
  from { transform: rotate(-6deg) translateX(-8%); }
  to { transform: rotate(-6deg) translateX(8%); }
}

@keyframes drift-left {
  from { transform: rotate(4deg) translateX(8%); }
  to { transform: rotate(4deg) translateX(-8%); }
}

@media (prefers-reduced-motion: reduce) {
  .drift-line {
    animation: none !important;
  }
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 28px;
  position: relative;
  z-index: 2;
}

/* Header */
.site-header {
  border-bottom: 1px solid rgba(244, 240, 230, 0.1);
  padding: 22px 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.mark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--brass-bright);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

.mark svg {
  color: var(--brass);
}

.tagline-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate);
}

/* Hero */
.hero {
  padding: 76px 28px 40px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass);
  margin: 0 0 18px;
}

h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1.04;
  letter-spacing: -0.01em;
  margin: 0 0 24px;
  color: var(--paper);
}

.hero-sub {
  max-width: 560px;
  color: var(--slate);
  font-size: 1.05rem;
  line-height: 1.65;
  margin: 0 0 40px;
}

/* Stitch divider â€” the signature motif */
.stitch-divider {
  height: 1px;
  background-image: repeating-linear-gradient(
    to right,
    var(--brass) 0px,
    var(--brass) 8px,
    transparent 8px,
    transparent 16px
  );
  opacity: 0.55;
}

.stitch-divider.small {
  margin: 14px 0 18px;
}

/* Workroom / inputs */
.workroom {
  padding: 20px 28px 24px;
}

.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

@media (max-width: 760px) {
  .input-grid,
  .output-grid {
    grid-template-columns: 1fr;
  }
  .hero {
    padding: 48px 20px 28px;
  }
  .wrap {
    padding: 0 18px;
  }
  h1 {
    font-size: clamp(2rem, 9vw, 2.8rem);
  }
  .hero-sub {
    font-size: 0.96rem;
  }
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .workroom {
    padding: 14px 18px 20px;
  }
  .actions {
    flex-direction: column;
  }
  .actions button {
    width: 100%;
  }
  textarea {
    height: 160px;
    font-size: 16px; /* prevents iOS auto-zoom on focus */
  }
  .output-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .results {
    padding: 8px 18px 60px;
  }
}

@media (max-width: 420px) {
  .mark span {
    font-size: 1rem;
  }
  .tag-num {
    width: 20px;
    height: 20px;
  }
}

.swatch-card {
  background: var(--ink-soft);
  border: 1px dashed rgba(201, 161, 90, 0.35);
  border-radius: 3px;
  padding: 18px;
}

.swatch-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.tag-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--brass);
  border-radius: 50%;
  color: var(--brass-bright);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  flex-shrink: 0;
}

.swatch-label label,
.swatch-label h2 {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--slate);
  margin: 0;
  font-weight: 500;
}

textarea {
  width: 100%;
  height: 210px;
  background: rgba(20, 24, 31, 0.6);
  border: 1px solid rgba(244, 240, 230, 0.12);
  border-radius: 3px;
  color: var(--paper);
  padding: 12px;
  font-size: 0.92rem;
  font-family: var(--font-body);
  resize: vertical;
}

textarea::placeholder {
  color: rgba(139, 147, 160, 0.7);
}

textarea:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

/* Actions */
.actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

button {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  border-radius: 3px;
  padding: 13px 26px;
  cursor: pointer;
  border: none;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

button:focus-visible {
  outline: 2px solid var(--brass-bright);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--brass);
  color: var(--ink);
}

.btn-primary:hover {
  background: var(--brass-bright);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: transparent;
  color: var(--paper);
  border: 1px solid rgba(244, 240, 230, 0.25);
}

.btn-secondary:hover {
  border-color: var(--brass);
  color: var(--brass-bright);
}

.status {
  margin-top: 18px;
  min-height: 20px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--slate);
}

/* Results */
.results {
  padding: 8px 28px 90px;
}

.output-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.output-card {
  background: var(--paper);
  color: var(--ink);
  border-radius: 3px;
  padding: 20px;
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.output-card .swatch-label h2 {
  color: var(--ink);
}

.output-card .tag-num {
  border-color: var(--thread-red);
  color: var(--thread-red);
}

.output-card .stitch-divider {
  background-image: repeating-linear-gradient(
    to right,
    var(--thread-red) 0px,
    var(--thread-red) 8px,
    transparent 8px,
    transparent 16px
  );
}

.copy-btn {
  padding: 6px 14px;
  font-size: 0.76rem;
  background: rgba(20, 24, 31, 0.08);
  color: var(--ink);
}

.copy-btn:hover {
  background: rgba(20, 24, 31, 0.15);
}

pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.6;
  max-height: 520px;
  overflow-y: auto;
  margin: 0;
}

/* Footer */
.site-footer {
  border-top: 1px solid rgba(244, 240, 230, 0.1);
  padding: 30px 0 50px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px;
}

.care-tag {
  border: 1px solid rgba(201, 161, 90, 0.3);
  border-radius: 3px;
  padding: 12px 16px;
  max-width: 480px;
}

.care-tag-title {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass);
  margin: 0 0 6px;
}

.care-tag p:last-child {
  margin: 0;
  font-size: 0.8rem;
  color: var(--slate);
  line-height: 1.6;
}

.footer-fine {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--slate);
  margin: 0;
}

/* Jobs section */
.jobs-section {
  padding: 12px 28px 90px;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  margin: 0 0 12px;
  color: var(--paper);
}

.hero-sub.small {
  font-size: 0.92rem;
  margin-bottom: 26px;
}

.job-search-bar {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 12px;
  margin-bottom: 10px;
}

.job-search-bar input,
.job-search-bar select {
  background: var(--ink-soft);
  border: 1px solid rgba(244, 240, 230, 0.15);
  border-radius: 3px;
  color: var(--paper);
  padding: 12px;
  font-family: var(--font-body);
  font-size: 0.9rem;
}

.job-search-bar input::placeholder {
  color: rgba(139, 147, 160, 0.7);
}

.job-search-bar input:focus-visible,
.job-search-bar select:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
}

.job-results {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 20px;
}

.job-card {
  background: var(--paper);
  color: var(--ink);
  border-radius: 3px;
  padding: 16px 18px;
}

.job-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.job-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.05rem;
  margin: 0;
}

.job-meta {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #6b7280;
}

.job-snippet {
  font-size: 0.88rem;
  color: #3a3f47;
  line-height: 1.55;
  margin: 8px 0 12px;
}

.job-link {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--thread-red);
  text-decoration: none;
  border-bottom: 1px dashed var(--thread-red);
}

.job-link:hover {
  opacity: 0.75;
}

@media (max-width: 760px) {
  .job-search-bar {
    grid-template-columns: 1fr;
  }
}

/* Site nav (multi-page) */
.mark {
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 20px;
}

.site-nav a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--slate);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-nav a:hover {
  color: var(--brass-bright);
  border-color: var(--brass);
}

/* Results page */
.results-page {
  padding: 12px 28px 90px;
  max-width: 760px;
}

.btn-link {
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--slate);
}

.empty-state p {
  margin-bottom: 20px;
}

.action-bar {
  display: flex;
  gap: 14px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px dashed rgba(201, 161, 90, 0.35);
  flex-wrap: wrap;
}

.action-bar-btn {
  flex: 1;
  min-width: 220px;
  text-align: center;
  font-size: 0.94rem;
}

#secondaryStatus {
  margin-top: 18px;
}

#secondaryOutputCard {
  margin-top: 4px;
}

@media (max-width: 760px) {
  .action-bar {
    flex-direction: column;
  }
  .action-bar-btn {
    width: 100%;
    min-width: 0;
  }
  .site-nav {
    font-size: 0.7rem;
  }
}

.coverage-note {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--slate);
  margin: 4px 0 20px;
  line-height: 1.6;
}

/* Quick links (non-Adzuna countries) */
.quick-links {
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.quick-link-card {
  display: block;
  background: var(--paper);
  color: var(--ink);
  border-radius: 3px;
  padding: 16px 18px;
  text-decoration: none;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  border-left: 3px solid var(--thread-red);
  transition: transform 0.12s ease;
}

.quick-link-card:hover {
  transform: translateX(3px);
}

/* Input tabs (Paste / Upload / Build from Scratch) */
.input-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(244, 240, 230, 0.12);
}

.input-tab {
  background: transparent;
  border: none;
  color: var(--slate);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.input-tab:hover {
  color: var(--paper);
}

.input-tab.active {
  color: var(--brass-bright);
  border-bottom-color: var(--brass);
}

.tab-hint {
  font-size: 0.78rem;
  color: var(--slate);
  margin: 0 0 12px;
  line-height: 1.5;
}

/* Upload tab */
.file-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 90px;
  border: 1px dashed rgba(201, 161, 90, 0.4);
  border-radius: 3px;
  background: rgba(20, 24, 31, 0.4);
  color: var(--paper);
  font-size: 0.88rem;
  cursor: pointer;
  text-align: center;
  padding: 0 16px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.file-drop:hover {
  border-color: var(--brass);
  background: rgba(201, 161, 90, 0.06);
}

/* Build from Scratch form */
.build-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--slate);
  margin-bottom: 6px;
}

.optional-tag {
  color: rgba(139, 147, 160, 0.7);
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
}

.field input[type="text"] {
  width: 100%;
  background: rgba(20, 24, 31, 0.6);
  border: 1px solid rgba(244, 240, 230, 0.12);
  border-radius: 3px;
  color: var(--paper);
  padding: 10px 12px;
  font-size: 0.9rem;
  font-family: var(--font-body);
}

.field input:focus-visible,
.field-textarea:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
}

.field-textarea {
  width: 100%;
  height: 80px;
  background: rgba(20, 24, 31, 0.6);
  border: 1px solid rgba(244, 240, 230, 0.12);
  border-radius: 3px;
  color: var(--paper);
  padding: 10px 12px;
  font-size: 0.9rem;
  font-family: var(--font-body);
  resize: vertical;
}

@media (max-width: 500px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

/* Privacy policy page */
.policy-page {
  padding: 12px 28px 90px;
  max-width: 720px;
}

.policy-block {
  margin-bottom: 32px;
}

.policy-block h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.25rem;
  color: var(--brass-bright);
  margin: 0 0 10px;
}

.policy-block p {
  color: var(--paper);
  font-size: 0.94rem;
  line-height: 1.7;
  margin: 0 0 8px;
}

.policy-block ul {
  margin: 8px 0 8px 20px;
  padding: 0;
}

.policy-block li {
  color: var(--paper);
  font-size: 0.94rem;
  line-height: 1.7;
  margin-bottom: 6px;
}

.policy-block strong {
  color: var(--brass-bright);
}

/* Privacy icon button (top right of header) */
.privacy-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(201, 161, 90, 0.35);
  border-radius: 3px;
  color: var(--slate);
  text-decoration: none;
  flex-shrink: 0;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.privacy-icon-btn:hover {
  color: var(--brass-bright);
  border-color: var(--brass);
  background: rgba(201, 161, 90, 0.08);
}

.privacy-icon-btn.active {
  color: var(--brass-bright);
  border-color: var(--brass);
  background: rgba(201, 161, 90, 0.1);
  cursor: default;
}
