/* Dark only. The colors follow the app's dark theme (K-Calendar 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;
  /* Dark values of the calendar palette (K-Calendar frontend/src/styles/palette.css). */
  --cal-teal: #0bd8b6;
  --cal-indigo: #9eb1ff;
  --success: #3fb950;

  --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 week demo: an event is created to repeat every weekday, fills the week, and its reminder arrives.
   Events are drawn like the app's: tinted into the surface with a 2 px bar in the calendar's colour. */
.week-demo {
  margin: 0;
  width: 100%;
  max-width: 36rem;
}

.wk-window {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
}

.wk-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;
}

.wk-range {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 500;
}

.wk-view {
  padding: 0.05rem 0.55rem;
  border: 1px solid var(--line-strong);
  color: var(--muted);
}

.composer {
  padding: 0.75rem 0.9rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

.composer-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.composer-title {
  min-height: 1.6em;
  margin: 0.15rem 0 0.55rem;
  padding-bottom: 0.15rem;
  border-bottom: 1px solid var(--line-strong);
  font-size: 1.1rem;
  font-weight: 600;

  &:empty::before {
    content: attr(data-placeholder);
    color: var(--faint);
    font-weight: 400;
  }

  &.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;
  }
}

.composer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.1rem;
  font-size: 0.8rem;
  color: var(--muted);

  > span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
  }
}

.composer-repeat {
  transition: color 0.2s ease;

  &.is-on {
    color: var(--brand);
  }

  &.flash {
    animation: flash 0.5s var(--ease-out);
  }
}

@keyframes flash {
  from {
    transform: scale(1.08);
  }
}

.wk {
  --hour: 2.25rem;
  --days: 7;
  --gutter: 2.9rem;
  font-size: 0.72rem;

  @media (max-width: 575.98px) {
    --days: 5;
    --gutter: 2.6rem;

    .is-weekend {
      display: none;
    }
  }
}

.wk-head,
.wk-body {
  display: grid;
  grid-template-columns: var(--gutter) repeat(var(--days), minmax(0, 1fr));
}

.wk-head {
  border-bottom: 1px solid var(--line);
  color: var(--muted);

  span {
    padding: 0.35rem 0;
    text-align: center;
    white-space: nowrap;
  }

  b {
    font-family: var(--mono);
    font-weight: 400;
    color: var(--ink);
  }
}

.wk-hours span {
  display: block;
  height: var(--hour);
  padding: 0.1rem 0.4rem 0 0;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--faint);
  text-align: right;
}

.wk-day {
  position: relative;
  border-left: 1px solid var(--line);
  background: linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% var(--hour);
}

.wk-ev {
  position: absolute;
  top: calc(var(--start) * var(--hour) + 1px);
  left: 2px;
  right: 2px;
  height: max(1.15rem, calc(var(--length) * var(--hour) - 2px));
  padding: 0.08rem 0.3rem;
  border-left: 2px solid var(--c);
  background: color-mix(in srgb, var(--c) 16%, var(--surface));
  line-height: 1.35;

  span {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

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

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

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

/* A push notification over the corner of the week, as the browser shows it. */
.wk-toast {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  width: min(15.5rem, calc(100% - 1.5rem));
  padding: 0.6rem 0.8rem 0.7rem;
  background: var(--surface-hover);
  border: 1px solid var(--line-strong);
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.75rem);
  transition:
    opacity 0.3s ease,
    transform 0.45s var(--ease-out),
    visibility 0s linear 0.45s;

  &.is-shown {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
  }
}

.wk-toast-app {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--muted);

  .bi {
    color: var(--brand);
  }
}

.wk-toast-when {
  margin-left: auto;
  color: var(--faint);
}

.wk-toast-title {
  margin: 0.3rem 0 0;
  font-weight: 600;
  font-size: 0.92rem;
}

.wk-toast-text {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

/* 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.26fr) 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) {
  .composer-title.caret::after {
    animation: none;
  }

  .wk-toast {
    transition: none;
  }
}
