@import url("https://fonts.googleapis.com/css2?family=EB+Garamond:wght@400;500;600;700&family=Roboto+Mono:wght@400;500;600;700&display=swap");

:root {
  color-scheme: light;
  --beige: #f3eadc;
  --black: #111111;
  --paper: var(--beige);
  --ink: var(--black);
  --muted: color-mix(in srgb, var(--black) 62%, var(--beige));
  --line: color-mix(in srgb, var(--black) 18%, var(--beige));
  --green: var(--black);
  --green-dark: var(--black);
  --yellow: var(--beige);
  --telegram: var(--black);
  --telegram-dark: var(--black);
  --panel: var(--beige);
  --lede: color-mix(in srgb, var(--black) 74%, var(--beige));
  --device-bg: var(--black);
  --device-bar: color-mix(in srgb, var(--beige) 38%, var(--black));
  --bubble-light: var(--beige);
  --bubble-note: color-mix(in srgb, var(--beige) 78%, var(--black));
  --shadow: none;
  --radius-sm: 8px;
  --radius-control: 18px;
  --radius-pill: 999px;
  --font-sans: "Roboto Mono", "Courier New", monospace;
  --font-serif: "EB Garamond", Georgia, Cambria, "Times New Roman", Times, serif;
  
  /* Web-native inbox colors */
  --color-primary: #6366f1;
  --color-primary-hover: #4f46e5;
  --color-success: #10b981;
  --color-surface: var(--paper);
  --color-text: var(--ink);
  --color-text-secondary: var(--muted);
  --color-border: var(--line);
  --color-hover: color-mix(in srgb, var(--black) 8%, var(--beige));
}

[data-theme="night"] {
  color-scheme: dark;
  --paper: var(--black);
  --ink: var(--beige);
  --muted: color-mix(in srgb, var(--beige) 66%, var(--black));
  --line: color-mix(in srgb, var(--beige) 22%, var(--black));
  --green: var(--beige);
  --green-dark: var(--beige);
  --yellow: var(--black);
  --telegram: var(--beige);
  --telegram-dark: var(--beige);
  --panel: var(--black);
  --lede: color-mix(in srgb, var(--beige) 78%, var(--black));
  --device-bg: var(--beige);
  --device-bar: color-mix(in srgb, var(--black) 42%, var(--beige));
  --bubble-light: var(--black);
  --bubble-note: color-mix(in srgb, var(--black) 76%, var(--beige));
  --shadow: none;
  
  /* Web-native inbox colors for dark mode */
  --color-surface: var(--paper);
  --color-text: var(--ink);
  --color-text-secondary: var(--muted);
  --color-border: var(--line);
  --color-hover: color-mix(in srgb, var(--beige) 12%, var(--black));
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
}

a {
  color: inherit;
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.landing {
  width: min(100% - 32px, 1120px);
  margin: 0 auto;
  padding: 24px 0 46px;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 34px;
}

.brand-logo {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  width: clamp(38px, 4vw, 52px);
  height: clamp(42px, 4.5vw, 58px);
}

.brand-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

[data-theme="day"] .logo-night,
[data-theme="night"] .logo-day {
  display: none;
}

@supports ((-webkit-mask: url("") center / contain no-repeat) or (mask: url("") center / contain no-repeat)) {
  .brand-logo {
    background: var(--ink);
    -webkit-mask: url("/media/darklogo.svg") center / contain no-repeat;
    mask: url("/media/darklogo.svg") center / contain no-repeat;
  }

  [data-theme="night"] .brand-logo {
    -webkit-mask-image: url("/media/whitelogo.svg");
    mask-image: url("/media/whitelogo.svg");
  }

  .brand-logo img {
    display: none;
  }
}

.brand-logo.nav-back {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: transparent;
  -webkit-mask: none;
  mask: none;
  justify-content: center;
}

.brand-logo.nav-back:hover {
  background: var(--ink);
  color: var(--paper);
}

.brand-logo.nav-back svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.prefs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.language-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
}

