@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Outfit:wght@400;500;600;700&display=swap");

:root {
  --bg: #f3f6f4;
  --bg-soft: #e7efea;
  --ink: #14201c;
  --muted: #5a6b63;
  --line: rgba(20, 32, 28, 0.12);
  --accent: #0f6d56;
  --accent-hover: #0b5744;
  --accent-soft: rgba(15, 109, 86, 0.1);
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --info: #175cd3;
  --info-bg: #eff8ff;
  --white: #ffffff;
  --shadow: 0 18px 50px rgba(20, 32, 28, 0.08);
  --radius: 18px;
  --font: "Outfit", sans-serif;
  --display: "Fraunces", Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
}

body {
  background:
    radial-gradient(ellipse 70% 45% at 15% 10%, rgba(15, 109, 86, 0.12), transparent 55%),
    radial-gradient(ellipse 55% 40% at 90% 85%, rgba(20, 32, 28, 0.06), transparent 50%),
    linear-gradient(180deg, #f7faf8 0%, #eef3f0 100%);
  background-attachment: fixed;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

/* ——— Home ——— */
.page-home {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  position: relative;
  overflow: hidden;
}

.page-home::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(20, 32, 28, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 32, 28, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
  pointer-events: none;
}

.home-stage {
  width: min(560px, 100%);
  position: relative;
  z-index: 1;
  text-align: center;
  animation: rise 0.55s ease-out both;
}

.brand {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--ink);
}

.lede {
  margin: 0 auto 28px;
  max-width: 34ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
  font-weight: 400;
  animation: rise 0.55s ease-out 0.08s both;
}

.dropzone {
  display: block;
  border: 1.5px dashed rgba(15, 109, 86, 0.35);
  border-radius: var(--radius);
  padding: 40px 24px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  animation: rise 0.55s ease-out 0.14s both;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--white);
  transform: translateY(-2px);
  box-shadow: 0 22px 55px rgba(15, 109, 86, 0.12);
}

.dropzone .icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.dropzone .icon svg {
  width: 26px;
  height: 26px;
}

.dropzone p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.dropzone .filename {
  margin-top: 12px;
  color: var(--ink);
  font-weight: 600;
  word-break: break-all;
}

#file-input {
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 14px 22px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(15, 109, 86, 0.22);
  animation: rise 0.55s ease-out 0.2s both;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-ghost {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-soft);
}

.alert {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  text-align: left;
  display: none;
}

.alert.visible {
  display: block;
  animation: rise 0.25s ease-out both;
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(180, 35, 24, 0.15);
}

.alert-info {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(23, 92, 211, 0.14);
}

.hint {
  margin-top: 18px;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
  animation: rise 0.55s ease-out 0.26s both;
}

/* ——— Editor ——— */
.editor-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #e8ece9;
}

.editor-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.editor-brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.1rem;
  white-space: nowrap;
}

.editor-brand a {
  color: var(--ink);
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-frame {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  background: #d7ddd9;
}

#placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--muted);
  padding: 24px;
  text-align: center;
  background: #eef2ef;
}

#onlyoffice-editor {
  width: 100%;
  height: 100%;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(15, 109, 86, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.error-code {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.page-center {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  width: min(480px, 100%);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 28px;
  text-align: center;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.card h1 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.card .subtitle {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
}

@media (max-width: 600px) {
  .brand {
    font-size: 2.1rem;
  }

  .dropzone {
    padding: 32px 18px;
  }

  .editor-bar {
    padding: 10px 12px;
  }

  .btn {
    padding: 12px 16px;
    font-size: 0.95rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
