/* Dark only. The colors follow the app's dark theme (K-Notes frontend/src/styles/tokens.css) with the
   logo's yellow as the accent: square corners, hairlines instead of shadows, Geist for text. */
:root {
  --bg: #0a0a0a;
  --surface: #121212;
  --surface-hover: #1a1a1a;
  --deep: #050505;
  --ink: #ededed;
  --muted: #a1a1a1;
  --faint: #8f8f8f;
  --line: #2e2e2e;
  --line-strong: #454545;
  --brand: #ffd063;
  --brand-hover: #ffc43d;
  --on-brand: #171717;
  --brand-soft: #2b2311;
  --note-sand: #7c4a03;
  --success: #3fb950;
  --warning: #f5a524;

  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display: "Montserrat", var(--font);
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

  --bs-body-font-family: var(--font);
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--ink);
  --bs-link-color-rgb: 255, 208, 99;
  --bs-link-hover-color-rgb: 255, 228, 166;
  --bs-border-color: var(--line);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1 0 auto;
  padding-bottom: clamp(5rem, 3.5rem + 5vw, 8.5rem);
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 700;
  color: var(--ink);
}

h2 {
  font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.1rem);
  letter-spacing: -0.015em;
  margin-bottom: 1.75rem;
  text-align: center;
}

h3 {
  font-size: 1.1rem;
}

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

.btn {
  font-weight: 600;
  border-radius: 0;
}

.btn-primary {
  --bs-btn-color: var(--on-brand);
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-color: var(--on-brand);
  --bs-btn-hover-bg: var(--brand-hover);
  --bs-btn-hover-border-color: var(--brand-hover);
  --bs-btn-active-color: var(--on-brand);
  --bs-btn-active-bg: var(--brand-hover);
  --bs-btn-active-border-color: var(--brand-hover);
  --bs-btn-focus-shadow-rgb: 255, 208, 99;
}

.btn-outline-secondary {
  --bs-btn-color: var(--ink);
  --bs-btn-border-color: var(--line-strong);
  --bs-btn-bg: transparent;
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-bg: var(--surface-hover);
  --bs-btn-hover-border-color: var(--muted);
  --bs-btn-active-color: var(--ink);
  --bs-btn-active-bg: var(--surface-hover);
  --bs-btn-active-border-color: var(--muted);
}

.btn-link {
  --bs-btn-color: var(--brand);
  --bs-btn-hover-color: var(--ink);
  --bs-btn-active-color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

/* Header */
.site-header {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);

  .brand img {
    height: 2.6rem;
    width: auto;
    display: block;

    @media (max-width: 575.98px) {
      height: 2.1rem;
    }
  }
}

.site-nav {
  display: flex;
  gap: 1.75rem;
  margin-right: 0.75rem;

  a {
    color: var(--muted);
    font-weight: 500;
    text-decoration: none;

    &:hover {
      color: var(--ink);
    }
  }

  @media (max-width: 767.98px) {
    display: none;
  }
}

.icon-link-btn {
  display: grid;
  place-items: center;
  padding: 4px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  text-decoration: none;

  &:hover {
    color: var(--ink);
  }
}

/* Hero */
.hero {
  padding: clamp(2.5rem, 1.5rem + 4vw, 5rem) 0 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2.25rem, 1.5rem + 3vw, 4.5rem);

  @media (max-width: 991.98px) {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    text-align: center;
  }
}

.hero-text {
  h1 {
    font-size: clamp(2.3rem, 1.4rem + 3vw, 3.7rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.03em;
    max-width: 14ch;
    margin: 0 0 1.25rem;

    @media (max-width: 991.98px) {
      margin-inline: auto;
    }
  }

  .lede {
    color: var(--muted);
    font-size: 1.2rem;
    max-width: 34rem;
    margin: 0 0 2rem;

    @media (max-width: 991.98px) {
      margin-inline: auto;
    }
  }
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;

  @media (max-width: 991.98px) {
    justify-content: center;
  }

  .btn-lg {
    padding: 0.7rem 1.4rem;
    font-size: 1.1rem;
  }
}

.hero-note {
  margin: 1rem 0 0;
  color: var(--faint);
  font-size: 0.95rem;
}

/* The sync demo: one checklist on two devices, as the app keeps it in step. */
.sync-demo {
  margin: 0;
  width: 100%;
  max-width: 34rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 3.5rem minmax(0, 1fr);
  align-items: stretch;

  @media (max-width: 575.98px) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 2.25rem auto;
  }
}

.device {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
}

.device-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
}

.device-name {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  color: var(--ink);
}

.sync-state {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  transition: color 0.2s ease;

  &[data-state="syncing"] .bi {
    animation: spin 1.1s linear infinite;
  }

  &[data-state="offline"] {
    color: var(--warning);
  }
}

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