.language-control select,
.theme-toggle {
  min-height: 36px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}

.language-control select {
  max-width: min(48vw, 190px);
  padding: 0 8px;
}

.theme-toggle {
  width: 40px;
  padding: 0;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}

.theme-icon {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon circle,
.theme-icon path {
  fill: none;
  stroke: currentColor;
}

[data-theme="day"] .icon-moon,
[data-theme="night"] .icon-sun {
  display: block;
}

[data-theme="day"] .icon-sun,
[data-theme="night"] .icon-moon {
  display: none;
}

.hero {
  min-height: clamp(360px, 58vh, 590px);
  display: grid;
  grid-template-columns: minmax(0, 760px);
  justify-content: center;
  align-items: center;
  gap: clamp(22px, 5vw, 56px);
  padding: clamp(26px, 5vw, 62px) 0 clamp(20px, 4vw, 44px);
  text-align: center;
}

.copy {
  display: grid;
  justify-items: center;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 400;
  letter-spacing: 0;
}

h1 {
  font-family: var(--font-serif);
  max-width: 820px;
  font-size: clamp(2.25rem, 5.9vw, 5.35rem);
  line-height: 1.04;
}

h2, h3 {
  font-family: var(--font-serif);
}

.lede {
  max-width: 670px;
  margin: 26px 0 0;
  color: var(--lede);
  font-size: clamp(1.06rem, 1.8vw, 1.28rem);
  line-height: 1.55;
}

/* Hide QR scan button — not needed on landing page */
.qr-scan-button,
#qr-image-input {
  display: none !important;
}

.link-search {
  width: 100%;
  max-width: 820px;
  margin-top: 76px;
  margin-bottom: 36px;
}

.link-search-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--panel);
  padding: 6px 6px 6px 15px;
}

.link-search-control > svg,
.qr-scan-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: var(--green-dark);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.link-search-clear,
.qr-scan-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  color: var(--green-dark);
  cursor: pointer;
}

.link-search-clear {
  border: 0;
}

.qr-scan-button {
  border: 1px solid var(--line);
  transition: border-color 160ms ease, background-color 160ms ease;
}

.link-search-clear svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.qr-scan-button:hover {
  border-color: var(--green-dark);
  background: color-mix(in srgb, var(--ink) 6%, var(--paper));
}

.link-search-clear:hover {
  background: color-mix(in srgb, var(--ink) 6%, var(--paper));
}

.link-search-control input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.02rem;
  outline: none;
}

.link-search-control input::placeholder {
  color: var(--muted);
}

.link-search-status {
  min-height: 1.4em;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 400;
  text-align: left;
}

.link-search-status.found {
  color: var(--green-dark);
}

.link-search-status.not-found,
.link-search-status.error {
  color: var(--ink);
}

.link-search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--panel);
  color: var(--ink);
  text-align: left;
}

.link-search-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--green-dark);
  color: var(--paper);
  font-weight: 700;
}

.link-search-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.link-search-title {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.link-search-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: -40px;
}

.button {
  display: inline-grid;
  place-items: center;
  min-height: 52px;
  padding: 0 20px;
  border: 1px solid var(--ink);
  font-weight: 400;
}

.button.primary {
  background: var(--ink);
  color: var(--paper);
}

.button.telegram-button {
  border-color: var(--telegram);
  background: var(--telegram);
  color: var(--paper);
  font-weight: 400;
}

.button.telegram-button:hover {
  border-color: var(--telegram-dark);
  background: var(--telegram-dark);
  color: var(--paper);
}

.button.secondary {
  background: transparent;
}

.button.ghost {
  border-color: transparent;
  color: var(--green-dark);
}

