/* Design language: ported from the Sanil.com.np QR generator — deep
   near-black surfaces, a single red accent, quiet borders. The Preeti
   input pane keeps rendering in the actual Preeti font so users can read
   what they're pasting before it's converted. */

:root {
  --bg: #0b0c0f;
  --surface: #16181d;
  --surface-2: #1d2026;
  --ink: #f5f5f4;
  --ink-soft: #c7c9cc;
  --ink-faint: #9ca3af;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --red: #dc2626;
  --red-bright: #ef4444;
  --red-tint-bg: #3a1414;
  --red-tint-fg: #fca5a5;
  --accent-bright: #fc0000;
  --focus: #ef4444;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.35);
}

@font-face {
  font-family: "Preeti";
  src: url("fonts/preeti.ttf") format("truetype");
  font-display: swap;
}

/* System UI fonts don't reliably render true light weights (300 often
   collapses to regular), which is why the hero looked heavier than the
   QR generator's. That site loads Roboto as a variable font for exactly
   this reason, so the hero borrows the same file (Latin subset only —
   the only script it needs here). */
@font-face {
  font-family: "Roboto Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/roboto-variable.woff2") format("woff2-variations");
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

html {
  font-size: 18px;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Roboto Variable", -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--red);
  color: var(--ink);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--ink-faint);
}

a {
  color: var(--red-bright);
  text-decoration: none;
}

a:hover {
  color: var(--red-tint-fg);
}

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

/* --- Page shell ------------------------------------------------------ */

.page {
  max-width: 64rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 0;
  --page-pt: 3rem;
}

@media (min-width: 768px) {
  .page {
    padding-top: 4.5rem;
    --page-pt: 4.5rem;
  }
}

.feature {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  min-height: calc(100vh - (var(--page-pt) * 2));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.brand__icon {
  width: 24px;
  height: 24px;
}

.brand__wordmark {
  font-weight: 300;
  font-size: 1.05rem;
  color: var(--red-bright);
}

/* --- Hero: ported 1:1 from the QR generator's index.html #seo-hero ----- */

.hero {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hero__brand {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 0.5rem;
}

.hero__brand img {
  width: 2.75rem;
  height: 2.75rem;
}

.hero__brand span {
  font-size: 1.875rem;
  font-weight: 300;
  color: var(--accent-bright);
}

.hero h1 {
  font-size: 2.25rem;
  font-weight: 300;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
  margin: 0;
}

@media (min-width: 768px) {
  .hero h1 {
    font-size: 3rem;
  }
}

.hero .lede {
  color: var(--ink-faint);
  max-width: 36rem;
  margin: 0;
}

.hero__checklist {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0;
  padding: 0;
  font-size: 0.875rem;
  color: var(--ink-faint);
}

.hero__checklist li {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.hero__checklist li span {
  color: var(--accent-bright);
}

/* --- The converter desk ------------------------------------------------ */

.desk {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.desk__panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  min-height: 260px;
}

.pane--in {
  border-right: 1px dashed var(--border-strong);
}

@media (max-width: 640px) {
  .desk__panes {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }

  .pane--in {
    border-right: none;
    border-bottom: 1px dashed var(--border-strong);
  }
}

.pane {
  padding: 1.1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.pane__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.pane__label span:first-child {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.pane textarea {
  flex: 1;
  min-height: 0;
  resize: none;
  border: none;
  background: transparent;
  color: var(--ink);
  padding: 0;
  overflow-y: auto;
}

.pane--in textarea {
  font-family: "Preeti", ui-monospace, "SF Mono", "Cascadia Code", Consolas,
    monospace;
  font-size: 1.3rem;
  line-height: 1.8;
}

.pane--out {
  background: var(--surface-2);
}

.pane--out .output-text {
  flex: 1;
  min-height: 0;
  font-size: 1.35rem;
  line-height: 1.9;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
}

.pane--out .output-text:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-faint);
  font-size: 1rem;
}

@keyframes stamp-spin {
  to {
    transform: rotate(360deg);
  }
}

.desk__footer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.desk__footer-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
}

.convert-btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--red);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.2s ease;
  grid-column: 1;
  justify-self: start;
}

.convert-btn svg {
  width: 16px;
  height: 16px;
}

.convert-btn:hover:not(:disabled) {
  background: var(--red-bright);
}

