/* ========== Quiet Paper Theme v1 ========== */
/* Core palette */
:root {
  --bg: #F7F6F3;
  --text: #1F1F1F;
  --muted: #6F6F6F;
  --line: #E4E2DD;
  --accent: #2F4A5A;

  --pad: 18px;
  --radius: 14px; /* not too round */
  --maxw: 720px;

  --shadow: 0 1px 0 rgba(0,0,0,0.03);
}

/* Base */
* { box-sizing: border-box; }
html, body { height: 100%; }

/* Hide screens during auth check */
body.auth-loading #screen-login,
body.auth-loading .topbar,
body.auth-loading #main,
body.auth-loading .footer {
  visibility: hidden;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  letter-spacing: 0.01em;
  
  /* Slow texture: subtle grain */
  background-image: radial-gradient(rgba(0,0,0,0.012) 1px, transparent 1px);
  background-size: 10px 10px;
}

/* ========== Login Screen ========== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  max-width: 420px;
  width: 100%;
  text-align: center;
  padding: 48px 32px;
}

.login-intro {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 40px;
}

.social-login {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-login {
  width: 100%;
  padding: 16px 24px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.3s ease;
  font-family: inherit;
}

.btn-login--secondary {
  background: var(--bg);
  border: 1px solid var(--line);
}

.btn-login:hover {
  background: #FAFAF9;
  border-color: #D4D2CD;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.btn-login:active {
  transform: translateY(0);
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-login__icon {
  flex-shrink: 0;
  display: block;
}

/* Email Form */
.email-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-field {
  width: 100%;
  padding: 14px 16px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.input-field:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-primary {
  width: 100%;
  padding: 14px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background: #254159;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-text {
  background: none;
  border: none;
  color: var(--muted);
  padding: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: color 0.3s ease;
}

.btn-text:hover {
  color: var(--text);
}

.login-note {
  margin-top: 32px;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--muted);
}

/* ========== Onboarding ========== */
#onboarding {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000000;
  z-index: 1000;
}

.onboarding-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.onboarding-step {
  width: 100%;
  text-align: center;
  animation: fadeIn 1s ease-in;
  cursor: pointer;
}

.onboarding-step#onboarding-step2,
.onboarding-step#onboarding-step3 {
  cursor: default;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.onboarding-content {
  margin-bottom: 48px;
}

.onboarding-text {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.8;
  color: #E0E0E0;
  margin: 0 0 20px 0;
}

.onboarding-text--emphasis {
  font-weight: 700;
  color: #FFFFFF;
  margin-top: 32px;
}

.onboarding-question {
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1.7;
  color: #E0E0E0;
  margin: 0 0 48px 0;
}

.btn-onboarding {
  padding: 12px 32px;
  background: transparent;
  border: 1px solid #444444;
  border-radius: 8px;
  color: #E0E0E0;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-onboarding:hover {
  background: #1A1A1A;
  border-color: #666666;
}

.onboarding-choices {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 300px;
  margin: 0 auto;
}

.btn-choice {
  padding: 16px 24px;
  background: transparent;
  border: 1px solid #444444;
  border-radius: 10px;
  color: #E0E0E0;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-choice:hover {
  background: #1A1A1A;
  border-color: #666666;
  transform: translateY(-1px);
}

.btn-skip-onboarding {
  margin-top: 32px;
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: #666666;
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.3s ease;
}

.btn-skip-onboarding:hover {
  color: #999999;
  text-decoration: underline;
}

/* Mobile onboarding */
@media (max-width: 768px) {
  .onboarding-container {
    padding: 40px 20px;
  }
  
  .onboarding-text {
    font-size: 1.2rem;
  }
  
  .onboarding-question {
    font-size: 1.8rem;
  }
  
  .btn-choice {
    font-size: 0.95rem;
  }
}

/* ========== Main App ========== */
button, input, textarea {
  font: inherit;
  color: inherit;
}