.text-link {
  color: var(--green-dark);
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.device {
  width: min(100%, 360px);
  min-height: 300px;
  justify-self: center;
  padding: 20px;
  background: var(--device-bg);
  color: var(--paper);
}

.device-bar {
  width: 82px;
  height: 8px;
  margin: 0 auto 34px;
  background: var(--device-bar);
}

.chat-line {
  width: fit-content;
  max-width: 84%;
  margin: 16px 0;
  padding: 14px 16px;
}

.chat-line.left {
  background: var(--bubble-light);
  color: var(--ink);
}

.chat-line.right {
  margin-left: auto;
  background: var(--green);
}

.chat-line.tag {
  margin-top: 58px;
  border: 1px solid color-mix(in srgb, var(--beige) 40%, var(--black));
  color: var(--bubble-note);
}

.send-panel {
  display: grid;
  grid-template-columns: minmax(0, 760px);
  justify-content: center;
  gap: 18px;
  align-items: center;
  padding: clamp(34px, 7vw, 82px) 0;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

h2 {
  max-width: 650px;
  font-size: clamp(1.8rem, 4.1vw, 3.45rem);
  line-height: 1.08;
}

.send-panel p,
.steps p {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
}

.steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 4.5vw, 48px);
  margin-top: calc(clamp(48px, 8vw, 96px) + 50px);
  padding: clamp(26px, 5vw, 52px) 0 clamp(12px, 3vw, 24px);
}

