/* ═══════════════════════════════════════════════════════════════
   CLOTO RESET — Normalize + Base + WP Compat
   ═══════════════════════════════════════════════════════════════ */

/* ── Box Model Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Prevent double-tap zoom on iOS (maximum-scale ignored since iOS 10) */
html {
  touch-action: manipulation;
}

/* ── Body ── */
html, body.cloto-app {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  margin: 0;
}

/* Anonymous landing: allow scroll for below-the-fold sections */
body.cloto-app.cloto-anon,
html.cloto-anon {
  height: auto;
  overflow: visible;
  overflow-x: hidden;
}

body.cloto-app {
  background: var(--cloto-void);
  color: var(--cloto-text-100);
  font-family: var(--cloto-font-body);
  font-size: var(--cloto-fs-base);
  line-height: 1.5;
  isolation: isolate;
}

body.cloto-app.fd-light {
  background: var(--cloto-void);
}

/* ── Animated Background — REMOVED (clean void) ── */
body.cloto-app::before,
body.cloto-app::after {
  display: none;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--cloto-teal-a15);
  border-radius: var(--radius-xs);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--cloto-glass-border-active);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--cloto-teal-a15) transparent;
}

/* ── Selection ── */
::selection {
  background: var(--cloto-teal-a25);
  color: var(--cloto-text-100);
}

/* ── Placeholder ── */
::placeholder {
  color: var(--cloto-text-50);
  font-style: italic;
}

/* ── Links ── */
a {
  color: var(--cloto-teal);
  text-decoration: none;
  transition: color var(--duration-normal) var(--ease-spring);
}
a:hover {
  color: var(--cloto-teal-light);
}

/* ── Images ── */
  img, svg { max-width: 100%;
  display: block; }

/* ── Lists ── */
ul, ol { list-style: none; }

/* ══════════════════════════════════════════════════════════════
   WP-COMPATIBLE BUTTON CLASSES
   JS generates `.button`, `.button-primary`, `.button-small`
   ══════════════════════════════════════════════════════════════ */

.button,
button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-7);
  min-height: 32px;
  font-family: var(--cloto-font-body);
  font-size: var(--cloto-fs-sm);
  font-weight: 500;
  line-height: 1.4;
  color: var(--cloto-text-70);
  background: transparent;
  border: 1px solid var(--cloto-glass-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-spring);
  white-space: nowrap;
  text-decoration: none;
  vertical-align: middle;
}

.button:hover {
  color: var(--cloto-text-100);
  border-color: var(--cloto-glass-border-hover);
  background: var(--cloto-teal-a4);
}

.button:active {
  background: var(--cloto-teal-a8);
}

.button:disabled,
.button[disabled] {
  opacity: var(--opacity-disabled);
  cursor: not-allowed;
  pointer-events: none;
}

.button:focus-visible {
  outline: 2px solid var(--cloto-teal-a40);
  outline-offset: 2px;
}

/* Primary */
.button-primary,
.button.button-primary {
  color: var(--cloto-teal);
  background: var(--cloto-teal-a8);
  border-color: var(--cloto-teal-a25);
}
.button-primary:hover {
  background: var(--cloto-teal-a15);
  border-color: var(--cloto-teal-a40);
  color: var(--cloto-teal-light);
}

/* Small */
.button-small,
.button.button-small {
  padding: var(--space-2) var(--space-5);
  min-height: 26px;
  font-size: var(--cloto-fs-xs);
}

/* ══════════════════════════════════════════════════════════════
   FORM ELEMENTS — Glass Dark Styling
   ══════════════════════════════════════════════════════════════ */

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: var(--space-4) var(--space-6);
  font-family: var(--cloto-font-body);
  font-size: var(--cloto-fs-base);
  color: var(--cloto-text-100);
  background: var(--cloto-input-bg);
  border: 1px solid var(--cloto-teal-a25);
  border-radius: var(--radius-xl);
  outline: none;
  transition: border-color var(--duration-normal) var(--ease-default), box-shadow var(--duration-normal) var(--ease-default);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cloto-teal-a35);
  box-shadow: var(--shadow-focus-teal);
}

textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

select {
  border-radius: var(--radius-md);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%233ecfcf' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: var(--space-16);
  cursor: pointer;
}

label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--cloto-fs-xs);
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--cloto-text-40);
}

/* ══════════════════════════════════════════════════════════════
   UTILITY — Markdown, Status, Loading
   ══════════════════════════════════════════════════════════════ */

#fbw-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.fbw-wrap {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.fbw-main {
  flex: 1 1 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* #fbw-outline-root display now controlled by .is-active in cloto-nav.css */

.fbw-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  font-size: var(--cloto-fs-lg);
  color: var(--cloto-text-40);
}

.fbw-error {
  padding: var(--space-8);
  color: var(--cloto-danger);
  text-align: center;
}

.fbw-empty {
  padding: var(--space-16);
  text-align: center;
  color: var(--cloto-text-40);
  font-style: italic;
}

.fbw-status {
  font-size: var(--cloto-fs-xs);
  color: var(--cloto-text-40);
}

.muted {
  color: var(--cloto-text-40);
}

/* Markdown rendered content */
.fbw-md {
  line-height: 1.7;
  color: var(--cloto-text-70);
}
.fbw-md p + p { margin-top: 0.8em; }
  .fbw-md strong { color: var(--cloto-text-100);
  font-weight: 600; }
.fbw-md em { font-style: italic; }
  .fbw-md ul, .fbw-md ol { padding-left: 1.5em;
  margin: 0.5em 0; }
.fbw-md li { margin: 0.25em 0; }
.fbw-md li::marker { color: var(--cloto-teal); }
.fbw-md code {
  font-family: var(--cloto-font-mono);
  font-size: 0.9em;
  padding: var(--space-1) var(--space-3);
  background: var(--cloto-teal-a6);
  border-radius: var(--radius-xs);
  color: var(--cloto-teal);
}
.fbw-md blockquote {
  border-left: 3px solid var(--cloto-teal-a20);
  padding-left: var(--space-6);
  color: var(--cloto-text-40);
  font-style: italic;
  margin: 0.5em 0;
}
.fbw-md h1, .fbw-md h2, .fbw-md h3 {
  color: var(--cloto-text-100);
  margin: 1em 0 0.5em;
}

/* ══════════════════════════════════════════════════════════════
   LIGHT THEME — Reset Overrides
   ══════════════════════════════════════════════════════════════ */

body.fd-light input[type="text"],
body.fd-light input[type="number"],
body.fd-light input[type="email"],
body.fd-light input[type="password"],
body.fd-light input[type="search"],
body.fd-light input[type="url"],
body.fd-light select,
body.fd-light textarea {
  background-color: rgba(255, 255, 255, 0.6);
  border-color: rgba(26, 28, 40, 0.12);
  color: var(--cloto-text-100);
}

body.fd-light input::placeholder,
body.fd-light textarea::placeholder {
  color: rgba(26, 28, 40, 0.35);
}

body.fd-light label {
  color: #6a6a76;
}

body.fd-light .button,
body.fd-light button.button {
  color: #3a3c48;
  border-color: var(--cloto-surface-a10);
}

body.fd-light .button:hover {
  color: var(--cloto-text-100);
  background: var(--cloto-teal-a6);
  border-color: var(--cloto-teal-a20);
}

body.fd-light .button-primary,
body.fd-light .button.button-primary {
  color: var(--cloto-teal);
  border-color: var(--cloto-teal-a30);
}

body.fd-light .fbw-loading {
  color: #6a6a76;
}
