:root {
  --ink: #16181d;
  --ink-soft: #4b505c;
  --muted: #767c8a;
  --paper: #ffffff;
  --paper-soft: #f6f7f9;
  --line: #e7e9ee;
  --brand: #4f46e5;
  --brand-ink: #ffffff;
  --brand-soft: #eef0ff;
  --accent-1: #6d5bf5;
  --accent-2: #22d3c9;
  --danger: #d33;
  --success: #1a8f5e;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-md: 0 12px 32px -12px rgba(22, 24, 29, 0.18);
  --shadow-lg: 0 24px 60px -20px rgba(22, 24, 29, 0.28);
  --max-width: 1120px;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3 {
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}

p {
  margin: 0 0 16px;
  color: var(--ink-soft);
}

.eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand);
  margin: 0 0 14px;
}

.center {
  text-align: center;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

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

.btn-primary {
  background: var(--brand);
  color: var(--brand-ink);
  box-shadow: 0 10px 24px -10px rgba(79, 70, 229, 0.6);
}

.btn-primary:hover {
  background: #4338ca;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn-ghost:hover {
  background: var(--paper-soft);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.site-nav a {
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink-soft);
}

.site-nav a:hover {
  color: var(--ink);
}

.site-nav a.is-active {
  color: var(--brand);
}

/* Page layout */

#page-main > section {
  position: relative;
}

.not-found {
  padding: 120px 24px;
  text-align: center;
}

.not-found a {
  color: var(--brand);
  font-weight: 600;
}

.text-section {
  padding: 96px 0;
  text-align: center;
}

.text-section h2 {
  max-width: 20ch;
  margin-left: auto;
  margin-right: auto;
  font-size: clamp(26px, 3vw, 36px);
}

.text-section p {
  max-width: 60ch;
  margin-left: auto;
  margin-right: auto;
}

/* Hero */

.hero {
  background:
    radial-gradient(1100px 500px at 15% -10%, var(--brand-soft), transparent 60%),
    linear-gradient(180deg, #fbfbfe 0%, #ffffff 60%);
  padding: 88px 0 96px;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}

.hero-copy h1 {
  font-size: clamp(34px, 4.4vw, 54px);
}

.hero-copy .lead {
  font-size: 18px;
  max-width: 46ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.image-frame {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: var(--paper-soft);
  aspect-ratio: 4 / 3;
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Features */

.features {
  padding: 96px 0;
  background: var(--paper-soft);
}

.features .eyebrow,
.features h2 {
  display: block;
}

.features h2 {
  max-width: 20ch;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 48px;
  font-size: clamp(26px, 3vw, 36px);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.feature-card {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 28px 24px;
  box-shadow: var(--shadow-md);
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  font-size: 22px;
  margin-bottom: 18px;
}

.feature-card h3 {
  font-size: 19px;
  margin-bottom: 8px;
}

.feature-card p {
  margin-bottom: 0;
  font-size: 15px;
}

/* About */

.about {
  padding: 96px 0;
}

.about-inner {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 56px;
  align-items: center;
}

.about-copy h2 {
  font-size: clamp(26px, 3vw, 36px);
}

.carousel-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  will-change: opacity, transform;
}

/* CTA */

.cta {
  padding: 96px 0 104px;
  background: linear-gradient(160deg, var(--ink) 0%, #262b3d 100%);
  color: #fff;
  text-align: center;
}

.cta-inner {
  max-width: 640px;
}

.cta h2 {
  font-size: clamp(28px, 3.6vw, 40px);
  color: #fff;
}

.cta p {
  color: rgba(255, 255, 255, 0.72);
  font-size: 17px;
}

.cta-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-icon {
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.22);
}

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

/* Footer */

.site-footer {
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 24px;
}

.footer-inner p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 18px;
}

.footer-icon-link {
  display: inline-flex;
  color: var(--muted);
  opacity: 0.6;
}

.footer-icon-link:hover {
  color: var(--ink);
  opacity: 1;
}

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

.admin-link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  opacity: 0.6;
}

.admin-link:hover {
  opacity: 1;
}

/* Responsive */

@media (max-width: 860px) {
  .hero-inner,
  .about-inner {
    grid-template-columns: 1fr;
  }

  .hero-media {
    order: -1;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 56px 0 64px;
  }

  .features,
  .about,
  .cta {
    padding: 64px 0;
  }
}

@media (max-width: 480px) {
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .footer-inner {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}

/* ---------------------------------------------------------------- */
/* Edit mode                                                        */
/* ---------------------------------------------------------------- */

.editable {
  outline: 2px dashed transparent;
  outline-offset: 4px;
  border-radius: 4px;
  transition: outline-color 0.15s ease, background-color 0.15s ease;
  cursor: text;
}

.editable:hover {
  outline-color: rgba(79, 70, 229, 0.35);
}

.editable:focus {
  outline: 2px solid var(--brand);
  background: var(--brand-soft);
}

.href-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  margin-left: 6px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
}

.href-edit-btn:hover {
  background: var(--paper-soft);
  color: var(--ink);
}

.cta .href-edit-btn {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.cta .href-edit-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.image-frame.editable-image {
  cursor: default;
}

.image-actions {
  position: absolute;
  bottom: 14px;
  right: 14px;
  z-index: 5;
  display: flex;
  gap: 8px;
}

.image-action-btn {
  background: rgba(22, 24, 29, 0.78);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.image-action-btn:hover {
  background: rgba(22, 24, 29, 0.92);
}

.image-frame.uploading::after {
  content: "Uploading…";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

.carousel-manager {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper-soft);
  position: relative;
}

.carousel-manager.uploading {
  opacity: 0.6;
  pointer-events: none;
}

.carousel-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.carousel-thumb {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper);
}

.carousel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-btn {
  position: absolute;
  border: none;
  background: rgba(22, 24, 29, 0.78);
  color: #fff;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.thumb-btn:hover:not(:disabled) {
  background: rgba(22, 24, 29, 0.92);
}

.thumb-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.thumb-crop {
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
}

.thumb-remove {
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 13px;
}

.thumb-move {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
}

.thumb-move-left,
.thumb-move-right {
  flex: 1;
  height: 20px;
  font-size: 12px;
}

.thumb-move-left {
  border-bottom-left-radius: var(--radius-sm);
}

.thumb-move-right {
  border-bottom-right-radius: var(--radius-sm);
}

.carousel-add-btn {
  width: 100%;
}

/* Image cropper */

.cropper-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(22, 24, 29, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.cropper-modal {
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: calc(100vw - 48px);
}

.cropper-title {
  margin: 0;
  font-size: 17px;
  align-self: flex-start;
}

.cropper-viewport {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--paper-soft);
  cursor: grab;
  touch-action: none;
  max-width: 100%;
}

.cropper-viewport:active {
  cursor: grabbing;
}

.cropper-stage {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  user-select: none;
  pointer-events: none;
}

.cropper-zoom-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.cropper-zoom {
  flex: 1;
}

.cropper-zoom-label {
  color: var(--muted);
  font-size: 16px;
  width: 16px;
  text-align: center;
}

.cropper-actions {
  display: flex;
  gap: 10px;
  align-self: flex-end;
}

.block-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  display: flex;
  gap: 6px;
}

.block-control-btn {
  background: rgba(22, 24, 29, 0.78);
  color: #fff;
  border: none;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(4px);
  white-space: nowrap;
}

.block-control-btn:hover:not(:disabled) {
  background: rgba(22, 24, 29, 0.92);
}

.block-control-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.block-remove {
  background: rgba(211, 51, 51, 0.85);
}

.block-remove:hover:not(:disabled) {
  background: rgba(211, 51, 51, 1);
}

.item-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
}

