@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=Fira+Code:wght@400;500&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #ffffff;
  --bg-alt: #fafafa;
  --card-bg: #f5f5f5;
  --text: #1a1a1a;
  --muted: #666666;
  --muted-soft: #888888;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --border: #eaeaea;
  --border-strong: #e5e5e5;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.04);
  --radius: 12px;
  --radius-sm: 8px;
  --brand-avatar-bg: #dbeafe;
  --header-height: 72px;
  --font-sans: 'Inter', 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Fira Code', 'JetBrains Mono', 'SFMono-Regular', Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

body.home-page {
  --brand-avatar-bg: #dbeafe;
  background:
    radial-gradient(circle at 8% 4%, rgba(37, 99, 235, 0.16), rgba(37, 99, 235, 0) 34%),
    radial-gradient(circle at 92% 8%, rgba(14, 165, 233, 0.16), rgba(14, 165, 233, 0) 34%),
    linear-gradient(180deg, #f5f9ff 0%, #ffffff 34%, #f7fbff 100%);
}

body.clickup-page {
  --brand-avatar-bg: #e4ddff;
}

body.ramble-page {
  --brand-avatar-bg: #ffdcd9;
}

body.society-page {
  --brand-avatar-bg: #ffe4f2;
}

body.testimonials-page {
  --brand-avatar-bg: #dafbe6;
}

a {
  color: inherit;
}

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

[id] {
  scroll-margin-top: calc(var(--header-height) + 20px);
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 72px 0;
}

.section-title {
  margin: 0 0 14px;
  font-size: clamp(1.75rem, 1.2rem + 1.8vw, 2.3rem);
  line-height: 1.2;
}

.section-subtitle {
  margin: 0 0 24px;
  color: var(--muted);
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-soft);
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 32px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--accent-dark);
}

.btn-outline {
  background: #ffffff;
  color: var(--accent);
  border-color: var(--accent);
}

.btn-outline:hover,
.btn-outline:focus-visible {
  background: #eff6ff;
}

.btn:focus-visible,
.site-nav a:focus-visible,
.section-nav a:focus-visible,
.brand:focus-visible,
.nav-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  min-height: var(--header-height);
}

.nav-wrap {
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-avatar {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: var(--brand-avatar-bg);
  border: 1px solid rgba(100, 116, 139, 0.26);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  flex-shrink: 0;
}

.brand-avatar img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  transform: scale(2.22) translateY(20%);
  transform-origin: center 45%;
  position: relative;
  z-index: 1;
}

.brand-text {
  line-height: 1;
}

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

.site-nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 8px 0;
  position: relative;
  transition: color 0.2s ease;
}

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

.site-nav a.current {
  color: var(--text);
  font-weight: 600;
}

.site-nav a.current::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 1px;
  width: 100%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.nav-toggle {
  display: none;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  border-radius: var(--radius-sm);
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.menu-icon {
  display: inline-block;
  width: 18px;
  height: 2px;
  background: var(--text);
  position: relative;
}

.menu-icon::before,
.menu-icon::after {
  content: '';
  width: 18px;
  height: 2px;
  position: absolute;
  left: 0;
  background: var(--text);
}

.menu-icon::before {
  top: -6px;
}

.menu-icon::after {
  top: 6px;
}

.hero-section {
  padding-top: 80px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  gap: 36px;
  align-items: center;
}

.hero-copy {
  max-width: 620px;
}

.hero-title {
  margin: 0;
  font-size: clamp(2.4rem, 1.7rem + 2.8vw, 4rem);
  line-height: 1.0;
  letter-spacing: -0.025em;
}

.hero-role {
  margin: 20px 0 0;
  font-size: clamp(1.35rem, 1.05rem + 1.25vw, 2rem);
  color: #334155;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.hero-copy p {
  margin: 0 0 18px;
}

.hero-media {
  width: 100%;
  justify-self: end;
}

.hero-media .video-placeholder {
  border-color: #d3def0;
  background: linear-gradient(160deg, #eaf2ff 0%, #e0ecff 100%);
}

.hero-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: #000;
  display: block;
  object-fit: cover;
}

.video-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: #ededed;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
}

.video-placeholder::before {
  content: '';
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border-strong);
  position: absolute;
}

.video-placeholder::after {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 18px solid var(--muted);
  transform: translateX(2px);
}