.demo-note {
  flex: 1;
  margin: 0.75rem;
  padding: 0.85rem 0.9rem 0.7rem;
  background: var(--note-sand);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 12.5rem;
}

.demo-title {
  margin: 0 0 0.45rem;
  font-weight: 600;
}

.demo-items {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.95rem;

  li {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.18rem 0;
  }

  li.arrive {
    animation: arrive 0.45s var(--ease-out) both;
  }

  .box {
    flex: none;
    width: 0.95rem;
    height: 0.95rem;
    border: 1px solid rgba(237, 237, 237, 0.7);
    display: grid;
    place-items: center;
  }

  .done .box::after {
    content: "";
    width: 0.3rem;
    height: 0.55rem;
    border: solid var(--ink);
    border-width: 0 2px 2px 0;
    transform: translateY(-1px) rotate(45deg);
  }

  .done .text {
    color: rgba(237, 237, 237, 0.55);
    text-decoration: line-through;
  }

  .caret::after {
    content: "";
    display: inline-block;
    width: 1px;
    height: 1em;
    margin-left: 1px;
    vertical-align: -0.12em;
    background: var(--ink);
    animation: blink 1s steps(1) infinite;
  }
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* A hairline between the devices with a dot running along it while a change travels. */
.sync-link {
  position: relative;
  align-self: center;
  height: 1px;
  background: var(--line-strong);

  span {
    position: absolute;
    top: -3px;
    left: 0;
    width: 7px;
    height: 7px;
    background: var(--brand);
    opacity: 0;
  }

  &.to-phone span {
    animation: travel 0.8s var(--ease-out) both;
  }

  &.to-laptop span {
    animation: travel 0.8s var(--ease-out) reverse both;
  }

  @media (max-width: 575.98px) {
    justify-self: center;
    align-self: stretch;
    width: 1px;
    height: auto;

    span {
      top: 0;
      left: -3px;
    }

    &.to-phone span,
    &.to-laptop span {
      animation-name: travel-down;
    }
  }
}

@keyframes travel {
  0% {
    opacity: 1;
    left: 0;
  }
  100% {
    opacity: 1;
    left: calc(100% - 7px);
  }
}

@keyframes travel-down {
  0% {
    opacity: 1;
    top: 0;
  }
  100% {
    opacity: 1;
    top: calc(100% - 7px);
  }
}

/* Screenshots: both themes are in the page, the switch shows one. */
.shot {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);

  img {
    display: block;
    width: 100%;
    height: auto;
  }
}

[data-shots="dark"] .shot-light,
[data-shots="light"] .shot-dark {
  display: none !important;
}

.hero-shot {
  margin-top: clamp(3rem, 2rem + 3vw, 4.5rem);
}

.theme-switch {
  display: flex;
  width: max-content;
  margin: 0 auto 2rem;
  border: 1px solid var(--line-strong);

  button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 1rem;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-weight: 500;
    transition:
      color 0.15s ease,
      background-color 0.15s ease;

    &:hover {
      color: var(--ink);
    }

    &[aria-pressed="true"] {
      background: var(--surface-hover);
      color: var(--ink);
    }

    + button {
      border-left: 1px solid var(--line-strong);
    }
  }
}

/* Sections */
.section {
  padding: clamp(3.5rem, 2rem + 4vw, 6rem) 0 0;
}

.section-lede {
  color: var(--muted);
  max-width: 44rem;
  margin: -1rem auto 2.5rem;
  text-align: center;
}

.feature-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.25rem 3rem;

  @media (max-width: 991.98px) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  @media (max-width: 575.98px) {
    grid-template-columns: minmax(0, 1fr);
  }

  li {
    border-top: 1px solid var(--line);
    padding-top: 1.4rem;
  }

  .bi {
    display: block;
    font-size: 1.5rem;
    color: var(--brand);
    margin-bottom: 0.6rem;
  }

  h3 {
    margin-bottom: 0.4rem;
  }

  p {
    color: var(--muted);
    margin: 0;
    max-width: 36ch;
  }
}

.screens {
  display: grid;
  /* Ratios make the 16:10 desktop and the tall phone screenshot the same height. */
  grid-template-columns: minmax(0, 3.46fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;

  @media (max-width: 767.98px) {
    grid-template-columns: minmax(0, 1fr);

    .screen-tall {
      max-width: 20rem;
      margin: 0 auto;
    }
  }

  figure {
    margin: 0;
  }

  figcaption {
    margin: 0.9rem auto 0;
    color: var(--muted);
    font-size: 0.95rem;
    max-width: 52ch;
    text-align: center;
  }
}

/* Self-host */
.install-steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;

  @media (max-width: 991.98px) {
    grid-template-columns: minmax(0, 1fr);
    max-width: 44rem;
    margin: 0 auto;
  }

  li {
    counter-increment: step;
    display: flex;
    flex-direction: column;
    padding: 1.4rem 1.5rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
  }

  h3 {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 1.15rem;
    margin-bottom: 0.6rem;

    &::before {
      content: counter(step);
      flex: none;
      width: 1.8rem;
      height: 1.8rem;
      display: grid;
      place-items: center;
      background: var(--brand);
      color: var(--on-brand);
      font-size: 0.95rem;
    }
  }

  p {
    color: var(--muted);
    font-size: 0.97rem;
    margin: 0 0 1.1rem;
  }

  .code {
    margin-top: auto;
  }
}