.item-btn {
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(22, 24, 29, 0.78);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-btn:hover:not(:disabled) {
  background: rgba(22, 24, 29, 0.92);
}

.item-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.item-add-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
}

.add-block-picker {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 32px 24px;
}

.add-block-select {
  font: inherit;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--paper);
}

body.edit-mode {
  padding-bottom: 76px;
}

.edit-toolbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: rgba(22, 24, 29, 0.92);
  backdrop-filter: blur(10px);
  color: #fff;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
}

.edit-toolbar[hidden] {
  display: none;
}

.edit-toolbar-brand {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.save-status {
  font-size: 14px;
  flex: 1;
}

.save-status.state-dirty {
  color: #ffd166;
}

.save-status.state-saving {
  color: rgba(255, 255, 255, 0.75);
}

.save-status.state-saved {
  color: #6ee7b7;
}

.save-status.state-error {
  color: #ff8a8a;
}

.edit-toolbar-actions {
  display: flex;
  gap: 10px;
}

.edit-toolbar .btn-ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.edit-toolbar .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ---------------------------------------------------------------- */
/* Login page                                                       */
/* ---------------------------------------------------------------- */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(900px 500px at 20% 0%, var(--brand-soft), transparent 60%),
    var(--paper-soft);
}

.login-wrap {
  width: 100%;
  padding: 24px;
}

.login-card {
  max-width: 360px;
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
}

.login-card h1 {
  font-size: 22px;
  margin-bottom: 6px;
}

.login-hint {
  font-size: 14px;
  margin-bottom: 24px;
}

.login-card label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.login-card input {
  font: inherit;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  margin-bottom: 8px;
}

.login-card input:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.login-card .btn {
  margin-top: 12px;
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  margin: 4px 0 0;
}

.login-back {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}

.login-back:hover {
  color: var(--ink);
}

/* ---------------------------------------------------------------- */
/* Page management                                                  */
/* ---------------------------------------------------------------- */

.pages-card {
  max-width: 560px;
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
}

.pages-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.pages-card-header h1 {
  font-size: 22px;
  margin: 0;
}

.pages-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pages-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}

.pages-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pages-item-title {
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
}

.pages-item-title:hover {
  color: var(--brand);
}

.pages-item-slug {
  font-size: 13px;
  color: var(--muted);
}

.pages-item-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.new-page-form {
  display: flex;
  gap: 10px;
}

.new-page-form input {
  flex: 1;
  font: inherit;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.new-page-form input:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}