.video-label {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.95rem;
  font-weight: 500;
  width: calc(100% - 24px);
}

.home-page .hero-section {
  padding-top: 56px;
  padding-bottom: 14px;
}

.home-page .hero-grid {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 540px);
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid #dce6f6;
  border-radius: 18px;
  padding: clamp(20px, 3vw, 34px);
  box-shadow: 0 14px 36px rgba(37, 99, 235, 0.09);
}

.home-page .projects-section {
  background: transparent;
  border-top: 0;
  border-bottom: 0;
  padding-top: 14px;
  padding-bottom: 24px;
}

.home-page .about-section {
  padding-top: 4px;
}

.home-page .about-card {
  max-width: none;
  background: linear-gradient(165deg, #fffdf6 0%, #fdf4d7 100%);
  border-color: #f0e4b0;
  border-top: 3px solid #eab308;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

.projects-section {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.project-card {
  --card-accent: var(--accent);
  --card-accent-dark: var(--accent-dark);
  --card-surface-start: #ffffff;
  --card-surface-end: #f7fbff;
  --card-border: #dbe5f5;
  height: 100%;
  background: linear-gradient(160deg, var(--card-surface-start) 0%, var(--card-surface-end) 100%);
  border: 1px solid var(--card-border);
  border-top: 3px solid var(--card-accent);
  border-radius: var(--radius);
  padding: 32px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.project-card--clickup {
  --card-accent: #7c3aed;
  --card-accent-dark: #6d28d9;
  --card-surface-start: #faf7ff;
  --card-surface-end: #ece5ff;
  --card-border: #ddd0fb;
}

.project-card--ramble {
  --card-accent: #ea580c;
  --card-accent-dark: #c2410c;
  --card-surface-start: #fff7f1;
  --card-surface-end: #ffe8d8;
  --card-border: #f6d7c2;
}

.project-card--society {
  --card-accent: #d9468c;
  --card-accent-dark: #be185d;
  --card-surface-start: #fff5fb;
  --card-surface-end: #ffe5f2;
  --card-border: #f0d0e0;
}

.project-card--testimonials {
  --card-accent: #0f9f63;
  --card-accent-dark: #0b7f4f;
  --card-surface-start: #f3fcf7;
  --card-surface-end: #e1f6ea;
  --card-border: #c8e9d8;
}

.project-card--ai-writing-systems {
  --card-accent: #0e7c86;
  --card-accent-dark: #0a5e66;
  --card-surface-start: #f1fafb;
  --card-surface-end: #ddf0f2;
  --card-border: #c2e3e6;
}

body.home-page .project-card--clickup {
  background: linear-gradient(160deg, #faf7ff 0%, #ece5ff 100%) !important;
  border-color: #ddd0fb !important;
  border-top-color: #7c3aed !important;
}

body.home-page .project-card--ramble {
  background: linear-gradient(160deg, #fff7f1 0%, #ffe8d8 100%) !important;
  border-color: #f6d7c2 !important;
  border-top-color: #ea580c !important;
}

body.home-page .project-card--society {
  background: linear-gradient(160deg, #fff5fb 0%, #ffe5f2 100%) !important;
  border-color: #f0d0e0 !important;
  border-top-color: #d9468c !important;
}

body.home-page .project-card--testimonials {
  background: linear-gradient(160deg, #f3fcf7 0%, #e1f6ea 100%) !important;
  border-color: #c8e9d8 !important;
  border-top-color: #0f9f63 !important;
}

body.home-page .project-card--ai-writing-systems {
  background: linear-gradient(160deg, #f1fafb 0%, #ddf0f2 100%) !important;
  border-color: #c2e3e6 !important;
  border-top-color: #0e7c86 !important;
}

.project-card-content {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.project-title {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.2;
}

.project-gif {
  width: 100%;
  margin: 14px 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #f8fafc;
  object-fit: cover;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.project-gif-link {
  display: block;
  border-radius: 10px;
  text-decoration: none;
}

.project-gif-link:hover .project-gif {
  transform: translateY(-1px);
  border-color: var(--card-accent);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
}

.project-gif-link:focus-visible {
  outline: 2px solid var(--card-accent);
  outline-offset: 3px;
}

.project-subtitle {
  margin: 10px 0 18px;
  font-size: 0.95rem;
  color: var(--muted);
}

.project-description {
  margin: 0 0 16px;
  color: var(--text);
}

.project-deliverables {
  margin: 0 0 28px;
  font-size: 0.9rem;
  color: var(--muted-soft);
}

.project-card .btn {
  margin-top: auto;
  align-self: flex-start;
}

.home-page .project-card .btn-primary {
  background: var(--card-accent);
}

.home-page .project-card .btn-primary:hover,
.home-page .project-card .btn-primary:focus-visible {
  background: var(--card-accent-dark);
}

body.home-page .project-card--clickup .btn-primary {
  background: #7c3aed !important;
}

body.home-page .project-card--clickup .btn-primary:hover,
body.home-page .project-card--clickup .btn-primary:focus-visible {
  background: #6d28d9 !important;
}

body.home-page .project-card--ramble .btn-primary {
  background: #ea580c !important;
}

body.home-page .project-card--ramble .btn-primary:hover,
body.home-page .project-card--ramble .btn-primary:focus-visible {
  background: #c2410c !important;
}

body.home-page .project-card--society .btn-primary {
  background: #d9468c !important;
}

body.home-page .project-card--society .btn-primary:hover,
body.home-page .project-card--society .btn-primary:focus-visible {
  background: #be185d !important;
}

body.home-page .project-card--testimonials .btn-primary {
  background: #0f9f63 !important;
}

body.home-page .project-card--testimonials .btn-primary:hover,
body.home-page .project-card--testimonials .btn-primary:focus-visible {
  background: #0b7f4f !important;
}

body.home-page .project-card--ai-writing-systems .btn-primary {
  background: #0e7c86 !important;
}

body.home-page .project-card--ai-writing-systems .btn-primary:hover,
body.home-page .project-card--ai-writing-systems .btn-primary:focus-visible {
  background: #0a5e66 !important;
}

@media (min-width: 901px) {
  .project-card-wide {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(0, 1.1fr);
    align-items: stretch;
    gap: 24px;
  }

  .project-card-wide .project-gif-link {
    height: 100%;
  }

  .project-card-wide .project-gif {
    margin: 0;
    height: 100%;
    min-height: 220px;
  }

  .project-card-wide .project-subtitle {
    margin-top: 8px;
  }
}

.about-section {
  background: #ffffff;
}

.about-card {
  max-width: 780px;
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 34px;
}

.about-card p {
  margin: 0 0 22px;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 30px 0 38px;
  background: #ffffff;
}

.footer-inner {
  text-align: center;
  color: var(--muted-soft);
  font-size: 0.9rem;
}

.footer-inner p {
  margin: 6px 0;
}

.footer-inner a {
  color: var(--muted);
  text-decoration: none;
}

.footer-inner a:hover {
  color: var(--text);
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 0;
}

.footer-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  transition: color 0.15s ease, transform 0.15s ease;
}

.footer-icon:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.footer-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.case-study-page {
  padding: 40px 0 72px;
}

.case-study-page > .container {
  max-width: 1240px;
}

.case-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 30px;
  align-items: start;
}

.section-nav-wrapper {
  position: sticky;
  top: calc(var(--header-height) + 16px);
}

.section-nav {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.section-nav a {
  text-decoration: none;
  font-size: 0.93rem;
  color: var(--muted);
  border-radius: 6px;
  padding: 8px 10px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.section-nav a:hover {
  background: #f3f4f6;
  color: var(--text);
}

.section-nav a.is-active {
  background: #eff6ff;
  color: var(--accent);
  font-weight: 600;
}

.project-intro {
  background: var(--bg-alt);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 30px;
  margin-bottom: 22px;
}

.project-intro h1 {
  margin: 0;
  font-size: clamp(2rem, 1.5rem + 1.4vw, 2.65rem);
  line-height: 1.15;
}

.project-intro .subtitle {
  margin: 10px 0 16px;
  color: var(--muted);
  font-weight: 600;
}

.project-intro p {
  margin: 0;
}

.case-section {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 30px;
  margin-bottom: 18px;
}

.case-section h2 {
  margin: 0 0 12px;
  font-size: 1.45rem;
}

.case-section p {
  margin: 0 0 12px;
}

.case-section p:last-child {
  margin-bottom: 0;
}

.case-list {
  margin: 0;
  padding-left: 20px;
  color: var(--text);
}

.case-list li {
  margin-bottom: 10px;
}

.bottom-nav {
  margin-top: 26px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--bg-alt);
}

.project-links {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.project-links a {
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
}

.project-links a:hover {
  color: var(--accent-dark);
}

.project-links .spacer {
  flex: 1;
}

.jump-links {
  margin-top: 16px;
  font-size: 0.95rem;
  color: var(--muted);
}

.jump-links a {
  color: var(--accent);
  text-decoration: none;
  margin-right: 14px;
}

.jump-links a:hover {
  color: var(--accent-dark);
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.video-card {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 20px;
}

.video-card .video-placeholder {
  border-radius: 10px;
}

.video-meta {
  margin-top: 14px;
}

.video-meta h3 {
  margin: 0;
  font-size: 1.05rem;
}

.video-meta p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.93rem;
}

@media (max-width: 1023px) {
  .case-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .section-nav-wrapper {
    top: var(--header-height);
    z-index: 900;
    background: #ffffff;
    padding-bottom: 10px;
  }

  .section-nav {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    white-space: nowrap;
    padding: 10px;
    border-radius: 10px;
  }

  .section-nav a {
    flex: 0 0 auto;
    border: 1px solid transparent;
  }

  .section-nav a.is-active {
    border-color: #bfdbfe;
  }
}

@media (max-width: 900px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 12px 24px 16px;
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    width: 100%;
    padding: 9px 0;
  }

  .site-nav a.current::after {
    display: none;
  }

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

  .hero-media {
    justify-self: stretch;
  }

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

/* Portfolio cards: 2x2 grid -> 1-up on mobile.
   The wide testimonials card spans the full row at every tier. */
@media (max-width: 900px) {
  .project-card-wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .container {
    padding: 0 20px;
  }

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

  .section {
    padding: 60px 0;
  }

  .hero-section {
    padding-top: 64px;
  }

  .home-page .hero-section {
    padding-top: 58px;
  }

  .project-card,
  .about-card,
  .project-intro,
  .case-section,
  .bottom-nav {
    padding: 24px;
  }

  .btn {
    width: 100%;
  }

  .project-card .btn {
    align-self: stretch;
  }
}

/* ============================================================
 * Editor UI (localhost-only)
 * ------------------------------------------------------------
 * editor.js gates itself on hostname — on Vercel/production these
 * styles still ship but their classes are never applied, so the
 * editor is a complete no-op in deployed builds.
 *
 * The editor picks up the page's accent via --accent (set globally
 * to blue, overridden per-page in clickup.css / the-society.css /
 * testimonials.css / ai-writing-systems.css), with a neutral rust
 * fallback for safety.
 * ============================================================ */

:root {
  --editor-accent: var(--accent, #c34a2c);
  --editor-paper: #ffffff;
  --editor-rule: var(--border, #eaeaea);
  --editor-hairline: var(--border-strong, #e5e5e5);
  --editor-ink: var(--text, #1a1a1a);
  --editor-ink-soft: var(--muted, #666666);
  --editor-ink-faint: var(--muted-soft, #888888);
  --editor-accent-soft: rgba(37, 99, 235, 0.08);
}

/* Floating Edit button, top-right. Subtle until hover. */
.edit-button {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1000;
  font-family: var(--font-sans, inherit);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 6px 12px;
  background: var(--editor-paper);
  color: var(--editor-ink-faint);
  border: 1px solid var(--editor-rule);
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}
.edit-button:hover {
  opacity: 1;
  color: var(--editor-accent);
  border-color: var(--editor-accent);
}
body.editing .edit-button { display: none; }

/* Sticky toolbar at the top while editing. */
.editor-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1001;
  background: var(--editor-paper);
  border-bottom: 1px solid var(--editor-rule);
  padding: 8px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  box-shadow: 0 1px 3px rgba(26, 24, 20, 0.05);
}
.editor-toolbar button {
  font-family: var(--font-sans, inherit);
  font-size: 13px;
  padding: 5px 10px;
  background: transparent;
  color: var(--editor-ink-soft);
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  line-height: 1.2;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.editor-toolbar button:hover {
  background: #f3f4f6;
  color: var(--editor-ink);
  border-color: var(--editor-hairline);
}
.editor-toolbar button.primary {
  color: var(--editor-accent);
  border-color: var(--editor-accent);
  font-weight: 600;
  margin-left: auto;
}
.editor-toolbar button.primary:hover {
  background: var(--editor-accent-soft);
}
.editor-toolbar button.ghost {
  color: var(--editor-ink-faint);
}

/* When editing, leave room at the top for the toolbar and tint the
   editable region with a dashed outline in the page's accent. */
body.editing { padding-top: 44px; }
body.editing #editable,
body.editing #content,
body.editing .editable,
body.editing .case-content[contenteditable="true"],
body.editing main[contenteditable="true"] {
  outline: 1px dashed var(--editor-accent);
  outline-offset: 8px;
  background: var(--editor-accent-soft);
  border-radius: 4px;
}

/* Locked-in-edit elements: figure.asset AND [data-edit-lock] widgets.
   The body is greyed/inert; captions inside figures stay editable. */
.locked-in-edit {
  position: relative;
}
.locked-in-edit > *:not(figcaption):not(.a4-caption):not(.editable-caption) {
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}
.locked-in-edit > div {
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}
figure.asset.locked-in-edit figcaption,
figure.asset.locked-in-edit .a4-caption,
figure.asset.locked-in-edit .editable-caption {
  opacity: 1;
  pointer-events: auto;
  user-select: text;
  position: relative;
  z-index: 1;
}
/* The lock badge sits over the locked body. */
.locked-in-edit::after {
  content: "🔒 locked while editing";
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--editor-paper);
  color: var(--editor-accent);
  border: 1px solid var(--editor-accent);
  padding: 3px 8px;
  border-radius: 3px;
  pointer-events: none;
  z-index: 2;
}

/* Captions inside a locked figure get a subtle "you can edit me" affordance. */
figure.asset.locked-in-edit .editable-caption-active {
  outline: 1px dashed rgba(0, 0, 0, 0.2);
  outline-offset: 4px;
  background: rgba(0, 0, 0, 0.015);
  border-radius: 3px;
  transition: outline-color 0.15s, background 0.15s;
  cursor: text;
}
figure.asset.locked-in-edit .editable-caption-active:hover {
  outline-color: var(--editor-accent);
  background: var(--editor-accent-soft);
}
figure.asset.locked-in-edit .editable-caption-active:focus {
  outline: 1px solid var(--editor-accent);
  outline-offset: 4px;
  background: var(--editor-accent-soft);
}
/* Tiny "editing caption" hint below the focused caption. */
figure.asset.locked-in-edit .editable-caption-active:focus::after {
  content: "editing caption";
  position: absolute;
  bottom: -22px;
  right: 0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--editor-accent);
  background: var(--editor-paper);
  border: 1px solid var(--editor-accent);
  padding: 2px 6px;
  border-radius: 3px;
  pointer-events: none;
}

/* Bottom-center toast for save status. */
.editor-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--editor-ink);
  color: var(--editor-paper);
  font-family: var(--font-sans, inherit);
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 4px;
  z-index: 1002;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  max-width: 80vw;
}
.editor-toast.visible {
  opacity: 0.96;
  transform: translateX(-50%) translateY(0);
}

/* Auto-save status pill — sits at the right end of the toolbar.
   Picks up the page's editor accent (rust fallback, blue/violet/pink
   per-page override) for the in-flight "Saving…" state. */
.editor-status {
  margin-left: 10px;
  align-self: center;
  font-family: var(--font-sans, inherit);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--editor-rule);
  background: var(--editor-paper);
  color: var(--editor-ink-faint);
  white-space: nowrap;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
  pointer-events: none;
  user-select: none;
}
.editor-status.is-saved {
  color: #3f6b3d;
  border-color: #c6dec3;
  background: #eff7ed;
}
.editor-status.is-editing {
  color: var(--editor-ink-soft);
  border-color: var(--editor-rule);
  background: #f4f5f7;
}
.editor-status.is-saving {
  color: var(--editor-accent);
  border-color: var(--editor-accent);
  background: var(--editor-accent-soft);
}
.editor-status.is-just-now {
  color: #305a30;
  border-color: #b0cdaf;
  background: #e8f3e6;
}
.editor-status.is-failed {
  color: #8a2a1a;
  border-color: #d99988;
  background: #fbe7df;
}
