@layer components {
  .login-wrapper {
    width: 100%;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;

    @media (max-width: 860px) {
      grid-template-columns: 1fr;
    }
  }

  .login-brand {
    background: var(--surface-dark);
    color: var(--text-on-dark);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--spacing-3xl) var(--spacing-xxl);
    position: relative;
    overflow: hidden;

    @media (max-width: 860px) {
      display: none;
    }

    /* Decorative corner glows; sizes/offsets are composition, not scale */
    &::before {
      content: '';
      position: absolute;
      top: -200px;
      right: -200px;
      width: 500px;
      height: 500px;
      border-radius: 50%;
      background: radial-gradient(circle, var(--accent-wash) 0%, transparent 70%);
      pointer-events: none;
    }

    &::after {
      content: '';
      position: absolute;
      bottom: -150px;
      left: -100px;
      width: 400px;
      height: 400px;
      border-radius: 50%;
      background: radial-gradient(circle, var(--accent-wash) 0%, transparent 70%);
      pointer-events: none;
    }
  }

  .brand-logo {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: var(--text-lg);
    letter-spacing: var(--tracking-normal);
    margin-bottom: var(--spacing-xxl);
    text-decoration: none;
    color: var(--text-on-dark);
    position: relative;
    z-index: 1;

    span {
      color: var(--accent-hover);
    }
  }

  .brand-content {
    position: relative;
    z-index: 1;

    h1 {
      font-family: var(--font-serif);
      font-size: var(--text-3xl);
      font-weight: 600;
      line-height: 1.12;
      margin-bottom: var(--spacing-md);
      max-width: 20ch;

      em {
        font-style: italic;
        color: var(--accent-hover);
      }
    }

    p {
      font-size: var(--text-sm);
      line-height: 1.7;
      color: var(--text-on-dark-secondary);
      max-width: 40ch;
    }
  }

  .brand-features {
    margin-top: var(--spacing-xxl);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    position: relative;
    z-index: 1;
  }

  .brand-feature {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);

    span {
      font-size: var(--text-sm);
      color: var(--text-on-dark-secondary);
    }
  }

  .feature-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-hover);
    flex-shrink: 0;
  }

  .login-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
  }

  .login-card {
    width: 100%;
    max-width: 400px; /* form column width per design */

    .back-link {
      display: inline-flex;
      align-items: center;
      gap: var(--spacing-xxs);
      font-size: var(--text-xs);
      color: var(--text-tertiary);
      text-decoration: none;
      margin-bottom: var(--spacing-xxl);
      transition: color 0.2s;

      svg {
        width: 14px;
        height: 14px;
      }
    }
    .back-link:hover {
      color: var(--accent);
    }

    h2 {
      font-family: var(--font-serif);
      font-size: var(--text-xxl);
      font-weight: 600;
      margin-bottom: var(--spacing-xs);
    }

    .subtitle {
      font-size: var(--text-sm);
      color: var(--text-secondary);
      margin-bottom: var(--spacing-xl);
    }

    .login-divider {
      display: flex;
      align-items: center;
      gap: var(--spacing-md);
      margin: var(--spacing-lg) 0;

      &::before,
      &::after {
        content: '';
        flex: 1;
        height: 1px;
        background: var(--border-subtle);
      }

      span {
        font-size: var(--text-xs);
        color: var(--text-tertiary);
        text-transform: uppercase;
        letter-spacing: var(--tracking-wide);
        font-weight: 500;
      }
    }

    .legal-links {
      text-align: center;
      margin-top: var(--spacing-xxl);
      font-size: var(--text-xs);
      color: var(--text-tertiary);

      a {
        color: var(--text-tertiary);
        text-decoration: none;
        transition: color 0.2s;
      }
      a:hover {
        color: var(--accent);
      }
    }
  }

  .form-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: var(--spacing-lg);
  }

  .forgot-link {
    font-size: var(--text-xs);
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
  }
  .forgot-link:hover {
    color: var(--accent-hover);
  }

  .login-btn {
    width: 100%;
    padding: var(--spacing-sm);
    background: var(--accent);
    color: var(--text-on-dark);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: var(--text-md);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
  }
  .login-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-accent);
  }
  .login-btn:active {
    transform: translateY(0);
  }

  /* Third-party sign-in buttons, styled to Google's branding spec (light
     theme: white fill, --oauth-button-stroke border, --oauth-button-text
     label at 14px medium, unaltered logo with a 10px gap to the label);
     the Microsoft button shares the chrome, which its guidelines permit.
     Deliberate deviation: the label is set in brand DM Sans rather than
     Google Sans, at the spec size/weight. */
  .alt-login-btn {
    width: 100%;
    padding: var(--spacing-sm);
    background: var(--surface-card);
    color: var(--oauth-button-text);
    border: 1px solid var(--oauth-button-stroke);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: var(--text-sm); /* 14px — Google branding spec */
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px; /* logo-to-label gap — Google branding spec */

    svg {
      width: 18px; /* logo size — Google branding spec */
      height: 18px;
      flex: none;
    }
  }
  .alt-login-btn:hover {
    background: var(--surface-page);
  }

  .alt-login-hint {
    text-align: center;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin: 0;
  }

  .alt-login-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);

    /* button_to wraps each button in a form; contents keeps the buttons
       direct flex children so the gap applies to them, not the wrappers. */
    form {
      display: contents;
    }
  }

  .login-footer {
    text-align: center;
    margin-top: var(--spacing-lg);
    font-size: var(--text-xs);
    color: var(--text-tertiary);

    a {
      color: var(--accent);
      text-decoration: none;
      font-weight: 500;
    }
    a:hover {
      color: var(--accent-hover);
    }
  }
}