.steps article {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 14px;
  min-height: 210px;
  padding: clamp(18px, 3vw, 30px) clamp(14px, 2.5vw, 26px);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border-color: var(--line);
  text-align: center;
  outline: none;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.steps article:hover,
.steps article:focus-visible {
  border-color: var(--ink);
}

.steps article:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.steps article:not(:last-child)::after {
  content: "→";
  position: absolute;
  top: 50%;
  right: calc(clamp(24px, 4.5vw, 48px) * -0.5);
  z-index: 4;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  transform: translate(50%, -50%);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-weight: 900;
}

/* Extra right padding so content doesn't crowd the arrow */
.steps article:not(:last-child) {
  padding-right: calc(clamp(14px, 2.5vw, 26px) + 22px);
}

.steps h3 {
  margin-top: 12px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  padding: 76px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 400;
}

.site-footer a:hover {
  color: var(--green-dark);
}

h3 {
  font-size: clamp(1.45rem, 2.6vw, 2.2rem);
}

@media (max-width: 820px) {
  .hero,
  .send-panel,
  .steps {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .device {
    justify-self: center;
    min-height: 300px;
  }

  .steps {
    background: transparent;
    gap: 44px;
  }

  .steps article {
    min-height: auto;
    justify-items: start;
    text-align: left;
    padding: 24px;
  }

  .steps article:not(:last-child)::after {
    content: "↓";
    top: auto;
    right: auto;
    bottom: -38px;
    left: 50%;
    transform: translateX(-50%);
  }
}

@media (max-width: 520px) {
  .landing {
    width: min(100% - 24px, 1120px);
  }

  .nav {
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .nav-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
  }

  .prefs {
    justify-content: flex-end;
  }

  .language-control {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .link-search-control {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 10px;
  }

  .qr-scan-button {
    justify-self: end;
  }

  .button {
    width: 100%;
  }
}
.language-control select,
.theme-toggle,
.button,
.nav-link,
.icon-button,
.feedback-form input,
.feedback-form textarea,
.profile-form input,
.profile-form textarea {
  border-radius: var(--radius-control);
}

.button,
.theme-toggle,
.icon-button,
.swatch {
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.button svg,
.icon-button svg,
.provider-pill svg,
.preview-orb svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button {
  grid-auto-flow: column;
  gap: 9px;
  min-height: 48px;
}

.button.primary {
  border-color: var(--green-dark);
  background: var(--green-dark);
  color: var(--paper);
}

.button.telegram-button {
  border-color: var(--telegram);
  background: var(--telegram);
  color: var(--paper);
}

.auth-status,
.form-status {
  min-height: 1.5em;
  margin: 0;
  color: var(--green-dark);
  font-size: 0.95rem;
  font-weight: 700;
}

.form-status.error {
  color: var(--ink);
}

.legal-page {
  width: min(100% - 32px, 820px);
}

.legal-page .nav {
  padding-bottom: clamp(26px, 6vw, 56px);
}

.legal-article,
.legal-hero {
  max-width: 760px;
  margin: 0 auto;
}

.legal-article h1,
.legal-hero h1 {
  font-size: clamp(2.35rem, 6.4vw, 4.75rem);
  line-height: 1.06;
}

.legal-article h2 {
  margin: 34px 0 10px;
}

.legal-article p,
.legal-article li {
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.66;
}

.legal-article ul {
  padding-left: 22px;
}

.answer-engine-context {
  display: grid;
  gap: 18px;
}

.answer-engine-context > p {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.66;
}

.answer-list {
  display: grid;
  gap: 0;
  margin: clamp(18px, 4vw, 34px) 0 0;
}

.answer-list div {
  display: grid;
  grid-template-columns: minmax(150px, 0.55fr) minmax(0, 1.45fr);
  gap: clamp(14px, 3vw, 28px);
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.answer-list div:last-child {
  border-bottom: 1px solid var(--line);
}

.answer-list dt,
.answer-list dd {
  margin: 0;
}

.answer-list dt {
  color: var(--ink);
  font-weight: 700;
  line-height: 1.45;
}

.answer-list dd {
  color: var(--muted);
  line-height: 1.62;
}

.note {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  padding: 18px;
  color: var(--lede);
}

.feedback-form,
.profile-form {
  display: grid;
  gap: 14px;
}

.feedback-form {
  max-width: 700px;
  margin: clamp(28px, 6vw, 50px) auto 0;
}

.feedback-form label,
.profile-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.feedback-form input,
.feedback-form textarea,
.profile-form input,
.profile-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 14px 16px;
  font: inherit;
  font-size: 1.02rem;
}

.feedback-form textarea,
.profile-form textarea {
  resize: vertical;
}

.dashboard-page {
  width: min(100% - 32px, 1060px);
}

.dashboard-hero {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
  padding-bottom: clamp(28px, 6vw, 54px);
}

.dashboard-hero h1 {
  font-size: clamp(2.55rem, 7vw, 5.8rem);
  line-height: 1.04;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: stretch;
}

.profile-preview,
.dashboard-panel,
.dashboard-stats article {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
}

.profile-preview {
  --profile-accent: var(--green-dark);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  min-height: 420px;
  padding: clamp(24px, 4vw, 42px);
  text-align: center;
}

.preview-orb {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid var(--profile-accent);
  background: var(--paper);
  color: var(--profile-accent);
}

.preview-orb svg {
  width: 34px;
  height: 34px;
}

.preview-kicker {
  margin: 0;
  color: var(--profile-accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.profile-preview h2 {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.profile-preview > p:not(.preview-kicker) {
  max-width: 330px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.preview-link-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  margin-top: 10px;
  color: var(--profile-accent);
  font-weight: 900;
}

.preview-link-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.dashboard-panel {
  padding: clamp(20px, 4vw, 36px);
}

.provider-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 20px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--green-dark);
  font-size: 0.92rem;
}

.accent-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0;
}

.swatch {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
}

.swatch.ink,
.swatch.sage,
.swatch.clay,
.swatch.gold {
  background: var(--ink);
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.dashboard-stats article {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 18px;
  text-align: center;
}

.dashboard-stats span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.dashboard-stats strong {
  font-size: clamp(1.45rem, 4vw, 2.1rem);
  font-weight: 400;
}

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

  .profile-preview {
    min-height: 340px;
  }
}

@media (max-width: 520px) {
  .legal-page .nav {
    flex-wrap: nowrap;
    align-items: center;
  }

  .legal-page .prefs {
    flex-shrink: 0;
    justify-content: flex-end;
  }

  .answer-list div {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .preview-link-row {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .button,
  .theme-toggle,
  .icon-button,
  .swatch {
    transition: none;
  }
}