.code {
  position: relative;
  background: var(--deep);
  border: 1px solid var(--line);

  pre {
    margin: 0;
    padding: 0.9rem 1rem;
    padding-right: 3rem;
    /* Wrapped rather than scrolled, so the long download URL is readable; copying takes the text as is. */
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: var(--mono);
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--ink);
  }
}

.copy-btn {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--faint);
  font-size: 1rem;
  transition:
    color 0.15s ease,
    background-color 0.15s ease;

  .bi {
    grid-area: 1 / 1;
    transition:
      opacity 0.2s var(--ease-out),
      transform 0.2s var(--ease-out);
  }

  .bi-check2 {
    color: var(--success);
    opacity: 0;
    transform: scale(0.6);
  }

  &:hover {
    color: var(--ink);
    background: var(--surface-hover);
  }

  &:active {
    transform: scale(0.94);
  }

  &.copied {
    .bi-clipboard {
      opacity: 0;
      transform: scale(0.6);
    }

    .bi-check2 {
      opacity: 1;
      transform: none;
    }
  }
}

.install-more {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 3rem;
  margin-top: clamp(2.5rem, 1.75rem + 2vw, 3.5rem);
  padding-top: 2rem;
  border-top: 1px solid var(--line);

  @media (max-width: 991.98px) {
    grid-template-columns: minmax(0, 1fr);
    max-width: 44rem;
    margin-inline: auto;
  }

  p {
    color: var(--muted);
    margin: 0 0 0.9rem;
  }
}

.install-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

/* FAQ */
.faq {
  max-width: 52rem;
  margin: 0 auto;
  border-top: 1px solid var(--line);

  details {
    border-bottom: 1px solid var(--line);
  }

  summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 0.25rem;
    font-family: var(--display);
    font-size: 1.1rem;
    font-weight: 600;
    transition: color 0.15s ease;

    &::-webkit-details-marker {
      display: none;
    }

    &:hover {
      color: var(--brand);
    }

    .bi {
      flex: none;
      color: var(--muted);
      transition: transform 0.26s var(--ease-out);
    }
  }

  details[open]:not(.closing) summary .bi {
    transform: rotate(180deg);
  }

  .faq-answer {
    overflow: hidden;
  }

  p {
    color: var(--muted);
    margin: 0;
    padding: 0 0.25rem 1.3rem;
    max-width: 70ch;
  }
}

/* Footer (same layout as the other Karlosoft projects) */
.app-footer {
  flex-shrink: 0;
  padding: 3.25rem 0 2.5rem;
  background: var(--deep);
  border-top: 1px solid transparent;
  border-image: linear-gradient(90deg, transparent 0%, #7c4a03 25%, #ffd063 75%, transparent 100%) 1;
  color: var(--faint);
  font-size: 0.95rem;

  h5 {
    font-family: var(--display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 0.9rem;
  }

  p {
    line-height: 1.6;
  }

  a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s ease;

    &:hover,
    &:focus-visible {
      color: var(--ink);
    }
  }

  p a {
    text-decoration: underline;
    text-decoration-color: var(--line-strong);
    text-underline-offset: 3px;
  }

  ul li {
    margin-bottom: 0.45rem;
  }
}

/* Language picker, shown once there is more than one language */
.lang-modal {
  .modal-content {
    background: var(--bg);
    border: 0;
    border-radius: 0;
  }

  .modal-header {
    align-items: flex-start;
    border: 0;
    padding: 2rem 2rem 0.5rem;
  }

  .modal-title {
    font-size: 1.85rem;
    font-weight: 800;
    margin: 0 0 0.25rem;
  }

  .modal-header p {
    color: var(--muted);
    margin: 0;
  }

  .modal-body {
    padding: 1.5rem 2rem 2.5rem;
  }
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 8px;
}

.lang-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 6px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;

  img {
    height: 45px;
    width: auto;
    max-width: 100%;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
  }

  &:hover,
  &.active {
    color: var(--ink);
    background: var(--surface);
    border-color: var(--line);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sync-state[data-state="syncing"] .bi,
  .demo-items .caret::after {
    animation: none;
  }
}
