/* Clarel Brand Theme — Ory Kratos Self-Service UI
 * Overrides --ory-theme-* variables and adds Clarel visual identity.
 * Loaded after theme.css so all overrides take precedence.
 */

:root {
  --ory-theme-font-family: "Poppins", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Clarel primary: deep burgundy */
  --ory-theme-accent-def: #80152c;
  --ory-theme-accent-muted: #9e1d37;
  --ory-theme-accent-emphasis: #5e0f21;
  --ory-theme-accent-disabled: #dcdcdc;
  --ory-theme-accent-subtle: #fce8e1;

  /* Foreground */
  --ory-theme-foreground-def: #292929;
  --ory-theme-foreground-muted: #616161;
  --ory-theme-foreground-subtle: #9e9e9e;
  --ory-theme-foreground-disabled: #bdbdbd;
  --ory-theme-foreground-on-dark: #ffffff;
  --ory-theme-foreground-on-accent: #ffffff;
  --ory-theme-foreground-on-disabled: #e0e0e0;

  /* Backgrounds — warm Clarel tones */
  --ory-theme-background-surface: #ffffff;
  --ory-theme-background-canvas: #f9f2ee;
  --ory-theme-background-subtle: #fce8e1;

  /* Error */
  --ory-theme-error-def: #9c0f2e;
  --ory-theme-error-subtle: #fce8ec;
  --ory-theme-error-muted: #e95c7b;
  --ory-theme-error-emphasis: #df1642;

  /* Success */
  --ory-theme-success-emphasis: #18a957;

  /* Borders — warm parchment tone */
  --ory-theme-border-def: #eeddd5;

  /* Text on accent backgrounds */
  --ory-theme-text-def: #ffffff;
  --ory-theme-text-disabled: #757575;

  /* Inputs */
  --ory-theme-input-background: #ffffff;
  --ory-theme-input-disabled: #e0e0e0;
  --ory-theme-input-placeholder: #ababab;
  --ory-theme-input-text: #292929;
}

body {
  font-family: var(--ory-theme-font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Split layout ──────────────────────────────────────────────────────── */

.clarel-split-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ── Brand panel (left) ────────────────────────────────────────────────── */

.clarel-brand-panel {
  width: 42%;
  min-height: 100vh;
  background: linear-gradient(
    158deg,
    #5e0f21 0%,
    #80152c 28%,
    #b5352e 58%,
    #e1733f 82%,
    #f7b790 100%
  );
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

/* Grain texture overlay for premium feel */
.clarel-brand-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 300px 300px;
  pointer-events: none;
  z-index: 1;
}

.clarel-brand-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
}

/* White pill: lets the original dark logo show clearly on the gradient */
.clarel-brand-logo-wrap {
  background: rgba(255, 255, 255, 0.93);
  border-radius: 0.75rem;
  padding: 0.875rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.clarel-brand-logo {
  max-width: 160px;
  height: auto;
  display: block;
}

/* Organic blob shapes — decorative, not interactive */
.clarel-blob {
  position: absolute;
  background: rgba(255, 255, 255, 0.07);
  pointer-events: none;
  z-index: 0;
}

.clarel-blob--1 {
  width: 420px;
  height: 420px;
  top: -130px;
  right: -130px;
  border-radius: 67% 33% 41% 59% / 56% 44% 56% 44%;
}

.clarel-blob--2 {
  width: 460px;
  height: 460px;
  bottom: -150px;
  left: -150px;
  border-radius: 41% 59% 67% 33% / 44% 56% 44% 56%;
}

.clarel-blob--3 {
  width: 180px;
  height: 180px;
  top: 38%;
  right: 6%;
  border-radius: 50% 50% 33% 67% / 50% 50% 67% 33%;
  background: rgba(255, 255, 255, 0.05);
}

/* ── Form panel (right) ─────────────────────────────────────────────────── */

.clarel-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--ory-theme-background-canvas);
  min-height: 100vh;
}

/* ── Responsive: brand panel becomes a slim header bar on mobile ────────── */

@media screen and (max-width: 768px) {
  .clarel-split-layout {
    flex-direction: column;
  }

  .clarel-brand-panel {
    width: 100%;
    min-height: auto;
    padding: 1.5rem 2rem;
  }

  .clarel-brand-inner {
    padding: 0;
  }

  .clarel-brand-logo-wrap {
    padding: 0.625rem 1.5rem;
    border-radius: 0.5rem;
  }

  .clarel-brand-logo {
    max-width: 100px;
  }

  .clarel-blob {
    display: none;
  }

  .clarel-form-panel {
    min-height: auto;
    align-items: flex-start;
    padding: 1.5rem 0 3rem;
  }
}