.app {
  max-width: 1024px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  padding: 18px var(--pad) 8px var(--pad);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.topbar .brand {
  align-self: flex-start;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
}

.brand__logo {
  height: 64px;
  width: auto;
}

/* Brand large (login screen) */
.brand--large {
  display: flex;
  justify-content: center;
  margin-bottom: 40px;
}

.brand--large .brand__logo {
  height: 160px;
  width: auto;
}

.topbar__nav {
  margin-top: 0;
  display: flex;
  gap: 10px;
  flex: 1;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.btn-logout {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-logout:hover {
  background: var(--line);
  color: var(--text);
}

.navbtn {
  background: transparent;
  border: 1px solid transparent;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
}
.navbtn[aria-current="page"] {
  color: var(--text);
  border-color: var(--line);
}

/* Main */
.main {
  flex: 1;
  padding: 12px var(--pad) 20px var(--pad);
}

/* Screens */
.screen { display: block; }
.hidden { display: none; }

/* Hero */
.hero {
  padding: 6px 0 18px 0;
}
.hero__line {
  margin: 0;
  font-size: 18px;
}
.hero__sub {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}
.hero__sub p { margin: 0; }

.soft-ink {
  color: var(--accent);
}

/* Card */
.card {
  background: rgba(255,255,255,0.35);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.card__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.card__hint {
  margin: 6px 0 14px 0;
  color: var(--muted);
  font-size: 14px;
}

/* Question list */
.q-list { display: grid; gap: 10px; }
.q-item {
  width: 100%;
  text-align: left;
  background: rgba(247,246,243,0.55);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.q-item:active { transform: translateY(1px); }
.q-item__axis {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.q-item__text {
  font-size: 16px;
  line-height: 1.6;
}

/* Quiet note */
.quiet-note {
  margin: 16px 2px 0 2px;
  color: var(--muted);
  font-size: 14px;
}

/* Write */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.row--space {
  justify-content: space-between;
}

.textbtn {
  background: transparent;
  border: none;
  padding: 6px 8px;
  color: var(--muted);
}
.textbtn:active { transform: translateY(1px); }

.q-block {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.q-block__label {
  font-size: 12px;
  color: var(--muted);
}
.q-block__text {
  margin-top: 6px;
  font-size: 18px;
  line-height: 1.6;
}

.onboarding-hint {
  margin: 20px 0;
  padding: 16px;
  background: rgba(0,0,0,0.02);
  border-radius: 8px;
  text-align: center;
}

.onboarding-hint p {
  margin: 4px 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--muted);
}

.field {
  margin-top: 14px;
}
.field__label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.field__textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.45);
  resize: vertical;
  min-height: 180px;
  outline: none;
}
.field__textarea:focus {
  border-color: rgba(47,74,90,0.35);
}

/* Toggle */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

/* Presence (Existence acknowledgement) */
.presence {
  margin-top: 16px;
  /* slow appearance handled by JS adding a class */
}

.presence__band {
  border-top: 1px solid var(--line);
  padding-top: 12px;

  /* subtle band */
  background: rgba(247,246,243,0.55);
  border-radius: 12px;
  padding: 14px 12px;
}

.presence__text {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.75;
}

/* Post */
.post {
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.post__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
.dot { font-size: 10px; }
.post__body {
  margin: 10px 0 12px 0;
  font-size: 16px;
}
.reactions {
  display: flex;
  gap: 16px;
  padding: 6px 0;
}
.react {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 6px 0;
  cursor: pointer;
  font-size: 0.95rem;
  transition: color 0.3s ease;
}
.react:hover {
  color: var(--text);
}
.react .icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.react .icon svg {
  display: block;
}
.react.is-on {
  color: var(--accent);
}
.react:focus-visible {
  outline: 1px solid var(--line);
  outline-offset: 3px;
  border-radius: 10px;
}
.post__guide {
  margin: 6px 0 0 0;
  font-size: 13px;
}

/* Footer */
.footer {
  padding: 12px var(--pad) 18px var(--pad);
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,0.25);
}

.footer__content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  font-size: 14px;
}

.footer__copy {
  font-size: 13px;
}

/* Utility */
.muted { color: var(--muted); }
.empty { padding: 14px 0; }

/* Mobile responsive */
@media (max-width: 768px) {
  .app {
    max-width: 100%;
  }
  
  .brand__logo {
    height: 32px;
  }
  
  .brand--large .brand__logo {
    height: 56px;
  }
  
  .topbar {
    padding: 12px var(--pad) 8px var(--pad);
    gap: 10px;
  }
  
  .topbar .brand__logo {
    height: 28px;
  }
  
  .btn-logout {
    font-size: 12px;
    padding: 5px 10px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