.convert-btn:disabled {
  cursor: default;
  opacity: 0.6;
}

.convert-btn.is-active svg {
  transform: scale(1.2);
}

.convert-btn.is-loading svg {
  animation: stamp-spin 0.9s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .convert-btn.is-loading svg {
    animation: none;
  }
}

.desk__hint {
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.desk__hint:empty {
  display: none;
}

.hint--error {
  color: var(--red-bright);
}

.btn {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}

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

.btn:active {
  transform: translateY(1px);
}

.btn[data-copied="true"] {
  border-color: var(--red);
  color: var(--red-bright);
}

.desk__footer-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  grid-column: 3;
  justify-self: end;
}

.btn--icon {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn--icon svg {
  width: 15px;
  height: 15px;
}

.btn--icon .icon-collapse {
  display: none;
}

.btn--icon[aria-pressed="true"] .icon-expand {
  display: none;
}

.btn--icon[aria-pressed="true"] .icon-collapse {
  display: block;
}

/* --- Fullscreen converter ------------------------------------------------ */

body.has-fullscreen-desk {
  overflow: hidden;
}

.desk--fullscreen {
  position: fixed;
  inset: 0;
  z-index: 100;
  border-radius: 0;
}

.desk--fullscreen .desk__panes {
  min-height: 0;
}

@media (max-width: 640px) {
  .desk--fullscreen .desk__panes {
    grid-template-rows: 1fr 1fr;
  }
}

/* --- Embed modal (index.html) ------------------------------------------- */

body.has-open-modal {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.modal__dialog {
  position: relative;
  width: 100%;
  max-width: 32rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.modal__header h2 {
  font-size: 1.1rem;
  margin: 0;
}

.modal__close {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-faint);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.2rem;
  cursor: pointer;
}

.modal__close:hover {
  color: var(--red-bright);
}

.modal__desc {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0 0 1rem;
}

.modal__code {
  margin: 0 0 1rem;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

/* --- SEO content sections (index.html) --------------------------------- */

.seo {
  margin-top: 4.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  --surface: #1d2026;
  --red-tint-bg: #1d2026;
}

.seo-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.seo-section h2 {
  font-size: 1.5rem;
  margin: 0 0 1.5rem;
  font-weight: 300;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.75rem;
}

.icon-card__badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--red-tint-bg);
  color: var(--red-tint-fg);
  display: grid;
  place-items: center;
  margin-bottom: 0.9rem;
}

.icon-card__badge svg {
  width: 18px;
  height: 18px;
}

.icon-card h3 {
  font-size: 1.1rem;
  margin: 0 0 0.35rem;
  font-weight: 300;
}

.icon-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-faint);
  line-height: 1.55;
}

.callout {
  background: var(--red-tint-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.callout__badge {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: rgba(220, 38, 38, 0.18);
  color: var(--red-tint-fg);
  display: grid;
  place-items: center;
}

.callout__badge svg {
  width: 20px;
  height: 20px;
}

.callout h2 {
  font-size: 1.4rem;
  margin: 0 0 0.6rem;
  font-weight: 300;
}

.callout p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.65;
}

.faq {
  background: var(--red-tint-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.faq h2 {
  font-size: 1.4rem;
  margin: 0 0 1.5rem;
  font-weight: 300;
}

.faq-item + .faq-item {
  margin-top: 1.25rem;
}

.faq-item h3 {
  font-size: 1.05rem;
  margin: 0 0 0.35rem;
  font-weight: 300;
  color: var(--ink);
}

.faq-item p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

.faq code,
.seo-section code {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.85em;
}

.page__footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  border-top: 1px solid var(--border);
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  font-size: 1rem;
  color: var(--ink-faint);
}

.page__footer-inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.page__footer .brand__wordmark {
  font-size: 1rem;
  color: #fff;
}

/* --- Embed variant ------------------------------------------------------ */

.embed-wrap {
  padding: 0.75rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.embed-wrap .desk {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.embed-wrap .desk__panes {
  flex: 1;
  min-height: 200px;
}

.watermark {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 1rem;
  color: var(--ink-faint);
  grid-column: 2;
  justify-self: center;
}

.watermark:hover {
  color: var(--red-bright);
}

.watermark img {
  width: 20px;
  height: 20px;
}