/* ── Ory branding footer — tone it down on the warm background ──────────── */

.ory-branding {
  opacity: 0.5;
}

.ory-branding:hover {
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

/* ── Registration: custom fieldset-based form ─────────────────────────── */

.auth-card {
  background: var(--ory-theme-background-surface);
  border: 1px solid var(--ory-theme-border-def);
  border-radius: 1rem;
  padding: 2.5rem;
  width: 100%;
  max-width: 28rem;
  box-sizing: border-box;
}

.auth-card__title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ory-theme-foreground-def);
  text-align: center;
  margin: 0 0 1.75rem;
}

/* Form-level messages */
.form-alert {
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  font-family: var(--ory-theme-font-family);
}
.form-alert--error {
  background: var(--ory-theme-error-subtle);
  color: var(--ory-theme-error-emphasis);
  border: 1px solid var(--ory-theme-error-muted);
}
.form-alert--info {
  background: var(--ory-theme-accent-subtle);
  color: var(--ory-theme-accent-emphasis);
}
.form-alert--success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

/* Fieldset section */
fieldset.form-section {
  border: 1px solid var(--ory-theme-border-def);
  border-radius: 0.5rem;
  padding: 1.25rem 1.25rem 1.5rem;
  margin: 0 0 1.25rem;
  background: var(--ory-theme-background-canvas);
}
fieldset.form-section:last-of-type {
  margin-bottom: 0;
}

legend.form-section__title {
  font-family: var(--ory-theme-font-family);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ory-theme-accent-def);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0 0.4rem;
}

/* Form field */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-top: 1rem;
}

.form-field__label {
  font-family: var(--ory-theme-font-family);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ory-theme-foreground-muted);
}

.form-field__input {
  all: unset;
  box-sizing: border-box;
  display: block;
  width: 100%;
  color: var(--ory-theme-input-text);
  border: 1px solid var(--ory-theme-border-def);
  border-radius: 0.25rem;
  padding: 0.75rem 1rem;
  background: var(--ory-theme-input-background);
  font-family: var(--ory-theme-font-family);
  font-size: 1rem;
  line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-field__input::placeholder {
  color: var(--ory-theme-input-placeholder);
}
.form-field__input:hover {
  border-color: var(--ory-theme-accent-muted);
}
.form-field__input:focus {
  border-color: var(--ory-theme-accent-def);
  box-shadow: 0 0 0 3px var(--ory-theme-accent-subtle);
  outline: none;
}
.form-field__input:disabled {
  background: var(--ory-theme-input-disabled);
  color: var(--ory-theme-foreground-disabled);
  cursor: not-allowed;
}

.form-field__error {
  font-family: var(--ory-theme-font-family);
  font-size: 0.8125rem;
  color: var(--ory-theme-error-emphasis);
}

/* Submit button */
.btn-submit {
  all: unset;
  box-sizing: border-box;
  display: block;
  width: 100%;
  text-align: center;
  background: var(--ory-theme-accent-def);
  color: var(--ory-theme-foreground-on-accent);
  font-family: var(--ory-theme-font-family);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.75rem;
  padding: 0.625rem 1rem;
  border-radius: 0.25rem;
  cursor: pointer;
  margin-top: 1.5rem;
  transition: background-color 0.15s ease;
}
.btn-submit:hover {
  background: var(--ory-theme-accent-muted);
}
.btn-submit:active {
  background: var(--ory-theme-accent-emphasis);
}
.btn-submit:disabled {
  background: var(--ory-theme-accent-disabled);
  cursor: not-allowed;
}

/* Footer link (sign in / sign up) */
.auth-card__footer {
  text-align: center;
  margin-top: 1.25rem;
  font-family: var(--ory-theme-font-family);
  font-size: 0.9375rem;
  color: var(--ory-theme-foreground-muted);
}
.auth-card__footer a {
  color: var(--ory-theme-accent-def);
  text-decoration: none;
  font-weight: 500;
}
.auth-card__footer a:hover {
  color: var(--ory-theme-accent-muted);
  text-decoration: underline;
}

/* Mobile: borderless card */
@media screen and (max-width: 40em) {
  .auth-card {
    border: none;
    border-radius: 0;
    padding: 1.5rem 1rem;
    max-width: 100%;
  }
}

/* ── Settings: sections per method ─────────────────────────────────────── */

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-bottom: 2.5rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--ory-theme-border-def);
}
.settings-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.settings-section__header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.settings-section__title {
  font-family: var(--ory-theme-font-family);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--ory-theme-foreground-def);
  margin: 0;
}

.settings-section__desc {
  font-family: var(--ory-theme-font-family);
  font-size: 0.875rem;
  color: var(--ory-theme-foreground-muted);
  margin: 0;
}
